Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-26 Thread Thomas Gleixner
On Tue, 20 Feb 2018, David Woodhouse wrote: > On Tue, 2018-02-20 at 11:42 +0100, Thomas Gleixner wrote: > > > > > > However, Paolo is very insistent that taking the trap every time is > > > > actually a lot *slower* than really frobbing IBRS on certain > > > > microarchitectures, so my hand-waving

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread Paolo Bonzini
On 20/02/2018 12:22, David Woodhouse wrote: However, Paolo is very insistent that taking the trap every time is actually a lot *slower* than really frobbing IBRS on certain microarchitectures, so my hand-waving "pfft, what did they expect?" is not acceptable.   Which I

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread Paolo Bonzini
On 19/02/2018 11:50, David Woodhouse wrote: > Cope with this by trapping and emulating *all* access to SPEC_CTRL from > KVM guests when the IBRS_ALL feature is present, so it can never be > turned off. Guests who see IBRS_ALL should never do anything except > turn it on at boot anyway. And if they

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread David Woodhouse
On Tue, 2018-02-20 at 11:42 +0100, Thomas Gleixner wrote: > > > > However, Paolo is very insistent that taking the trap every time is > > > actually a lot *slower* than really frobbing IBRS on certain > > > microarchitectures, so my hand-waving "pfft, what did they expect?" is > > > not acceptab

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread Thomas Gleixner
On Tue, 20 Feb 2018, Thomas Gleixner wrote: > On Tue, 20 Feb 2018, David Woodhouse wrote: > > On Tue, 2018-02-20 at 09:31 +0100, Thomas Gleixner wrote: > > > > @@ -3387,13 +3387,14 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, > > > > struct msr_data *msr_info) > > > >   > > > >  

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread Thomas Gleixner
On Tue, 20 Feb 2018, David Woodhouse wrote: > On Tue, 2018-02-20 at 09:31 +0100, Thomas Gleixner wrote: > > > @@ -3387,13 +3387,14 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, > > > struct msr_data *msr_info) > > >   > > >   vmx->spec_ctrl = data; > > >   > > > - if (!data) > >

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread David Woodhouse
On Tue, 2018-02-20 at 09:31 +0100, Thomas Gleixner wrote: > > @@ -237,6 +239,16 @@ static void __init spectre_v2_select_mitigation(void) > >   > >   case SPECTRE_V2_CMD_FORCE: > >   case SPECTRE_V2_CMD_AUTO: > > + if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) { > > +

Re: [PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-20 Thread Thomas Gleixner
On Mon, 19 Feb 2018, David Woodhouse wrote: > diff --git a/arch/x86/include/asm/nospec-branch.h > b/arch/x86/include/asm/nospec-branch.h > index 0995c6a..34cbce3 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -141,9 +141,16 @@ enum spectre_v2_

[PATCH v3 2/4] x86/speculation: Support "Enhanced IBRS" on future CPUs

2018-02-19 Thread David Woodhouse
The original IBRS hack in microcode is horribly slow. For the next generation of CPUs, as a stopgap until we get a proper fix, Intel promise an "Enhanced IBRS" which will be fast. The assumption is that predictions in the BTB/RSB will be tagged with the VMX mode and ring that they were learned in,