Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sairaj Kodilkar <sarunkod@amd.com>
Cc: sashiko-reviews@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [RFC PATCH v3 5/6] KVM: SVM: Add support for AMD IOMMU Guest APIC Physical Processor Interrupt (GAPPI)
Date: Mon, 10 Aug 2026 17:40:13 -0700	[thread overview]
Message-ID: <anpvbdzUIE_JtVoL@google.com> (raw)
In-Reply-To: <6adaf312-84ff-4fea-b072-61588fd73b40@amd.com>

On Mon, Jul 13, 2026, Sairaj Kodilkar wrote:
> On 7/13/2026 4:41 PM, sashiko-bot@kernel.org 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").

  reply	other threads:[~2026-08-11  0:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 10:50 [RFC PATCH v3 0/6] Add support for AMD IOMMU GAPPI Sairaj Kodilkar
2026-07-13 10:50 ` [RFC PATCH v3 1/6] iommu/amd: KVM: SVM: Rename cpu to apicid in IOMMU interface Sairaj Kodilkar
2026-07-13 10:50 ` [RFC PATCH v3 2/6] iommu/amd: KVM: SVM: Rename ga_log_intr to wakeup_intr " Sairaj Kodilkar
2026-07-13 10:50 ` [RFC PATCH v3 3/6] iommu/amd: KVM: SVM: Add explicit vCPU running state to " Sairaj Kodilkar
2026-07-13 11:08   ` sashiko-bot
2026-08-10  5:06     ` Sairaj Kodilkar
2026-08-11  0:34   ` Sean Christopherson
2026-07-13 10:50 ` [RFC PATCH v3 4/6] iommu/amd: Program guest-mode IRTEs for GAPPI wakeup when IRTE[IsRun] = 0 Sairaj Kodilkar
2026-07-13 11:07   ` sashiko-bot
2026-08-10  5:14     ` Sairaj Kodilkar
2026-07-13 10:50 ` [RFC PATCH v3 5/6] KVM: SVM: Add support for AMD IOMMU Guest APIC Physical Processor Interrupt (GAPPI) Sairaj Kodilkar
2026-07-13 11:11   ` sashiko-bot
2026-07-13 12:56     ` Sairaj Kodilkar
2026-08-11  0:40       ` Sean Christopherson [this message]
2026-08-10  5:54     ` Sairaj Kodilkar
2026-08-11  0:43       ` Sean Christopherson
2026-07-13 10:50 ` [RFC PATCH v3 6/6] iommu/amd: Provide kernel command line option to enable GAPPI Sairaj Kodilkar
2026-07-13 11:11   ` sashiko-bot
2026-08-10  6:12     ` Sairaj Kodilkar
2026-08-10  9:21 ` [RFC PATCH v3 0/6] Add support for AMD IOMMU GAPPI Sairaj Kodilkar
2026-08-11  0:48 ` Sean Christopherson

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=anpvbdzUIE_JtVoL@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sarunkod@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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