All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v3 0/2] Realtime workqueues and panthor realtime submission
@ 2026-07-17  9:02 Tvrtko Ursulin
  2026-07-17  9:02 ` [RFC v3 1/2] workqueue: Add support for real-time workers Tvrtko Ursulin
  2026-07-17  9:02 ` [RFC v3 2/2] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
  0 siblings, 2 replies; 6+ messages in thread
From: Tvrtko Ursulin @ 2026-07-17  9:02 UTC (permalink / raw)
  To: dri-devel
  Cc: Boris Brezillon, Steven Price, Liviu Dudau, Chia-I Wu,
	Matthew Brost, kernel-dev, linux-kernel, Tvrtko Ursulin

This is a continuation of the previous discussion which was here:
https://lore.kernel.org/dri-devel/20260702143745.79293-1-tvrtko.ursulin@igalia.com/

Work is now converted to a much simpler approach by adding real-time scheduling
workqueues based on Tejun's feedback

To re-cap, when an userspace thread submits GPU work, due how the DRM scheduler
uses workqueues to feed the GPU, and regardless of the GPU rendering context
priority, or the CPU scheduling priority of the userspace thread itself, the
use of workqueues adds (a lot of) latency to the submit path.

When CPU is busy with enough backround load this translates to severe latency
spikes measured as time between userspace submitting work and GPU actually being
given that work to execute.

With the panthor workqueue upgraded to use WQ_HIGHPRI and varying the CPU
priority of the submit thread, the test program from
https://gitlab.freedesktop.org/panfrost/linux/-/work_items/49 reproduces these
kind of latencies:

         .    N    RT
    M   27   28    32
  95%  163  246   809
  98%  924  991  1882

Legend:

   M = Median submit latency in us
 95% = Percentile latency in us

   . = Userspace submit thread SCHED_OTHER
   N = -||= nice -1
  RT = -||- FIFO 1

Upgrading the panthor workqueues so that the realtime GPU priority queue uses
WQ_RTPRI, submit latency becomes completely controlled with the median of 14us
and 95 and 98-th percentiles at 23us and 25us respectively.

Important to note is that VK_QUEUE_GLOBAL_PRIORITY_REALTIME already required
the userspace to have CAP_SYS_NICE, meaning access to real-time workqueues is
effectively also guared behind this capability. The implementation of WQ_RTPRI
itself also adds some limites on the maximum number of worker threads in order
to prevent scheduling starvation.

v2:
 * See patch 1 changelog.

v3:
 * See patch 1 changelog + apologies for v3 following so quickly after v2.
   I have found a race condition as I expanded the testing to a second platform.

Tvrtko Ursulin (2):
  workqueue: Add support for real-time workers
  drm/panthor: Create per queue priority workqueues

 drivers/gpu/drm/panthor/panthor_sched.c |  38 +++++-
 include/linux/workqueue.h               |  23 +++-
 kernel/workqueue.c                      | 152 ++++++++++++++++++------
 3 files changed, 168 insertions(+), 45 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-17 10:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  9:02 [RFC v3 0/2] Realtime workqueues and panthor realtime submission Tvrtko Ursulin
2026-07-17  9:02 ` [RFC v3 1/2] workqueue: Add support for real-time workers Tvrtko Ursulin
2026-07-17  9:17   ` sashiko-bot
2026-07-17 10:06   ` Tvrtko Ursulin
2026-07-17  9:02 ` [RFC v3 2/2] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
2026-07-17  9:24   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.