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/i915/reset: Handle the display vs. GPU reset deadlock using a custom dma-fence
Date: Sun, 12 Apr 2026 12:04:48 +1000	[thread overview]
Message-ID: <review-patch5-20260408233458.22666-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260408233458.22666-6-ville.syrjala@linux.intel.com>

Patch Review

This is the core patch. Key design:

1. A `dma_fence` is lazily created on first request (`intel_display_reset_fence_get`) and stored in `display->reset.fence`, protected by `display->reset.mutex`.
2. `intel_atomic_commit_fence_wait()` gets the reset fence and waits on both the plane fence and the reset fence via `dma_fence_wait_any_timeout()`.
3. `intel_display_reset_prepare()` signals the reset fence before proceeding with the reset.
4. `intel_display_reset_finish()` discards the old (signaled) fence so the next caller gets a fresh one.

**Race concern — discard vs. in-flight waiters:** In `intel_display_reset_fence_discard()`, the fence is put (potentially freed) under the mutex. But a concurrent `intel_atomic_commit_fence_wait()` has already taken a reference via `dma_fence_get()`, so this is safe — the refcount protects against use-after-free. This is correct.

**Potential concern — signal ordering:** `intel_display_reset_prepare()` signals the fence first, then proceeds to take `mode_config.mutex` and modeset locks. The commit path, after waking from fence wait, proceeds into `intel_atomic_commit_tail()` which eventually calls `drm_atomic_helper_wait_for_dependencies()` etc. The reset path then acquires modeset locks. There could be a race where the commit proceeds and tries to do hardware access while the reset is in flight. However, this is the same as the original design intent — the fence wait unblocking lets the commit proceed to eventually release modeset locks that the reset needs. The commit path should not do harmful hardware access before the reset completes because the GPU is already hung.

**`dma_fence_init` with context=0, seqno=0:** Using `dma_fence_init(fence, &ops, NULL, 0, 0)` — context 0 with seqno 0 means all reset fences share the same context/seqno. This is fine for this use case since there's only ever one active reset fence at a time, and they are purely for signaling, not ordering. However, `dma_fence` debug infrastructure may complain about context 0 reuse. Consider using `dma_fence_context_alloc(1)` for a unique context.

**Missing `mutex_destroy` in cleanup:** `intel_display_reset_fence_init()` calls `mutex_init()` but there's no corresponding `mutex_destroy()` in the teardown path. `intel_display_driver_remove()` calls `intel_display_reset_fence_discard()` which discards the fence but doesn't destroy the mutex. Minor leak of debug resources on CONFIG_DEBUG_MUTEXES kernels.

**xe Makefile addition:** Adding `intel_display_reset.o` to the xe build is needed since `intel_display_reset_fence_get` is now called from shared display code. The compat stubs for `intel_clock_gating.h` from patch 4 make this build cleanly.

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 23:34 [PATCH 0/6] drm/i915/reset: Solve display vs. GPU reset deadlock, again Ville Syrjala
2026-04-08 23:34 ` [PATCH 1/6] dma-buf: Remove old lies about dma_fence_wait_any_timeout() not accepting some fences Ville Syrjala
2026-04-09  8:09   ` Jani Nikula
2026-04-09 10:39   ` Christian König
2026-04-12  2:04   ` Claude review: " Claude Code Review Bot
2026-04-08 23:34 ` [PATCH 2/6] drm/i915/reset: Reorganize display reset code Ville Syrjala
2026-04-09  8:13   ` Jani Nikula
2026-04-12  2:04   ` Claude review: " Claude Code Review Bot
2026-04-08 23:34 ` [PATCH 3/6] drm/i915/reset: Move pending_fb_pin handling to i915 Ville Syrjala
2026-04-09  8:17   ` Jani Nikula
2026-04-12  2:04   ` Claude review: " Claude Code Review Bot
2026-04-08 23:34 ` [PATCH 4/6] drm/xe/display: Add init_clock_gating.h stubs Ville Syrjala
2026-04-09  8:19   ` Jani Nikula
2026-04-12  2:04   ` Claude review: " Claude Code Review Bot
2026-04-08 23:34 ` [PATCH 5/6] drm/i915/reset: Handle the display vs. GPU reset deadlock using a custom dma-fence Ville Syrjala
2026-04-09 10:37   ` Jani Nikula
2026-04-09 10:46   ` Christian König
2026-04-09 11:19     ` Ville Syrjälä
2026-04-09 12:17       ` Christian König
2026-04-12  2:04   ` Claude Code Review Bot [this message]
2026-04-08 23:34 ` [PATCH 6/6] drm/i915/display: Make fence timeout infinite Ville Syrjala
2026-04-09 10:51   ` Jani Nikula
2026-04-12  2:04   ` Claude review: " Claude Code Review Bot
2026-04-12  2:04 ` Claude review: drm/i915/reset: Solve display vs. GPU reset deadlock, again 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-patch5-20260408233458.22666-6-ville.syrjala@linux.intel.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