* KVM: nested VMX: disable perf cpuid reporting
@ 2014-09-18 21:24 Marcelo Tosatti
2014-09-19 13:28 ` Paolo Bonzini
2014-09-22 19:01 ` Marcelo Tosatti
0 siblings, 2 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2014-09-18 21:24 UTC (permalink / raw)
To: kvm-devel; +Cc: Gleb Natapov, Paolo Bonzini, Bandan Das, Nadav Amit
Initilization of L2 guest with -cpu host, on L1 guest with -cpu host
triggers:
(qemu) KVM: entry failed, hardware error 0x7
...
nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported
Nested VMX MSR load/store support is not sufficient to
allow perf for L2 guest.
Until properly fixed, trap CPUID and disable function 0xA.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index e28d798..976e3a5 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -774,6 +774,12 @@ 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 e8f08e9..2ab5047 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6986,6 +6986,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
case EXIT_REASON_TASK_SWITCH:
return 1;
case EXIT_REASON_CPUID:
+ if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
+ return 0;
return 1;
case EXIT_REASON_HLT:
return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: KVM: nested VMX: disable perf cpuid reporting
2014-09-18 21:24 KVM: nested VMX: disable perf cpuid reporting Marcelo Tosatti
@ 2014-09-19 13:28 ` Paolo Bonzini
2014-09-22 19:01 ` Marcelo Tosatti
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-09-19 13:28 UTC (permalink / raw)
To: Marcelo Tosatti, kvm-devel; +Cc: Gleb Natapov, Bandan Das, Nadav Amit
Il 18/09/2014 23:24, Marcelo Tosatti ha scritto:
>
> Initilization of L2 guest with -cpu host, on L1 guest with -cpu host
> triggers:
>
> (qemu) KVM: entry failed, hardware error 0x7
> ...
> nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported
>
> Nested VMX MSR load/store support is not sufficient to
> allow perf for L2 guest.
>
> Until properly fixed, trap CPUID and disable function 0xA.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index e28d798..976e3a5 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -774,6 +774,12 @@ 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 e8f08e9..2ab5047 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6986,6 +6986,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
> case EXIT_REASON_TASK_SWITCH:
> return 1;
> case EXIT_REASON_CPUID:
> + if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
> + return 0;
> return 1;
> case EXIT_REASON_HLT:
> return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
>
Nice solution. :)
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: KVM: nested VMX: disable perf cpuid reporting
2014-09-18 21:24 KVM: nested VMX: disable perf cpuid reporting Marcelo Tosatti
2014-09-19 13:28 ` Paolo Bonzini
@ 2014-09-22 19:01 ` Marcelo Tosatti
2014-09-22 19:16 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2014-09-22 19:01 UTC (permalink / raw)
To: kvm-devel; +Cc: Gleb Natapov, Paolo Bonzini, Bandan Das, Nadav Amit
On Thu, Sep 18, 2014 at 06:24:57PM -0300, Marcelo Tosatti wrote:
>
> Initilization of L2 guest with -cpu host, on L1 guest with -cpu host
> triggers:
>
> (qemu) KVM: entry failed, hardware error 0x7
> ...
> nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported
>
> Nested VMX MSR load/store support is not sufficient to
> allow perf for L2 guest.
>
> Until properly fixed, trap CPUID and disable function 0xA.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Ping, Paolo?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: KVM: nested VMX: disable perf cpuid reporting
2014-09-22 19:01 ` Marcelo Tosatti
@ 2014-09-22 19:16 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-09-22 19:16 UTC (permalink / raw)
To: Marcelo Tosatti, kvm-devel; +Cc: Gleb Natapov, Bandan Das, Nadav Amit
Il 22/09/2014 21:01, Marcelo Tosatti ha scritto:
> On Thu, Sep 18, 2014 at 06:24:57PM -0300, Marcelo Tosatti wrote:
>>
>> Initilization of L2 guest with -cpu host, on L1 guest with -cpu host
>> triggers:
>>
>> (qemu) KVM: entry failed, hardware error 0x7
>> ...
>> nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported
>>
>> Nested VMX MSR load/store support is not sufficient to
>> allow perf for L2 guest.
>>
>> Until properly fixed, trap CPUID and disable function 0xA.
>>
>> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> Ping, Paolo?
>
Sorry, didn't push to kvm/queue but I've already applied the patch
locally. I will do it first thing tomorrow (my workstation is off right
now so I cannot send you a SHA).
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-22 19:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 21:24 KVM: nested VMX: disable perf cpuid reporting Marcelo Tosatti
2014-09-19 13:28 ` Paolo Bonzini
2014-09-22 19:01 ` Marcelo Tosatti
2014-09-22 19:16 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox