Re: [PATCH 1/2] KVM: x86: Invert APICv/AVIC enablement check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 17, 2021 at 2:26 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Mon, May 17, 2021, Jim Mattson wrote:
> > On Mon, May 17, 2021 at 2:03 PM Sean Christopherson <seanjc@xxxxxxxxxx> 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.
> +        */

Hey! I'm just the messenger. Wei Huang 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) {



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux