[PATCH] drm/sched: Avoid data corruptions
Christian König
ckoenig.leichtzumerken at gmail.com
Wed May 19 14:15:10 UTC 2021
Am 19.05.21 um 16:14 schrieb Andrey Grodzovsky:
> Wait for all dependencies of a job to complete before
> killing it to avoid data corruptions.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/scheduler/sched_entity.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index 2e93e881b65f..d5cf61972558 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -222,11 +222,16 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,
> static void drm_sched_entity_kill_jobs(struct drm_sched_entity *entity)
> {
> struct drm_sched_job *job;
> + struct dma_fence *f;
> int r;
>
> while ((job = to_drm_sched_job(spsc_queue_pop(&entity->job_queue)))) {
> struct drm_sched_fence *s_fence = job->s_fence;
>
> + /* Wait for all dependencies to avoid data corruptions */
> + while ((f = job->sched->ops->dependency(job, entity)))
> + dma_fence_wait(f);
> +
> drm_sched_fence_scheduled(s_fence);
> dma_fence_set_error(&s_fence->finished, -ESRCH);
>
More information about the amd-gfx
mailing list