public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/amdxdna: Fix dead lock for suspend and resume
Date: Wed, 11 Feb 2026 16:16:32 +1000	[thread overview]
Message-ID: <review-overall-20260210191626.311976-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260210191626.311976-1-lizhi.hou@amd.com>

Overall Series Review

Subject: accel/amdxdna: Fix dead lock for suspend and resume
Author: Lizhi Hou <lizhi.hou@amd.com>
Patches: 1
Reviewed: 2026-02-11T16:16:32.498103

---

This single-patch series addresses a **critical deadlock** in the amdxdna accelerator driver that occurs during power management operations. The deadlock scenario is:

1. IOCTL path: holds `dev_lock` → calls `pm_runtime_resume_and_get()` → waits for suspend to complete
2. Suspend path: tries to acquire `dev_lock` → blocks waiting for IOCTL to release it

**Deadlock: ABBA lock ordering problem** (dev_lock vs PM subsystem internal locks)

The fix introduces `amdxdna_pm_resume_get_locked()` helper that temporarily drops `dev_lock` before calling into PM runtime, then reacquires it. The suspend/resume callbacks now also explicitly take `dev_lock`.

**Concerns:**
- **Race conditions**: Dropping and reacquiring locks creates windows where device state could change
- **Inconsistent locking**: Not all PM callsites converted (only some use `_locked` variant)
- **Unprotected hardware access**: Code between unlock/lock may execute with device in inconsistent state
- **Missing validation**: After reacquiring lock, no checks if device state changed
- **SRCU removal**: Unrelated cleanup removing SRCU protection without justification

**Severity: HIGH** - This fixes a deadlock but introduces potential race conditions that could cause use-after-free or hardware corruption.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-02-11  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 19:16 [PATCH V1] accel/amdxdna: Fix dead lock for suspend and resume Lizhi Hou
2026-02-11  6:16 ` Claude review: " Claude Code Review Bot
2026-02-11  6:16 ` Claude Code Review Bot [this message]
2026-02-11 19:23 ` [PATCH V1] " Mario Limonciello
2026-02-11 19:29   ` Lizhi Hou

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-20260210191626.311976-1-lizhi.hou@amd.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