Skip to content

Commit

Permalink
drm/sched: Declare entity idle only after HW submission
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Cc: Lucas Stach <[email protected]>
Reviewed-by: Steven Price <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
bbrezillon committed Jun 28, 2021
1 parent 7150185 commit 3b5ac97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpu/drm/scheduler/sched_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)) {
Expand Down

0 comments on commit 3b5ac97

Please sign in to comment.