From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/vblank: timer: Use absolute timer since boot Date: Thu, 04 Jun 2026 14:03:59 +1000 Message-ID: In-Reply-To: <20260601141922.91498-4-tzimmermann@suse.de> References: <20260601141922.91498-1-tzimmermann@suse.de> <20260601141922.91498-4-tzimmermann@suse.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Critical issue: Clock domain mismatch.** The timer is changed from `CLOCK_MONOTONIC` to `CLOCK_BOOTTIME`, but the initial start time uses `ktime_get_ns()`, which returns `CLOCK_MONOTONIC` time: ```c hrtimer_setup(&vtimer->timer, drm_vblank_timer_function, CLOCK_BOOTTIME, HRTIMER_MODE_ABS); ... vblank_time_ns = roundup(ktime_get_ns(), vblank->framedur_ns); hrtimer_start(&vtimer->timer, ns_to_ktime(vblank_time_ns), HRTIMER_MODE_ABS); ``` This should be `ktime_get_boottime_ns()`. After any system suspend, `CLOCK_BOOTTIME > CLOCK_MONOTONIC`, so a monotonic timestamp used as a boottime absolute value would be in the past, causing the timer to fire immediately and then forward rapidly. This mismatch also breaks the comparison in the existing `drm_crtc_vblank_get_vblank_timeout()`: `vtimer->timer.node.expires` is now in the boottime domain, while `cur_time` from `drm_crtc_vblank_count_and_time()` is in the monotonic domain (vblank timestamps are stored via `ktime_get()` in the vblank core). The `!ktime_compare(*vblank_time, cur_time)` check compares values from different clock domains. **Division by zero risk:** If `vblank->framedur_ns` is 0 (e.g., dotclock is 0), `roundup(ktime_get_ns(), 0)` will trigger a division by zero. The `drm_calc_timestamping_constants` called just before can leave `framedur_ns` at 0 if `dotclock <= 0`. A guard is needed. **The underrun detection** (`!ret_overrun` case) is a nice addition for debugging. --- --- Generated by Claude Code Patch Reviewer