From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936329AbdJRJbQ (ORCPT ); Wed, 18 Oct 2017 05:31:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55524 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932990AbdJRJbO (ORCPT ); Wed, 18 Oct 2017 05:31:14 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4F65B80F97 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com Subject: Re: [PATCH v3 1/2] KVM: nVMX: Fix EPT switching advertising To: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li , Jim Mattson References: <1508290980-3525-1-git-send-email-wanpeng.li@hotmail.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <1cad7936-cbf3-2723-9892-60e66528a2d1@redhat.com> Date: Wed, 18 Oct 2017 11:31:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1508290980-3525-1-git-send-email-wanpeng.li@hotmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 18 Oct 2017 09:31:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.10.2017 03:42, Wanpeng Li wrote: > From: Wanpeng Li > > 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 > Cc: Radim Krčmář > Cc: Jim Mattson > Signed-off-by: Wanpeng Li > --- > 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 :) Reviewed-by: David Hildenbrand -- Thanks, David