public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: "Naveen N Rao (AMD)" <naveen@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org,  Jim Mattson <jmattson@google.com>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	 Vasant Hegde <vasant.hegde@amd.com>,
	 Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Nikunj A Dadhania <nikunj@amd.com>,
	 Alejandro Jimenez <alejandro.j.jimenez@oracle.com>,
	Joao Martins <joao.m.martins@oracle.com>,
	 "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
Subject: Re: [RFC PATCH v2 3/5] KVM: SVM: Move all AVIC setup to avic_hardware_setup()
Date: Mon, 15 Sep 2025 12:59:40 -0700	[thread overview]
Message-ID: <aMhwLGxyEipwu-SE@google.com> (raw)
In-Reply-To: <aa7c82543158f6ac27c7aff8feaf6c7830236894.1756993734.git.naveen@kernel.org>

On Thu, Sep 04, 2025, Naveen N Rao (AMD) wrote:
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index cb4f81be0024..d5854e0bc799 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -162,7 +162,7 @@ module_param(tsc_scaling, int, 0444);
>   * enable / disable AVIC.  Because the defaults differ for APICv
>   * support between VMX and SVM we cannot use module_param_named.
>   */
> -static bool avic;
> +bool avic;

I'm all for consolidating module params and globals, but they should be grouped
by "area", i.e. the AVIC variables/params should grouped be in avic.c, not in svm.c.

>  module_param(avic, bool, 0444);
>  module_param(enable_ipiv, bool, 0444);
>  
> @@ -5406,7 +5406,7 @@ static __init int svm_hardware_setup(void)
>  			goto err;
>  	}
>  
> -	enable_apicv = avic = avic && avic_hardware_setup();
> +	avic_hardware_setup();


I would prefer to keep a mix of the old and new: move "avic" into avic.c, but
have avic_hardware_setup() return true/false and use it to set enable_apicv.

enable_apicv is tied to kvm.ko, and so I find it helpful to have it be set by
svm_hardware_setup(), e.g. so that when reading code in common x86, it's easier
to find where/when/how a global variable is configured by vendor code.  More
importantly, I don't want to create a hidden dependency between avic_hardware_setup()
setting enable_apicv and this code reading enable_apicv.

Alternatively, we could have avic_hardware_setup() clear the svm_x86_ops hooks,
but I wouldn't want to do that without having avic_hardware_setup() also _set_
the hooks, and I think doing that would be a big net negative since it would
make it harder to see the vcpu_(un)blocking = avic_vcpu_(un)blocking connection
for the soon-to-be-common case of AVIC being enabled.

  reply	other threads:[~2025-09-15 19:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 18:00 [RFC PATCH v2 0/5] KVM: SVM: Enable AVIC by default on Zen 4+ Naveen N Rao (AMD)
2025-09-04 18:00 ` [RFC PATCH v2 1/5] KVM: SVM: Stop warning if x2AVIC feature bit alone is enabled Naveen N Rao (AMD)
2025-09-15 20:04   ` Sean Christopherson
2025-09-16  7:14     ` Naveen N Rao
2025-09-16 13:40       ` Mario Limonciello
2025-09-16 13:51         ` Sean Christopherson
2025-09-16 18:37           ` Naveen N Rao
2025-09-16 19:26             ` Mario Limonciello
2025-09-17  0:44               ` Sean Christopherson
2025-09-04 18:00 ` [RFC PATCH v2 2/5] KVM: SVM: Simplify the message printed with 'force_avic' Naveen N Rao (AMD)
2025-09-15 22:42   ` Sean Christopherson
2025-09-04 18:00 ` [RFC PATCH v2 3/5] KVM: SVM: Move all AVIC setup to avic_hardware_setup() Naveen N Rao (AMD)
2025-09-15 19:59   ` Sean Christopherson [this message]
2025-09-04 18:00 ` [RFC PATCH v2 4/5] KVM: SVM: Move 'force_avic' module parameter to svm.c Naveen N Rao (AMD)
2025-09-15 22:43   ` Sean Christopherson
2025-09-04 18:00 ` [RFC PATCH v2 5/5] KVM: SVM: Enable AVIC by default from Zen 4 Naveen N Rao (AMD)
2025-09-15 22:53   ` Sean Christopherson
2025-09-16  7:39     ` Naveen N Rao
2025-09-16 14:27       ` Sean Christopherson
2025-09-16 18:53         ` Naveen N Rao
2025-09-15 23:17   ` Sean Christopherson
2025-09-16 10:17     ` Naveen N Rao
2025-09-15 23:23 ` [RFC PATCH v2 0/5] KVM: SVM: Enable AVIC by default on Zen 4+ Sean Christopherson
2025-09-16 10:31   ` Naveen N Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aMhwLGxyEipwu-SE@google.com \
    --to=seanjc@google.com \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=jmattson@google.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=maciej.szmigiero@oracle.com \
    --cc=mlevitsk@redhat.com \
    --cc=naveen@kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=vasant.hegde@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox