cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Philipp Stanner" <phasta@mailbox.org>,
	phasta@kernel.org, "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	kernel-dev@igalia.com, intel-xe@lists.freedesktop.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Christian König" <christian.koenig@amd.com>,
	"Leo Liu" <Leo.Liu@amd.com>, "Maíra Canal" <mcanal@igalia.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Michel Dänzer" <michel.daenzer@mailbox.org>,
	"Pierre-Eric Pelloux-Prayer" <pierre-eric.pelloux-prayer@amd.com>,
	"Rob Clark" <robdclark@gmail.com>, "Tejun Heo" <tj@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Rob Herring" <robh@kernel.org>,
	"Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Boqun Feng" <boqunf@netflix.com>,
	"Grégoire Péan" <gpean@netflix.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	airlied@gmail.com
Subject: Re: [RFC v8 00/21] DRM scheduling cgroup controller
Date: Tue, 7 Oct 2025 17:44:29 +0200	[thread overview]
Message-ID: <20251007174429.0fc0ad84@fedora> (raw)
In-Reply-To: <aa7dedae-8f31-49f9-ad73-009cb8550b93@kernel.org>

On Tue, 7 Oct 2025 16:44:59 +0200
Danilo Krummrich <dakr@kernel.org> wrote:

> On 9/30/25 1:57 PM, Boris Brezillon wrote:
> > Can you remind me what the problem is? I thought the lifetime issue was
> > coming from the fact the drm_sched ownership model was lax enough that
> > the job could be owned by both drm_gpu_scheduler and drm_sched_entity
> > at the same time.  
> 
> I don't think that's (directly) a thing from the perspective of the drm_sched
> design. A job should be either in the entity queue for the pending_list of the
> scheduler.
> 
> However, different drivers do implement their own lifetime (and ownership) model
> on top of that, because they ultimately have to deal with jobs being either tied
> to the entity or the scheduler lifetime, which is everything else but strait
> forward in error cases and tear down paths.
> 
> And the fundamental problem why drivers implement their own rules on top of this
> is because it is hard to deal with jobs being tied to entirely different
> lifetime model depending on their state.
> 
> So, what I'm saying is that from the perspective of the component itself it's
> probably fine, but for the application in drivers it's the root cause for a lot
> of the hacks we see on top of the scheduler in drivers.
> 
> Some of those hacks even make their way into the scheduler [1].
> 
> [1]
> https://elixir.bootlin.com/linux/v6.17.1/source/drivers/gpu/drm/scheduler/sched_main.c#L1439
> 
> >> Instead, I think the new Jobqueue should always own and always dispatch jobs
> >> directly and provide some "control API" to be instructed by an external
> >> component (orchestrator) on top of it when and to which ring to dispatch jobs.  
> > 
> > Feels to me that we're getting back to a model where the JobQueue needs
> > to know about the upper-layer in charge of the scheduling. I mean, it
> > can work, but you're adding some complexity back to JobQueue, which I
> > was expecting to be a simple FIFO with a dep-tracking logic.  
> 
> Yes, the Jobqueue would need an interface to the orchestrator. I rather have the
> complexity encapsulated in the Jobqueue, rather than pushing the complexity to
> drivers by having a more complex lifetime and ownership model that leaks into
> drivers as mentioned above.
> 
> > I have a hard time seeing how it can fully integrate in this
> > orchestrator model. We can hook ourselves in the JobQueue::run_job()
> > and schedule the group for execution when we queue a job to the
> > ringbuf, but the group scheduler would still be something on the side.  
> 
> Can you please expand a bit more on the group model?
> 
> My understanding is that you have a limited number of firmware rings (R) and
> each of those rings has N slots, where N is the number of queue types supported
> by the GPU.

Honestly, the naming is a bit confusing, because for us, the ring
buffer is what gets attached to each queue and contains the jobs to be
executed on that queue. But other than this naming issue, that's pretty
much it, yes.

> 
> So, you need something that can schedule "groups" of queues over all available
> firmware rings, because it would be pointless to schedule each individual queue
> independently, as a firmware ring has slots for each of those. Is that correct?

It's not just that it would be pointless, it's not even an option,
because there are inter-queue synchronization mechanisms that only work
if the queues belong to the same group.

  reply	other threads:[~2025-10-07 15:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 15:23 [RFC v8 00/21] DRM scheduling cgroup controller Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 01/21] drm/sched: Add some scheduling quality unit tests Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 02/21] drm/sched: Add some more " Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 03/21] drm/sched: Implement RR via FIFO Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 04/21] drm/sched: Consolidate entity run queue management Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 05/21] drm/sched: Move run queue related code into a separate file Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 06/21] drm/sched: Free all finished jobs at once Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 07/21] drm/sched: Account entity GPU time Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 08/21] drm/sched: Remove idle entity from tree Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 09/21] drm/sched: Add fair scheduling policy Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 10/21] drm/sched: Break submission patterns with some randomness Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 11/21] drm/sched: Remove FIFO and RR and simplify to a single run queue Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 12/21] drm/sched: Embed run queue singleton into the scheduler Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 13/21] cgroup: Add the DRM cgroup controller Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 14/21] cgroup/drm: Track DRM clients per cgroup Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 15/21] cgroup/drm: Add scheduling weight callback Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 16/21] cgroup/drm: Introduce weight based scheduling control Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 17/21] drm/sched: Add helper for tracking entities per client Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 18/21] drm/sched: Add helper for DRM cgroup controller weight notifications Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 19/21] drm/amdgpu: Register with the DRM scheduling cgroup controller Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 20/21] drm/xe: Allow changing GuC scheduling priority Tvrtko Ursulin
2025-09-03 15:23 ` [RFC 21/21] drm/xe: Register with the DRM scheduling cgroup controller Tvrtko Ursulin
2025-09-04 12:08   ` Tvrtko Ursulin
2025-09-29 14:07 ` [RFC v8 00/21] " Danilo Krummrich
2025-09-30  9:00   ` Philipp Stanner
2025-09-30  9:28     ` DRM Jobqueue design (was "[RFC v8 00/21] DRM scheduling cgroup controller") Danilo Krummrich
2025-09-30 10:12     ` [RFC v8 00/21] DRM scheduling cgroup controller Boris Brezillon
2025-09-30 10:58       ` Danilo Krummrich
2025-09-30 11:57         ` Boris Brezillon
2025-10-07 14:44           ` Danilo Krummrich
2025-10-07 15:44             ` Boris Brezillon [this message]
2025-10-23 11:18   ` Tvrtko Ursulin

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=20251007174429.0fc0ad84@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=Leo.Liu@amd.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=aliceryhl@google.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=apopple@nvidia.com \
    --cc=boqunf@netflix.com \
    --cc=cgroups@vger.kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpean@netflix.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mcanal@igalia.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=mkoutny@suse.com \
    --cc=phasta@kernel.org \
    --cc=phasta@mailbox.org \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=robdclark@gmail.com \
    --cc=robh@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=ttabi@nvidia.com \
    --cc=tvrtko.ursulin@igalia.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;
as well as URLs for NNTP newsgroup(s).