linux-stable/drivers/dma-buf
Christian König 4e82b9c11d dma-buf: add dma_fence_timestamp helper
[ Upstream commit b83ce9cb4a ]

When a fence signals there is a very small race window where the timestamp
isn't updated yet. sync_file solves this by busy waiting for the
timestamp to appear, but on other ocassions didn't handled this
correctly.

Provide a dma_fence_timestamp() helper function for this and use it in
all appropriate cases.

Another alternative would be to grab the spinlock when that happens.

v2 by teddy: add a wait parameter to wait for the timestamp to show up, in case
   the accurate timestamp is needed and/or the timestamp is not based on
   ktime (e.g. hw timestamp)
v3 chk: drop the parameter again for unified handling

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 1774baa64f ("drm/scheduler: Change scheduled fence track v2")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20230929104725.2358-1-christian.koenig@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-23 08:55:10 +01:00
..
heaps dma-buf: cma_heap: Fix mutex locking section 2022-03-08 19:12:37 +01:00
Kconfig
Makefile
dma-buf-sysfs-stats.c
dma-buf-sysfs-stats.h
dma-buf.c dma-buf/poll: Get a file reference for outstanding fence callbacks 2022-07-12 16:34:51 +02:00
dma-fence-array.c
dma-fence-chain.c
dma-fence-unwrap.c dma-buf: add dma_fence_timestamp helper 2024-02-23 08:55:10 +01:00
dma-fence.c
dma-heap.c dma-buf: fix racing conflict of dma_heap_add() 2022-12-02 17:41:06 +01:00
dma-resv.c
selftest.c
selftest.h
selftests.h
seqno-fence.c
st-dma-fence-chain.c
st-dma-fence.c
sw_sync.c dma-buf/sw_sync: Avoid recursive lock during fence signal 2023-08-30 16:18:21 +02:00
sync_debug.c
sync_debug.h
sync_file.c dma-buf: add dma_fence_timestamp helper 2024-02-23 08:55:10 +01:00
sync_trace.h
udmabuf.c udmabuf: Set ubuf->sg = NULL if the creation of sg table fails 2022-10-26 12:35:39 +02:00