From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752799AbbIPMco (ORCPT ); Wed, 16 Sep 2015 08:32:44 -0400 Received: from thoth.sbs.de ([192.35.17.2]:48087 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632AbbIPMcn (ORCPT ); Wed, 16 Sep 2015 08:32:43 -0400 Subject: Re: [PATCH] KVM: vmx: fix VPID is 0000H in non-root operation To: Wanpeng Li , Paolo Bonzini References: Cc: Bandan Das , Wincy Van , kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Jan Kiszka Message-ID: <55F96161.2090405@siemens.com> Date: Wed, 16 Sep 2015 14:32:33 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015-09-16 13:31, Wanpeng Li wrote: > Reference SDM 28.1: > > The current VPID is 0000H in the following situations: > — Outside VMX operation. (This includes operation in system-management > mode under the default treatment of SMIs and SMM with VMX operation; > see Section 34.14.) > — In VMX root operation. > — In VMX non-root operation when the “enable VPID” VM-execution control > is 0. > > The VPID should never be 0000H in non-root operation when "enable VPID" > VM-execution control is 1. However, commit (34a1cd60: 'kvm: x86: vmx: > move some vmx setting from vmx_init() to hardware_setup()') remove the > codes which reserve 0000H for VMX root operation. > > This patch fix it by reintroducing reserve 0000H for VMX root operation. > > Reported-by: Wincy Van > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/vmx.c | 2 ++ > 1 file changed, 2 insertions(+) > > 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); > > + set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ > + > if (enable_apicv) { > for (msr = 0x800; msr <= 0x8ff; msr++) > vmx_disable_intercept_msr_read_x2apic(msr); > Good point. BTW, what will happen if allocate_vpid runs out of free slots and returns 0? Will we always fail then...? Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux