]> git.ipfire.org Git - thirdparty/linux.git/commit
dma-buf: protected fence ops by RCU v8
authorChristian König <christian.koenig@amd.com>
Tue, 7 Oct 2025 12:06:05 +0000 (14:06 +0200)
committerChristian König <christian.koenig@amd.com>
Mon, 23 Feb 2026 15:09:56 +0000 (16:09 +0100)
commitf4cc3ab824d6772a48ca9d9c74ac623b3309985d
tree70c19dee709ad674e4395a51e9cc0e350cc5d8ab
parent8b85987d3cf50178f67618122d9f3bb202f62f42
dma-buf: protected fence ops by RCU v8

The fence ops of a dma_fence currently need to life as long as the
dma_fence is alive. This means that the module which originally issued
a dma_fence can't unload unless all fences are freed up.

As first step to solve this issue protect the fence ops by RCU.

While it is counter intuitive to protect a constant function pointer table
by RCU it allows modules to wait for an RCU grace period before they
unload, to make sure that nobody is executing their functions any more.

This patch has not much functional change, but only adds the RCU
handling for the static checker to test.

v2: make one the now duplicated lockdep warnings a comment instead.
v3: Add more documentation to ->wait and ->release callback.
v4: fix typo in documentation
v5: rebased on drm-tip
v6: improve code comments
v7: improve commit message and code comments
v8: fix sparse rcu warnings

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/r/20260219160822.1529-2-christian.koenig@amd.com
drivers/dma-buf/dma-fence.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/scheduler/sched_fence.c
include/linux/dma-fence.h