Repository navigation
drm/asahi: g17: M5 Pro: find a queue's own compute inputs without the device mutex - #2074
DjDeveloperr wants to merge 1 commit into
Conversation
… device mutex On the M5 Pro a compute input from another compute command becomes a firmware wait when its producer declares a visible completion: the consumer's kick entry names the producer's kick, and the consumer takes a loan on the producer queue's binding. Finding that producer takes the device mutex once per pending source in the submit ioctl, with a recovery-word read and a walk of every compute queue each time, and every compute queue is walked again at publication. Userspace backs same-priority Vulkan queues with one kernel queue, so a semaphore wait between two such queues names earlier work of the consumer's own queue. Every command of a logical queue goes to its one bound queue in submission order, so such a source is either published there ahead of the consumer or still queued ahead of it: by the time the consumer is published, its own sources are published or complete, and the ioctl's publication check and wait have nothing to find. Record the publishing logical queue in each submission. A source of the consumer's own queue skips the publication lookup in the submit ioctl. At publication it is looked for on the consumer's bound queue first. A source found there takes the same checks as one found by the walk (ticket, recovery epoch, cancellation and status), the same kick-entry dependency and binding loan, and the same firmware-consumer mark, so a failed or recovered source fails or replays its consumer as before. A local source not live on that queue takes the walk. Other boards are unchanged. The capacity view counts the local sources found on their own queue (local=). Signed-off-by: Diljit Singh <hey@djdev.me>
|
Early note on this draft (no full review yet):
Assisted-by: LLM (Claude:Opus 5.5) |
|
Not on integration/aurora; the commit (ca9bf84) applies cleanly to 110861f. The open note from the early review stands: the own-queue lookup in g17/runtime.rs checks m5 && source.local, while source.local is already set only when completion_inputs() holds, so the chip check can go and the capability alone decide the path. A full review follows once the draft is ready. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. Host tests (tools/asahi/run-host-tests.py --only) on 110861f plus this change: g17 passes (90/90). |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: REQUEST CHANGES at ca9bf84b
Blockers:
- Branch is
CONFLICTINGwithmain. Rebase/merge currentmainso the PR isMERGEABLEand build/KUnit CI runs cleanly. - Redundant chip gate and missing exact-head hardware verification. As noted on
2026-11-23, the own-queue lookup indrivers/gpu/drm/asahi/g17/runtime.rschecksm5 && source.local, even thoughsource.localis already set only whencompletion_inputs()holds — gate on the capability rather than the chip flag. No exact-head hardware test row has been posted after rebasing ontomain.
Checked:
- Diff (
+88/-23, 7 files),CONFLICTINGagainstmain.
Evidence
- Rebase onto
main, drop the redundantm5check wheresource.localalready encodes the capability, ensure CI passes, and attach an exact-head hardware verification row.
Dismissed under the 12-01 merge bar: this review's blockers were not shown failures (CI/rows/rebase/design or re-run asks). Follow-ups, not blocking: Only diff summary checked; follow-ups: rebase, drop redundant m5 gate for source.local capability, exact-head row
|
Closing as superseded by #3025 (merged 11-25). It moved the M5 submit path's source checks off the device mutex in a more general way: published sources are confirmed lock-free through the per-submission publication snapshot, the mutex is taken once outside the leaf loop only for unconfirmed ones, and same-QID sources drop their explicit barrier at publication. This branch now conflicts with that code in all four g17 files it touches. If the bound-queue-first lookup at publication still shows up in an M5 profile, it can come back as a small PR on top of #3025. |
On the M5 Pro (J714s), userspace backs same-priority Vulkan queues of one device with one kernel queue, so a semaphore wait between two such queues names earlier work of the consumer's own kernel queue. Today each such source takes the device mutex in the submit ioctl (a recovery-word read and a walk of every compute queue) to find its publication, and every compute queue is walked again at publication.
Every command of a logical queue reaches its one bound queue in submission order, so an own-queue source is already published (or complete) when its consumer is published, and the ioctl's publication check and wait have nothing to find. This change:
Submission::origin);source_dependency), the same kick-entry dependency and binding loan, and the same firmware-consumer mark (note_input_consumer), so a failed or recovered source fails or replays its consumer as before. A local source not live on that queue takes the walk.Only boards where explicit waits take the completion class (M5) take the new path; others are unchanged. The capacity view counts the local sources found on their own queue (
local=).Measured on the M5 Pro
Current intg10 kit (4d7e036, carrying #2066's held kick order and #2073's GPU power floor), runtime-switch test form e3593c8 of this change, gpubench 0dae261. Five interleaved, rotated paired rounds per row; two test boots because of deep-sleep priority. Every completed control/change/no-dependency comparison was performed within one boot. Medians of the per-unit medians, us per hop (lower is better):
Occlusion extra time remains below 1 us: depth 1, 0.37 -> -0.37 us (measurement noise around zero); depth 16, 0.36 -> 0.47 us. Zero GPU faults, other failure matches or new kernel lines in either timing segment. Both test turns restored and verified the default.
The current hop gain is smaller than on the earlier intg7-based run (binary 18.24 -> 15.10; timeline 17.85 -> 15.03 us). Those are different boots and kernel bases; they do not isolate the cause of the difference. Current hops still trail the historical macOS reference (~13.1 us, W about 0.69). A separate factorial experiment has now completed on one boot (five rotated paired rounds per row, source 36034c6 on merged integration bf423bf, frozen intg10 Image/DTB). The A patch has the same stable patch-id as this head:
The restored pre-#2066-commit-2 path changes only the held/order transaction; wake reconfiguration and the GPU power floor remain. This isolates a kick-order interaction on the tested boot, while the earlier cross-base comparisons still contain other changes. Zero faults or new kernel lines in this segment, and default restored/verified before release. The old-order arm is a timing diagnostic: these rows do not qualify its post-wake correctness. Even the combined 15.15/15.19 us hops still trail the historical macOS reference (W about 0.87/0.86).
Checks
g17-capacity-fault,g17-growth*,g17-compute-*,g17-unpublished,g17-shared-pool,g17-uninstalled-cleanup,g17-admission-order,g17-pool-release,g17-owner-release-order,g17-resource).One affected round out of three on each side, with the same level-1/full-recovery class also present on control. This matrix establishes no added failure class at this sample size; it does not solve the shared fault or prove absence of a causal effect. On/off safe stress completed 20/20 pass. Every turn restored and verified the default. Frozen source/results were preserved across #2080's later integration merge.
Not yet