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-fence: Signal all callbacks from dma_fence_release()

This is an illegal scenario, to free the fence whilst there are pending
callbacks. Currently, we emit a WARN and then cast aside the callbacks
leaving them dangling. Alternatively, we could set an error on the fence
and then signal fence so that any dependency chains from the fence can
be tidied up, and if they care they can check for the error.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190609110002.31915-1-chris@chris-wilson.co.uk

+19 -2
+19 -2
drivers/dma-buf/dma-fence.c
··· 256 256 257 257 trace_dma_fence_destroy(fence); 258 258 259 - /* Failed to signal before release, could be a refcounting issue */ 260 - WARN_ON(!list_empty(&fence->cb_list)); 259 + if (WARN(!list_empty(&fence->cb_list), 260 + "Fence %s:%s:%llx:%llx released with pending signals!\n", 261 + fence->ops->get_driver_name(fence), 262 + fence->ops->get_timeline_name(fence), 263 + fence->context, fence->seqno)) { 264 + unsigned long flags; 265 + 266 + /* 267 + * Failed to signal before release, likely a refcounting issue. 268 + * 269 + * This should never happen, but if it does make sure that we 270 + * don't leave chains dangling. We set the error flag first 271 + * so that the callbacks know this signal is due to an error. 272 + */ 273 + spin_lock_irqsave(fence->lock, flags); 274 + fence->error = -EDEADLK; 275 + dma_fence_signal_locked(fence); 276 + spin_unlock_irqrestore(fence->lock, flags); 277 + } 261 278 262 279 if (fence->ops->release) 263 280 fence->ops->release(fence);