[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516880855.30244.78.camel@infradead.org>
Date: Thu, 25 Jan 2018 11:47:35 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: arjan@...ux.intel.com, tglx@...utronix.de, karahmed@...zon.de,
x86@...nel.org, linux-kernel@...r.kernel.org,
tim.c.chen@...ux.intel.com, peterz@...radead.org,
pbonzini@...hat.com, ak@...ux.intel.com,
torvalds@...ux-foundation.org, gregkh@...ux-foundation.org,
dave.hansen@...el.com, gnomes@...rguk.ukuu.org.uk,
ashok.raj@...el.com, mingo@...nel.org
Subject: Re: [PATCH v4 7/7] x86/speculation: Add basic IBPB (Indirect
Branch Prediction Barrier) support
On Thu, 2018-01-25 at 12:41 +0100, Borislav Petkov wrote:
>
> > +static inline void indirect_branch_prediction_barrier(void)
> > +{
> > + asm volatile(ALTERNATIVE("",
> > + "movl %[msr], %%ecx\n\t"
> > + "movl %[val], %%eax\n\t"
> > + "movl $0, %%edx\n\t"
> > + "wrmsr",
> > + X86_FEATURE_IBPB)
> > + : : [msr] "i" (MSR_IA32_PRED_CMD),
> > + [val] "i" (PRED_CMD_IBPB)
> > + : "eax", "ecx", "edx", "memory");
>
> Lemme paste my simplification suggestion from the other day:
>
> "Btw, we can simplify this a bit by dropping the inputs and marking the 3
> GPRs as clobbered:
>
> alternative_input("",
> "mov $0x49, %%ecx\n\t"
> "mov $1, %%eax\n\t"
> "xor %%edx, %%edx\n\t"
> "wrmsr\n\t",
> X86_FEATURE_IBPB,
> ASM_NO_INPUT_CLOBBER("eax", "ecx", "edx", "memory"));
Yeah, I saw that; sorry for not replying explicitly.
I did already do the explicit clobbers now you reminded me how to do
them, but I elected not to use ASM_NO_INPUT_CLOBBER() because on
balance, losing the MSR_IA32_PRED_CMD / PRED_CMD_IBPB definitions and
having to hard-code the numbers was not so much of a win.
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (5213 bytes)
Powered by blists - more mailing lists