Skip to content

Commit

Permalink
drm/sched: Re-queue run job worker when drm_sched_entity_pop_job() re…
Browse files Browse the repository at this point in the history
…turns NULL

Rather then loop over entities until one with a ready job is found,
re-queue the run job worker when drm_sched_entity_pop_job() returns NULL.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Christian König <[email protected]>
Fixes: 66dbd90 ("drm/sched: Drain all entities in DRM sched run job worker")
Reviewed-by: Luben Tuikov <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mbrost05 authored and RadxaStephen committed Nov 24, 2024
1 parent f2eab5d commit ab79b29
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/gpu/drm/scheduler/sched_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,21 +1178,24 @@ static void drm_sched_run_job_work(struct work_struct *w)
struct drm_sched_entity *entity;
struct dma_fence *fence;
struct drm_sched_fence *s_fence;
struct drm_sched_job *sched_job = NULL;
struct drm_sched_job *sched_job;
int r;

if (READ_ONCE(sched->pause_submit))
return;

/* Find entity with a ready job */
while (!sched_job && (entity = drm_sched_select_entity(sched))) {
sched_job = drm_sched_entity_pop_job(entity);
if (!sched_job)
complete_all(&entity->entity_idle);
}
entity = drm_sched_select_entity(sched);
if (!entity)
return; /* No more work */

sched_job = drm_sched_entity_pop_job(entity);
if (!sched_job) {
complete_all(&entity->entity_idle);
drm_sched_run_job_queue(sched);
return;
}

s_fence = sched_job->s_fence;

atomic_add(sched_job->credits, &sched->credit_count);
Expand Down

0 comments on commit ab79b29

Please sign in to comment.