AMD General
This patch series addresses the vblank timeout issue when vblank is off, as
well as cases interrupted by userspace signals. If there are no further
comments, could someone please help pick these up for drm-misc-next? Thanks!
Regards,
Prike
> -----Original Message-----
> From: Liang, Prike <[email protected]>
> Sent: Thursday, November 26, 2026 4:55 PM
> To: [email protected]; [email protected]
> Cc: [email protected]; Liang, Prike <[email protected]>; Ville Syrjälä
> <[email protected]>
> Subject: [PATCH 3/3] drm/client: Make the FBIO_WAITFORVSYNC vblank wait
> interruptible
>
> FBIO_WAITFORVSYNC calls drm_client_modeset_wait_for_vblank(), which waits
> with drm_crtc_wait_one_vblank(). That wait is uninterruptible and only gives
> up after
> one second. If no vblank interrupt arrives, for example while the driver
> resets the
> display hardware, the caller sleeps in D state for the whole second and can't
> be
> interrupted, not even by SIGKILL.
>
> DRM_IOCTL_WAIT_VBLANK waits interruptibly, and so do fbdev drivers that
> implement FBIO_WAITFORVSYNC themselves, such as atyfb and matroxfb.
>
> Use drm_crtc_wait_one_vblank_interruptible() in
> drm_client_modeset_wait_for_vblank(). Return -ERESTARTSYS when a signal
> interrupts the wait, so that the ioctl returns to userspace or is restarted.
> Timeouts and
> disabled CRTCs are still not reported.
>
> The fbdev damage worker also calls drm_client_modeset_wait_for_vblank(),
> but it runs in a kernel thread, which doesn't receive signals, so its wait
> doesn't
> change.
>
> Link: https://lore.kernel.org/r/[email protected]
> Cc: Thomas Zimmermann <[email protected]>
> Cc: Ville Syrjälä <[email protected]>
> Assisted-by: Copilot:claude-opus-5.5
> Signed-off-by: Prike Liang <[email protected]>
> Reviewed-by: Ville Syrjälä <[email protected]>
> ---
> drivers/gpu/drm/drm_client_modeset.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> b/drivers/gpu/drm/drm_client_modeset.c
> index 67f90e5d1512..122ca1bf98e6 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -1301,10 +1301,11 @@ EXPORT_SYMBOL(drm_client_modeset_dpms);
> *
> * Block the caller until the given CRTC has seen a VBLANK. Do nothing
> * if the CRTC is disabled. If there's another DRM master present, fail
> - * with -EBUSY.
> + * with -EBUSY. A signal interrupts the wait.
> *
> * Returns:
> - * 0 on success, or negative error code otherwise.
> + * 0 on success, -ERESTARTSYS if a signal interrupted the wait, or
> + * negative error code otherwise.
> */
> int drm_client_modeset_wait_for_vblank(struct drm_client_dev *client,
> unsigned int
> crtc_index) { @@ -1328,13 +1329,14 @@ int
> drm_client_modeset_wait_for_vblank(struct drm_client_dev *client, unsigned i
> */
> ret = drm_crtc_vblank_get(crtc);
> if (!ret) {
> - drm_crtc_wait_one_vblank(crtc);
> + ret = drm_crtc_wait_one_vblank_interruptible(crtc);
> drm_crtc_vblank_put(crtc);
> }
>
> drm_master_internal_release(dev);
>
> - return 0;
> + /* Only report interruption by a signal, not timeouts. */
> + return ret == -ERESTARTSYS ? ret : 0;
> }
> EXPORT_SYMBOL(drm_client_modeset_wait_for_vblank);
>
> --
> 2.34.1