linux-stable/drivers/dma-buf
Chris Wilson 182c594668 dma-buf/fence: Fix lock inversion within dma-fence-array
[ Upstream commit 03e4e0a9e0 ]

Ages ago Rob Clark noted,

"Currently with fence-array, we have a potential deadlock situation.  If
we fence_add_callback() on an array-fence, the array-fence's lock is
acquired first, and in it's ->enable_signaling() callback, it will install
cbs on it's array-member fences, so the array-member's lock is acquired
second.

But in the signal path, the array-member's lock is acquired first, and
the array-fence's lock acquired second."

Rob proposed either extensive changes to dma-fence to unnest the
fence-array signaling, or to defer the signaling onto a workqueue. This
is a more refined version of the later, that should keep the latency
of the fence signaling to a minimum by using an irq-work, which is
executed asap.

Reported-by: Rob Clark <robdclark@gmail.com>
Suggested-by: Rob Clark <robdclark@gmail.com>
References: 1476635975-21981-1-git-send-email-robdclark@gmail.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114162719.30958-1-chris@chris-wilson.co.uk
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 08:42:47 +01:00
..
dma-buf.c dma-buf: Adjust a null pointer check in dma_buf_attach() 2017-05-08 20:50:21 +05:30
dma-fence-array.c dma-buf/fence: Fix lock inversion within dma-fence-array 2018-03-19 08:42:47 +01:00
dma-fence.c Linux 4.13-rc2 2017-07-27 08:15:43 +10:00
Kconfig dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
Makefile dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
reservation.c dma-buf: fix reservation_object_wait_timeout_rcu once more v2 2018-02-22 15:42:17 +01:00
seqno-fence.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
sw_sync.c dma-buf/sw_sync: force signal all unsignaled fences on dying timeline 2017-12-10 13:40:44 +01:00
sync_debug.c Linux 4.13-rc2 2017-07-27 08:15:43 +10:00
sync_debug.h dma-buf/sw-sync: Use an rbtree to sort fences in the timeline 2017-06-29 18:54:07 -03:00
sync_file.c sync_file: Return consistent status in SYNC_IOC_FILE_INFO 2017-10-09 13:09:19 -03:00
sync_trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00