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: drm/imagination: Fix deadlock in soft reset sequence
Date: Tue, 10 Mar 2026 12:12:14 +1000	[thread overview]
Message-ID: <review-patch1-20260309-fix-soft-reset-v1-1-121113be554f@imgtec.com> (raw)
In-Reply-To: <20260309-fix-soft-reset-v1-1-121113be554f@imgtec.com>

Patch Review

**Correctness: Good.**

The call chain is confirmed:
1. `pvr_device_irq_thread_handler()` (`pvr_device.c:203`) — threaded IRQ handler
2. → `pvr_fwccb_process()` (`pvr_device.c:217`)
3. → `process_fwccb_command()` (`pvr_ccb.c:196`)
4. → `pvr_power_reset(pvr_dev, false)` (`pvr_ccb.c:149`)

Inside `pvr_power_reset`, the original code unconditionally called `disable_irq()`, which invokes `synchronize_irq()` internally, deadlocking because the threaded handler is waiting for itself to complete.

The fix:
```c
if (hard_reset) {
    disable_irq(pvr_dev->irq);
} else {
    /*
     * Soft reset is triggered as a response to a FW command to the Host and is
     * processed from the threaded IRQ handler. This code cannot (nor needs to)
     * wait for any IRQ processing to complete.
     */
    disable_irq_nosync(pvr_dev->irq);
}
```

This is correct. `disable_irq_nosync()` still increments the IRQ disable depth counter, preventing new IRQs from being delivered, but doesn't call `synchronize_irq()`. Since we're already running *as* the threaded handler, there's no concurrent IRQ processing to wait for.

**Soft-to-hard escalation path: Correct.** When a soft reset fails (`pvr_power.c:559-562`), the code sets `hard_reset = true` and loops. The IRQ is already disabled (via `_nosync`), and the loop proceeds to do the hard reset with IRQs still disabled. At completion, `enable_irq()` at line 568 re-enables correctly regardless of which `disable_irq` variant was used, since both increment the same disable depth counter.

**Comment quality: Good.** The comment clearly explains why `disable_irq_nosync()` is used and why it's safe.

**Minor observation (non-blocking):** The hard reset callers (`pvr_power.c:209` in the watchdog, `pvr_mmu.c:169`) appear to run from non-IRQ context, so `disable_irq()` remains correct for that path.

No issues found. The patch is clean, minimal, and correct.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-03-10  2:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 15:23 [PATCH] drm/imagination: Fix deadlock in soft reset sequence Alessio Belle
2026-03-10  2:12 ` Claude review: " Claude Code Review Bot
2026-03-10  2:12 ` Claude Code Review Bot [this message]

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-patch1-20260309-fix-soft-reset-v1-1-121113be554f@imgtec.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