The timestamp bit is annoying and dangerous because it makes memory ordering difficult. It's only accessor function, dma_fence_timestamp(), is unnecessarily complicated.
The current state is largely UB. Most notably, since there is no memory ordering, people might accidentally read a list head for a timestamp, generating total bogus output. I have previously proposed backporting a hot fix for the ordering [1]. Tvrtko recently dived into fixing drm_sched [2]. My hope would be that the full drm_sched fix could be set on top of this series. The first two patches could be backported into misc-fixes, and the rest enter into misc-next? I'm not entirely sure what the best strategy is. Pls review, P. [1] https://lore.kernel.org/dri-devel/[email protected]/ [2] https://lore.kernel.org/dri-devel/[email protected]/ Philipp Stanner (8): dma-buf: dma-fence: Hot-fix timestamp misordering drm/sched: Hot-fix timestamp misordering dma-buf: dma-fence: Ensure ordering with locks for timestamps dma-buf: dma-fence: Improve dma_fence_timestamp() drm/amdgpu: Stop using dma_fence internals dma-buf: sync_debug: don't use TIMESTAMP bit drm/i915: Remove TIMESTAMP bit dma-buf: dma-fence: Remove TIMESTAMP bit drivers/dma-buf/dma-fence-unwrap.c | 20 ++++++++++----- drivers/dma-buf/dma-fence.c | 2 -- drivers/dma-buf/sync_debug.c | 8 +++--- drivers/dma-buf/sync_file.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 11 ++++---- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 1 - drivers/gpu/drm/scheduler/sched_entity.c | 4 +-- drivers/gpu/drm/scheduler/sched_main.c | 26 +++++++++++++++---- include/linux/dma-fence.h | 28 +++++++++++++-------- 9 files changed, 68 insertions(+), 40 deletions(-) -- 2.56.0
