]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/sched: Avoid data corruptions
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Wed, 19 May 2021 14:14:07 +0000 (10:14 -0400)
committerAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Thu, 20 May 2021 03:50:28 +0000 (23:50 -0400)
Wait for all dependencies of a job  to complete before
killing it to avoid data corruptions.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210519141407.88444-1-andrey.grodzovsky@amd.com
drivers/gpu/drm/scheduler/sched_entity.c

index 2e93e881b65f7b5f15037d9f2e2d196d8effe1d8..79554aa4dbb18f6d6198c4d4cafc8f9d24160fe1 100644 (file)
@@ -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, false);
+
                drm_sched_fence_scheduled(s_fence);
                dma_fence_set_error(&s_fence->finished, -ESRCH);