]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dma-buf: inline spinlock for fence protection v5
authorChristian König <christian.koenig@amd.com>
Thu, 9 Oct 2025 08:40:06 +0000 (10:40 +0200)
committerChristian König <christian.koenig@amd.com>
Mon, 23 Feb 2026 15:14:19 +0000 (16:14 +0100)
commit1f32f310a13c9fb67a9993ab67f596b3f960206f
treecccc11e7551f545e8584227d706880ab2f27a4df
parent3e5067931b5df667f5350fafe4410554e228e53e
dma-buf: inline spinlock for fence protection v5

Implement per-fence spinlocks, allowing implementations to not give an
external spinlock to protect the fence internal state. Instead a spinlock
embedded into the fence structure itself is used in this case.

Shared spinlocks have the problem that implementations need to guarantee
that the lock lives at least as long all fences referencing them.

Using a per-fence spinlock allows completely decoupling spinlock producer
and consumer life times, simplifying the handling in most use cases.

v2: improve naming, coverage and function documentation
v3: fix one additional locking in the selftests
v4: separate out some changes to make the patch smaller,
    fix one amdgpu crash found by CI systems
v5: improve comments

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/r/20260219160822.1529-5-christian.koenig@amd.com
drivers/dma-buf/dma-fence.c
drivers/dma-buf/sync_debug.h
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_writeback.c
drivers/gpu/drm/nouveau/nouveau_fence.c
drivers/gpu/drm/qxl/qxl_release.c
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
drivers/gpu/drm/xe/xe_hw_fence.c
include/linux/dma-fence.h