mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Naveen N Rao <naveen@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	Borislav Petkov <bp@alien8.de>,
	 kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Nikunj A Dadhania <nikunj@amd.com>,
	 Tianyu Lan <tiala@microsoft.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 Thomas Gleixner <tglx@kernel.org>
Subject: Re: [RFC PATCH v3 02/27] x86/apic: Drop savic_eoi() in favor of native_apic_msr_eoi() for Secure AVIC
Date: Tue, 3 Nov 2026 00:15:52 +0530	[thread overview]
Message-ID: <aujZ6BuUPcKMzWZZ@blrnaveerao1> (raw)
In-Reply-To: <atDVyVCeUFafWPHm@google.com>

On Thu, Oct 15, 2026 at 06:31:53AM -0700, Sean Christopherson wrote:
> On Thu, Oct 08, 2026, Naveen N Rao wrote:
> > On Mon, Oct 05, 2026 at 11:16:51PM -0700, Sean Christopherson wrote:
> > > On Tue, Jul 14, 2026, Naveen N Rao wrote:
> > > > On Mon, Jul 13, 2026 at 12:43:45PM -0500, Tom Lendacky wrote:
> > > > > On 7/8/26 01:32, Naveen N Rao (AMD) wrote:
> > > > > > Drop savic_eoi() in favor of using the native helper that writes to the
> > > > > > APIC_EOI MSR. savic_eoi() was added mainly to be able to handle
> > > > > > level-triggered interrupts. However, it relies on APIC_TMR indicating a
> > > > > > vector to be level-triggered, but APIC_TMR can never have a bit set
> > > > > > since it is only updated when the LAPIC accepts a level-triggered
> > > > > > interrupt. In the case of a Secure AVIC SEV-SNP guest, all
> > > > > > level-triggered interrupt sources are in the VMM (emulated IOAPIC
> > > > > > primarily) and KVM accepts them on behalf of the guest resulting in the
> > > > > > APIC_TMR in KVM APIC backing page having a bit set. This is never seen
> > > > > > by the guest, which has its own private APIC backing page. As such, the
> > > > > > savic_eoi() handler is dead code. Remove it.
> > > > > > 
> > > > > > Fixes: 43b6687ac877 ("x86/apic: Handle EOI writes for Secure AVIC guests")
> > > > > > Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
> > > > > 
> > > > > Another guest change which should be separate from this series.
> > > > 
> > > > Yes, I have called this out in the cover letter. I see now that I should 
> > > > have used a better subject for the cover letter though.
> > > > 
> > > > > 
> > > > > Is this causing issues with this hypervisor support or is just code that
> > > > > is never invoked? Do other hypervisors behave the same way and will
> > > > > removing this break them?
> > > > 
> > > > This is code that is never invoked and is independent of the hypervisor.  
> > > > No impact to hypervisor code.
> > > 
> > > Doesn't that mean level-triggered interrupts are fundamentally incompatible with
> > > Secure AVIC?
> > 
> > I think so, at least from the hypervisor front. Secure AVIC uses a 
> > guest-private, encrypted APIC backing page. KVM's APIC_TMR is not 
> > visible to the guest and the only injection mechanism is via 
> > VMCB->Requested_IRR field, which can only carry vectors. This means 
> > APIC_TMR in the guest backing page will never be set. So, all guest 
> > writes to APIC_EOI are accelerated and do not cause an exit.
> > 
> > The guest could track level-triggered interrupts and notify the 
> > hypervisor though. But, it isn't clear to me that is necessarily better.  
> > Linux already seems to have a fallback which works for I/O APIC (see 
> > below).
> > 
> > I believe TDX has similar restrictions?
> 
> No.  VMX lets the hypervisor select exactly which vectors will trigger a VM-Exit
> on EOI, via a dedicated bitmap.  Only SVM's approach of keying off the TMR is
> problematic.  FWIW, SVM's approach is flawed in general because it makes assumptions
> about hypervisor behavior that don't hold true, e.g. see the games that have to
> be played to deal with RTC tick stuffing when it's wired up as an edge-triggered
> interrupt.

Agreed w.r.t VMX vs. SVM.

However, as far as I can tell, for TDX guests, the EOI exit bitmap is 
not honored and so, level-triggered interrupts are incompatible with 
those too, no?


- Naveen

  reply	other threads:[~2026-11-02 18:55 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  6:31 [RFC PATCH v3 00/27] KVM: SVM: Add support for SEV-SNP " Naveen N Rao (AMD)
2026-07-08  6:31 ` [RFC PATCH v3 01/27] x86/apic: Propagate APIC_SPIV writes to hv for " Naveen N Rao (AMD)
2026-07-10  2:03   ` Borislav Petkov
2026-07-10 15:02     ` Naveen N Rao
2026-07-11  4:37       ` Borislav Petkov
2026-07-13 17:38       ` Tom Lendacky
2026-07-14  8:57         ` Naveen N Rao
2026-07-08  6:32 ` [RFC PATCH v3 02/27] x86/apic: Drop savic_eoi() in favor of native_apic_msr_eoi() " Naveen N Rao (AMD)
2026-07-13 17:43   ` Tom Lendacky
2026-07-14  9:02     ` Naveen N Rao
2026-10-06  6:16       ` Sean Christopherson
2026-10-08  7:35         ` Naveen N Rao
2026-10-15 13:31           ` Sean Christopherson
2026-11-02 18:45             ` Naveen N Rao [this message]
2026-10-06  3:20   ` Borislav Petkov
2026-10-08  7:57     ` Naveen N Rao
2026-07-08  6:32 ` [RFC PATCH v3 03/27] x86/kvm: Disable PV_SEND_IPI if Secure AVIC is enabled Naveen N Rao (AMD)
2026-07-13 17:52   ` Tom Lendacky
2026-07-14  9:42     ` Naveen N Rao
2026-07-08  6:32 ` [RFC PATCH v3 04/27] x86/apic: Use AVIC_INCOMPLETE_IPI VMGEXIT for Secure AVIC IPI handling Naveen N Rao (AMD)
2026-07-13 17:59   ` Tom Lendacky
2026-07-14 10:03     ` Naveen N Rao
2026-07-08  6:32 ` [RFC PATCH v3 05/27] x86/cpufeatures: Add Secure AVIC CPU feature Naveen N Rao (AMD)
2026-07-13 18:32   ` Tom Lendacky
2026-07-08  6:32 ` [RFC PATCH v3 06/27] KVM: SVM: Add helper to check if Secure AVIC is enabled for a guest Naveen N Rao (AMD)
2026-07-13 18:35   ` Tom Lendacky
2026-07-08  6:32 ` [RFC PATCH v3 07/27] KVM: SVM: Set guest_apic_protected if Secure AVIC is enabled Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 08/27] kvm: irqfd: Have kvm_arch_has_irq_bypass() take struct kvm pointer Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 09/27] KVM: SVM: Disable IRQ bypass for Secure AVIC Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 10/27] KVM: SVM: Add avic_ipiv_is_soft_disabled() as a wrapper around enable_ipiv Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 11/27] KVM: SVM: Disable IPIv for Secure AVIC Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 12/27] KVM: SVM: Short-circuit a few AVIC flows " Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 13/27] KVM: SVM: Warn if we ever receive AVIC_UNACCELERATED_ACCESS #VMEXIT Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 14/27] KVM: SVM: Do not inhibit AVIC for SEV-SNP guests if Secure AVIC is enabled Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 15/27] KVM: SVM: Set VGIF in VMSA area for Secure AVIC guests Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 16/27] KVM: SVM: Add handler for VMGEXIT Secure AVIC NAE event Naveen N Rao (AMD)
2026-08-26 16:09   ` Sean Christopherson
2026-09-22 15:01     ` Naveen N Rao
2026-09-30 14:43       ` Naveen N Rao
2026-09-30 15:45         ` Sean Christopherson
2026-09-30 19:54           ` Naveen N Rao
2026-07-08  6:32 ` [RFC PATCH v3 17/27] KVM: SVM: Do not intercept SECURE_AVIC_CONTROL MSR for Secure AVIC guests Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 18/27] KVM: x86: Add a new kvm_x86_op protected_apic_has_injectable_intr() Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 19/27] KVM: SVM: Implement kvm_x86_ops->protected_apic_has_injectable_intr() for Secure AVIC Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 20/27] KVM: SVM: Implement kvm_x86_ops->protected_apic_has_interrupt() " Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 21/27] KVM: SVM: Add interrupt delivery support for Secure AVIC guests Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 22/27] KVM: SVM: Add support for incomplete IPI handling for Secure AVIC Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 23/27] KVM: SVM: Add support for injecting NMIs for Secure AVIC guests Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 24/27] KVM: SVM: Mandate use of split irqchip for Secure AVIC Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 25/27] KVM: SVM: Do not inject exceptions " Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 26/27] KVM: SVM: Do not intercept exceptions for Secure AVIC guests Naveen N Rao (AMD)
2026-07-08  6:32 ` [RFC PATCH v3 27/27] KVM: SVM: Advertise Secure AVIC support for SEV-SNP guests Naveen N Rao (AMD)
2026-07-08  9:20 ` [RFC PATCH v3 00/27] KVM: SVM: Add support for SEV-SNP Secure AVIC 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=aujZ6BuUPcKMzWZZ@blrnaveerao1 \
    --to=naveen@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=tiala@microsoft.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

all inboxes | Powered by JetHome®