From: Sean Christopherson <seanjc@google.com>
To: Naveen N Rao <naveen@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/5] KVM: SVM: Disable x2AVIC RDMSR interception for MSRs KVM actually supports
Date: Thu, 7 May 2026 07:27:11 -0700 [thread overview]
Message-ID: <afyhP1dx7kzUV-D-@google.com> (raw)
In-Reply-To: <afx7eh2ghy1_Nd34@blrnaveerao1>
On Thu, May 07, 2026, Naveen N Rao wrote:
> On Wed, May 06, 2026 at 11:47:42AM -0700, Sean Christopherson wrote:
> > Fix multiple (classes of) bugs with one stone by using KVM's mask of
> > readable local APIC registers to determine which x2APIC MSRs to pass
> > through (or not) when toggling x2AVIC on/off. The existing hand-coded
> > list of MSRs is wrong on multiple fronts:
> >
> > - ARBPRI isn't supported by x2APIC, but its unaccelerated AVIC intercept
> ^^^^^^^^^
> access/exit?
Ya, #VMEXIT is a better description here.
> > is fault-like; disabling interception is nonsensical and suboptimal as
> > the access generates a #VMEXIT that requires decoding the instruction.
>
> As far as I can tell, it looks like ARBPRI is actually "supported" in
> x2APIC mode on AMD processors. APM lists this in the x2APIC register
> list (Section 16.11.1 x2APIC Register Address Space Table 16-6. x2APIC
> Register), as well as in the AVIC chapter (15.29.3.1, table 15-22).
Yeah, agreed. I missed Table 16-6 (so many things to cross-reference, blech).
> This is probably not relevant though, since it looks like KVM has never
> supported this.
Definitely worth getting it right in the changelog though.
> > - DFR and ICR2 aren't supported by x2APIC and so don't need their
> > intercepts disabled for performance reasons. While the #GP due to
> > x2APIC being abled has higher priority than the trap-like #VMEXIT,
> ^^^^^ enabled
>
> > disabling interception of unsupported MSRs is confusing and
> > unnecessary.
> >
> > - RRR is completely unsupported.
>
> Would be good to also call out change to EOI and LVTT handling.
+1. I either totally missed or forgot that this also impacts LVTT reads, and
I definitely missed that KVM was allowing EOI reads.
> LVTT reads will now be allowed and should be returned from the backing page.
> I'm guessing this is fine and that the hardware won't validate it as
> LVTT may have TSC Deadline enabled (for emulation).
Ya, confirmed via the KUT test:
diff --git x86/apic.c x86/apic.c
index 0a52e9a4..b91e8500 100644
--- x86/apic.c
+++ x86/apic.c
@@ -569,6 +569,9 @@ static inline void apic_change_mode(unsigned long new_mode)
lvtt = apic_read(APIC_LVTT);
apic_write(APIC_LVTT, (lvtt & ~APIC_LVT_TIMER_MASK) | new_mode);
+
+ lvtt = apic_read(APIC_LVTT);
+ report((lvtt & APIC_LVT_TIMER_MASK) == new_mode, "LVTT mode switch");
}
static void test_apic_change_mode(void)
And given that AVIC (!x2APIC mode) says that reads are allowed, I don't see how
hardware could do anything differently.
next prev parent reply other threads:[~2026-05-07 14:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 18:47 [PATCH v2 0/5] KVM: SVM: Fix x2AVIC MSR interception issues Sean Christopherson
2026-05-06 18:47 ` [PATCH v2 1/5] KVM: SVM: Disable x2AVIC RDMSR interception for MSRs KVM actually supports Sean Christopherson
2026-05-07 13:56 ` Naveen N Rao
2026-05-07 14:27 ` Sean Christopherson [this message]
2026-05-08 16:35 ` Naveen N Rao
2026-05-06 18:47 ` [PATCH v2 2/5] KVM: SVM: Always intercept RDMSR for TMCCT (current APIC timer count) Sean Christopherson
2026-05-07 14:19 ` Naveen N Rao
2026-05-07 15:44 ` Sean Christopherson
2026-05-07 18:26 ` Sean Christopherson
2026-05-08 16:41 ` Naveen N Rao
2026-05-08 16:56 ` Sean Christopherson
2026-05-06 18:47 ` [PATCH v2 3/5] KVM: SVM: Only disable x2AVIC WRMSR interception for MSRs that are accelerated Sean Christopherson
2026-05-08 16:59 ` Naveen N Rao
2026-05-06 18:47 ` [PATCH v2 4/5] *** DO NOT MERGE *** KVM: x86: Hack in a stat to track guest-induced exits (for testing) Sean Christopherson
2026-05-08 17:14 ` Naveen N Rao
2026-05-08 17:49 ` Sean Christopherson
2026-05-09 5:08 ` Naveen N Rao
2026-05-06 18:47 ` [PATCH v2 5/5] *** DO NOT MERGE *** KVM: selftests: Add hacky test to verify x2APIC MSR interception Sean Christopherson
2026-05-09 5:10 ` [PATCH v2 0/5] KVM: SVM: Fix x2AVIC MSR interception issues 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=afyhP1dx7kzUV-D-@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naveen@kernel.org \
--cc=pbonzini@redhat.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