From: Mingyu Wang <25181214217@stu.xidian.edu.cn>
This series backports the generic vblank timer infrastructure and
converts the vkms driver to use it, fixing an ABBA deadlock.
Bug Context:
During local fuzzing with Syzkaller, an RCU preempt stall (soft lockup)
was consistently observed in the vkms driver. The issue stems from the
open-coded hrtimer in vkms attempting to acquire the vblank_time_lock
(spinlock) from the timer's hardirq context, while the disable path
holds the same lock and calls hrtimer_cancel(), resulting in a classic
ABBA deadlock.
This 5-patch series is the complete upstream fix recommended by the DRM
maintainers. It introduces the safe generic vblank timer to the DRM core
and transitions vkms to it, cleanly resolving the lockup.
Additionally, a lock dependency audit was conducted on other DRM drivers
(i915/gvt, xe, msm) that utilize hrtimer_cancel. They were found to be
structurally safe from this specific deadlock pattern, confirming this
is a vkms-specific legacy issue.
Changes in v2:
- Added the missing Signed-off-by trailers from Mingyu Wang to properly
establish the chain of custody, as requested by Sasha Levin.
- Included the bug report context in the cover letter as suggested by
Maarten Lankhorst.
- The 5 patches remain identical to v1.
Thomas Zimmermann (5):
drm/vblank: Add vblank timer
drm/vblank: Add CRTC helpers for simple use cases
drm/vkms: Convert to DRM's vblank timer
drm/atomic: Increase timeout in drm_atomic_helper_wait_for_vblanks()
drm/vblank: Fix kernel docs for vblank timer
Documentation/gpu/drm-kms-helpers.rst | 12 ++
drivers/gpu/drm/Makefile | 3 +-
drivers/gpu/drm/drm_atomic_helper.c | 2 +-
drivers/gpu/drm/drm_vblank.c | 172 +++++++++++++++++++++-
drivers/gpu/drm/drm_vblank_helper.c | 176 +++++++++++++++++++++++
drivers/gpu/drm/vkms/vkms_crtc.c | 83 +----------
drivers/gpu/drm/vkms/vkms_drv.h | 2 -
include/drm/drm_modeset_helper_vtables.h | 12 ++
include/drm/drm_vblank.h | 32 +++++
include/drm/drm_vblank_helper.h | 56 ++++++++
10 files changed, 468 insertions(+), 82 deletions(-)
create mode 100644 drivers/gpu/drm/drm_vblank_helper.c
create mode 100644 include/drm/drm_vblank_helper.h
--
2.34.1