Commit d0399da9 authored by Matthew Brost's avatar Matthew Brost Committed by Dave Airlie
Browse files

drm/sched: Re-queue run job worker when drm_sched_entity_pop_job() returns 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: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Fixes: 66dbd900 ("drm/sched: Drain all entities in DRM sched run job worker")
Reviewed-by: default avatarLuben Tuikov <ltuikov89@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240130030413.2031009-1-matthew.brost@intel.com
parent 54be6c6c
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -1178,20 +1178,23 @@ 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))) {
	entity = drm_sched_select_entity(sched);
	if (!entity)
		return;	/* No more work */

	sched_job = drm_sched_entity_pop_job(entity);
		if (!sched_job)
	if (!sched_job) {
		complete_all(&entity->entity_idle);
		drm_sched_run_job_queue(sched);
		return;
	}
	if (!entity)
		return;	/* No more work */

	s_fence = sched_job->s_fence;