Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932527AbdIFOAO (ORCPT ); Wed, 6 Sep 2017 10:00:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52918 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247AbdIFOAL (ORCPT ); Wed, 6 Sep 2017 10:00:11 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5B7805D68C Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com Subject: Re: [PATCH] KVM: SVM: Do not issue virtual VMLOAD/VMSAVE supported-message To: Borislav Petkov Cc: KVM , LKML , Janakarajan Natarajan , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <20170905170628.10211-1-bp@alien8.de> <20170906131736.4tkvjveqjfmkdpxo@pd.tnic> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Wed, 6 Sep 2017 16:00:04 +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: <20170906131736.4tkvjveqjfmkdpxo@pd.tnic> 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.39]); Wed, 06 Sep 2017 14:00:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2014 Lines: 70 On 06.09.2017 15:17, Borislav Petkov wrote: > On Wed, Sep 06, 2017 at 02:54:05PM +0200, David Hildenbrand wrote: >> Maybe go one step further and incorporate everything (+vls) into a >> single if statement? > > Or maybe simplify it even more by not even looking at vls. If the user > disables it, fine, if she enables it but the hw doesn't support it, it > will be set to false automatically. > > Or am I missing a case? > > --- > From: Borislav Petkov > Date: Tue, 5 Sep 2017 18:59:55 +0200 > Subject: [PATCH] KVM: SVM: Do not issue virtual VMLOAD/VMSAVE > supported-message > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > There's no need to issue that everytime during boot - we have the > /proc/cpuinfo flag for people and software to query. > > Also, simplify logic which verifies the vls chicken bit setting. > > Signed-off-by: Borislav Petkov > Cc: David Hildenbrand > Cc: Janakarajan Natarajan > Cc: Paolo Bonzini > Cc: Radim Krčmář > --- > arch/x86/kvm/svm.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 8dbd8dbc83eb..d3c481778d9c 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -1098,15 +1098,10 @@ static __init int svm_hardware_setup(void) > } > } > > - if (vls) { > - if (!npt_enabled || > - !boot_cpu_has(X86_FEATURE_V_VMSAVE_VMLOAD) || > - !IS_ENABLED(CONFIG_X86_64)) { > - vls = false; > - } else { > - pr_info("Virtual VMLOAD VMSAVE supported\n"); > - } > - } > + if (!npt_enabled || > + !boot_cpu_has(X86_FEATURE_V_VMSAVE_VMLOAD) || > + !IS_ENABLED(CONFIG_X86_64)) > + vls = false; > > return 0; > > had the same idea but was worried about runtime. but this is really only executed once, so Reviewed-by: David Hildenbrand -- Thanks, David