Skip to content

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 into
integration/aurorafrom
gpu/agx-stats-unsupported-20261107
Nov 6, 2026
Merged

RyanTheTide merged 7 commits into
integration/aurorafrom
gpu/agx-stats-unsupported-20261107

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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)

  • All existing agx_stats keys keep their format and order (512 byte-identical C formatter fixtures against the old formatter).
  • New key appended last: requested_frequency_hz, the nominal OPP frequency of the pstate printed in the same read, looked up in the driver's own parsed operating-points-v2 table in firmware order. unsupported for an index with no table entry. It is not an achieved clock.

G16S (M4 Pro, V25G83) and G17P (A18 Pro, V26A428); qualified snapshot

  • pstate_status now reads unsupported for 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", so unavailable keeps its meaning (no qualified sample in this epoch) on any firmware that does emit the record.
  • The status words are 0 unavailable, 1 valid, 2 stale, 3 unsupported; the C formatter maps them one to one. The earlier branch commit printed unsupported for any status 0, which also relabelled invalid selectors and backwards timestamps; that is replaced.
  • Utilisation keeps its valid/stale/unavailable states. requested_frequency_hz, achieved_frequency_hz, busy_ns, power_mw, temperature_raw stay unsupported (no qualified field).
  • From the t-4177 branch: the power-epoch boundary now discards only the records already queued at the boundary (per-role producer cutoff) instead of the whole next drain, and firmware_reports debugfs reads no longer invalidate telemetry.
  • Documentation/ABI/testing/sysfs-driver-asahi-agx-stats documents the four statuses and that unsupported is a fixed firmware property.
  • Utilisation no longer reads stale between on-time deliveries. V25G83 produces a tag 0x13 record every 8 ms, but the host receives them three at a time: the newest one arrives every 24.0 ms under steady load (p50 23.9, p90 24.0, max 24.1 ms). The age limit was 16 ms from receipt, so the last 8 ms of every interval read stale even 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

  • e80ec76 drm/asahi: export legacy OPP frequency and statistics admission diagnostics (t-4177)
  • a7cbd2e drm/asahi: bound power-epoch discards and keep report reads immutable (t-4177)
  • 69e6172 drm/asahi: report G16S/G17P pstate as unsupported by firmware (t-4177)
  • f1f0bb8 merge of integration/aurora 05ae9bf
  • 96611b3 drm/asahi: report G16S/G17P pstate as unsupported from firmware match data
  • 5099fd9 drm/asahi: g17: age utilisation against the firmware delivery cadence
  • ad59009 merge of integration/aurora 6954114

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_stats sampled every 200 ms.

M1 Pro (G13S, fleet16 baseline)

fleet16  8.81 s: busy_ns=11254437730 jobs=22237 pstate=6 power_mw=22275 util1=100 util2=100 util3=0 util4=100 temperature_raw=26814 temperature_scale=8
m4gt1    8.82 s: busy_ns=8952041137 jobs=22045 pstate=6 power_mw=22049 util1=100 util2=100 util3=0 util4=100 temperature_raw=26778 temperature_scale=8 requested_frequency_hz=1296000000
m4gt1    idle:   ... pstate 0 ... requested_frequency_hz 0

aurora-diag: frequency 1296 MHz requested (pstate 6 ...), matching agx_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)

fleet17 idle:  busy_ns=7234594133 jobs=906 pstate=1 power_mw=0 util1=1 util2=1 util3=1 util4=1 temperature_raw=12141 temperature_scale=3
m4gt1   idle:  busy_ns=153808083 jobs=150 pstate=1 power_mw=0 util1=2 util2=2 util3=1 util4=2 temperature_raw=17607 temperature_scale=6 requested_frequency_hz=444000000
fleet17 8.82 s: busy_ns=18275666431 jobs=14361 pstate=8 power_mw=9873 util1=100 util2=100 util3=0 util4=100 temperature_raw=35376 temperature_scale=8
m4gt1   8.82 s: busy_ns=9054866763 jobs=13771 pstate=8 power_mw=9990 util1=100 util2=100 util3=0 util4=100 temperature_raw=33598 temperature_scale=8 requested_frequency_hz=1398000000

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.ko arm for the same release (one more one-shot boot). Load sampled every 200 ms for 20 s.

fleet17 idle:   utilisation_status stale ... pstate_status unavailable pstate unsupported requested_frequency_hz unsupported ...
m4gt1   idle:   utilisation_status stale ... pstate_status unsupported pstate unsupported requested_frequency_hz unsupported ...
fleet17 8.01 s: utilisation_status=stale util_tiler_percent=unsupported util_renderer_percent=unsupported util_device_percent=unsupported pstate_status=unavailable ...
fleet17 8.21 s: utilisation_status=valid util_tiler_percent=0 util_renderer_percent=100 util_device_percent=100 pstate_status=unavailable ...
m4gt1+fix 8.01 s: utilisation_status=valid util_tiler_percent=0 util_renderer_percent=100 util_device_percent=100 pstate_status=unsupported ...
reads valid during load gpubench fill 1080p d4 glmark2 terrain
fleet17 69 / 101 (first 0.2 s) 82 / 101 (first 0.6 s)
m4gt1 (pstate change only) 73 / 101 (first 0.2 s) 82 / 101 (first 0.4 s)
m4gt1 + delivery fix 100 / 101 (first 0.2 s) 99 / 101 (first 0.2 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 valid 0% instead of stale. pstate_status reads unsupported idle 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 new delivery mutation). 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.
  • KUnit asahi* (arm64 QEMU, LLVM): 201 passed, 1 skipped of 202 (base 200 + 1 skipped of 201; the new test passes).
  • W=1 over drivers/gpu/drm/asahi with the fleet release config: 0 warnings on the test kernel source (with the fix) and on the branch head.

Known, not changed here

G13/G14 busy_ns credits 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

RyanTheTide and others added 7 commits November 1, 2026 03:41
…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]>
@RyanTheTide RyanTheTide changed the title drm/asahi: agx_stats: G13/G14 requested frequency, explicit firmware-unsupported pstate on G16S/G17P drm/asahi: agx_stats: G13/G14 requested frequency, firmware-unsupported pstate and delivery-aware utilisation age on G16S/G17P Nov 6, 2026
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 6, 2026 15:01
@RyanTheTide
RyanTheTide merged commit b452c28 into integration/aurora Nov 6, 2026
@RyanTheTide
RyanTheTide deleted the gpu/agx-stats-unsupported-20261107 branch November 6, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant