From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794509173; b=holjaadYJ95+y+NwomNCq7co1xOGI1bJ+e5NkZ7HkB7uT6lly0+eTaMsz08oVl/KcfiA SwqYpD8tKF1KKj9Wd9XDkFxosu6iQIelnE6dlsSmPlJUnRV8dnz0kMwZQ0O6MRiktNfFC 6ybhrEPW5fARkXSa/3BGw3LtS6YjrsDR5th76AAnhPUp/xRBa2yXFbLPDoIsiQh1mYJQO oif1xQVCHbRyTsgQhUIKlGqJflYLK8UEeK8YDEcy5DXqqjx5qHysdd0FFWqRjH3SDpzAV VqppzCl4eRNyW8cgBCLFMxj5tAp2NI+hk7Naqzhix+/Uc+dR6zXSifUGRI9IDXdHyVQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794509173; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=dSW5Stw32iWcEj4GcRrtOc37CAGFHwzbxNsYprtjcwA=; b=KQ0r8KKtZa/krEp7sbL07R8YkBeFT9OopmnKBYDgri+OoqoU9cGF4qrE/EtiU7wvcu63 WBRinooU1VZ1j5N0xF+xWNb3O+VPKOEHCO6tI7d5sVZdL5Zx35SHe3L06euXdsT+BoycP f1MJBAtNMo0iWkI61kn0OfmT64mJryPGobnD9nwj2lIypBLQWS1tRy6tZYYjoAR70pq/6 zyPsyc1drRbDc2rOVTKH9dC8kNOlFKDpAl1eHjraJbIyYh0CS541rcngwYNkK1IYPvFbi PFBNH2XNncd/BUwMt4terDYhpiCZsGsln0rVlSs7Xaaq9ApVMjbmqE5ar6Y1Glg4SUg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b="TOpQ1/ss"; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8983606A31C; Thu, 12 Nov 2026 18:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A8983606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=TOpQ1/ss Received: by linux.microsoft.com (Postfix, from userid 1216) id 92B3F20B7166; Thu, 12 Nov 2026 10:46:08 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 92B3F20B7166 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1794509168; bh=dSW5Stw32iWcEj4GcRrtOc37CAGFHwzbxNsYprtjcwA=; h=From:To:Cc:Subject:Date:From; b=TOpQ1/ssBy7asZeNf9N2/X6/Gb5WYd9LK9Qz+7N9uu9A3A4jSbvUNYzxz0eysAvO8 ccoujDHCw9+QbHr6pxhFVTrMI5i/goBoNagh3LCoNu3Pi0RHrnfmSoJzOGC9Ov9LFj MG25fthjWn0sX993ifgkM6xI89AppnJVARkV4hwg= From: Hamza Mahfooz To: dri-devel@lists.freedesktop.org Cc: Dexuan Cui , Saurabh Sengar , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , linux-hyperv@vger.kernel.org, Hamza Mahfooz , stable@vger.kernel.org Subject: [PATCH] drm/hyperv: wait for flip_done instead of vblanks in commit tail Date: Thu, 12 Nov 2026 13:45:53 -0500 Message-ID: <20261112184553.1595055-1-hamzamahfooz@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: stable@vger.kernel.org Fixes: 52e6b1988334 ("drm/hypervdrm: Use vblank timer") Signed-off-by: Hamza Mahfooz --- 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); + drm_atomic_helper_cleanup_planes(dev, state); +} + +static const struct drm_mode_config_helper_funcs hv_drm_mode_config_helper_funcs = { + .atomic_commit_tail = hv_drm_atomic_commit_tail, +}; + int hv_drm_mode_config_init(struct hv_drm_device *hv) { struct drm_device *dev = &hv->dev; @@ -526,6 +549,7 @@ int hv_drm_mode_config_init(struct hv_drm_device *hv) dev->mode_config.prefer_shadow = 0; dev->mode_config.funcs = &hv_drm_mode_config_funcs; + dev->mode_config.helper_private = &hv_drm_mode_config_helper_funcs; ret = hv_drm_pipe_init(hv); if (ret) { -- 2.56.0