public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@mailbox.org>
To: Christian König <christian.koenig@amd.com>,
	Philipp Stanner <phasta@kernel.org>,
	avid Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann	 <tzimmermann@suse.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan	 <skhan@linuxfoundation.org>,
	dakr@kernel.org, Tvrtko Ursulin	 <tvrtko.ursulin@igalia.com>
Cc: dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Documentation: drm: Add entry for removing spsc_queue to TODO list
Date: Wed, 03 Jun 2026 13:14:01 +0200	[thread overview]
Message-ID: <c6ecda00eb1aa6a88c17354e26d4dd7dc58ae582.camel@mailbox.org> (raw)
In-Reply-To: <aceb688b-4f65-4539-a4f1-fc5455b60a5f@amd.com>

On Mon, 2026-06-01 at 10:30 +0200, Christian König wrote:
> 
> 
> On 5/29/26 23:52, Philipp Stanner wrote:
> > 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.
> > 
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>

Pushed to drm-misc-next

Thx
P.

> 
> > ---
> >  Documentation/gpu/todo.rst | 41 ++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> > 
> > diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> > index cdddf8db35f5..87e082b0eb48 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
> >  ===========
> >  

  reply	other threads:[~2026-06-03 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 21:52 [PATCH] Documentation: drm: Add entry for removing spsc_queue to TODO list Philipp Stanner
2026-06-01  8:30 ` Christian König
2026-06-03 11:14   ` Philipp Stanner [this message]
2026-06-04  5:59 ` Claude review: " Claude Code Review Bot
2026-06-04  5:59 ` Claude Code Review Bot

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=c6ecda00eb1aa6a88c17354e26d4dd7dc58ae582.camel@mailbox.org \
    --to=phasta@mailbox.org \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=phasta@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skhan@linuxfoundation.org \
    --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