All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting"
@ 2016-12-21  0:34 Jim Mattson
  2016-12-21  9:01 ` David Hildenbrand
  2017-01-20 21:21 ` Radim Krčmář
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Mattson @ 2016-12-21  0:34 UTC (permalink / raw)
  To: kvm; +Cc: Jim Mattson

This reverts commit bc6134942dbbf31c25e9bd7c876be5da81c9e1ce.

A CPUID instruction executed in VMX non-root mode always causes a
VM-exit, regardless of the leaf being queried.

Fixes: bc6134942dbb ("KVM: nested VMX: disable perf cpuid reporting")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/cpuid.c | 6 ------
 arch/x86/kvm/vmx.c   | 2 --
 2 files changed, 8 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 84b62ee..4b6e9ab 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -850,12 +850,6 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
 	if (!best)
 		best = check_cpuid_limit(vcpu, function, index);
 
-	/*
-	 * Perfmon not yet supported for L2 guest.
-	 */
-	if (is_guest_mode(vcpu) && function == 0xa)
-		best = NULL;
-
 	if (best) {
 		*eax = best->eax;
 		*ebx = best->ebx;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 64774f4..c7a87ff 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8045,8 +8045,6 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 	case EXIT_REASON_TASK_SWITCH:
 		return true;
 	case EXIT_REASON_CPUID:
-		if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
-			return false;
 		return true;
 	case EXIT_REASON_HLT:
 		return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
-- 
2.8.0.rc3.226.g39d4020


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

* Re: [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting"
  2016-12-21  0:34 [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting" Jim Mattson
@ 2016-12-21  9:01 ` David Hildenbrand
  2016-12-21 16:00   ` Jim Mattson
  2017-01-20 21:21 ` Radim Krčmář
  1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2016-12-21  9:01 UTC (permalink / raw)
  To: Jim Mattson, kvm

Am 21.12.2016 um 01:34 schrieb Jim Mattson:
> This reverts commit bc6134942dbbf31c25e9bd7c876be5da81c9e1ce.
>
> A CPUID instruction executed in VMX non-root mode always causes a
> VM-exit, regardless of the leaf being queried.

Makes sense, but wonder if the original problem has been resolved?

-- 

David

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

* Re: [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting"
  2016-12-21  9:01 ` David Hildenbrand
@ 2016-12-21 16:00   ` Jim Mattson
  2016-12-21 17:48     ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Mattson @ 2016-12-21 16:00 UTC (permalink / raw)
  To: David Hildenbrand; +Cc: kvm

Originally, the L1 hypervisor triggered the following message from L0:

nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported

This message was removed with commit ff651cb613b4 ("KVM: nVMX: Add
nested msr load/restore algorithm").

It seems likely that this was induced by an attempt to save/restore
MSR_CORE_PERF_GLOBAL_CTRL, since L0 doesn't set the
VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL/VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL
bits in L1's VMX capability MSRs. (As an aside: why not?) This MSR is
virtualized in intel_pmu.c, so I would expect the original problem to
be resolved.

On Wed, Dec 21, 2016 at 1:01 AM, David Hildenbrand <david@redhat.com> wrote:
> Am 21.12.2016 um 01:34 schrieb Jim Mattson:
>>
>> This reverts commit bc6134942dbbf31c25e9bd7c876be5da81c9e1ce.
>>
>> A CPUID instruction executed in VMX non-root mode always causes a
>> VM-exit, regardless of the leaf being queried.
>
>
> Makes sense, but wonder if the original problem has been resolved?
>
> --
>
> David

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

* Re: [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting"
  2016-12-21 16:00   ` Jim Mattson
@ 2016-12-21 17:48     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2016-12-21 17:48 UTC (permalink / raw)
  To: Jim Mattson, David Hildenbrand; +Cc: kvm



On 21/12/2016 17:00, Jim Mattson wrote:
> 
> It seems likely that this was induced by an attempt to save/restore
> MSR_CORE_PERF_GLOBAL_CTRL, since L0 doesn't set the
> VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL/VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL
> bits in L1's VMX capability MSRs. (As an aside: why not?)

Because no one has ever tried, I guess.

Paolo

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

* Re: [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting"
  2016-12-21  0:34 [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting" Jim Mattson
  2016-12-21  9:01 ` David Hildenbrand
@ 2017-01-20 21:21 ` Radim Krčmář
  1 sibling, 0 replies; 5+ messages in thread
From: Radim Krčmář @ 2017-01-20 21:21 UTC (permalink / raw)
  To: Jim Mattson; +Cc: kvm

2016-12-20 16:34-0800, Jim Mattson:
> This reverts commit bc6134942dbbf31c25e9bd7c876be5da81c9e1ce.
> 
> A CPUID instruction executed in VMX non-root mode always causes a
> VM-exit, regardless of the leaf being queried.
> 
> Fixes: bc6134942dbb ("KVM: nested VMX: disable perf cpuid reporting")
> Signed-off-by: Jim Mattson <jmattson@google.com>
> ---

Applied to kvm/queue, thanks.

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

end of thread, other threads:[~2017-01-20 21:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21  0:34 [PATCH] Revert "KVM: nested VMX: disable perf cpuid reporting" Jim Mattson
2016-12-21  9:01 ` David Hildenbrand
2016-12-21 16:00   ` Jim Mattson
2016-12-21 17:48     ` Paolo Bonzini
2017-01-20 21:21 ` Radim Krčmář

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.