linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
@ 2019-02-07 10:42 Vitaly Kuznetsov
  2019-02-07 21:17 ` Jim Mattson
  0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2019-02-07 10:42 UTC (permalink / raw)
  To: kvm
  Cc: Paolo Bonzini, Radim Krčmář,
	Sean Christopherson, linux-kernel

SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If
(CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that
some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6,
model: 0xf, stepping: 0x6") don't have it. Add the missing check.

Reported-by: Zdenek Kaspar <zkaspar82@gmail.com>
Tested-by: Zdenek Kaspar <zkaspar82@gmail.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/vmx/nested.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 653830d0f3da..4bd0902bfd8c 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -5557,9 +5557,11 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps,
 	 * secondary cpu-based controls.  Do not include those that
 	 * depend on CPUID bits, they are added later by vmx_cpuid_update.
 	 */
-	rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
-		msrs->secondary_ctls_low,
-		msrs->secondary_ctls_high);
+	if (msrs->procbased_ctls_high & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
+		rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
+		      msrs->secondary_ctls_low,
+		      msrs->secondary_ctls_high);
+
 	msrs->secondary_ctls_low = 0;
 	msrs->secondary_ctls_high &=
 		SECONDARY_EXEC_DESC |
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
  2019-02-07 10:42 [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available Vitaly Kuznetsov
@ 2019-02-07 21:17 ` Jim Mattson
  2019-02-12 14:16   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Mattson @ 2019-02-07 21:17 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: kvm list, Paolo Bonzini, Radim Krčmář,
	Sean Christopherson, LKML

On Thu, Feb 7, 2019 at 2:42 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If
> (CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that
> some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6,
> model: 0xf, stepping: 0x6") don't have it. Add the missing check.
>
> Reported-by: Zdenek Kaspar <zkaspar82@gmail.com>
> Tested-by: Zdenek Kaspar <zkaspar82@gmail.com>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Jim Mattson <jmattson@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
  2019-02-07 21:17 ` Jim Mattson
@ 2019-02-12 14:16   ` Paolo Bonzini
  2019-02-12 18:00     ` Jim Mattson
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2019-02-12 14:16 UTC (permalink / raw)
  To: Jim Mattson, Vitaly Kuznetsov
  Cc: kvm list, Radim Krčmář, Sean Christopherson, LKML

On 07/02/19 22:17, Jim Mattson wrote:
>> SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If
>> (CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that
>> some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6,
>> model: 0xf, stepping: 0x6") don't have it. Add the missing check.
>> 
>> Reported-by: Zdenek Kaspar <zkaspar82@gmail.com>
>> Tested-by: Zdenek Kaspar <zkaspar82@gmail.com>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> Reviewed-by: Jim Mattson <jmattson@google.com>

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
  2019-02-12 14:16   ` Paolo Bonzini
@ 2019-02-12 18:00     ` Jim Mattson
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Mattson @ 2019-02-12 18:00 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Vitaly Kuznetsov, kvm list, Radim Krčmář,
	Sean Christopherson, LKML

On Tue, Feb 12, 2019 at 6:16 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 07/02/19 22:17, Jim Mattson wrote:
> >> SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If
> >> (CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that
> >> some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6,
> >> model: 0xf, stepping: 0x6") don't have it. Add the missing check.
> >>
> >> Reported-by: Zdenek Kaspar <zkaspar82@gmail.com>
> >> Tested-by: Zdenek Kaspar <zkaspar82@gmail.com>
> >> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> >
> > Reviewed-by: Jim Mattson <jmattson@google.com>
>
> Queued, thanks.
>
> Paolo

Alternatively, rdmsr could be changed to rdmsr_safe.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-12 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 10:42 [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available Vitaly Kuznetsov
2019-02-07 21:17 ` Jim Mattson
2019-02-12 14:16   ` Paolo Bonzini
2019-02-12 18:00     ` Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).