From: Sairaj Kodilkar <sarunkod@amd.com>
To: Sean Christopherson <seanjc@google.com>
Cc: <sarunkod@amd.com>, <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: Wed, 12 Aug 2026 11:18:27 +0530 [thread overview]
Message-ID: <09aaceca-c01b-41d9-9f87-4ee6a3a4800e@amd.com> (raw)
In-Reply-To: <anpvbdzUIE_JtVoL@google.com>
On 8/11/2026 6:10 AM, Sean Christopherson wrote:
> 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").
Will do this in next version.
Thanks
Sairaj
next prev parent reply other threads:[~2026-08-12 5:48 UTC|newest]
Thread overview: 28+ 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-08-12 5:19 ` Sairaj Kodilkar
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
2026-08-12 5:48 ` Sairaj Kodilkar [this message]
2026-08-10 5:54 ` Sairaj Kodilkar
2026-08-11 0:43 ` Sean Christopherson
2026-08-12 5:47 ` Sairaj Kodilkar
2026-08-12 21:59 ` Sean Christopherson
2026-08-17 6:26 ` Sairaj Kodilkar
2026-08-17 13:46 ` 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
2026-08-12 5:21 ` Sairaj Kodilkar
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=09aaceca-c01b-41d9-9f87-4ee6a3a4800e@amd.com \
--to=sarunkod@amd.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=seanjc@google.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