mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@mailbox.org>
To: Boris Brezillon <boris.brezillon@collabora.com>,
	Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
	"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>,
	"Luben Tuikov" <luben.tuikov@amd.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com, stable@vger.kernel.org
Subject: Re: [PATCH] drm/sched: Sanitise wqueue_start/wqueue_stop/is_stopped interleavings
Date: Mon, 30 Nov 2026 17:31:56 +0100	[thread overview]
Message-ID: <649a3337c3a51bd5d8fc677e531aba4fd0a0afe9.camel@mailbox.org> (raw)
In-Reply-To: <20261130102418.68ed62fd@fedora1.home>

On Mon, 2026-11-30 at 10:24 +0100, Boris Brezillon wrote:
> Hi Nicolas,
> 

[…]

> 
> This feels clunky given the newly introduced lock is taken in the
> stop/start helpers. I get that drm_sched_is_stopped() is the reason you
> have to enforce ordering with smp_store_release(), but mixing a lock
> for write accesses and lockless mechanism for read accesses feels odd.

+1

> >  bool drm_sched_is_stopped(struct drm_gpu_scheduler *sched)
> >  {
> > -	return READ_ONCE(sched->pause_submit);
> > +	/*
> > +	 * Ensure drm_sched_wqueue_{stop,start}() && drm_sched_is_stopped()
> > +	 * gives a consistent view to any observer that ensures no concurrent
> > +	 * starting or stopping operation is ongoing.
> > +	 */
> > +	return smp_load_acquire(&sched->pause_submit);
> 
> This is all super fragile IMHO, because it relies on the fact the state
> of the scheduler doesn't change between the moment this helper is called
> and the moment the caller decides to do something with the result.

+1

> Acquiring the newly introduced pause_lock doesn't help unless we turn
> drm_sched_is_stopped() into drm_sched_is_stopped_locked() and force the
> caller to check the pause_submit state and do the associated action

The "caller" is the right keyword here.

> My gut feeling is that we should find a way to kill
> drm_sched_is_stopped() altogether and try to find a replacement for all
> the current users.

This existing is_stopped() mechanism seems to be yet another relic
where the gpu_scheduler is used a synchronisation mechanism and a
storage vessel for knowledge that lies in the driver.

The driver stops the scheduler, so it knows that it has stopped it. Why
does it need to check at another place with drm_sched_is_stopped()?

I agree that this function shouldn't exist, and the state for which
function it has called on which object should be stored in driver data.
A first glance at the xe code looks as if there is synchronisation with
a mutex in place there, which is likely the reason why the explosion
has not been observed there.

amdgpu also seems to hold a mutex, except for in
amdgpu_multi_ring_reset_helper_begin().

@Christian, any info on that?


P.

      reply	other threads:[~2026-11-30 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  8:27 Nicolas Frattaroli
2026-11-30  9:24 ` Boris Brezillon
2026-11-30 16:31   ` Philipp Stanner [this message]

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=649a3337c3a51bd5d8fc677e531aba4fd0a0afe9.camel@mailbox.org \
    --to=phasta@mailbox.org \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=nicolas.frattaroli@collabora.com \
    --cc=phasta@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --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®