lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKLfi4Xn95hDefgH@google.com>
Date:   Mon, 17 May 2021 21:26:35 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Jim Mattson <jmattson@...gle.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        kvm list <kvm@...r.kernel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Kechen Lu <kechenl@...dia.com>,
        Maxim Levitsky <mlevitsk@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] KVM: x86: Invert APICv/AVIC enablement check

On Mon, May 17, 2021, Jim Mattson wrote:
> On Mon, May 17, 2021 at 2:03 PM Sean Christopherson <seanjc@...gle.com> wrote:
> >
> > On Thu, May 13, 2021, Vitaly Kuznetsov wrote:
> > > Currently, APICv/AVIC enablement is global ('enable_apicv' module parameter
> > > for Intel, 'avic' module parameter for AMD) but there's no way to check
> > > it from vendor-neutral code. Add 'apicv_supported()' to kvm_x86_ops and
> > > invert kvm_apicv_init() (which now doesn't need to be called from arch-
> > > specific code).
> >
> > Rather than add a new hook, just move the variable to x86.c, and export it so
> > that VMX and SVM can give it different module names.  The only hiccup is that
> > avic is off by default, but I don't see why that can't be changed.
> 
> See https://www.spinics.net/lists/kvm/msg208722.html.

Boo.  A common enable_apicv can still work, SVM just needs an intermediary
between the module param and enable_apicv.

--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -185,6 +185,10 @@ module_param(vls, int, 0444);
 static int vgif = true;
 module_param(vgif, int, 0444);

+/* enable / disable AVIC */
+static bool avic;
+module_param(avic, bool, S_IRUGO);
+
 bool __read_mostly dump_invalid_vmcb;
 module_param(dump_invalid_vmcb, bool, 0644);

@@ -1009,16 +1013,19 @@ static __init int svm_hardware_setup(void)
                        nrips = false;
        }

-       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))
+               avic = false;

-                       amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);
-               }
+       /*
+        * Override the common enable_apicv.  AVIC is disabled by default
+        * because Jim said so.
+        */
+       enable_apicv = avic;
+
+       if (enable_apicv) {
+               pr_info("AVIC enabled\n");
+
+               amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);
        }

        if (vls) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ