dma-buf: add dma_fence_timestamp helper
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: 1774baa6 ("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
Showing
- drivers/dma-buf/dma-fence-unwrap.c 4 additions, 9 deletionsdrivers/dma-buf/dma-fence-unwrap.c
- drivers/dma-buf/sync_file.c 3 additions, 6 deletionsdrivers/dma-buf/sync_file.c
- drivers/gpu/drm/scheduler/sched_main.c 1 addition, 1 deletiondrivers/gpu/drm/scheduler/sched_main.c
- include/linux/dma-fence.h 19 additions, 0 deletionsinclude/linux/dma-fence.h
Loading
Please register or sign in to comment