Re: [PATCH v2 1/4] x86/speculation: Use IBRS if available before calling into firmware

From: David Woodhouse
Date: Thu Feb 15 2018 - 04:22:24 EST


On Wed, 2018-02-14 at 16:46 -0800, Jim Mattson wrote:
> On Wed, Feb 14, 2018 at 3:29 PM, David Woodhouse <dwmw@xxxxxxxxxxxx> wrote:
>
> > +#define alternative_msr_write(_msr, _val, _feature)ÂÂÂÂÂÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂ asm volatile(ALTERNATIVE("",ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "movl %[msr], %%ecx\n\t"ÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "movl %[val], %%eax\n\t"ÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "movl $0, %%edx\n\t"ÂÂÂÂÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "wrmsr",ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ _feature)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ : : [msr] "i" (_msr), [val] "i" (_val)ÂÂÂÂ \
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ : "eax", "ecx", "edx", "memory")
> > +
>
> It's not needed now, but this would be more generally useful if the
> high 32 bits of the MSR value could also be specified.

Yeah, if we ever do want to make it completely generic then we could
move it from nospec-branch.h to alternative.h and make it possible to
set the high word. But for now I'm inclined not to overengineer it.

The idea *was* that Boris was going to bikeshed it away into some other
form, but having just reverted two of those patches I am less inclined
to accept any more of that kind of change that doesn't actually fix a
real bug.

Attachment: smime.p7s
Description: S/MIME cryptographic signature