Re: [PATCH] drm/sched: Extend locking in drm_sched_entity_select_rq()

From: Tvrtko Ursulin

Date: Thu Nov 26 2026 - 11:39:32 EST



On 26/11/2026 16:14, Philipp Stanner wrote:
On Tue, 2026-11-17 at 10:37 +0100, Philipp Stanner wrote:
drm_sched_entity_select_rq() evaluates entity->sched_list locklessly,
which is elsewhere always lock-protected. Another lockless check regards
spsc_queue_count(). spsc_queue is evaluated under lock protection at
many places already and the plan is to replace it with fully locked
infrastructure anyways.

Move the spin_lock() in drm_sched_entity_select_rq() upwards.

Tvrtko, Christian, objections with merging that for now?

I don't have any huge objections but it is a bit underwhelming aka we don't get anything much with it really.

I was hoping my series which ends with "drm/sched: Address the fence_seq fixme" would get some more attention because it basically ends with a similar but perhaps a better result, where the lock actually goes one level up to drm_sched_job_arm and atomic_t fence_seq gets removed. So we can say there are some tangible benefits in that case.

But it is not just that series and the sched_list confusion it fixes, but also since in this commit message you elude to spsc queue removal, that's another one which we have sitting in limbo.

I mean it's all well and good moving spsc_queue_count under a lock but, again, it doesn't gain us much. In the spsc removal sketch I have for example demonstrated how that we can easily remove that spsc_queue_count, plus some spsc_queue_peeks. In theory that could be done even without the full spsc queue removal.

Perhaps we could close on all those opens somehow?

Regards,

Tvrtko