Message ID | 20230908182431.12634-1-Yunxiang.Li@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/sched: test before reading fence timestamp | expand |
Am 08.09.23 um 20:24 schrieb Yunxiang Li: > 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. Yeah, Teddy already stumbled over that problem as well I think. We are currently testing a more wider fix for this. Regards, Christian. > > Fixes: 1774baa64f93 ("drm/scheduler: Change scheduled fence track v2") > Signed-off-by: Yunxiang Li <Yunxiang.Li@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 */
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 */
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@amd.com> --- drivers/gpu/drm/scheduler/sched_main.c | 3 +++ 1 file changed, 3 insertions(+)