Repository navigation
Conversation
ApplicationOwner::work() runs a job on a worker and the submitting thread polls the ticket word with fsleep(): every 20 us for the first 2 ms of its wait, every 200 us after that. The wait starts at the spawn, so it includes queueing behind other clients' jobs, and in a desktop session most submissions were in the 200 us regime: they returned 0.10-0.14 ms (up to 0.28 ms) after their job had ended. Let the worker complete a Completion and the caller sleep on it, in 1 s slices so that a long wait (queued behind other clients' jobs and their recovery) does not trip the hung-task detector. The ticket word still carries the outcome, and the worker releases the session lock before the wake-up, since the caller or the next client's worker takes it next. The completion is signalled from a drop guard, so a worker closure that is dropped without running also wakes the caller, which then sees the ticket still running and fails with EIO rather than waiting forever. Measured on a MacBook Pro (M6, J804) from the driver's job phase timestamps, on an earlier base (integration/aurora f5fa539) with the J804 firmware support that is not part of this series, and without the 1 s slices. Not tested on J873. Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wait_job() polls the firmware state every 20 us for the first 2 ms of a job and every 200 us after that. Every full-panel job takes longer than 2 ms (2-10 ms), so its retirement was noticed about 0.14 ms late on average: 7 of 12 sampled long jobs show one extra 230-282 us step between the scheduler's completion and the last retirement condition. Keep the fine interval for the first 20 ms. The retirement conditions also do not become true together: the scheduler's completed count and the stage stamps lead the inner queue counters and the completion masks by 50-150 us, and each sleeping poll added 60-100 us on top. Once the render path's check sees the scheduler completed or the stamps written, re-poll with a 2 us delay instead of sleeping, for at most 200 us, then sleep as before. The retirement condition itself is unchanged. Measured on a MacBook Pro (M6, J804) from the driver's job phase timestamps, on an earlier base (integration/aurora f5fa539) with the J804 firmware support that is not part of this series. Not tested on J873. Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The driver writes trace mask 3 into the GFX status-A word. With it the firmware writes about 59 trace records per render job, 48 of them before the completion event and 2.6-3.0 us apart by their timestamps, and the host copies every one out inside its wait loop. Write 0 instead unless the new aurora.g18_fw_trace parameter is 1, which restores mask 3; g18_graphics_stall_trace=1 still selects 0x203. Retirement uses the event ring and the shared counters, not the trace records. This changes the default on every G18 machine: the trace journal that is dumped on G18_APP_FAIL no longer has firmware trace records unless aurora.g18_fw_trace=1 is set. Measured on a MacBook Pro (M6, J804), on an earlier base (integration/aurora f5fa539) with the J804 firmware support that is not part of this series: with mask 0 no trace records are produced for a render job, and rendering is unaffected. Not tested on J873. Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sithglan
left a comment
There was a problem hiding this comment.
Test report, 2026-11-17: Apple Mac mini M6 (J873g/T8152, board 0x24). PR revision tested: 5dbb3a85205d9f606f155dba7fdfca0484f794bc.
The three original PR patches were applied as clean cherry-picks to the existing working M6 branch (base 805d9fcc6812). The comparison used one rebuilt Image and matching Rust 1.98.1 modules; only the GPU module's three #2109 patches differed. Both sides used installed Mesa 26.3.0~aurora.wip.ac9d556248c-1, all 12 CPUs, fixed client affinity and performance governors (4.788/2.94 GHz).
Median clear+finish timings (median of per-process averages):
| Workload | Control | Patched | Reduction |
|---|---|---|---|
| 64x64, five trials | 0.441 ms | 0.343 ms | 22.2% |
| 2048x2048, five trials | 0.597 ms | 0.492 ms | 17.6% |
| Two concurrent 2048x2048 clients, three pairs | 1.4145 ms | 1.2445 ms | 12.0% |
Exact triangle readbacks passed at 64/256/1024/2048. Captured logs showed no new GPU failure/recovery, DART fault, WARN/Oops or SError. Separate 20-second 4K60 OpenGL playback samples recorded 0 dropped frames for control and 2 for patched, with 0 delayed in both; these single samples do not establish a statistically significant playback change.
Initial controls with one online CPU or mismatched governors were excluded. The valid control's governors were checked before and after. Both sides shared #2110 and #2112 plus the latter's sleep prerequisite. This was a matched GPU-module comparison on the working M6 branch, not a pristine upstream-base boot.
Limits: microbenchmark results, not a general application-speed claim. Forced fault/recovery, waits beyond 1 s and the firmware-trace override were not tested. The original boot files were restored and their checksums verified after testing.
|
Thanks for the J804 GPU work and for keeping the firmware trace switchable. One part doesn't match how we usually do it. Could the retire move onto the completion event, even as a first step for this stage? If something about the current G18 bring-up makes that impossible, a comment explaining why would cover it. We can run no-regression rows on our other GPUs if the change touches shared code. |
Summary
These are three host-side latency fixes in the G18 job path. They change no firmware interface and are not J804-specific. They were measured on a MacBook Pro (M6, J804).
ApplicationOwner::work()polled the worker's ticket withfsleep(): 20 us for 2 ms, then 200 us. The caller now sleeps on aCompletionthat the worker completes from a drop guard, after storing the outcome and releasing the session lock. It sleeps in 1 s slices (wait_for_completion_timeout()in a loop), so a long wait behind other clients' jobs and their recovery does not trip the hung-task detector. A closure dropped without running still wakes the caller, which then fails with EIO.wait_job()keeps the fine 20 us interval for 20 ms instead of 2 ms, because full-panel jobs take 2-10 ms. Once the scheduler's completed count or the stage stamps show the job finished, it re-polls with a 2 us delay for at most 200 us instead of sleeping. The retirement condition is unchanged.aurora.g18_fw_trace=1restores mask 3.g18_graphics_stall_trace=1still selects 0x203.G18_APP_FAILno longer contains firmware trace records unlessaurora.g18_fw_trace=1is set. Maintainers may flip the default back to 3 if they would rather keep those records by default; the latency gain of this commit then becomes opt-in.Measurements (J804, same Mesa, before -> after all three)
The regression suite passed 33/33, with 0 job failures and 0 recoveries.
Testing
On hardware: MacBook Pro 14-inch (M6, J804), 2026-11-16, tested by LiamRay11.
bf423bf0ewith all nine J804 linux PRs merged (t8152-mailboxes, dart-gen3, dt-board, centauri, g18-fast-retire, cfg80211-stale-scan, smc, cs42l84-jack, and an NVMe PR that is not sent yet), plus retest-only device-tree changes that are not part of these PRs: SSD nodes (ANS mailbox, SART, NVMe), PCIe port 0 with the N1 Wi-Fi, the USB0 gadget console, and aread-onlyNVRAM partition. Those nodes were needed to reach the root filesystem and SSH.systemctl rebootfrom this kernel (watchdog restart) returned to the installed system.Results for this PR: not testable in this retest. The tree has no GPU node, so the G18 driver did not run; on this base the change is build-tested only.
drivers/gpu/drm/asahi/builds with rustc 1.85 and bindgen 0.71, with no warning in the changed files (the 33 crate warnings are in untouched code). It was not built with the CI's Rust 1.96, and the host-tests (tools/asahi, asahi-g15/m4 selftests) were not run locally.integration/aurora has since moved to
677be395b; this branch still merges into it without conflicts.Not included (from the bring-up stack)
g18-builtin: superseded. Upstream no longer calls__module_get()in the G18 boot path.zz-g18-cached-command: superseded by aeee874.Notes
MAINTAINERS has no G18 entry. Please coordinate with the G18 authors before merging, especially on the trace-mask default.
🤖 Generated with Claude Code