Skip to content

drm/asahi: g17: run drm_sched submit workqueues at WQ_HIGHPRI - #3391

Merged
DjDeveloperr merged 1 commit into
mainfrom
perf/g17-highpri-sched-wq
Nov 27, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
perf/g17-highpri-sched-wq

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

What: Run G17 drm_sched submit workqueues at WQ_HIGHPRI | WQ_MEM_RECLAIM instead of normal CFS priority.

  • Add OwnedQueue::new_ordered_highpri_reclaim() in rust/kernel/workqueue.rs (WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI with max_active = 1).
  • Use it unconditionally in g17/job.rs::Scheduler::new() while keeping restrict(cluster) gated on creator_cluster_scheduling().

When a G17 command waits on a host fence (such as a query_access compute or a render behind RENDER_DEPTH = 32), drm_sched wakes its ordered submit workqueue to publish the ready job. Under CPU-heavy game workloads (GTA V / BeamNG), normal-priority drm_sched workers wait behind game/Wine threads (14-143 us pub - done wakeup lag) while the GPU sits idle.

Tested:

  • Host tests at cfe3bf649a598: tools/asahi/g17-highpri-sched-wq-tests.py (4/4 pass including 3 mutation traps) and g17-m5-multiqueue-contention (7/7 pass). scripts/checkpatch.pl --strict 0 errors, 0 checks. Local asahi.config build of rust/kernel.o and drivers/gpu/drm/asahi/aurora.o succeeds cleanly.
  • J714s (Apple M5 Pro, G17S B1) same-slot, same-Mesa-kit (inst-A), same-DTB (origin/main DTB, MCC/SLC disabled) A/B (notsws2-rescan vs slot3-direct adding cfe3bf649a598 + inline cross-engine pub + direct staged/compute render over origin/main + #3319 + #3330 + #3380):
    • VK CTS (1.4.7.1): 594/594 executed passed, 0 failures (synchronization2.op.single_queue.barrier.*_read_image_compute*: 412/412; occlusion_query.copy_*: 152/159 + 7 NS; multiview.queries.*: 16/16; synchronization.smoke.*: 12/12; concurrent_queries.*: 2/2).
    • GTA V Enhanced (3024x1964 native, Preset 2 Very High, TAA On, 10 s 24 MHz trace): HOST_WAIT(FR->CO) cut -25.1% (169.1 ms, med 179.7 us -> 126.7 ms, med 162.0 us), GPU busy 92.86% -> 94.72% (+1.86 pp), P4 54.27 -> 55.07 FPS, 0 GPU faults, 0 new kernel errors.
    • BeamNG wcusa (3024x1964): 0 >1 ms GPU-idle blackouts, 0 GPU faults, 0 new kernel errors.

Risk: Two-way door · WQ_HIGHPRI on ordered per-scheduler G17 submit workqueues only, matching the existing WQ_HIGHPRI | WQ_MEM_RECLAIM priority of aurora_g17_events.

Not yet: Isolated single-commit J714s A/B (measured combined in slot3-direct), G17P/G17C/G17D hardware rows, and CI.

When a G17 command cannot publish inline (for example, query-accessing
compute commands host-waiting on a pending timestamp writer, or commands
queued behind a backlog), drm_sched wakes its ordered submit workqueue
after the blocking fence signals. Previously Scheduler::new() either let
drm_sched allocate a default normal-priority ordered workqueue (single-die
M5) or allocated OwnedQueue::new_ordered_reclaim() without WQ_HIGHPRI.
Under heavy game CPU load (GTA V, BeamNG), the normal-priority submit
worker waited 30-140 us in CFS behind userspace threads, letting the GPU
go idle and incur a ~55 us firmware cold-start penalty on top.

Add OwnedQueue::new_ordered_highpri_reclaim() (WQ_MEM_RECLAIM | WQ_HIGHPRI,
preserving highpri across workqueue_restrict()) and use it for G17
scheduler submit queues while keeping cluster restriction gated on
creator_cluster_scheduling().

Add a compiled host test with 3 mutation traps verifying WQ_MEM_RECLAIM,
WQ_HIGHPRI, highpri tracking for workqueue_restrict(), and G17 wiring.

Signed-off-by: DjDeveloperr <[email protected]>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 27, 2026 14:13

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code approved at the reviewed head. The ordered allocator preserves ordering and reclaim flags, while publishing its high-priority attribute to the queue wrapper. The existing creator-cluster condition still controls affinity. I ran the exact-head host harness and it passed. Keep hosted CI, the isolated A/B, and peer evidence as merge gates. The existing game run combines three scheduler changes.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J700 (MacBook Neo, Apple A18 Pro T8140 / G17P B1, second generation) batched kernel verification row at exact head cfe3bf649a5980f2dc838baf79e71f3be31f78e5: PASS (no regression, 0 failures, 0 GPU faults/recoveries).

  • Combined trial tree (7.3.0-neo-g17perf3, commit c13bc246932c):
    • Base: origin/main (cec0503a5a02a79cff2ac0d5051dd5cad932d4cb)
    • Combined PRs tested together in one one-shot boot:
      • #3388 (perf/g17-direct-render-stage-prefixes, head 4d03fcdf4566d0e012eb30c3583553abb07226f6)
      • #3390 (perf/g17-inline-cross-engine-pub, head 6c79a541616a40c7d854ecdf2c3202c9b6b24b4d)
      • #3391 (perf/g17-highpri-sched-wq, head cfe3bf649a5980f2dc838baf79e71f3be31f78e5)
    • All kernel/driver/Rust files merged cleanly onto origin/main with zero conflicts (only adjacent test registrations in tools/asahi/run-host-tests.py were combined).
    • Host tests on the combined tree: python3 tools/asahi/run-host-tests.py --only g17 passed 247/247.
  • Setup & identity:
    • Built with stock 7.3.0-41 config + LOCALVERSION=-neo-g17perf3 (0 build errors).
    • Booted via one-shot grub2-reboot only with a 16-minute fallback timer; default entry remained 7.3.0-41.fc44.aurora.aarch64. System Mesa, stock kernel command line.
    • Verified on boot (4f7dec46): uname -r = 7.3.0-neo-g17perf3, kernel build ID 68549d094454b6372b43d55ed18d9741810e4c71 (MATCH), aurora.ko build ID cbe831860d8ad06e6b910d0ffc10bce90cf9bef8 (MATCH).
  • VK CTS (6 jobs, 37,886 cases in 185 s): 31,611 Pass, 6,275 NotSupported, 0 Fail, 0 recoveries (gate rc 0):
    • dEQP-VK.synchronization2.*_read_image_compute*: 5,100 Pass, 5,806 NotSupported, 0 Fail (10,906 total; NotSupported are exclusive-compute-queue / unsupported feature cases).
    • dEQP-VK.synchronization{,2}.* (basic, smoke, single-queue, timeline semaphore, implicit, none_set_reset, internally synchronized objects, plus all synchronization2.*_read_image_compute*): 31,242 Pass, 6,178 NotSupported, 0 Fail (37,420 total).
    • dEQP-VK.compute.pipeline.basic.*: 79 Pass, 2 NotSupported, 0 Fail.
    • dEQP-VK.api.command_buffers.*: 65 Pass, 66 NotSupported, 0 Fail.
    • dEQP-VK.renderpass{,2}.suballocation.subpass_dependencies.*: 73 Pass, 22 NotSupported, 0 Fail.
    • dEQP-VK.query_pool.occlusion_query.copy_*: 152 Pass, 7 NotSupported, 0 Fail.
  • gpubench-vk (fdf4dd6, system Mesa, 17/17 rows ok, CRCs matched stock 7.3.0-41 pre-boot baseline):
    • render.deferred (tile msaa=4 1080p d1/d2): 5e4130ce (match), GPU 10617.8 / 10535.4 µs (stock 10786.8 / 10568.6 µs).
    • render.postfx (msaa=4 1080p d1/d2): 668d6f0a (match), us/sub 773.2 / 566.0 µs (stock 765.3 / 558.7 µs).
    • render.pass_chain (all_bar d1/d4): 93411763 (match), us/sub 550.5 / 371.3 µs (stock 518.1 / 450.5 µs).
    • render.pass_chain (oq_bar d1/d4): 93411763 (match), us/sub 761.4 / 1587.3 µs (stock 773.2 / 852.3 µs).
    • render.light d1/d8: ok, us/sub 132.2 / 31.1 µs (stock 120.2 / 28.7 µs).
    • compute.heavy (alu d1/d4): ok, us/sub 1351.4 / 1181.1 µs (stock 1382.5 / 1181.1 µs).
    • compute.light d1/d8: ok, us/sub 104.7 / 17.0 µs (stock 102.6 / 15.9 µs).
    • compute.cull_mdi d1/d4: 57276de2 (match), us/sub 9677.4 / 1851.9 µs (stock 5263.2 / 1863.4 µs).
    • sync.signal (compute.light d1): ok, latency p5/med/p95 151.2 / 155.5 / 165.2 µs (stock 137.0 / 143.6 / 152.3 µs).
    • Note: stock 7.3.0-41 predates origin/main (cec0503a5a02a), so this row serves as a combined correctness/CRC/stability verification rather than a merge-base perf A/B.
  • Kernel health & restore:
    • 0 GPU faults/recoveries, 0 MMU faults, 0 WARN/BUG/Oops/lockup/RCU-stall/timeout lines, 0 new kernel error lines, 0 AVC denials, 0 failed units, 0 core dumps.
    • Restored cleanly to stock 7.3.0-41.fc44.aurora.aarch64 (boot e2259760, PMU f701/f702 = 30 00); trial /boot, /lib/modules, BLS entry, and fallback timer removed, stock.sh POST vs PRE diff = 0 bytes.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:rust Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at cfe3bf64: not ready yet

Check Detail
CI at head running running: KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp, KUnit jpeg, KUnit prores
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at cfe3bf64
Conflicts ok none
PR text ok Risk: two-way · WQHIGHPRI on ordered per-scheduler G17 submit workqueues only, matching the existing `WQHIGHPRI

Areas: area:gpu, area:rust

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr
DjDeveloperr merged commit 50a647d into main Nov 27, 2026
26 of 27 checks passed
@DjDeveloperr
DjDeveloperr deleted the perf/g17-highpri-sched-wq branch November 27, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:rust Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant