Skip to content

Commit 66dbd90

Browse files
mbrost05airlied
authored andcommitted
drm/sched: Drain all entities in DRM sched run job worker
All entities must be drained in the DRM scheduler run job worker to avoid the following case. An entity found that is ready, no job found ready on entity, and run job worker goes idle with other entities + jobs ready. Draining all ready entities (i.e. loop over all ready entities) in the run job worker ensures all job that are ready will be scheduled. Cc: Thorsten Leemhuis <[email protected]> Reported-by: Mikhail Gavrilov <[email protected]> Closes: https://lore.kernel.org/all/CABXGCsM2VLs489CH-vF-1539-s3in37=bwuOWtoeeE+q26zE+Q@mail.gmail.com/ Reported-and-tested-by: Mario Limonciello <[email protected]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3124 Link: https://lore.kernel.org/all/[email protected]/ Reported-and-tested-by: Vlastimil Babka <[email protected]> Closes: https://lore.kernel.org/dri-devel/[email protected]/T/#m0c31d4d1b9ae9995bb880974c4f1dbaddc33a48a Signed-off-by: Matthew Brost <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 77fe8f1 commit 66dbd90

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,21 +1178,20 @@ static void drm_sched_run_job_work(struct work_struct *w)
11781178
struct drm_sched_entity *entity;
11791179
struct dma_fence *fence;
11801180
struct drm_sched_fence *s_fence;
1181-
struct drm_sched_job *sched_job;
1181+
struct drm_sched_job *sched_job = NULL;
11821182
int r;
11831183

11841184
if (READ_ONCE(sched->pause_submit))
11851185
return;
11861186

1187-
entity = drm_sched_select_entity(sched);
1187+
/* Find entity with a ready job */
1188+
while (!sched_job && (entity = drm_sched_select_entity(sched))) {
1189+
sched_job = drm_sched_entity_pop_job(entity);
1190+
if (!sched_job)
1191+
complete_all(&entity->entity_idle);
1192+
}
11881193
if (!entity)
1189-
return;
1190-
1191-
sched_job = drm_sched_entity_pop_job(entity);
1192-
if (!sched_job) {
1193-
complete_all(&entity->entity_idle);
11941194
return; /* No more work */
1195-
}
11961195

11971196
s_fence = sched_job->s_fence;
11981197

0 commit comments

Comments
 (0)