diff mbox

[8/8] KVM: x86: add SPEC_CTRL and IBPB_SUPPORT to MSR and CPUID lists

Message ID alpine.LRH.2.11.1801130120140.444@mail.ewheeler.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Wheeler Jan. 13, 2018, 1:25 a.m. UTC
On Tue, 9 Jan 2018, Paolo Bonzini wrote:

> Expose them to userspace, now that guests can use them.
> I am not adding cpufeatures here to avoid having a kernel
> that shows spec_ctrl in /proc/cpuinfo and actually has no
> support whatsoever for IBRS/IBPB.  Keep the ugly special-casing
> for now, and clean it up once the generic arch/x86/ code
> learns about them.
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index daa1918031df..4abb37d9f4d8 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1032,6 +1032,7 @@ unsigned int kvm_get_pt_addr_cnt(void)
>  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
>  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
>  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> +	MSR_IA32_SPEC_CTRL,
>  };

Hi Paolo,

Thank you for posting this!

I am trying to merge this into 4.14 which does not have 
kvm_get_pt_addr_cnt. The rest of the patch commits, but this gets 
rejected. Is this a necessary part of the commit?

patching file arch/x86/kvm/cpuid.c
Hunk #1 succeeded at 389 (offset -8 lines).
Hunk #2 succeeded at 479 (offset -9 lines).
Hunk #3 succeeded at 636 (offset -27 lines).
patching file arch/x86/kvm/x86.c
Hunk #1 FAILED at 1032.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kvm/x86.c.rej

]# cat arch/x86/kvm/x86.c.rej


Thank you for your help!

--
Eric Wheeler


>  
>  static unsigned num_msrs_to_save;
> -- 
> 1.8.3.1
> 
> 
>

Comments

Paolo Bonzini Jan. 13, 2018, 8 a.m. UTC | #1
Just add the new MSR at the end of the array.

Paolo

----- Eric Wheeler <kvm@lists.ewheeler.net> ha scritto:
> On Tue, 9 Jan 2018, Paolo Bonzini wrote:
> 
> > Expose them to userspace, now that guests can use them.
> > I am not adding cpufeatures here to avoid having a kernel
> > that shows spec_ctrl in /proc/cpuinfo and actually has no
> > support whatsoever for IBRS/IBPB.  Keep the ugly special-casing
> > for now, and clean it up once the generic arch/x86/ code
> > learns about them.
> > 
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index daa1918031df..4abb37d9f4d8 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -1032,6 +1032,7 @@ unsigned int kvm_get_pt_addr_cnt(void)
> >  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
> >  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
> >  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> > +	MSR_IA32_SPEC_CTRL,
> >  };
> 
> Hi Paolo,
> 
> Thank you for posting this!
> 
> I am trying to merge this into 4.14 which does not have 
> kvm_get_pt_addr_cnt. The rest of the patch commits, but this gets 
> rejected. Is this a necessary part of the commit?
> 
> patching file arch/x86/kvm/cpuid.c
> Hunk #1 succeeded at 389 (offset -8 lines).
> Hunk #2 succeeded at 479 (offset -9 lines).
> Hunk #3 succeeded at 636 (offset -27 lines).
> patching file arch/x86/kvm/x86.c
> Hunk #1 FAILED at 1032.
> 1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kvm/x86.c.rej
> 
> ]# cat arch/x86/kvm/x86.c.rej
> --- arch/x86/kvm/x86.c
> +++ arch/x86/kvm/x86.c
> @@ -1032,6 +1032,7 @@
>  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
>  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
>  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> +	MSR_IA32_SPEC_CTRL,
>  };
>  
>  static unsigned num_msrs_to_save;
> 
> 
> Thank you for your help!
> 
> --
> Eric Wheeler
> 
> 
> >  
> >  static unsigned num_msrs_to_save;
> > -- 
> > 1.8.3.1
> > 
> > 
> >
Eric Wheeler Jan. 16, 2018, 12:40 a.m. UTC | #2
On Sat, 13 Jan 2018, Paolo Bonzini wrote:

> Just add the new MSR at the end of the array.

I'm assuming you meant emulated_msrs[], correct?  


--
Eric Wheeler



> 
> Paolo
> 
> ----- Eric Wheeler <kvm@lists.ewheeler.net> ha scritto:
> > On Tue, 9 Jan 2018, Paolo Bonzini wrote:
> > 
> > > Expose them to userspace, now that guests can use them.
> > > I am not adding cpufeatures here to avoid having a kernel
> > > that shows spec_ctrl in /proc/cpuinfo and actually has no
> > > support whatsoever for IBRS/IBPB.  Keep the ugly special-casing
> > > for now, and clean it up once the generic arch/x86/ code
> > > learns about them.
> > > 
> > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > index daa1918031df..4abb37d9f4d8 100644
> > > --- a/arch/x86/kvm/x86.c
> > > +++ b/arch/x86/kvm/x86.c
> > > @@ -1032,6 +1032,7 @@ unsigned int kvm_get_pt_addr_cnt(void)
> > >  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
> > >  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
> > >  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> > > +	MSR_IA32_SPEC_CTRL,
> > >  };
> > 
> > Hi Paolo,
> > 
> > Thank you for posting this!
> > 
> > I am trying to merge this into 4.14 which does not have 
> > kvm_get_pt_addr_cnt. The rest of the patch commits, but this gets 
> > rejected. Is this a necessary part of the commit?
> > 
> > patching file arch/x86/kvm/cpuid.c
> > Hunk #1 succeeded at 389 (offset -8 lines).
> > Hunk #2 succeeded at 479 (offset -9 lines).
> > Hunk #3 succeeded at 636 (offset -27 lines).
> > patching file arch/x86/kvm/x86.c
> > Hunk #1 FAILED at 1032.
> > 1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kvm/x86.c.rej
> > 
> > ]# cat arch/x86/kvm/x86.c.rej
> > --- arch/x86/kvm/x86.c
> > +++ arch/x86/kvm/x86.c
> > @@ -1032,6 +1032,7 @@
> >  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
> >  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
> >  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> > +	MSR_IA32_SPEC_CTRL,
> >  };
> >  
> >  static unsigned num_msrs_to_save;
> > 
> > 
> > Thank you for your help!
> > 
> > --
> > Eric Wheeler
> > 
> > 
> > >  
> > >  static unsigned num_msrs_to_save;
> > > -- 
> > > 1.8.3.1
> > > 
> > > 
> > > 
> 
>
Paolo Bonzini Jan. 16, 2018, 7:39 a.m. UTC | #3
----- Eric Wheeler <kvm@lists.ewheeler.net> ha scritto:
> On Sat, 13 Jan 2018, Paolo Bonzini wrote:
> 
> > Just add the new MSR at the end of the array.
> 
> I'm assuming you meant emulated_msrs[], correct?  

No, msrs_to_save. It's just above emulated_msrs.

Paolo
> 
> 
> --
> Eric Wheeler
> 
> 
> 
> > 
> > Paolo
> > 
> > ----- Eric Wheeler <kvm@lists.ewheeler.net> ha scritto:
> > > On Tue, 9 Jan 2018, Paolo Bonzini wrote:
> > > 
> > > > Expose them to userspace, now that guests can use them.
> > > > I am not adding cpufeatures here to avoid having a kernel
> > > > that shows spec_ctrl in /proc/cpuinfo and actually has no
> > > > support whatsoever for IBRS/IBPB.  Keep the ugly special-casing
> > > > for now, and clean it up once the generic arch/x86/ code
> > > > learns about them.
> > > > 
> > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > > index daa1918031df..4abb37d9f4d8 100644
> > > > --- a/arch/x86/kvm/x86.c
> > > > +++ b/arch/x86/kvm/x86.c
> > > > @@ -1032,6 +1032,7 @@ unsigned int kvm_get_pt_addr_cnt(void)
> > > >  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
> > > >  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
> > > >  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> > > > +	MSR_IA32_SPEC_CTRL,
> > > >  };
> > > 
> > > Hi Paolo,
> > > 
> > > Thank you for posting this!
> > > 
> > > I am trying to merge this into 4.14 which does not have 
> > > kvm_get_pt_addr_cnt. The rest of the patch commits, but this gets 
> > > rejected. Is this a necessary part of the commit?
> > > 
> > > patching file arch/x86/kvm/cpuid.c
> > > Hunk #1 succeeded at 389 (offset -8 lines).
> > > Hunk #2 succeeded at 479 (offset -9 lines).
> > > Hunk #3 succeeded at 636 (offset -27 lines).
> > > patching file arch/x86/kvm/x86.c
> > > Hunk #1 FAILED at 1032.
> > > 1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kvm/x86.c.rej
> > > 
> > > ]# cat arch/x86/kvm/x86.c.rej
> > > --- arch/x86/kvm/x86.c
> > > +++ arch/x86/kvm/x86.c
> > > @@ -1032,6 +1032,7 @@
> > >  	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
> > >  	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
> > >  	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
> > > +	MSR_IA32_SPEC_CTRL,
> > >  };
> > >  
> > >  static unsigned num_msrs_to_save;
> > > 
> > > 
> > > Thank you for your help!
> > > 
> > > --
> > > Eric Wheeler
> > > 
> > > 
> > > >  
> > > >  static unsigned num_msrs_to_save;
> > > > -- 
> > > > 1.8.3.1
> > > > 
> > > > 
> > > > 
> > 
> >
diff mbox

Patch

--- arch/x86/kvm/x86.c
+++ arch/x86/kvm/x86.c
@@ -1032,6 +1032,7 @@ 
 	MSR_IA32_RTIT_ADDR1_A, MSR_IA32_RTIT_ADDR1_B,
 	MSR_IA32_RTIT_ADDR2_A, MSR_IA32_RTIT_ADDR2_B,
 	MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B,
+	MSR_IA32_SPEC_CTRL,
 };
 
 static unsigned num_msrs_to_save;