From: Philipp Stanner <phasta@kernel.org>
To: "Danilo Krummrich" <dakr@kernel.org>,
"Philipp Stanner" <phasta@kernel.org>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/3] drm/sched: Lock spsc_queue_pop() in drm_sched_entity_pop_job()
Date: Thu, 10 Sep 2026 09:59:42 +0200 [thread overview]
Message-ID: <20260910075942.2000338-4-phasta@kernel.org> (raw)
In-Reply-To: <20260910075942.2000338-2-phasta@kernel.org>
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@kernel.org>
---
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
next prev parent reply other threads:[~2026-09-10 8:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 7:59 [PATCH v3 0/3] drm/sched: Introduce more locking to entity Philipp Stanner
2026-09-10 7:59 ` [PATCH v3 1/3] drm/sched: Lock drm_sched_rq_pop_entity() externally Philipp Stanner
2026-09-10 7:59 ` Philipp Stanner [this message]
2026-09-10 7:59 ` [PATCH v3 3/3] drm/sched: Protect entity->last_scheduled with spinlock Philipp Stanner
2026-09-11 8:17 ` Tvrtko Ursulin
2026-09-11 8:19 ` [PATCH v3 0/3] drm/sched: Introduce more locking to entity Tvrtko Ursulin
2026-09-11 10:34 ` Philipp Stanner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910075942.2000338-4-phasta@kernel.org \
--to=phasta@kernel.org \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tvrtko.ursulin@igalia.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®