diff options
| author | Philipp Stanner <phasta@kernel.org> | 2026-05-29 23:52:07 +0200 |
|---|---|---|
| committer | Philipp Stanner <phasta@kernel.org> | 2026-06-03 13:12:51 +0200 |
| commit | 6e7eb171ac96fefa32197afa658e7d9da238be89 (patch) | |
| tree | 72846b02abea7ebe9c36b1904c30a482dfd86fd5 | |
| parent | b0d4740dae77c9e7b97344d6d81c8727a6ea8795 (diff) | |
Documentation: drm: Add entry for removing spsc_queue to TODO list
drm_sched contains a lockless queue (spsc_queue) that seems to be
useless and potentially unsound.
Add a TODO list entry for replacing spsc_queue with a locked list.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20260529215207.115513-2-phasta@kernel.org
| -rw-r--r-- | Documentation/gpu/todo.rst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index f5a6139356da..e3d169d42f19 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -948,6 +948,47 @@ Contact: Philipp Stanner <phasta@kernel.org> Level: Intermediate +Replace the lockless queue with a locked list +--------------------------------------------- + +drm_sched is the only user in the entire kernel of a special lockless queue, the +spsc_queue. This queue utilizes: + +- preempt_disable() +- atomic instructions +- memory barriers +- ACCESS_ONCE() + +whereas a conventional spinlock utilizes: + +- preempt_disable() +- 1 atomic instruction for taking / releasing the lock +- memory barriers + +Moreover, drm_sched_entity_push_job(), the only user of spsc_queue_push(), has +to take a lock in some situations anyways and calls to it are often serialized +with a driver lock. + +It is, thus, highly questionable whether the lockless queue grants any advantage +at all. Considering that its internals are not well documented and its correctness +is not formally proven, it seems desirable to replace the queue with a mere list +or hlist that is protected by a spinlock. + +Tasks: + +- Replace the spsc_queue in drm/sched (and those who might access the scheduler's + internal queue) with a spinlock + (h)list. +- Ideally, check with some micro benchmarks and real world tests (preferably + with amdgpu) for relevant performance regressions. +- Remove the spsc_queue from the kernel altogether. + +Contact: + +- Philipp Stanner <phasta@kernel.org> +- Christian König <christian.koenig@amd.com> + +Level: Beginner + Outside DRM =========== |
