From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756862AbdCUJP2 (ORCPT ); Tue, 21 Mar 2017 05:15:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756171AbdCUJP0 (ORCPT ); Tue, 21 Mar 2017 05:15:26 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5B95C80F7B 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=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5B95C80F7B Subject: Re: [PATCH v2 2/3] KVM: VMX: Fix enable VPID even if INVVPID is not exposed in vmx capability To: Wanpeng Li References: <1490069935-6232-1-git-send-email-wanpeng.li@hotmail.com> <1490069935-6232-2-git-send-email-wanpeng.li@hotmail.com> <6b112918-a785-bf87-71c4-8649915e7772@redhat.com> Cc: "linux-kernel@vger.kernel.org" , kvm , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 21 Mar 2017 10:15:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Mar 2017 09:15:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> Cc: Paolo Bonzini >>> Cc: Radim Krčmář >>> Signed-off-by: Wanpeng Li >>> --- >>> arch/x86/kvm/vmx.c | 9 ++++++++- >>> 1 file changed, 8 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >>> index 06d8080..b310214 100644 >>> --- a/arch/x86/kvm/vmx.c >>> +++ b/arch/x86/kvm/vmx.c >>> @@ -1239,6 +1239,11 @@ static inline bool cpu_has_vmx_invvpid_global(void) >>> return vmx_capability.vpid & VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT; >>> } >>> >>> +static inline bool cpu_has_vmx_invvpid(void) >>> +{ >>> + return vmx_capability.vpid & VMX_VPID_INVVPID_BIT; >>> +} >>> + >>> static inline bool cpu_has_vmx_ept(void) >>> { >>> return vmcs_config.cpu_based_2nd_exec_ctrl & >>> @@ -6519,8 +6524,10 @@ static __init int hardware_setup(void) >>> if (boot_cpu_has(X86_FEATURE_NX)) >>> kvm_enable_efer_bits(EFER_NX); >>> >>> - if (!cpu_has_vmx_vpid()) >>> + if (!cpu_has_vmx_vpid() || >>> + !(cpu_has_vmx_invvpid())) >> >> This indentation looks weird. Can't this be fit into one line? > > The same as cpu_has_vmx_ept_4levels(). I only know the general rules: 1. make things fit into one line unless it really harms readability 2. when splitting conditions over multiple lines, make them start at the same level. And I said, this indentation looks weird, because 1 and 2 are not met. Anyhow, the general patch is fine in my opinion. -- Thanks, David