aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/amd/scheduler/gpu_scheduler.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 5ace1a74071f..8b2becd1aa07 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -47,6 +47,8 @@ static void amd_sched_rq_init(struct amd_sched_rq *rq)
47static void amd_sched_rq_add_entity(struct amd_sched_rq *rq, 47static void amd_sched_rq_add_entity(struct amd_sched_rq *rq,
48 struct amd_sched_entity *entity) 48 struct amd_sched_entity *entity)
49{ 49{
50 if (!list_empty(&entity->list))
51 return;
50 spin_lock(&rq->lock); 52 spin_lock(&rq->lock);
51 list_add_tail(&entity->list, &rq->entities); 53 list_add_tail(&entity->list, &rq->entities);
52 spin_unlock(&rq->lock); 54 spin_unlock(&rq->lock);
@@ -55,6 +57,8 @@ static void amd_sched_rq_add_entity(struct amd_sched_rq *rq,
55static void amd_sched_rq_remove_entity(struct amd_sched_rq *rq, 57static void amd_sched_rq_remove_entity(struct amd_sched_rq *rq,
56 struct amd_sched_entity *entity) 58 struct amd_sched_entity *entity)
57{ 59{
60 if (list_empty(&entity->list))
61 return;
58 spin_lock(&rq->lock); 62 spin_lock(&rq->lock);
59 list_del_init(&entity->list); 63 list_del_init(&entity->list);
60 if (rq->current_entity == entity) 64 if (rq->current_entity == entity)
@@ -138,9 +142,6 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
138 atomic_set(&entity->fence_seq, 0); 142 atomic_set(&entity->fence_seq, 0);
139 entity->fence_context = fence_context_alloc(1); 143 entity->fence_context = fence_context_alloc(1);
140 144
141 /* Add the entity to the run queue */
142 amd_sched_rq_add_entity(rq, entity);
143
144 return 0; 145 return 0;
145} 146}
146 147
@@ -302,9 +303,11 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
302 spin_unlock(&entity->queue_lock); 303 spin_unlock(&entity->queue_lock);
303 304
304 /* first job wakes up scheduler */ 305 /* first job wakes up scheduler */
305 if (first) 306 if (first) {
307 /* Add the entity to the run queue */
308 amd_sched_rq_add_entity(entity->rq, entity);
306 amd_sched_wakeup(sched); 309 amd_sched_wakeup(sched);
307 310 }
308 return added; 311 return added;
309} 312}
310 313