From patchwork Wed Sep 6 13:17:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 9940673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62D936035F for ; Wed, 6 Sep 2017 13:17:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5829E28BD7 for ; Wed, 6 Sep 2017 13:17:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CAAB28BCD; Wed, 6 Sep 2017 13:17:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 319D928BD7 for ; Wed, 6 Sep 2017 13:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754197AbdIFNRs (ORCPT ); Wed, 6 Sep 2017 09:17:48 -0400 Received: from mail.skyhub.de ([5.9.137.197]:35464 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbdIFNRr (ORCPT ); Wed, 6 Sep 2017 09:17:47 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id hy0_mPpgN_tL; Wed, 6 Sep 2017 15:17:45 +0200 (CEST) Received: from pd.tnic (p2003008C2F295500EC10A8A0DE3082FC.dip0.t-ipconnect.de [IPv6:2003:8c:2f29:5500:ec10:a8a0:de30:82fc]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 701021EC0372; Wed, 6 Sep 2017 15:17:45 +0200 (CEST) Date: Wed, 6 Sep 2017 15:17:36 +0200 From: Borislav Petkov To: David Hildenbrand Cc: KVM , LKML , Janakarajan Natarajan , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: SVM: Do not issue virtual VMLOAD/VMSAVE supported-message Message-ID: <20170906131736.4tkvjveqjfmkdpxo@pd.tnic> References: <20170905170628.10211-1-bp@alien8.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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? Reviewed-by: David Hildenbrand --- 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;