Skip to content

Commit bc8d6a9

Browse files
author
Luben Tuikov
committed
drm/sched: Don't disturb the entity when in RR-mode scheduling
Don't call drm_sched_select_entity() in drm_sched_run_job_queue(). In fact, rename __drm_sched_run_job_queue() to just drm_sched_run_job_queue(), and let it do just that, schedule the work item for execution. The problem is that drm_sched_run_job_queue() calls drm_sched_select_entity() to determine if the scheduler has an entity ready in one of its run-queues, and in the case of the Round-Robin (RR) scheduling, the function drm_sched_rq_select_entity_rr() does just that, selects the _next_ entity which is ready, sets up the run-queue and completion and returns that entity. The FIFO scheduling algorithm is unaffected. Now, since drm_sched_run_job_work() also calls drm_sched_select_entity(), then in the case of RR scheduling, that would result in drm_sched_select_entity() having been called twice, which may result in skipping a ready entity if more than one entity is ready. This commit fixes this by eliminating the call to drm_sched_select_entity() from drm_sched_run_job_queue(), and leaves it only in drm_sched_run_job_work(). v2: Rebased on top of Tvrtko's renames series of patches. (Luben) Add fixes-tag. (Tvrtko) Signed-off-by: Luben Tuikov <[email protected]> Fixes: f7fe64a ("drm/sched: Split free_job into own work item") Reviewed-by: Matthew Brost <[email protected]> Reviewed-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c015fb6 commit bc8d6a9

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ drm_sched_rq_select_entity_fifo(struct drm_sched_rq *rq)
256256
}
257257

258258
/**
259-
* __drm_sched_run_job_queue - enqueue run-job work
259+
* drm_sched_run_job_queue - enqueue run-job work
260260
* @sched: scheduler instance
261261
*/
262-
static void __drm_sched_run_job_queue(struct drm_gpu_scheduler *sched)
262+
static void drm_sched_run_job_queue(struct drm_gpu_scheduler *sched)
263263
{
264264
if (!READ_ONCE(sched->pause_submit))
265265
queue_work(sched->submit_wq, &sched->work_run_job);
@@ -928,7 +928,7 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched)
928928
void drm_sched_wakeup(struct drm_gpu_scheduler *sched)
929929
{
930930
if (drm_sched_can_queue(sched))
931-
__drm_sched_run_job_queue(sched);
931+
drm_sched_run_job_queue(sched);
932932
}
933933

934934
/**
@@ -1040,16 +1040,6 @@ drm_sched_pick_best(struct drm_gpu_scheduler **sched_list,
10401040
}
10411041
EXPORT_SYMBOL(drm_sched_pick_best);
10421042

1043-
/**
1044-
* drm_sched_run_job_queue - enqueue run-job work if there are ready entities
1045-
* @sched: scheduler instance
1046-
*/
1047-
static void drm_sched_run_job_queue(struct drm_gpu_scheduler *sched)
1048-
{
1049-
if (drm_sched_select_entity(sched))
1050-
__drm_sched_run_job_queue(sched);
1051-
}
1052-
10531043
/**
10541044
* drm_sched_free_job_work - worker to call free_job
10551045
*

0 commit comments

Comments
 (0)