From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amd/display: Implement deferred vblanks on IPS platforms
Date: Wed, 25 Mar 2026 07:22:02 +1000 [thread overview]
Message-ID: <review-patch4-20260323202755.315929-5-sunpeng.li@amd.com> (raw)
In-Reply-To: <20260323202755.315929-5-sunpeng.li@amd.com>
Patch Review
**1. `active_vblank_irq_count` is not protected**
```c
dm->active_vblank_irq_count++;
```
This counter is incremented/decremented in the deferred callbacks, which run in workqueue context. Without any lock protecting it, concurrent enable/disable on different CRTCs could race. The deferred workqueue isn't ordered (see patch 2 review), so these can run in parallel.
**2. `dc_lock` held across pre→enable→post boundary is asymmetric**
`pre_enable_vblank` acquires `dc_lock`, and `post_enable_vblank` releases it. This means the DRM vblank core's `drm_vblank_enable()` (called between pre and post) runs with `dc_lock` held. This works for the IPS use case, but it means the `enable_vblank` driver callback also runs with `dc_lock` held — which is the intent, but it couples the DRM core's locking guarantees to driver-internal lock ordering. If any code path under `drm_vblank_enable()` ever tries to acquire a lock that `dc_lock` nests inside, it would deadlock.
**3. Accessing `crtc->state` without proper locking**
```c
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
```
In `post_enable_vblank` and `post_disable_vblank`, `crtc->state` is accessed from workqueue context. The `crtc->state` pointer can change during atomic commits. This needs either atomic state locking or the driver needs to ensure the state won't change while the worker runs (e.g., by holding a reference or ensuring commit serialization). This is a pre-existing pattern in the AMDGPU driver's vblank control worker, but deferring it to the DRM core's workqueue may change timing assumptions.
**4. `vblank_control_work` on the stack**
```c
struct vblank_control_work vblank_work = { 0 };
```
Using a stack-allocated `vblank_control_work` and calling `amdgpu_dm_crtc_set_panel_sr_feature()` with it seems fine as long as that function doesn't store a pointer to it. Worth verifying.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-24 21:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 20:27 [PATCH v2 0/5] drm/vblank: Deferred Enable and Disable sunpeng.li
2026-03-23 20:27 ` [PATCH v2 1/5] drm/vblank: Add drm_crtc_vblank_is_off() helper sunpeng.li
2026-03-24 20:20 ` Mario Limonciello
2026-03-24 21:22 ` Claude review: " Claude Code Review Bot
2026-03-23 20:27 ` [PATCH v2 2/5] drm/vblank: Introduce deferred vblank enable/disable sunpeng.li
2026-03-24 21:22 ` Claude review: " Claude Code Review Bot
2026-03-23 20:27 ` [PATCH v2 3/5] drm/amd/display: Refactor amdgpu_dm_crtc_set_vblank sunpeng.li
2026-03-24 21:22 ` Claude review: " Claude Code Review Bot
2026-03-23 20:27 ` [PATCH v2 4/5] drm/amd/display: Implement deferred vblanks on IPS platforms sunpeng.li
2026-03-24 21:22 ` Claude Code Review Bot [this message]
2026-03-23 20:27 ` [PATCH v2 5/5] drm/vblank: Add some debugging trace events sunpeng.li
2026-03-24 21:22 ` Claude review: " Claude Code Review Bot
2026-03-24 21:22 ` Claude review: drm/vblank: Deferred Enable and Disable Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-02-24 21:26 [PATCH 0/5] " sunpeng.li
2026-02-24 21:26 ` [PATCH 4/5] drm/amd/display: Implement deferred vblanks on IPS platforms sunpeng.li
2026-02-27 4:40 ` Claude review: " 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-patch4-20260323202755.315929-5-sunpeng.li@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