[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CyM5Pm6Vu1w3aVzuvonZYcZqJo_6xLxVTe-bhggZSoL+g@mail.gmail.com>
Date: Wed, 18 Oct 2017 17:36:20 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: David Hildenbrand <david@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
kvm <kvm@...r.kernel.org>, Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Wanpeng Li <wanpeng.li@...mail.com>,
Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH v3 1/2] KVM: nVMX: Fix EPT switching advertising
2017-10-18 17:31 GMT+08:00 David Hildenbrand <david@...hat.com>:
> On 18.10.2017 03:42, Wanpeng Li wrote:
>> From: Wanpeng Li <wanpeng.li@...mail.com>
>>
>> I can use vmxcap tool to observe "EPTP Switching yes" even if EPT is not
>> exposed to L1.
>>
>> EPT switching is advertised unconditionally since it is emulated, however,
>> it can be treated as an extended feature for EPT and it should not be
>> advertised if EPT itself is not exposed. This patch fixes it.
>>
>> Cc: Paolo Bonzini <pbonzini@...hat.com>
>> Cc: Radim Krčmář <rkrcmar@...hat.com>
>> Cc: Jim Mattson <jmattson@...gle.com>
>> Signed-off-by: Wanpeng Li <wanpeng.li@...mail.com>
>> ---
>> v2 -> v3:
>> * it is legal for the IA32_VMX_VMFUNC MSR to report all-zero
>> v1 -> v2:
>> * don't advertise "EPT VM Functions" in secondary processor-based VM-execution
>> controls if we don't actually support any VM Functions.
>>
>> arch/x86/kvm/vmx.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index c460b0b..3644540 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -2842,8 +2842,9 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
>> * Advertise EPTP switching unconditionally
>> * since we emulate it
>> */
>> - vmx->nested.nested_vmx_vmfunc_controls =
>> - VMX_VMFUNC_EPTP_SWITCHING;
>> + if (enable_ept)
>> + vmx->nested.nested_vmx_vmfunc_controls =
>> + VMX_VMFUNC_EPTP_SWITCHING;
>> }
>>
>> /*
>>
>
> I think we talked about how that cannot happen. But you observe it, so
> it seems to happen :)
It is very easy to reproduce if you run L1 w/ ept=0.
Regards,
Wanpeng Li
Powered by blists - more mailing lists