From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937160AbdJQRsY (ORCPT ); Tue, 17 Oct 2017 13:48:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40006 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937079AbdJQRsW (ORCPT ); Tue, 17 Oct 2017 13:48:22 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C130C13AA8 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v2 2/2] KVM: VMX: Fix VPID capability detection To: Jim Mattson , Wanpeng Li Cc: LKML , kvm list , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li References: <1508213038-5593-1-git-send-email-wanpeng.li@hotmail.com> <1508213038-5593-2-git-send-email-wanpeng.li@hotmail.com> From: Paolo Bonzini Message-ID: <52b28aa7-d69a-53d9-4eb6-3c18ceddccc1@redhat.com> Date: Tue, 17 Oct 2017 19:48:09 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 17 Oct 2017 17:48:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/10/2017 19:43, Jim Mattson wrote: >> + &vmx_capability.ept, &vmx_capability.vpid); >> + >> if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) { >> /* CR3 accesses and invlpg don't need to cause VM Exits when EPT >> enabled */ >> _cpu_based_exec_control &= ~(CPU_BASED_CR3_LOAD_EXITING | >> CPU_BASED_CR3_STORE_EXITING | >> CPU_BASED_INVLPG_EXITING); >> - rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, >> - vmx_capability.ept, vmx_capability.vpid); >> - } >> + } else >> + vmx_capability.ept = 0; > I would expect vmx_capability.ept to already be 0 here. Otherwise, L0 > is reporting inconsistent VMX capabilities. > >> + if (!(_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_VPID)) >> + vmx_capability.vpid = 0; > I would expect vmx_capability.vpid to already be 0 here. Otherwise, L0 > is reporting inconsistent VMX capabilities. > That's true, but I think it's better to be safe. Maybe add a pr_warn if it is not zero? Paolo