Repository navigation
drm/asahi: refresh G16S/G17P utilisation from pending statistics - #1096
Conversation
Consume pending statistics from both firmware roles under the existing device mutex and epoch admission rules, without requiring another event notification. Retain the shared tag-0x13 decoder and keep device percentages separate from per-client fdinfo engine time. Exercise the production reader with queued samples, expiry, zero samples and lifecycle boundaries; add a missing-drain negative control. Document the exact shared-power ABI facts still needed before pstate or frequency can be exported. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The firmware gates the G16S/G17P cores a few milliseconds after the last work completes and emits no utilisation record while they are gated. Every power observation invalidated the readout, so agx_stats reported a stale sample (and "unsupported" values) whenever it was read on an idle or lightly loaded GPU, which is almost always. On the Neo, with or without the statistics drain on reads, utilisation was valid only under sustained glmark2 load and stale at idle and under short bursts, although the firmware delivered and the driver admitted every tag 0x13 record. A power gate still ends the averaging epoch, but the last sample now stays valid until it ages out, and the gated GPU then reads as a valid zero for every utilisation value. A wake starts a new epoch that stays stale until its first record. Suspend, recovery, restart and quarantine remain stale, never idle. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
|
Hardware run on the Neo (J700, G17P, firmware 26A428). One-shot test kernel 7.3.0-aurora-gpux1 = fleet23 (810b92c) + this branch at c977cb3 + linux#1065 + linux#1146. SELinux enforcing, 0 AVC, 0 failed units.
Pushed 7a1effc on this branch: drm/asahi: g17: read a power-gated GPU as idle, not stale.
The hardware re-run of the idle-zero / load / idle acceptance on a gpux2 kernel follows. pstate/frequency (stage 2) is filed as Daybreak t-5591. |
|
J616s hardware check of this PR + 7a1effc ("read a power-gated GPU as idle, not stale"), 2026-11-08 05:12 AEDT. One-shot kernel 7.3.0-aurora-gpux2, removed afterwards; same Stage 2 DTB and the same script as the fleet27 comparison.
The power-gate fix closes the idle gap on the J616s (G16S). A few stale samples remain right at transitions. glmark2 build score 7248 vs 7221. Enforcing, 0 AVC, no new kernel warnings. |
|
Neo (G17P) hardware proof for head 7a1effc, 2026-11-08 23:27-23:36. One-shot test kernel 7.3.0-aurora-gputel1 = integration 009c878 + this branch (clean merge 9d335902), compared against the fleet34 default without it. Sampled at 5 Hz.
Host tests on the merged tree: 196/196, dcp 87/0. CI host-tests: green. G16S was proven on the J616s at 05:12 (comment above). It shares this reader, so a J616s re-check is a follow-up and does not block the merge. Data: |
G16S and G17P already share the tag-0x13 decoder, bounded averages and agx_stats formatter, but reads only inspected the cached snapshot, and every GPU power-gate invalidated it. This PR does two things:
stale/unsupportedwhenever the GPU was idle. A gate still ends the averaging epoch; the last sample stays valid until it ages out, then the gated GPU reads as a valid 0 %. A wake is stale until its first record. Suspend, recovery, restart and quarantine stay stale.agx_stats also gains
utilisation_source,utilisation_samplesandutilisation_host_nsdiagnostics. Executable tests of the production reader cover both firmware graphs: queued records without event service, repeated reads, freshness expiry, valid idle zero, gated idle, suspend/resume, power epochs, recovery, crash and detach. A missing-drain mutation fails them. Per-client fdinfo engine nanoseconds stay separate: tag-0x13 percentages have no client identity and cannot become busy_ns or cycles.Scope: utilisation only.
pstate,requested_frequency_hz,achieved_frequency_hzandbusy_nsstayunsupportedon G16S/G17P. The stage 2 layout research found that the available evidence does not match the shipped firmware builds closely enough to read those fields safely; Documentation/gpu/asahi-usage-stats.rst lists what is still missing. No speculative firmware command or module parameter is added. The classic (M1/M2 family) statistics path is untouched: the only sysfs change is inside the qualified-stats formatter that G16S/G17P use.Hardware results
Neo (J700, G17P), 2026-11-08 23:27-23:36. Default fleet34 kernel (without this PR) as baseline, then a one-shot test kernel 7.3.0-aurora-gputel1 = integration 009c878 (fleet33) + this branch at 7a1effc, clean merge 9d335902, fleet config.
agx_statssampled at 5 Hz, load = glmark2-es2-gbm offscreen terrain (silent, displays off):J616s (G16S), 2026-11-08 05:12. Same branch at 7a1effc, one-shot test kernel 7.3.0-aurora-gpux2: idle 20/25 valid 0 % (5 stale at the transition), load valid ~100 %, idle after 25/25 valid 0 %. fleet27 without the change: every idle sample stale (details in the comment below). The J616s was not re-run tonight. It uses the same G16S/G17P reader as the Neo, so the Neo proof covers this head; a J616s re-check on the next fleet kernel is a follow-up.
Tests
tools/asahi/run-host-tests.py196/196, apple-dcp selftests 87 ok / 0 not ok. Before the merge:g17-telemetry-tests.rs6/6, Rust part ofg17-telemetry-integration-tests.py20/20.