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/vmwgfx: Break ABBA deadlock in vblank disable path
Date: Mon, 25 May 2026 18:39:18 +1000	[thread overview]
Message-ID: <review-patch1-20260522123526.567109-1-w15303746062@163.com> (raw)
In-Reply-To: <20260522123526.567109-1-w15303746062@163.com>

Patch Review

**Status: Superseded by upstream refactoring**

**The bug analysis is correct.** The commit message accurately describes the ABBA deadlock: `drm_crtc_vblank_off()` holds `dev->vbl_lock` and calls `disable_vblank()`, which called blocking `hrtimer_cancel()`, while the timer callback calls `drm_crtc_handle_vblank()` which tries to acquire `dev->vbl_lock`. This is a legitimate deadlock scenario.

**The fix approach has a correctness gap.** In `vmw_vkms_disable_vblank()`:

```c
-	hrtimer_cancel(&du->vkms.timer);
+	hrtimer_try_to_cancel(&du->vkms.timer);
 	du->vkms.surface = NULL;
```

`hrtimer_try_to_cancel()` returns `-1` if the timer callback is currently executing, meaning the cancel did not happen. The patch then sets `du->vkms.surface = NULL` regardless, so a still-running timer callback could race against the surface being cleared. The follow-up `hrtimer_cancel()` in `vmw_vkms_crtc_atomic_disable()` would eventually synchronize, but between the `try_to_cancel` and the later `hrtimer_cancel`, the timer callback may fire again and access the now-NULL surface pointer.

**The upstream fix is superior.** In drm-next, the entire vblank timer has been moved into the DRM core (`struct drm_vblank_crtc_timer`). The `vmw_vkms_disable_vblank()` now calls `drm_crtc_vblank_cancel_timer(crtc)` which internally uses `hrtimer_try_to_cancel()` with proper interval-zeroing under a spinlock, and the old `du->vkms.timer` field no longer exists. The `vmw_vkms_crtc_atomic_disable()` function no longer needs a separate `hrtimer_cancel()` call.

**Minor style issues (moot given NAK):**
- The `period_ns` line (`du->vkms.period_ns = ktime_set(0, 0)`) was removed in the diff context but this field no longer exists upstream either.
- The added comments, while accurate, are somewhat verbose for kernel style.

**Recommendation:** This patch should be rejected. The underlying bug was real but has been fixed by the vblank timer infrastructure refactoring already in drm-next. If the submitter is targeting a stable kernel that predates that refactoring, they should note the target branch and add a `Fixes:` tag identifying the commit that introduced the original `hrtimer_cancel()` call, along with a `Cc: stable@vger.kernel.org` tag.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-25  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 12:35 [PATCH] drm/vmwgfx: Break ABBA deadlock in vblank disable path w15303746062
2026-05-25  8:39 ` Claude review: " Claude Code Review Bot
2026-05-25  8:39 ` 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-20260522123526.567109-1-w15303746062@163.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