From: Michael Kelley Sent: Thursday, September 4, 2025 10:36 PM > > From: Thomas Zimmermann <tzimmerm...@suse.de> Sent: Thursday, September 4, > 2025 7:56 AM > > > > Compositors often depend on vblanks to limit their display-update > > rate. Without, they see vblank events ASAP, which breaks the rate- > > limit feature. This creates high CPU overhead. It is especially a > > problem with virtual devices with fast framebuffer access. > > > > The series moves vkms' vblank timer to DRM and converts the hyperv > > DRM driver. An earlier version of this series contains examples of > > other updated drivers. In principle, any DRM driver without vblank > > hardware can use the timer. > > I've tested this patch set in a Hyper-V guest against the linux-next20250829 > kernel. All looks good. Results and perf are the same as reported here [4]. > So far I haven't seen the "vblank timer overrun" error, which is consistent > with the changes you made since my earlier testing. I'll keep running this > test kernel for a while to see if anything anomalous occurs.
As I continued to run with this patch set, I got a single occurrence of this WARN_ON. I can't associate it with any particular action as I didn't notice it until well after it occurred. [213730.719364] ------------[ cut here ]------------ [213730.719423] hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] drm_WARN_ON(!ktime_compare(*vblank_time, vblank->time)) [213730.719522] WARNING: drivers/gpu/drm/drm_vblank.c:2309 at drm_crtc_vblank_get_vblank_timeout+0x90/0xb0 [drm], CPU#4: kworker/4:0/7172 [213730.719871] Modules linked in: nls_iso8859_1(E) dm_multipath(E) scsi_dh_rdac(E) scsi_dh_emc(E) scsi_dh_alua(E) binfmt_misc(E) intel_rapl_msr(E) intel_rapl_common(E) rapl(E) hyperv_fb(E) cfbfillrect(E) cfbimgblt(E) fb_io_fops(E) serio_raw(E) cfbcopyarea(E) hv_balloon(E) joydev(E) mac_hid(E) sch_fq_codel(E) msr(E) ramoops(E) reed_solomon(E) efi_pstore(E) autofs4(E) btrfs(E) blake2b_generic(E) raid10(E) raid456(E) async_raid6_recov(E) async_memcpy(E) async_pq(E) async_xor(E) async_tx(E) xor(E) raid6_pq(E) raid1(E) raid0(E) hyperv_drm(E) drm_client_lib(E) drm_shmem_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) drm_kms_helper(E) drm(E) drm_panel_orientation_quirks(E) fb(E) hid_generic(E) hid_hyperv(E) lcd(E) hid(E) hv_storvsc(E) ledtrig_backlight(E) hyperv_keyboard(E) hv_netvsc(E) hv_utils(E) scsi_transport_fc(E) ghash_clmulni_intel(E) hv_vmbus(E) aesni_intel(E) [213730.720514] CPU: 4 UID: 0 PID: 7172 Comm: kworker/4:0 Kdump: loaded Tainted: G E 6.17.0-rc3-next-20250829+ #3 PREEMPT(voluntary) [213730.723220] Tainted: [E]=UNSIGNED_MODULE [213730.724452] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 11/21/2024 [213730.724993] Workqueue: events drm_fb_helper_damage_work [drm_kms_helper] [213730.725491] RIP: 0010:drm_crtc_vblank_get_vblank_timeout+0x90/0xb0 [drm] [213730.726082] Code: 8b 7f 08 4c 8b 67 50 4d 85 e4 74 33 e8 99 b6 7f c7 48 c7 c1 60 e8 93 c0 4c 89 e2 48 c7 c7 b5 25 94 c0 48 89 c6 e8 00 06 e3 c6 <0f> 0b eb c0 e8 07 f6 f1 c6 48 89 03 5b 41 5c 5d c3 cc cc cc cc 4c [213730.726506] RSP: 0018:ffffbba54e0efc00 EFLAGS: 00010282 [213730.726692] RAX: 0000000000000000 RBX: ffffbba54e0efc78 RCX: 0000000000000027 [213730.726899] RDX: ffff954f07d1cec8 RSI: 0000000000000001 RDI: ffff954f07d1cec0 [213730.727094] RBP: ffffbba54e0efc10 R08: 0000000000000000 R09: ffffbba54e0efa70 [213730.727280] R10: ffffbba54e0efa68 R11: ffffffff88d4c748 R12: ffff954e010a4cc0 [213730.727456] R13: 0000000000000000 R14: ffff954e20070d80 R15: ffff954e251002c8 [213730.727636] FS: 0000000000000000(0000) GS:ffff954f7e938000(0000) knlGS:0000000000000000 [213730.727834] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [213730.728009] CR2: 00007fe11629d010 CR3: 000000011f843004 CR4: 0000000000b70ef0 [213730.728186] Call Trace: [213730.728359] <TASK> [213730.728511] drm_crtc_vblank_helper_get_vblank_timestamp_from_timer+0x15/0x20 [drm_kms_helper] [213730.728674] drm_crtc_get_last_vbltimestamp+0x55/0x90 [drm] [213730.728864] drm_crtc_next_vblank_start+0x4e/0x90 [drm] [213730.729043] drm_atomic_helper_wait_for_fences+0x7c/0x1e0 [drm_kms_helper] [213730.729196] drm_atomic_helper_commit+0xa1/0x160 [drm_kms_helper] [213730.729335] drm_atomic_commit+0xb0/0xe0 [drm] [213730.729481] ? __pfx___drm_printfn_info+0x10/0x10 [drm] [213730.729643] drm_atomic_helper_dirtyfb+0x1aa/0x280 [drm_kms_helper] [213730.729800] drm_fbdev_shmem_helper_fb_dirty+0x4c/0xb0 [drm_shmem_helper] [213730.729939] drm_fb_helper_damage_work+0x8d/0x170 [drm_kms_helper] [213730.730071] process_one_work+0x19c/0x3f0 [213730.730204] worker_thread+0x2c3/0x3d0 [213730.730332] kthread+0x116/0x230 [213730.730459] ? __pfx_worker_thread+0x10/0x10 [213730.730580] ? _raw_spin_unlock_irq+0x12/0x40 [213730.730744] ? __pfx_kthread+0x10/0x10 [213730.730898] ret_from_fork+0xec/0x130 [213730.731027] ? __pfx_kthread+0x10/0x10 [213730.731152] ret_from_fork_asm+0x1a/0x30 [213730.731277] </TASK> [213730.731396] ---[ end trace 0000000000000000 ]--- > > For Patches 1, 2, and 4 of the series on a Hyper-V guest, > > Tested-by: Michael Kelley <mhkli...@outlook.com> > > [4] https://lore.kernel.org/dri-devel/20250523161522.409504-1- > mhkli...@outlook.com/T/#m2e288dddaf7b3c025bbbf88da4b4c39e7aa950a7 > > > > > The series has been motivated by a recent discussion about hypervdrm [1] > > and other long-standing bug reports. [2][3] > > > > v3: > > - fix deadlock (Ville, Lyude) > > v2: > > - rework interfaces > > > > [1] https://lore.kernel.org/dri-devel/20250523161522.409504-1- > mhkli...@outlook.com/T/#ma2ebb52b60bfb0325879349377738fadcd7cb7ef > > [2] https://bugzilla.suse.com/show_bug.cgi?id=1189174 > > [3] https://invent.kde.org/plasma/kwin/-/merge_requests/1229#note_284606 > > > > Thomas Zimmermann (4): > > drm/vblank: Add vblank timer > > drm/vblank: Add CRTC helpers for simple use cases > > drm/vkms: Convert to DRM's vblank timer > > drm/hypervdrm: Use vblank timer > > > > Documentation/gpu/drm-kms-helpers.rst | 12 ++ > > drivers/gpu/drm/Makefile | 3 +- > > drivers/gpu/drm/drm_vblank.c | 161 +++++++++++++++++- > > drivers/gpu/drm/drm_vblank_helper.c | 176 ++++++++++++++++++++ > > drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 11 ++ > > 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, 467 insertions(+), 81 deletions(-) > > create mode 100644 drivers/gpu/drm/drm_vblank_helper.c > > create mode 100644 include/drm/drm_vblank_helper.h > > > > -- > > 2.50.1