diff options
author | Christian König <christian.koenig@amd.com> | 2023-09-08 10:27:23 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2023-10-05 11:05:58 +0200 |
commit | b83ce9cb4a465b8f9a3fa45561b721a9551f60e3 (patch) | |
tree | 3d460e3784fd649aa85f01ed710f361f9bc870aa /drivers/gpu | |
parent | d59e75eef52d89201aaf5342a3ac23ddf3e9b112 (diff) | |
download | linux-b83ce9cb4a465b8f9a3fa45561b721a9551f60e3.tar.gz linux-b83ce9cb4a465b8f9a3fa45561b721a9551f60e3.tar.bz2 linux-b83ce9cb4a465b8f9a3fa45561b721a9551f60e3.zip |
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: 1774baa64f93 ("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
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/scheduler/sched_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 506371c42745..5a3a622fc672 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -929,7 +929,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) if (next) { next->s_fence->scheduled.timestamp = - job->s_fence->finished.timestamp; + dma_fence_timestamp(&job->s_fence->finished); /* start TO timer for next job */ drm_sched_start_timeout(sched); } |