From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Danilo Krummrich" <dakr@kernel.org>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
"Christian König" <christian.koenig@amd.com>,
"Philipp Stanner" <phasta@mailbox.org>,
phasta@kernel.org, "David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>, "Gary Guo" <gary@garyguo.net>,
"Benno Lossin" <lossin@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, lucas.demarchi@intel.com,
thomas.hellstrom@linux.intel.com, rodrigo.vivi@intel.com
Subject: Re: [RFC PATCH 2/4] rust: sync: Add dma_fence abstractions
Date: Wed, 11 Feb 2026 12:12:23 +0100 [thread overview]
Message-ID: <20260211121223.78674f22@fedora> (raw)
In-Reply-To: <DGC2WYUT80B4.3D4QKYP8FVVQJ@kernel.org>
On Wed, 11 Feb 2026 12:00:30 +0100
"Danilo Krummrich" <dakr@kernel.org> wrote:
> On Wed Feb 11, 2026 at 11:20 AM CET, Boris Brezillon wrote:
> > On Wed, 11 Feb 2026 10:57:27 +0100
> > "Danilo Krummrich" <dakr@kernel.org> wrote:
> >
> >> (Cc: Xe maintainers)
> >>
> >> On Tue Feb 10, 2026 at 12:40 PM CET, Alice Ryhl wrote:
> >> > On Tue, Feb 10, 2026 at 11:46:44AM +0100, Christian König wrote:
> >> >> On 2/10/26 11:36, Danilo Krummrich wrote:
> >> >> > On Tue Feb 10, 2026 at 11:15 AM CET, Alice Ryhl wrote:
> >> >> >> One way you can see this is by looking at what we require of the
> >> >> >> workqueue. For all this to work, it's pretty important that we never
> >> >> >> schedule anything on the workqueue that's not signalling safe, since
> >> >> >> otherwise you could have a deadlock where the workqueue is executes some
> >> >> >> random job calling kmalloc(GFP_KERNEL) and then blocks on our fence,
> >> >> >> meaning that the VM_BIND job never gets scheduled since the workqueue
> >> >> >> is never freed up. Deadlock.
> >> >> >
> >> >> > Yes, I also pointed this out multiple times in the past in the context of C GPU
> >> >> > scheduler discussions. It really depends on the workqueue and how it is used.
> >> >> >
> >> >> > In the C GPU scheduler the driver can pass its own workqueue to the scheduler,
> >> >> > which means that the driver has to ensure that at least one out of the
> >> >> > wq->max_active works is free for the scheduler to make progress on the
> >> >> > scheduler's run and free job work.
> >> >> >
> >> >> > Or in other words, there must be no more than wq->max_active - 1 works that
> >> >> > execute code violating the DMA fence signalling rules.
> >> >
> >> > Ouch, is that really the best way to do that? Why not two workqueues?
> >>
> >> Most drivers making use of this re-use the same workqueue for multiple GPU
> >> scheduler instances in firmware scheduling mode (i.e. 1:1 relationship between
> >> scheduler and entity). This is equivalent to the JobQ use-case.
> >>
> >> Note that we will have one JobQ instance per userspace queue, so sharing the
> >> workqueue between JobQ instances can make sense.
> >
> > Definitely, but I think that's orthogonal to allowing this common
> > workqueue to be used for work items that don't comply with the
> > dma-fence signalling rules, isn't it?
>
> Yes and no. If we allow passing around shared WQs without a corresponding type
> abstraction we open the door for drivers to abuse it the schedule their own
> work.
>
> I.e. sharing a workqueue between JobQs is fine, but we have to ensure they can't
> be used for anything else.
Totally agree with that, and that's where I was going with this special
DmaFenceWorkqueue wrapper/abstract, that would only accept
scheduling MaySignalDmaFencesWorkItem objects.
>
> >> Besides that, IIRC Xe was re-using the workqueue for something else, but that
> >> doesn't seem to be the case anymore. I can only find [1], which more seems like
> >> some custom GPU scheduler extention [2] to me...
> >
> > Yep, I think it can be the problematic case. It doesn't mean we can't
> > schedule work items that don't signal fences, but I think it'd be
> > simpler if we were forcing those to follow the same rules (no blocking
> > alloc, no locks taken that are also taken in other paths were blocking
> > allocs happen, etc) regardless of this wq->max_active value.
> >
> >>
> >> [1] https://elixir.bootlin.com/linux/v6.18.6/source/drivers/gpu/drm/xe/xe_gpu_scheduler.c#L40
> >> [2] https://elixir.bootlin.com/linux/v6.18.6/source/drivers/gpu/drm/xe/xe_gpu_scheduler_types.h#L28
>
next prev parent reply other threads:[~2026-02-11 11:12 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 8:13 [RFC PATCH 0/4] Add dma_fence abstractions and DRM Jobqueue Philipp Stanner
2026-02-03 8:14 ` [RFC PATCH 1/4] rust: list: Add unsafe for container_of Philipp Stanner
2026-02-03 15:25 ` Gary Guo
2026-02-04 10:30 ` Alice Ryhl
2026-02-03 8:14 ` [RFC PATCH 2/4] rust: sync: Add dma_fence abstractions Philipp Stanner
2026-02-05 8:57 ` Boris Brezillon
2026-02-06 10:23 ` Danilo Krummrich
2026-02-09 8:19 ` Philipp Stanner
2026-02-09 14:58 ` Boris Brezillon
2026-02-10 8:16 ` Christian König
2026-02-10 8:38 ` Alice Ryhl
2026-02-10 9:06 ` Philipp Stanner
2026-02-10 9:54 ` Christian König
2026-02-10 9:15 ` Boris Brezillon
2026-02-10 10:15 ` Alice Ryhl
2026-02-10 10:36 ` Danilo Krummrich
2026-02-10 10:46 ` Christian König
2026-02-10 11:40 ` Alice Ryhl
2026-02-10 12:28 ` Boris Brezillon
2026-02-11 9:57 ` Danilo Krummrich
2026-02-11 10:08 ` Philipp Stanner
2026-02-11 10:28 ` Boris Brezillon
2026-02-11 10:20 ` Boris Brezillon
2026-02-11 11:00 ` Danilo Krummrich
2026-02-11 11:12 ` Boris Brezillon [this message]
2026-02-11 14:38 ` Danilo Krummrich
2026-02-11 15:00 ` Boris Brezillon
2026-02-11 15:05 ` Danilo Krummrich
2026-02-11 15:14 ` Boris Brezillon
2026-02-11 15:16 ` Danilo Krummrich
2026-03-13 17:27 ` Matthew Brost
2026-02-10 10:46 ` Boris Brezillon
2026-02-10 11:34 ` Boris Brezillon
2026-02-10 11:45 ` Alice Ryhl
2026-02-10 12:21 ` Boris Brezillon
2026-02-10 13:34 ` Alice Ryhl
2026-02-10 12:36 ` Boris Brezillon
2026-02-10 13:15 ` Alice Ryhl
2026-02-10 13:26 ` Boris Brezillon
2026-02-10 13:49 ` Alice Ryhl
2026-02-10 13:56 ` Christian König
2026-02-10 14:00 ` Philipp Stanner
2026-02-10 14:06 ` Christian König
2026-02-10 15:32 ` Philipp Stanner
2026-02-10 15:50 ` Christian König
2026-02-10 15:07 ` Alice Ryhl
2026-02-10 15:45 ` Christian König
2026-02-11 8:16 ` Philipp Stanner
2026-02-17 14:03 ` Philipp Stanner
2026-02-17 14:09 ` Alice Ryhl
2026-02-17 14:22 ` Christian König
2026-02-17 14:28 ` Philipp Stanner
2026-02-17 14:44 ` Danilo Krummrich
2026-03-13 23:20 ` Matthew Brost
2026-02-17 15:01 ` Christian König
2026-02-18 9:50 ` Alice Ryhl
2026-02-18 10:48 ` Boris Brezillon
2026-02-10 12:49 ` Boris Brezillon
2026-02-10 12:56 ` Boris Brezillon
2026-02-10 13:26 ` Alice Ryhl
2026-02-10 13:51 ` Boris Brezillon
2026-02-10 14:11 ` Alice Ryhl
2026-02-10 14:50 ` Boris Brezillon
2026-02-11 8:16 ` Alice Ryhl
2026-02-11 9:20 ` Boris Brezillon
2026-02-10 9:26 ` Christian König
2026-02-05 10:16 ` Boris Brezillon
2026-02-05 13:16 ` Gary Guo
2026-02-06 9:32 ` Philipp Stanner
2026-02-06 10:16 ` Danilo Krummrich
2026-02-06 13:24 ` Philipp Stanner
2026-02-06 11:04 ` Boris Brezillon
2026-02-09 8:21 ` Philipp Stanner
2026-02-06 11:23 ` Boris Brezillon
2026-02-09 11:30 ` Alice Ryhl
2026-02-03 8:14 ` [RFC PATCH 3/4] rust/drm: Add DRM Jobqueue Philipp Stanner
2026-02-10 14:57 ` Boris Brezillon
2026-02-11 10:47 ` Philipp Stanner
2026-02-11 11:07 ` Boris Brezillon
2026-02-11 11:19 ` Danilo Krummrich
2026-02-11 12:10 ` Boris Brezillon
2026-02-11 12:32 ` Danilo Krummrich
2026-02-11 12:51 ` Boris Brezillon
2026-02-11 11:19 ` Philipp Stanner
2026-02-11 11:59 ` Boris Brezillon
2026-02-11 12:14 ` Philipp Stanner
2026-02-11 12:24 ` Boris Brezillon
2026-02-11 12:22 ` Alice Ryhl
2026-02-11 12:44 ` Philipp Stanner
2026-02-11 12:52 ` Alice Ryhl
2026-02-11 13:53 ` Philipp Stanner
2026-02-11 15:28 ` Alice Ryhl
2026-02-11 12:45 ` Danilo Krummrich
2026-02-11 13:45 ` Gary Guo
2026-02-11 14:07 ` Boris Brezillon
2026-02-11 15:17 ` Alice Ryhl
2026-02-11 15:20 ` Philipp Stanner
2026-02-11 15:51 ` Boris Brezillon
2026-02-11 15:53 ` Alice Ryhl
2026-02-11 15:54 ` Danilo Krummrich
2026-02-11 15:33 ` Alice Ryhl
2026-02-03 8:14 ` [RFC PATCH 4/4] samples: rust: Add jobqueue tester Philipp Stanner
2026-02-03 16:46 ` [RFC PATCH 0/4] Add dma_fence abstractions and DRM Jobqueue Daniel Almeida
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=20260211121223.78674f22@fedora \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=phasta@kernel.org \
--cc=phasta@mailbox.org \
--cc=rodrigo.vivi@intel.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
/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