mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Tejun Heo <tj@kernel.org>
Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	kernel-dev@igalia.com, Chia-I Wu <olv@google.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Steven Price <steven.price@arm.com>
Subject: Re: [RFC v6 3/3] drm/panthor: Create per queue priority workqueues
Date: Mon, 5 Oct 2026 15:08:12 +0200	[thread overview]
Message-ID: <20261005150812.18f86b39@fedora-61.home> (raw)
In-Reply-To: <64d59ed5538c6af257058533c880740e@kernel.org>

Hello Tejun and Tvrtko,

On Fri, 02 Oct 2026 09:30:53 -1000
Tejun Heo <tj@kernel.org> wrote:

> > +	sched->submit_wq[PANTHOR_CSG_PRIORITY_MEDIUM] = alloc_workqueue("panthor-drm", WQ_MEM_RECLAIM | WQ_UNBOUND, 2);
> > +	sched->submit_wq[PANTHOR_CSG_PRIORITY_LOW] = sched->submit_wq[PANTHOR_CSG_PRIORITY_MEDIUM];
> > +	sched->submit_wq[PANTHOR_CSG_PRIORITY_HIGH] = alloc_workqueue("panthor-drm-high", WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 2);
> > +	sched->submit_wq[PANTHOR_CSG_PRIORITY_RT] = alloc_workqueue("panthor-drm-rt", WQ_RT | WQ_MEM_RECLAIM | WQ_UNBOUND, 2);  
> 
> For an unbound wq max_active applies to the whole wq, so this is two
> in-flight items per priority level across all the queues on the device,
> where the shared wq before had no effective limit. queue_run_job() blocks
> on sched->lock which tick_work() holds across FW round trips, so two
> blocked run_jobs would stall every other queue's run and free work at that
> level.

First off, panthor_sched::lock being a device-wide contention point for
submissions is something we plan to address (either by using a rw_lock
taken in read mode in the submit path and write mode in the scheduler
tick path, or by locking at a finer granularity).

> What's the reason for 2?

I think it was picked to keep the number of RT threads small, and
because we have this huge contention point, in ::run_job(), it was
deemed unimportant for now. Ultimately, if we were to size max_active
according to how fast the HW can dequeue, I guess we would go for
something like `max_active=panthor_sched::csg_slot_count`.

The other thing we need to address is the fact we now have proper
priority enforcement for submissions, but events are still processed
in a random order, so we probably want to have per-prio wq for OOM
handling, and we need a mechanism to process events in the CSG prio
order in panthor_sched_report_fw_events(). I'm also worried that an
RT-prio context would preempt the tick scheduled on
panthor_scheduler::wq, which is a regular-prio wq, thus making fairness
between RT contexts non-functional (if one RT context manages to queue
jobs fast enough, it would stay on the CSG slot with the highest prio
longer than we expect).

It's all these tiny details I'd like to sort out (or at least have a
plan for) before merging the per-prio-submit-wq stuff in panthor. This
being said, I don't think it should block the workqueue/drm_sched
changes, if they are deemed acceptable.

BTW, I apologize for being MIA for this long :-/.

Regards,

Boris

      reply	other threads:[~2026-10-05 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 16:07 [RFC v6 0/3] Realtime workqueues and panthor realtime submission Tvrtko Ursulin
2026-10-01 16:07 ` [RFC v6 1/3] workqueue: Simplify unbound sysfs attribute registration Tvrtko Ursulin
2026-10-02 19:30   ` Tejun Heo
2026-10-01 16:07 ` [RFC v6 2/3] workqueue: Add support for real-time workers Tvrtko Ursulin
2026-10-01 18:48   ` [RFC v6.1 " Tvrtko Ursulin
2026-10-02 19:30     ` Tejun Heo
2026-10-01 16:07 ` [RFC v6 3/3] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
2026-10-02 19:30   ` Tejun Heo
2026-10-05 13:08     ` Boris Brezillon [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=20261005150812.18f86b39@fedora-61.home \
    --to=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=matthew.brost@intel.com \
    --cc=olv@google.com \
    --cc=steven.price@arm.com \
    --cc=tj@kernel.org \
    --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

all inboxes | Powered by JetHome®