[PATCH] drm/sched: test before reading fence timestamp
Christian König
christian.koenig at amd.com
Mon Sep 11 09:16:17 UTC 2023
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 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 */
More information about the dri-devel
mailing list