public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Mario Limonciello <superm1@kernel.org>
Cc: Naveen N Rao <naveen@kernel.org>,
	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 1/5] KVM: SVM: Stop warning if x2AVIC feature bit alone is enabled
Date: Tue, 16 Sep 2025 17:44:48 -0700	[thread overview]
Message-ID: <aMoEgKQsfkIfL_wz@google.com> (raw)
In-Reply-To: <fa63be53-8769-4761-b878-556f20e1fbfc@kernel.org>

On Tue, Sep 16, 2025, Mario Limonciello wrote:
> On 9/16/25 1:37 PM, Naveen N Rao wrote:
> > On Tue, Sep 16, 2025 at 06:51:55AM -0700, Sean Christopherson wrote:
> > > On Tue, Sep 16, 2025, Mario Limonciello wrote:
> > > > On 9/16/25 2:14 AM, Naveen N Rao wrote:
> > > > > On Mon, Sep 15, 2025 at 01:04:56PM -0700, Sean Christopherson wrote:
> > > > > > On Thu, Sep 04, 2025, Naveen N Rao (AMD) wrote:
> > > > > There are platforms where this is the case though:
> > > > > 
> > > > > $ cpuid -1 -l 0x8000000A | grep -i avic
> > > > >         AVIC: AMD virtual interrupt controller  = false
> > > > >         X2AVIC: virtualized X2APIC              = true
> > > > >         extended LVT AVIC access changes        = true
> > > > > 
> > > > > The above is from Zen 4 (Phoenix), and my primary concern is that we
> > > > > will start printing a warning by default. Besides, there isn't much a
> > > > > user can do here (except start using force_avic, which will taint the
> > > > > kernel). Maybe we can warn only if AVIC is being explicitly enabled?
> > > 
> > > Uh, get that platform to not ship with a broken setup?
> > > 
> > > > I'd say if you need to say something downgrade it to info instead and not
> > > > mark it as firmware bug.
> > > 
> > > How is the above not a "firmware" bug?
> > 
> > Ok, looking at AVIC-related CPUID feature bits:
> > 1. Fn8000_000A_EDX[AVIC] (bit 13) representing core AVIC support
> > 2. Fn8000_000A_EDX[x2AVIC] (bit 18) for x2APIC MSR support
> > 3. Fn8000_000A_EDX[ExtLvtAvicAccessChg] (bit 27) for change to AVIC
> > handling of eLVT registers
> > 4. Fn8000_000A_ECX[x2AVIC_EXT] (bit 6) for x2AVIC 4k vCPU support
> > 
> > The latter three are dependent on the first feature being enabled. If a
> > platform wants to disable AVIC for whatever reason, it could:
> > - disable (1), and leave the rest of the three feature bits on as a way
> >    to advertise support for those (OR)
> > - disable all the four CPUID feature bits above
> > 
> > I think you are saying that the former is wrong and the right way to
> > disable AVIC would be to turn off all the four CPUID feature bits above?

Yes.

> > I don't know enough about x86/CPUIDs to argue about that ;)
> > 
> > However, it appears to me that the former approach of only disabling the
> > base AVIC CPUID feature bit is helpful in advertising the platform
> > capabilities.

My objection to that approach is that by disabling AVIC, the platform is no longer
capable of x2AVIC.  There are other situations where firmware can disable a feature
that is reported as support in CPUID, e.g. VMX vs. FEATURE_CONTROL on Intel, but
in those cases, the disabling is visible to software in something other than CPUID,
i.e. it's obvious to software that firmware has disabled (or maybe just not enabled)
the related feature.

For me, this is different.  It won't be at all obvious to the vast majority of
users, myself included, that firmware is even capable of manipulating CPUID in
this way.

> > Assuming AVIC was disabled due to a harware erratum, those who are _not_
> > affected by the erratum can meaningfully force-enable AVIC and also have
> > x2AVIC (and other related AVIC features and extensions) get enabled
> > automatically.  If all AVIC related CPUID feature bits were to be
> > disabled, then force_avic will serve a limited role unless it is
> > extended.
> > 
> > I don't know if there is precedence for this, or if it is at all ok,
> > just that it may be helpful.
> > 
> > Also, those platforms are unlikely to be fixed (client/desktop systems
> > that are unlikely to receive updates).

I know, but IMO it's not KVM's responsibility to hide the existence of what appears
buggy firmware.  With my user hat on, I would be very frustrated if I had to post
to the KVM mailing and wait for someone in the loop to explain that my firmware is
buggy.

> > The current warning suggests passing force_avic, but that will just
> > taint the kernel and potentially break more things assuming AVIC was
> > turned off for a good reason. Or, users can start explicitly disabling
> > AVIC by passing "avic=0" if they want to turn off the warning. Both of
> > these don't seem helpful, especially on client platforms.
> > 
> > So, if you still think that we should retain that warning, should we
> > tweak it not to suggest force_avic?

Hmm, yeah, I agree.  Suggesting random users to enable force_avic by default is
borderline irresponsible.  Even suggesting it to anyone that enables AVIC manually
is a bit sketchy...

  reply	other threads:[~2025-09-17  0:44 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 [this message]
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
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=aMoEgKQsfkIfL_wz@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=superm1@kernel.org \
    --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