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: Fri, 27 Feb 2026 14:40:53 +1000 [thread overview]
Message-ID: <review-patch4-20260224212639.390768-5-sunpeng.li@amd.com> (raw)
In-Reply-To: <20260224212639.390768-5-sunpeng.li@amd.com>
Patch Review
This is the driver-side implementation. The pre/post callbacks acquire/release `dc_lock` to bracket HW access. The design is sound in principle.
**Issue 1: `crtc->state` access from worker context**
In `amdgpu_dm_crtc_post_enable_vblank()` and `amdgpu_dm_crtc_post_disable_vblank()`:
```c
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
```
These run from the deferred workqueue, meaning there's a window between when the work was queued (from `drm_vblank_get()`) and when it executes. During that window, an atomic commit could swap `crtc->state`. Accessing `crtc->state` without holding `drm_modeset_lock` from a worker is unsafe. The stream pointer could become stale or freed.
Consider either:
- Capturing the stream reference at queue time and passing it through to the worker, or
- Ensuring `dc_lock` serialization is sufficient to prevent state changes (it might be, since commits also take `dc_lock`, but this is fragile and should be documented)
**Issue 2: dc_lock held across drm_vblank_enable/disable internals**
`pre_enable_vblank` takes `dc_lock` and `post_enable_vblank` releases it. This means `dc_lock` is held while the DRM core calls `__enable_vblank` → `enable_vblank` callback → `amdgpu_dm_crtc_deferred_enable_vblank()`. That callback also does `amdgpu_dm_crtc_set_vblank()` which itself touches DC state. Since `dc_lock` is already held, this requires that all the code in the `set_vblank` path is safe for recursive `dc_lock` holding (mutex is not recursive by default). Verify that `dc_lock` isn't taken again inside `set_vblank` → interrupt enable path, or this will deadlock.
**Issue 3: Missing `crtc->enabled` check in deferred enable**
As noted in patch 3 review, `amdgpu_dm_crtc_deferred_enable_vblank()` doesn't check `crtc->enabled` before calling `set_vblank`. The `post_enable_vblank` callback does check `crtc->enabled` and bails early, but `active_vblank_irq_count` has already been incremented by that point.
**Issue 4: Duplicate vtable**
`amdgpu_dm_crtc_deferred_vblank_funcs` duplicates the entire `amdgpu_dm_crtc_funcs` structure with only 6 fields differing (enable/disable_vblank + 4 pre/post callbacks). If future changes are made to `amdgpu_dm_crtc_funcs`, the deferred variant must be kept in sync manually. Consider documenting this coupling prominently, or using a helper to populate shared fields.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-02-27 4:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 21:26 [PATCH 0/5] drm/vblank: Deferred Enable and Disable sunpeng.li
2026-02-24 21:26 ` [PATCH 1/5] drm/vblank: Add drm_crtc_vblank_is_off() helper sunpeng.li
2026-02-27 4:40 ` Claude review: " Claude Code Review Bot
2026-02-24 21:26 ` [PATCH 2/5] drm/vblank: Introduce deferred vblank enable/disable sunpeng.li
2026-02-25 4:42 ` kernel test robot
2026-02-27 4:40 ` Claude review: " Claude Code Review Bot
2026-02-24 21:26 ` [PATCH 3/5] drm/amd/display: Refactor amdgpu_dm_crtc_set_vblank sunpeng.li
2026-02-27 4:40 ` Claude review: " Claude Code Review Bot
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 Code Review Bot [this message]
2026-02-24 21:26 ` [PATCH 5/5] drm/vblank: Add some debugging trace events sunpeng.li
2026-02-27 4:40 ` Claude review: " Claude Code Review Bot
2026-02-27 4:40 ` Claude review: drm/vblank: Deferred Enable and Disable Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-23 20:27 [PATCH v2 0/5] " sunpeng.li
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 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-20260224212639.390768-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