[PATCH] drm/sched: test before reading fence timestamp
Yunxiang Li
Yunxiang.Li at amd.com
Fri Sep 8 18:24:32 UTC 2023
Reading fence timestamp always need to check the corresponding flag bit
before to make sure the write is actually visible, otherwise we can read
garbage here.
Fixes: 1774baa64f93 ("drm/scheduler: Change scheduled fence track v2")
Signed-off-by: Yunxiang Li <Yunxiang.Li at amd.com>
---
drivers/gpu/drm/scheduler/sched_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 506371c42745..8ed00f54c59d 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -928,6 +928,9 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
typeof(*next), list);
if (next) {
+ while (!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT,
+ &job->s_fence->finished.flags))
+ cpu_relax();
next->s_fence->scheduled.timestamp =
job->s_fence->finished.timestamp;
/* start TO timer for next job */
--
2.34.1
More information about the dri-devel
mailing list