summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2026-02-24 21:39:22 +0300
committerMatthew Brost <matthew.brost@intel.com>2026-02-25 12:19:41 +0300
commit2622649ad6cdbb3e77bfafc8c0fe686090b77f70 (patch)
tree610f13b4fe0260d0dcbcfb751639b3bf07cd1df6
parent2ec86535555c0e748443c1f07087c088b645a9d5 (diff)
downloadlinux-2622649ad6cdbb3e77bfafc8c0fe686090b77f70.tar.xz
dma-buf: Assign separate lockdep class to array lock
dma_fence_array_enable_signaling() runs while holding the array inline_lock and may add callbacks to underlying fences, which takes their inline_lock. Since both locks share the same lockdep class, this valid nesting triggers a recursive locking warning. Assign a distinct lockdep class to the array inline_lock so lockdep can correctly model the hierarchy. Fixes: 5943243914b9 ("dma-buf: use inline lock for the dma-fence-array") Cc: Christian König <christian.koenig@amd.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Philipp Stanner <phasta@kernel.org> Cc: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patch.msgid.link/20260224183922.2256492-2-matthew.brost@intel.com
-rw-r--r--drivers/dma-buf/dma-fence-array.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index cd970eceaefb..089f69469524 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -200,6 +200,8 @@ void dma_fence_array_init(struct dma_fence_array *array,
u64 context, unsigned seqno,
bool signal_on_any)
{
+ static struct lock_class_key dma_fence_array_lock_key;
+
WARN_ON(!num_fences || !fences);
array->num_fences = num_fences;
@@ -208,6 +210,18 @@ void dma_fence_array_init(struct dma_fence_array *array,
seqno);
init_irq_work(&array->work, irq_dma_fence_array_work);
+ /*
+ * dma_fence_array_enable_signaling() is invoked while holding
+ * array->base.inline_lock and may call dma_fence_add_callback()
+ * on the underlying fences, which takes their inline_lock.
+ *
+ * Since both locks share the same lockdep class, this legitimate
+ * nesting confuses lockdep and triggers a recursive locking
+ * warning. Assign a separate lockdep class to the array lock
+ * to model this hierarchy correctly.
+ */
+ lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key);
+
atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
array->fences = fences;