All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Prike Liang <Prike.Liang@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Alexander.Deucher@amd.com, Christian.Koenig@amd.com,
	Harry.Wentland@amd.com, Sunpeng.Li@amd.com, tzimmermann@suse.de
Subject: Re: [PATCH v2 3/5] drm/client: Make the FBIO_WAITFORVSYNC vblank wait interruptible
Date: Thu, 19 Nov 2026 16:40:05 +0200	[thread overview]
Message-ID: <av8KRUbu966lGfi_@intel.com> (raw)
In-Reply-To: <20261119082424.554841-3-Prike.Liang@amd.com>

On Thu, Nov 19, 2026 at 04:24:22PM +0800, Prike Liang wrote:
> 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.

So we have precedent. Good.

> 
> 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.

The damage workers recent unilateral use of vblank waits is bugging me.
Enabling vblanks has hardware side effects on i915/xe that we probably
don't want there. Need to take a look at demidlayering that at some
point...

> 
> Version update:
> 1) https://lists.freedesktop.org/archives/dri-devel/2026-November/616727.html
> 
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Assisted-by: Copilot:claude-opus-5.5
> Signed-off-by: Prike Liang <Prike.Liang@amd.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  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 0080a8e9556a..b475b8dbdb17 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

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-11-19 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  8:24 [PATCH v2 1/5] drm/vblank: Stop drm_crtc_wait_one_vblank() when vblank is turned off Prike Liang
2026-11-19  8:24 ` [PATCH v2 2/5] drm/vblank: Add drm_crtc_wait_one_vblank_interruptible() Prike Liang
2026-11-19 14:33   ` Ville Syrjälä
2026-11-19  8:24 ` [PATCH v2 3/5] drm/client: Make the FBIO_WAITFORVSYNC vblank wait interruptible Prike Liang
2026-11-19 14:40   ` Ville Syrjälä [this message]
2026-11-19  8:24 ` [PATCH v2 4/5] drm/amd/display: send the flip event right away if vblank is off Prike Liang
2026-11-19  8:24 ` [PATCH v2 5/5] drm/amd/display: turn vblank off in DRM across GPU reset Prike Liang
2026-11-19  8:56   ` sashiko-bot
2026-11-19 14:31 ` [PATCH v2 1/5] drm/vblank: Stop drm_crtc_wait_one_vblank() when vblank is turned off Ville Syrjälä
2026-11-20  2:23   ` Liang, Prike

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=av8KRUbu966lGfi_@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Prike.Liang@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.