From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: vmx: fix VPID is 0000H in non-root operation Date: Wed, 16 Sep 2015 14:32:33 +0200 Message-ID: <55F96161.2090405@siemens.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Bandan Das , Wincy Van , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Wanpeng Li , Paolo Bonzini Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 2015-09-16 13:31, Wanpeng Li wrote: > Reference SDM 28.1: >=20 > The current VPID is 0000H in the following situations: > =E2=80=94 Outside VMX operation. (This includes operation in system-m= anagement=20 > mode under the default treatment of SMIs and SMM with VMX operation= ;=20 > see Section 34.14.) > =E2=80=94 In VMX root operation. > =E2=80=94 In VMX non-root operation when the =E2=80=9Cenable VPID=E2=80= =9D VM-execution control=20 > is 0. >=20 > The VPID should never be 0000H in non-root operation when "enable VPI= D"=20 > VM-execution control is 1. However, commit (34a1cd60: 'kvm: x86: vmx:= =20 > move some vmx setting from vmx_init() to hardware_setup()') remove th= e=20 > codes which reserve 0000H for VMX root operation.=20 >=20 > This patch fix it by reintroducing reserve 0000H for VMX root operati= on. >=20 > Reported-by: Wincy Van > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/vmx.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 9ff6a3f..a63b9ca 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -6056,6 +6056,8 @@ static __init int hardware_setup(void) > memcpy(vmx_msr_bitmap_longmode_x2apic, > vmx_msr_bitmap_longmode, PAGE_SIZE); > =20 > + set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ > + > if (enable_apicv) { > for (msr =3D 0x800; msr <=3D 0x8ff; msr++) > vmx_disable_intercept_msr_read_x2apic(msr); >=20 Good point. BTW, what will happen if allocate_vpid runs out of free slots and returns 0? Will we always fail then...? Jan --=20 Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux