From patchwork Wed Sep 13 14:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 9951449 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 71658603FB for ; Wed, 13 Sep 2017 14:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62BFB28D8F for ; Wed, 13 Sep 2017 14:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 573C028DA9; Wed, 13 Sep 2017 14:06:23 +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,HK_RANDOM_FROM, 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 A35E728DED for ; Wed, 13 Sep 2017 14:06:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751641AbdIMOGQ (ORCPT ); Wed, 13 Sep 2017 10:06:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44402 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbdIMOGN (ORCPT ); Wed, 13 Sep 2017 10:06:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48E9785542; Wed, 13 Sep 2017 14:06:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 48E9785542 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=rkrcmar@redhat.com Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id E1128614CF; Wed, 13 Sep 2017 14:06:09 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 13 Sep 2017 16:06:09 +0200 Date: Wed, 13 Sep 2017 16:06:09 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Borislav Petkov Cc: KVM , LKML , Janakarajan Natarajan , Paolo Bonzini Subject: Re: [PATCH] KVM: SVM: Do not issue virtual VMLOAD/VMSAVE supported-message Message-ID: <20170913140608.GA2673@flask> References: <20170905170628.10211-1-bp@alien8.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170905170628.10211-1-bp@alien8.de> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Sep 2017 14:06:13 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 2017-09-05 19:06+0200, Borislav Petkov: > From: Borislav Petkov > > There's no need to issue that everytime during boot - we have the > /proc/cpuinfo flag for people and software to query. > > Signed-off-by: Borislav Petkov > Cc: Janakarajan Natarajan > Cc: Paolo Bonzini > Cc: Radim Krčmář > --- > arch/x86/kvm/svm.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 8dbd8dbc83eb..f25e5b930932 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -1101,11 +1101,8 @@ 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)) { > + !IS_ENABLED(CONFIG_X86_64)) > vls = false; > - } else { > - pr_info("Virtual VMLOAD VMSAVE supported\n"); SVM prints more offending messages on boot, so I'd do all one go. I am thinking of collocating the info instead as the information might prevent one round of asking for SVM features. ---8<--- Subject: [PATCH] KVM: SVM: print enabled features on one line The information might be useful for debugging, but having each feature present itself is needlessly verbose. Signed-off-by: Radim Krčmář --- arch/x86/kvm/svm.c | 56 ++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index af54327b9017..1901815777d0 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1078,10 +1078,8 @@ static __init int svm_hardware_setup(void) kvm_tsc_scaling_ratio_frac_bits = 32; } - if (nested) { - printk(KERN_INFO "kvm: Nested Virtualization enabled\n"); + if (nested) kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE); - } for_each_possible_cpu(cpu) { r = svm_cpu_init(cpu); @@ -1089,48 +1087,32 @@ static __init int svm_hardware_setup(void) goto err; } - if (!boot_cpu_has(X86_FEATURE_NPT)) - npt_enabled = false; - - if (npt_enabled && !npt) { - printk(KERN_INFO "kvm: Nested Paging disabled\n"); + if (!boot_cpu_has(X86_FEATURE_NPT) || !npt) npt_enabled = false; - } - if (npt_enabled) { - printk(KERN_INFO "kvm: Nested Paging enabled\n"); + if (npt_enabled) kvm_enable_tdp(); - } else + else kvm_disable_tdp(); - if (avic) { - if (!npt_enabled || - !boot_cpu_has(X86_FEATURE_AVIC) || - !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) { - avic = false; - } else { - pr_info("AVIC enabled\n"); + if (!npt_enabled || + !boot_cpu_has(X86_FEATURE_AVIC) || + !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) + avic = false; - amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier); - } - } + if (avic) + amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier); - 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; - if (vgif) { - if (!boot_cpu_has(X86_FEATURE_VGIF)) - vgif = false; - else - pr_info("Virtual GIF supported\n"); - } + if (!boot_cpu_has(X86_FEATURE_VGIF)) + vgif = false; + + pr_info("SVM nested=%d npt=%d avic=%d vls=%d vgif=%d\n", + nested, npt_enabled, avic, vls, vgif); return 0;