Re: [RFC PATCH v3 5/6] KVM: SVM: Add support for AMD IOMMU Guest APIC Physical Processor Interrupt (GAPPI)

Sean Christopherson <[email protected]>
Newsgroups org.kernel.vger.kvm,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>
On Mon, Jul 13, 2026, Sairaj Kodilkar wrote:
> On 7/13/2026 4:41 PM, [email protected] wrote:
> > [Severity: High]
> > Does this lock ordering create an ABBA deadlock?
> > 
> > When a vCPU is preempted, the scheduler executes kvm_sched_out() while holding
> > the runqueue lock (rq_lock). KVM then calls __avic_vcpu_put(), which in turn
> > calls avic_add_vcpu_to_gappi_wakeup_list(). This acquires the
> > gappi_vcpu_wakeup_list_lock, establishing an ordering of rq_lock ->
> > gappi_vcpu_wakeup_list_lock.
> > 
> > Conversely, when a GAPPI interrupt arrives, avic_gappi_wakeup_handler()
> > acquires gappi_vcpu_wakeup_list_lock and calls kvm_vcpu_wake_up(). The wakeup
> > path then attempts to acquire the target task's runqueue lock, establishing
> > the reverse order: gappi_vcpu_wakeup_list_lock -> rq_lock.
> > 
> > This inversion will likely trigger a lockdep ABBA deadlock splat and violates
> > the scheduler locking hierarchy.
> 
> For this condition to exist, Following two conditions must be true.
> 1. avic_vcpu_put() and gappi interrupt handler() must be on same
> physical CPU.
> 2. GAPPI must preempt the __avic_vcpu_put() once it has acquired
> gappi_vcpu_wakeup_list_lock().
> 
> The second condition is not possible since __avic_vcpu_put() disables
> the interrupt while aquiring the ir_list lock.
> 
> Hence ABBA deadlock is not possible

I wouldn't be surprised if you need to tell lockdep that, e.g. see commit
c0b8dcabb2cd ("KVM: VMX: Use separate subclasses for PI wakeup lock to squash
false positive").
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.