Repository navigation
drm/asahi: g16: cut the added latency of short and interleaved submits - #4034
DjDeveloperr wants to merge 4 commits into
Conversation
…tion On an idle-to-active submission (!had_flights with a flight published, such as d=1 workloads and sync.signal host after its 200 us spin), submit_locked() previously checked housekeeping_due against the 1 ms HOUSEKEEPING_NS interval and immediately queued poll_now() onto the submitting CPU. Because the new single flight is still executing on the GPU, FAST_POLL_WORK immediately entered poll_step() without retiring anything and ran run_housekeeping() (session.check(), objects.health(), service_power(), auxiliary ring drains) under Shared::state right in the middle of the flight, blocking the incoming EP 0x20 completion and userspace wakeup. Skip the eager housekeeping poll_now() kick when transitioning from idle to active (!had_flights && !flights.is_empty()). submit_locked() already arms the resnap hrtimer (default 100 us, tunable 25-1000 us) and 1-jiffy backup poll, so short d=1 flights complete on EP 0x20 and wake userspace via complete_all() before deferred housekeeping runs. Long flights still service housekeeping on a later poll tick once the 5 ms ACTIVE_HOUSEKEEPING_NS deadline elapses (the first resnap tick can precede that deadline), and active bursts (had_flights) keep the 5 ms ACTIVE_HOUSEKEEPING_NS cadence unchanged. Add a host selftest regression verifying both idle-to-active suppression and idle no-flight housekeeping delivery. Signed-off-by: DjDeveloperr <hey@djdev.me>
…eues can_defer_busy_coalesce() holds a single-queue submission for up to COALESCE_WINDOW_US (18 us) when the queue already has >= 2 commands of that class in flight so consecutive same-class submits fold into one multi-command flight. When the same queue already has active flights of the other engine class (such as single-queue compute/render interleaving in concurrent.cr interleave), the next submit alternates classes and cannot fold, so holding for 18 us only stalls cross-engine overlap. Bypass busy coalescing in can_defer_busy_coalesce() whenever the other engine class is currently active in flights, and extend test-publication.py to cover same-queue interleaved C+R bypass in both directions. Signed-off-by: DjDeveloperr <hey@djdev.me>
G16 logical queues currently allocate their ordered drm_sched submit workqueue with OwnedQueue::new_ordered_reclaim() (normal nice-0 CFS priority) and unconditionally restrict it to the creating CPU's cluster. When a host-signalled or dependency-blocked submission wakes via drm_sched_entity_wakeup() (such as sync.signal host after DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL), the submit kworker competes at normal CFS priority with busy application threads on the same cluster before running SchedJob::run() and ringing the doorbell. Switch Scheduler::new() to OwnedQueue::new_ordered_highpri_reclaim() (WQ_MEM_RECLAIM | WQ_HIGHPRI) and restrict to the creating CPU's cluster only when cluster.weight() > 1, matching g17/job.rs. Raising worker priority reduces contention with normal-priority threads, though scheduler latency remains possible. Add a host selftest regression executing production Scheduler::new() for both multi-CPU and single-CPU cluster topologies. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed 1408ae8. The mixed-flight checks bypass a wait that cannot fold the head job. Idle-to-active submit keeps the completion and timer paths for housekeeping, and the high-priority worker retains cluster affinity where topology permits it. Hardware A/B is pending.
|
J516s (M3 Pro) g16batch row: FAIL (judge exit 1). Except for one CPU-time flag that looks like noise, every failure also happens on base. For this PR: Kernel Same on both arms:
Why the judge says FAIL:
The J516s is back on its stock kernel ( |
|
J516s |
|
Both J516s arms lost the device on the 2.5 s long job. The remaining row at |
J773g (Mac mini M4, T8132, G16G B0)
|
|
The long-job failure in the g16batch row comes from the test, not the driver.
New kit: |
|
Hardware row at head Kit: Boots:
|
|
J773g (Mac mini M4, 27.2) row at head e492e5d: FAIL, so not for merge as is.
|
What: Three small g16 scheduling fixes for short and mixed submits: don't run housekeeping in the middle of a single short job, don't hold back a submit to fold it when the queue alternates compute and render (it cannot fold), and run the submit worker at high priority, as g17 does.
Tested: No hardware run at the head of this PR; an earlier combined run is in Evidence. Local checks at
1408ae85c1c4: arm64 W=1 build ofdrivers/gpu/drm/asahi(clang) with the same warnings as main,run-host-tests.py --only asahi-m41/1 and--only g162/2, checkpatch --strict clean.Risk: two-way · M4 (T8132) and M3 (T8122, T6030), which share the g16 backend
Not yet: J773g and J516s base/head ABBA at the head of this PR:
sync.signalhost d1,concurrent.crinterleave d4,compute.lightandrender.lightd1 to d16,idle.wake, plus GPU clock and temperature limits under a long single job (housekeeping also runs the GPU power service) and one s2idle. No performance gain is claimed until that ABBA is in.Details
submit_locked()queued an immediate poll when housekeeping was due. The job was still running, so the poll retired nothing and ran housekeeping underShared::statewhile the completion was arriving. The resnap timer and the 1-jiffy backup poll are already armed, so housekeeping now waits for them.can_defer_busy_coalesce()holds a single-queue submit for up to 18 µs so the next one can fold into the same flight. When that queue also has work of the other engine in flight, the next submit alternates and cannot fold, so it is no longer held. The function already requires every active flight to belong to the same queue, so another process's work never turns folding off.drm_schedsubmit workqueue becomesWQ_HIGHPRI, and it is pinned to the creating CPU's cluster only when that cluster has more than one CPU.Evidence
Hardware, supporting only: J773g, gpubench
7a0dfcf8. Stock kernelefed1ae377baon 12-01 (Mesadfc5b9016749), against the 16-commit tree53599499071aas a module on kernel6c83a2a64539on 12-02. These are different boots and base kernels, and the stack holds other changes, so this is not an A/B of this PR. All CRCs were valid.sync.signalhost d1, latencyconcurrent.crinterleave d4Host tests: the idle-to-active housekeeping rule and the idle delivery, the interleaved bypass in both directions, and
Scheduler::new()on single-CPU and multi-CPU clusters.Checks ran on main
d1ae4f292b93plus this branch.