summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-11-10 09:45:20 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2026-11-17 15:40:36 +0100
commite109454dce1db5a5659509407305c849bc959af5 (patch)
treef221db92633580a95b6ca84baf111c18e801facd /rust/kernel/alloc
parentf02d1f70d361c42d09569e51612d6be5ffceb7d6 (diff)
drm/vblank: Cancel vblank timer outside of critical section
Cancel the vblank timer's hrtimer after disabling the vblank timer to avoid running timer function with outdated interval. Stopping and restarting the vblank timer with a different interval can leave behind an already-running timer function that uses the previous interval. This can result in a vblank event with inconsistent timing. At the same time, canceling the hrtimer in drm_crtc_vblank_cancel_timer() with hrtimer_cancel() is not possible due to a deadlock between vblank_time_lock and the hrtimer. Resolve this problem by calling hrtimer_cancel() outside of vblank_time_lock's critical section. Implement this with the new callback sync_vblank in struct drm_crtc_funcs. Invoke this callback after switching off the vblank. Some internal bookkeeping is necessary to ensure that the timer is really switched off. Implement sync_vblank for vblank timers with the new helper drm_crtc_vblank_helper_sync_vblank_timer(). From there, the vblank function drm_crtc_blank_stop_timer() stops the hrtimer unconditionally. Install drm_crtc_vblank_helper_sync_vblank_timer() in most drivers via DRM_CRTC_VBLANK_TIMER_FUNCS. Update vmwgfx, which does not use this macro. Implement the locking in drm_crtc_vblank_cancel_timer() with a guard. Also remove the call to hrtimer_try_to_cancel() from that function. It is no longer needed with sync_vblank invoking hrtimer_cancel(). v2: - handle uninitialized timer in drm_crtc_vblank_cancel_timer() Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Zack Rusin <zack.rusin@broadcom.com> Link: https://patch.msgid.link/20261110084710.503870-3-tzimmermann@suse.de
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions