]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/sched: Declare entity idle only after HW submission
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 24 Jun 2021 14:08:50 +0000 (16:08 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Mon, 28 Jun 2021 11:16:49 +0000 (13:16 +0200)
The panfrost driver tries to kill in-flight jobs on FD close after
destroying the FD scheduler entities. For this to work properly, we
need to make sure the jobs popped from the scheduler entities have
been queued at the HW level before declaring the entity idle, otherwise
we might iterate over a list that doesn't contain those jobs.

Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210624140850.2229697-1-boris.brezillon@collabora.com
drivers/gpu/drm/scheduler/sched_main.c

index a2a953693b4508cf89d6e6d95a64231b15f4bcdb..60125fbe7bb5984a73e219c11abf7b9bf91653db 100644 (file)
@@ -802,10 +802,10 @@ static int drm_sched_main(void *param)
 
                sched_job = drm_sched_entity_pop_job(entity);
 
-               complete(&entity->entity_idle);
-
-               if (!sched_job)
+               if (!sched_job) {
+                       complete(&entity->entity_idle);
                        continue;
+               }
 
                s_fence = sched_job->s_fence;
 
@@ -814,6 +814,7 @@ static int drm_sched_main(void *param)
 
                trace_drm_run_job(sched_job, entity);
                fence = sched->ops->run_job(sched_job);
+               complete(&entity->entity_idle);
                drm_sched_fence_scheduled(s_fence);
 
                if (!IS_ERR_OR_NULL(fence)) {