On Thu, Nov 12, 2026 at 01:45:53PM -0500, Hamza Mahfooz wrote:
> Since commit 52e6b1988334 ("drm/hypervdrm: Use vblank timer"), the
> driver's vblanks are generated by an hrtimer, and the default commit
> tail waits in drm_atomic_helper_wait_for_vblanks() for that timer to
> fire. In a VM, a timer can fire arbitrarily late, for instance when the
> host does not run the vCPU that the timer is queued on while the
> committing task keeps running on another vCPU. If the delay exceeds the
> helper's timeout, it warns, even though the display works fine:
> 
>   [CRTC:35:crtc-0] vblank wait timed out
>   WARNING: drivers/gpu/drm/drm_atomic_helper.c:1921 at 
> drm_atomic_helper_wait_for_vblanks.part.0+0x212/0x230, CPU#30: setfont/559
>   Call Trace:
>    drm_atomic_helper_commit_tail
>    commit_tail
>    drm_atomic_helper_commit
>    drm_atomic_commit
>    drm_client_modeset_commit_atomic
>    drm_client_modeset_commit_locked
>    drm_fb_helper_pan_display
>    fb_pan_display
>    bit_update_start
>    fbcon_switch
>    redraw_screen
>    fbcon_do_set_font
>    fbcon_set_font
>    con_font_op
>    vt_ioctl
> 
> This was seen intermittently on Azure VMs during boot, when setfont
> redraws the console right after hyperv_drm has taken it over.
> 
> Cc: [email protected]
> Fixes: 52e6b1988334 ("drm/hypervdrm: Use vblank timer")
> Signed-off-by: Hamza Mahfooz <[email protected]>
> ---
> This is inspired by VKMS (which also uses DRM's vblank timer), wait for
> the commit's flip_done instead. It completes once the vblank event that
> drm_crtc_vblank_atomic_flush() armed has been sent on the next timer
> tick.
> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 24 +++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c 
> b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
> index cc5c5fbc8..8e5036051 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
> @@ -504,6 +504,29 @@ static const struct drm_mode_config_funcs 
> hv_drm_mode_config_funcs = {
>       .atomic_commit = drm_atomic_helper_commit,
>  };
>  
> +/*
> + * Like drm_atomic_helper_commit_tail(), but wait for the commit's vblank
> + * events rather than for the vblank counter to advance. The host can delay
> + * the vblank timer for longer than drm_atomic_helper_wait_for_vblanks()
> + * waits before warning.
> + */
> +static void hv_drm_atomic_commit_tail(struct drm_atomic_commit *state)
> +{
> +     struct drm_device *dev = state->dev;
> +
> +     drm_atomic_helper_commit_modeset_disables(dev, state);
> +     drm_atomic_helper_commit_planes(dev, state, 0);
> +     drm_atomic_helper_commit_modeset_enables(dev, state);
> +     drm_atomic_helper_fake_vblank(state);
> +     drm_atomic_helper_commit_hw_done(state);
> +     drm_atomic_helper_wait_for_flip_done(dev, state);

Thanks for the patch. Below are my thoughts:

Since flip_done is normally signalled through the same vblank timer,
this change does not remove the dependency on that timer. However,
drm_atomic_helper_wait_for_vblanks() has a 1-second timeout, whereas
drm_atomic_helper_wait_for_flip_done() waits up to 10 seconds.
Could you clarify whether the change resolves the reported case because
of the longer timeout, or because it avoids waiting for another vblank
after the commit's event has already completed ?

This seems relevant to other timer-backed virtual DRM drivers as well.
The older wait_for_vblanks helper also predates flip_done tracking and
has previously been described as an interim solution [1].

We already have a vblank timeout increase [2], and Thomas's timer
reliability series [3] also discusses delayed vblank handling triggering
DRM checks, although it is not clear whether those changes address this
particular case.

Using flip_done is consistent with VKMS and seems reasonable. However,
rather than duplicating the default commit tail in each affected driver,
could we consider a common DRM solution for all ?

It would help to identify the precise condition causing the hyperv_drm
warning and explain why the existing generic timeout increase is
insufficient. If this is needed as a targeted stable fix, please document
this in the commit message and as a comment in code.

[1] https://patchwork.freedesktop.org/patch/318967/
[2] https://git.kernel.org/linus/79ae8510b5b81b9500370f89c619b50ca9c0990f
[3] 
https://lore.kernel.org/dri-devel/[email protected]/

- Saurabh

Attachment: signature.asc
Description: PGP signature

Reply via email to