Repository navigation
drm/asahi: agx_stats: G13/G14 requested frequency, firmware-unsupported pstate and delivery-aware utilisation age on G16S/G17P - #1037
Merged
RyanTheTide merged 7 commits intoNov 6, 2026
Conversation
…ostics Append requested_frequency_hz from the parsed legacy firmware OPP table, using the same pstate printed by sysfs and preserving existing output. Keep firmware table order and reject invalid indices. Expose per-role/tag transport admission alongside complete statistics records and decoded values, without changing admission or power policy. Exercise production lookups, receiver/report storage and the C formatter, and register the new lookup case in the host runner. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Remember each statistics producer cursor at a power boundary and reject only the prefix already published there. Discarding the entire next drain also loses fresh records queued after the observation, including when the ring was empty. Keep late wake observations conservative, reject live telemetry while powered off, and preserve suspend/restart/quarantine rules. Stop firmware_reports reads from invalidating telemetry and arming discards. Use an immutable firmware borrow, and append the observed power state and per-role cutoff to the admission diagnostic. Exercise complete histogram/transition payloads without treating their unqualified words as pstate, both role cutoffs at wrap, late wake and bad producers, and repeated production debugfs reads. Add controls for bypassed cutoffs and the old whole-batch discard. The qualified logical pstate ABI remains tag 0x10 word 6; no other tag or enable is established by the SPEC. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The V25G83 (G16S) and V26A428 (G17P) firmwares accept statistics tag 0x10 but never emit it, and no other record carries the current GPU pstate: tag 0x1b is a boost-controller distribution, not a live pstate. Raw Neo captures confirm it: no tag 0x10 in 120 report snapshots across idle, wake and load, with nothing discarded or quarantined. pstate_status therefore read "unavailable" forever on these machines, which suggests a transient state. Report it as "unsupported" when no pstate has ever been decoded. A firmware that does send tag 0x10 still reports valid or stale, and the requested and achieved frequency keys remain unsupported. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Bring the t-4177 telemetry work (legacy OPP frequency, admission diagnostics, bounded power-epoch discards) up to date with integration/aurora 05ae9bf. Signed-off-by: Ryan Murray <[email protected]>
… data The V25G83 (G16S) and V26A428 (G17P) firmwares accept statistics tag 0x10 but never emit it, and no other record carries the current GPU pstate. The previous change printed "unsupported" whenever the decoded pstate status was 0, which also relabelled real "unavailable" states (no sample yet in the epoch, an invalid selector, a backwards timestamp) on a firmware that does emit the record. Make the capability explicit per firmware instead: g17::stats gains reports_pstate(), false for both current firmware graphs, and the sysfs reader marks pstate with a new status, unsupported (3), from that match data. The decoder and the firmware_reports debugfs view still keep any tag 0x10 that arrives. The C formatter maps the status words one to one again, so unavailable keeps meaning "no qualified sample yet". agx_stats on G16S/G17P now reads "pstate_status unsupported" at every point of the device lifetime, independent of load, power gating, suspend or restart, while utilisation keeps its valid/stale/unavailable states. G13/G14 output is unchanged, including requested_frequency_hz. Document the four status values and their meaning in the ABI file, and extend the host integration test with the per-firmware capability and the formatter output for an unsupported pstate next to valid utilisation. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
On the M4 Pro (V25G83) the firmware produces a utilisation record every 8 ms, but the host receives them three at a time: the newest tag 0x13 record arrives every 24.0 ms under a steady load (p50 23.9, p90 24.0, max 24.1 ms over 10 s of a saturating fill workload). The qualified snapshot ages a sample from its host receive time against a 16 ms limit (two nominal periods), so for the last 8 ms of every delivery interval the newest sample read as stale. On the J616s 27 to 31 percent of agx_stats reads during a 100 percent load said "utilisation_status stale", and aurora-diag reported the busy GPU as idle. A sample is only late once the next delivery is overdue. Give every record of one statistics drain the same receive time (one clock read per non-empty drain instead of one per record), track the receive time of each utilisation delivery in the epoch, and add the shorter of the last two delivery intervals to the age limit. The shorter interval keeps a single long gap from extending the validity of the sample after it, and an epoch boundary forgets the cadence, so the first delivery of an epoch keeps the old 16/32 ms limit. Nothing here is a per-SoC value: the cadence is measured, and the host policy constants are unchanged. The averaging window is unchanged, the debugfs diagnostic shows the two intervals, and the ABI document describes the rule. A KUnit/host case covers batched deliveries, a late delivery, a long gap and an epoch boundary; a ring-level host case checks that one drain is one delivery. A new host-test mutation that uses the longer interval is rejected. The host harness clock is per test thread so that case cannot race others. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
RyanTheTide
marked this pull request as ready for review
November 6, 2026 15:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the t-4177 GPU telemetry work up to date with integration/aurora and makes the G16S/G17P pstate status explicit.
What changes, per generation
G13 / G14 (M1, M1 Pro/Max, M2 family; legacy firmware snapshot)
agx_statskeys keep their format and order (512 byte-identical C formatter fixtures against the old formatter).requested_frequency_hz, the nominal OPP frequency of the pstate printed in the same read, looked up in the driver's own parsedoperating-points-v2table in firmware order.unsupportedfor an index with no table entry. It is not an achieved clock.G16S (M4 Pro, V25G83) and G17P (A18 Pro, V26A428); qualified snapshot
pstate_statusnow readsunsupportedfor the whole device lifetime. These firmwares accept statistics tag 0x10 but never emit it, and no other record carries the live pstate (tag 0x1b is a boost-controller distribution). The status comes from per-firmware match data (g17::stats::reports_pstate(), false for both graphs), not from "no sample seen yet", sounavailablekeeps its meaning (no qualified sample in this epoch) on any firmware that does emit the record.0 unavailable, 1 valid, 2 stale, 3 unsupported; the C formatter maps them one to one. The earlier branch commit printedunsupportedfor any status 0, which also relabelled invalid selectors and backwards timestamps; that is replaced.requested_frequency_hz,achieved_frequency_hz,busy_ns,power_mw,temperature_rawstayunsupported(no qualified field).firmware_reportsdebugfs reads no longer invalidate telemetry.unsupportedis a fixed firmware property.staleeven at 100% load (27-31% of reads on the J616s; aurora-diag then called the busy GPU idle). All records of one drain now share one receive time (one clock read per non-empty drain), and the 16/32 ms host policy is added to the shorter of the last two measured delivery intervals in the epoch. One long gap cannot extend validity, an epoch boundary forgets the cadence, and no per-SoC constant is added.One code path per snapshot type; the only per-firmware differences are match data (
max_age_ns,reports_pstate).About the reported "0/stale for the first ~8 s of load" on the J616s: it did not reproduce on fleet17 or on these kernels (first valid sample 0.2 s into a gpubench load, 0.4-0.6 s into glmark2). What did reproduce on every kernel was the intermittent stale under load described above, which is what made the start of a load look empty; the earlier fleet12 "0% the whole run" report predates the epoch-cutoff change (a7cbd2e) that stops whole drains being discarded. No module parameters, no new Kconfig.
Commits
Hardware
Test kernel
7.3.0-aurora-m4gt1= fleet17 source 2661d71 + the four telemetry commits, fleet17 recipe and config (config identical apart from the release name), own release, one-shot boots, fleet defaults restored and the test kernel removed afterwards. Load:gpubench-vk --test render.heavy --depths 4 --param kind=fill --param res=1080p(silent),agx_statssampled every 200 ms.M1 Pro (G13S, fleet16 baseline)
aurora-diag:
frequency 1296 MHz requested (pstate 6 ...), matchingagx_stats.requested_frequency_hz. Kernel warnings 6 (same set as fleet16), 0 err, SELinux enforcing 0 AVC, 0 failed units, Wi-Fi, Vulkan G13S.M2 (G14G, fleet17 baseline)
Same workload, jobs over the 20 s window 30726 (m4gt1) vs 30744 (fleet17). aurora-diag
1398 MHz requested (pstate 8 ...). Warnings = fleet17 set (8), 0 err, 0 AVC, 0 failed units, Wi-Fi, eDP + DP, Vulkan G14G.J616s (G16S, fleet17 baseline)
Same kernel, plus the delivery-cadence fix loaded as an
aurora.koarm for the same release (one more one-shot boot). Load sampled every 200 ms for 20 s.The one non-valid read in each fixed run is the read taken before the load started. Real idle phases inside the gpubench run now read
valid0% instead ofstale.pstate_statusreadsunsupportedidle and under load.gpubench (median us per submit, 5 x 250 ms): fill 1080p d4 127.8 fleet17 / 127.7 m4gt1 / 128.0 with fix; render.light tri d16 25.8 / 25.4-27.7 / 26.2; compute.light d16 12.0 / 12.2 / 12.0. No change beyond run-to-run noise. Kernel warnings a subset of fleet17's (4-5 vs 6), 0 err, SELinux enforcing 0 AVC, 0 failed units, Wi-Fi, eDP + DP-2, Vulkan G16S. aurora-diag now prints
pstate_status=unsupported.Neo (G17P): not booted (fleet kit only, TID6 hold); the G17P path is the same code and is covered by the host tests below.
Tests
tools/asahi/run-host-tests.py: 193/193 on this head (integration/aurora base 189/189; the extra runs are this branch's telemetry/frequency suites and the newdeliverymutation). The g17 telemetry suite runs 17 production Rust cases (new:current_firmwares_report_pstate_unsupported_and_keep_utilisation,one_drain_is_one_utilisation_delivery,batched_deliveries_stay_valid_until_the_next_one_is_late) plus the C formatter with an unsupported pstate next to valid utilisation; all 10 mutation controls are rejected.asahi*(arm64 QEMU, LLVM): 201 passed, 1 skipped of 202 (base 200 + 1 skipped of 201; the new test passes).Known, not changed here
G13/G14
busy_nscredits the whole idle gap before the first Utilization message after idle at that message's percentage (+2.4 to 2.6 s seen at load start on M1 Pro and M2, before and after this change). Fixing it needs the PowerOn/PowerOff duration units qualified first; tracked separately.🤖 Generated with Claude Code