From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/vblank: timer: Avoid reading the vblank time unnecessarily
Date: Thu, 04 Jun 2026 14:04:00 +1000 [thread overview]
Message-ID: <review-patch7-20260601141922.91498-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20260601141922.91498-8-tzimmermann@suse.de>
Patch Review
**Optimization and robustness improvement.** The change from double `drm_crtc_vblank_count_and_time()` to initial `drm_crtc_vblank_count()` + single `drm_crtc_vblank_count_and_time()` per iteration avoids one seqlock read per iteration.
**The retry limit of 10 with `drm_WARN_ON` is reasonable** as a backstop. If the vblank counter changes 10+ times during this read loop, something is fundamentally broken.
**Subtle loop behavior:** The condition `cur_count != lst_count && retries--` means the `retries--` side effect only happens when the count actually changed. If the count is stable on the first try, `retries` is never decremented and `cur_time` is set correctly. This is correct.
**Minor:** `cur_count` is read initially with `drm_crtc_vblank_count()` (which goes through `drm_vblank_count` → atomic64_read), while subsequent reads use `drm_crtc_vblank_count_and_time()` (which goes through the seqlock). The `drm_crtc_vblank_count` path doesn't have the seqlock barrier that `drm_crtc_vblank_count_and_time` has. This means the initial `cur_count` could theoretically be stale relative to the following `*vblank_time = READ_ONCE(vtimer->timer.node.expires)` read. However, since we're comparing with the post-read count, this is caught by the loop — the loop simply runs one extra iteration in that case. No correctness issue, just a theoretical efficiency consideration.
No functional issues in this patch.
---
**Summary of key issues requiring attention:**
1. **Clock domain mismatch (Patches 3, 5):** Replace `ktime_get_ns()` with `ktime_get_boottime_ns()` in `drm_crtc_vblank_start_timer()` and the disabled-timer estimation path, or keep `CLOCK_MONOTONIC` throughout. The comparison between timer expiry and vblank core timestamps also needs reconciliation.
2. **Missing vmwgfx update (Patch 1):** `vmw_vkms_get_vblank_timestamp()` must propagate the new return value.
3. **Division by zero risk (Patch 3):** Guard `roundup(..., vblank->framedur_ns)` against zero denominator.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 4:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 14:08 [PATCH 0/7] drm/vblank: timer: Fix timestamps and improve reliabilty Thomas Zimmermann
2026-06-01 14:08 ` [PATCH 1/7] drm/vblank: timer: Return success status from get_vblank_timeout Thomas Zimmermann
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 2/7] drm/vblank: timer: Fix timestamp calculation Thomas Zimmermann
2026-06-01 16:24 ` Michel Dänzer
2026-06-01 17:30 ` Thomas Zimmermann
2026-06-02 14:14 ` Michel Dänzer
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 3/7] drm/vblank: timer: Use absolute timer since boot Thomas Zimmermann
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 4/7] drm/vblank: timer: Reorganize get_vblank_timeout Thomas Zimmermann
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 5/7] drm/vblank: timer: Estimate vblank timeout if timer is disabled Thomas Zimmermann
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 6/7] drm/vblank: timer: Verify that expiry time is in the future Thomas Zimmermann
2026-06-04 4:03 ` Claude review: " Claude Code Review Bot
2026-06-01 14:08 ` [PATCH 7/7] drm/vblank: timer: Avoid reading the vblank time unnecessarily Thomas Zimmermann
2026-06-04 4:04 ` Claude Code Review Bot [this message]
2026-06-04 4:03 ` Claude review: drm/vblank: timer: Fix timestamps and improve reliabilty 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-patch7-20260601141922.91498-8-tzimmermann@suse.de \
--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