Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-buf: Assign separate lockdep class to chain lock

dma_fence_chain_enable_signaling() and runs while holding the chain
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 chain inline_lock so lockdep can correctly model the hierarchy.

Fixes: a408c0ca0c41 ("dma-buf: use inline lock for the dma-fence-chain")
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-1-matthew.brost@intel.com

+13
+13
drivers/dma-buf/dma-fence-chain.c
··· 242 242 struct dma_fence *fence, 243 243 uint64_t seqno) 244 244 { 245 + static struct lock_class_key dma_fence_chain_lock_key; 245 246 struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev); 246 247 uint64_t context; 247 248 ··· 263 262 264 263 dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL, 265 264 context, seqno); 265 + 266 + /* 267 + * dma_fence_chain_enable_signaling() is invoked while holding 268 + * chain->base.inline_lock and may call dma_fence_add_callback() 269 + * on the underlying fences, which takes their inline_lock. 270 + * 271 + * Since both locks share the same lockdep class, this legitimate 272 + * nesting confuses lockdep and triggers a recursive locking 273 + * warning. Assign a separate lockdep class to the chain lock 274 + * to model this hierarchy correctly. 275 + */ 276 + lockdep_set_class(&chain->base.inline_lock, &dma_fence_chain_lock_key); 266 277 267 278 /* 268 279 * Chaining dma_fence_chain container together is only allowed through