]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/vmwgfx: Add seqno waiter for sync_files
authorIan Forbes <ian.forbes@broadcom.com>
Fri, 28 Feb 2025 20:06:33 +0000 (14:06 -0600)
committerZack Rusin <zack.rusin@broadcom.com>
Mon, 10 Mar 2025 18:31:43 +0000 (14:31 -0400)
commit0039a3b35b10d9c15d3d26320532ab56cc566750
treef55098f3ec230316185dbfa30529a1068febe91f
parent171e3a45f42593b74434d740936d1d0dc80ed332
drm/vmwgfx: Add seqno waiter for sync_files

Because sync_files are passive waiters they do not participate in
the processing of fences like the traditional vmw_fence_wait IOCTL.
If userspace exclusively uses sync_files for synchronization then
nothing in the kernel actually processes fence updates as interrupts
for fences are masked and ignored if the kernel does not indicate to the
SVGA device that there are active waiters.

This oversight results in a bug where the entire GUI can freeze waiting
on a sync_file that will never be signalled as we've masked the interrupts
to signal its completion. This bug is incredibly racy as any process which
interacts with the fencing code via the 3D stack can process the stuck
fences on behalf of the stuck process causing it to run again. Even a
simple app like eglinfo is enough to resume the stuck process. Usually
this bug is seen at a login screen like GDM because there are no other
3D apps running.

By adding a seqno waiter we re-enable interrupt based processing of the
dma_fences associated with the sync_file which is signalled as part of a
dma_fence_callback.

This has likely been broken since it was initially added to the kernel in
2017 but has gone unnoticed until mutter recently started using sync_files
heavily over the course of 2024 as part of their explicit sync support.

Fixes: c906965dee22 ("drm/vmwgfx: Add export fence to file descriptor support")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250228200633.642417-1-ian.forbes@broadcom.com
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c