[PATCH v3 2/3] drm/sched: Lock spsc_queue_pop() in drm_sched_entity_pop_job()
From: Philipp Stanner
Date: Thu Sep 10 2026 - 04:00:49 EST
As a preparational step to lock the access of entity->last_scheduled, it
is necessary to lock the call to spsc_queue_pop() in
drm_sched_entity_pop_job(). The reason is that later the existing lock
needs to be moved upward and the relative order between spsc_queue_pop()
and drm_sched_rq_pop_entity() needs to be preserved.
Guard spsc_queue_pop() with the existing spinlock.
Signed-off-by: Philipp Stanner <phasta@xxxxxxxxxx>
---
drivers/gpu/drm/scheduler/sched_entity.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 274d7a702298..e168f445f2ab 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -563,9 +563,8 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity)
*/
smp_wmb();
- spsc_queue_pop(&entity->job_queue);
-
spin_lock(&entity->lock);
+ spsc_queue_pop(&entity->job_queue);
drm_sched_rq_pop_entity(entity);
spin_unlock(&entity->lock);
--
2.55.0