From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amdgpu: replace PASID IDR with XArray
Date: Tue, 31 Mar 2026 16:57:38 +1000 [thread overview]
Message-ID: <review-overall-20260330191120.105065-1-mikhail.v.gavrilov@gmail.com> (raw)
In-Reply-To: <20260330191120.105065-1-mikhail.v.gavrilov@gmail.com>
Overall Series Review
Subject: drm/amdgpu: replace PASID IDR with XArray
Author: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Patches: 3
Reviewed: 2026-03-31T16:57:38.374656
---
This is a single v5 patch converting amdgpu's PASID allocator from IDR+spinlock to XArray, fixing two real bugs introduced by commit 8f1de51f49be: sleeping under spinlock and a process/hardirq lock deadlock. The conversion is clean and well-motivated, but **the patch has a remaining deadlock vulnerability** — the same class of bug it's trying to fix.
The core issue: `xa_alloc_cyclic()` uses plain `xa_lock()` internally (IRQs remain enabled), while `amdgpu_pasid_free()` correctly uses `xa_lock_irqsave()`. If a hardirq fires on the same CPU while `xa_alloc_cyclic()` holds the xa_lock, and the IRQ handler calls `amdgpu_pasid_free()` → `xa_lock_irqsave()`, it will deadlock on the already-held lock — exactly the same pattern as the original bug.
**The fix is straightforward**: use `xa_alloc_cyclic_irq()` instead of `xa_alloc_cyclic()`. This variant (at `include/linux/xarray.h:1054`) takes and releases the xa_lock while disabling interrupts, which prevents the deadlock.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-31 6:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 19:11 [PATCH v5] drm/amdgpu: replace PASID IDR with XArray Mikhail Gavrilov
2026-03-30 21:18 ` Eric Huang
2026-03-31 3:32 ` Lazar, Lijo
2026-03-31 6:57 ` Claude review: " Claude Code Review Bot
2026-03-31 6:57 ` Claude Code Review Bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-03-31 14:21 [PATCH v7] " Mikhail Gavrilov
2026-03-31 21:43 ` Claude review: " Claude Code Review Bot
2026-03-31 21:43 ` Claude Code Review Bot
2026-03-31 11:17 [PATCH v6] " Mikhail Gavrilov
2026-03-31 21:48 ` Claude review: " Claude Code Review Bot
2026-03-31 21:48 ` Claude Code Review Bot
2026-03-30 14:50 [PATCH v4] " Mikhail Gavrilov
2026-03-31 7:08 ` Claude review: " Claude Code Review Bot
2026-03-31 7:08 ` Claude Code Review Bot
2026-03-30 11:35 [PATCH v3] " Mikhail Gavrilov
2026-03-31 7:18 ` Claude review: " Claude Code Review Bot
2026-03-31 7:18 ` Claude Code Review Bot
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=review-overall-20260330191120.105065-1-mikhail.v.gavrilov@gmail.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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