Skip to content

drm/asahi: g16: Log cooling decisions at debug, ceiling edges at info - #2744

Draft
RyanTheTide wants to merge 6 commits into
mainfrom
j713/g16-cooling-log-edges
Draft

RyanTheTide wants to merge 6 commits into
mainfrom
j713/g16-cooling-log-edges

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

G16 logs every change of its cooling decision at info level (M4 cooling: sample_ns=... limit=S<n>). On a fanless M4 Air under sustained GPU load the governor, budget and backstop move several times a second. During a 97-104 C desktop load on the J713 that was up to 82 lines in 10 s, which pushes older lines out of the kernel log buffer within minutes. Every boot also writes about 15 of them while the startup hold lets go.

Change

The full decision line moves to dev_dbg. At info level, G16 logs only the two edges: the ceiling dropping below the board's top state, and coming back to it, with the temperature and the number of decisions in between. The startup hold counts as "below the top", so a normal boot logs one line when it lets go. The cooling policy itself does not change.

Stacked on #2676 (djdev/g16-272 at ed41e08).

Testing

  • make cpu in tools/testing/selftests/drivers/gpu/asahi-m4: 24/24 pass.
  • Builds clean as part of a full J713 kernel (the J713's t4 config) with this commit on top. power.rs is identical between drm/asahi: g16: run the M4 GPU on the macOS 27.2 firmware (26B123) #2676's ed41e08 and the head it was first built on.
  • The log rate in the Problem section is measured on the J713 default (t4) during a GNOME + 3D + video load.

Still to run

  • A J713 boot with this change: check one info line at the end of the startup hold, and only edge lines under a heat row. It will ride the next J713 default candidate build.
Measurement

M4 cooling lines per 10 s in the soak's kernel log (t4, die hotspot 97-104 C): 5, 54, 72, 82, 58, 4, 14. Ceiling values seen in those lines: S1 28, S2 24, S3 14, S4 19, S5 19, S6 44, S7 58, S8 61, S9 22.

DjDeveloperr and others added 6 commits November 21, 2026 13:01
Rename the retained-session predicate to apple_pmp_t8132_retained_board()
and detect the retained T8132 PMP power-vote bridge from the device tree's
own `pmp` node (`apple,t8132-pmp-v2`, available, `apple,tunable-soc-device`
present) rather than gating on a board list, root SoC compatible, or OS
firmware version string. Keep apple_pmp_j713_board() as an inline alias
for existing callers.

Signed-off-by: Diljit Singh <hey@djdev.me>
… and run to top p-state

Admit the J773g 25G83 firmware images, including the boot-filled B000
ranges zeroed before digest verification, and cover them in fwid.rs unit
tests.

Derive the firmware DVFS table row count (10-row 6-pair vs 11-row
5-pair+top) directly from the preserved ADT performance-state table
rather than gating on a board compatible, and let the utilization
governor, cooling ceiling, and reported p-state bound run up to the
board table's top state (S10 on 11-row tables).

Signed-off-by: Diljit Singh <hey@djdev.me>
… PB heap, and close VM caches

Carry the G16 parameter-buffer and compute-pipelining updates needed
under the 26B123 runtime:
- unconditionally reuse a pass slot's retired PB epoch for the same VM
  and binding (no runtime toggle or mutable debugfs);
- keep compute commands in flight on dedicated per-unit UMA slots;
- share one 64 MiB PB heap per VM across render allocators, sizing the
  PB manager descriptor fields to the actual backed heap_blocks rather
  than hardcoding 256 MiB, and recycle never-exposed spare epochs;
- let closed VMs release arenas while slot leases retain only their own
  backing, and drain spare epochs in both Registry::prune() and
  Gpu::vm_closed() to break the Cache -> Arc<VmState> cycle;
- avoid redundant submit-path publication while a render is active.

Signed-off-by: Diljit Singh <hey@djdev.me>
… idle power-off

Support the 26B123 G16 GPU firmware (also shipped in 26B131) while
leaving 25G83 byte-for-byte unchanged. Firmware selection keys strictly
on the boot loader's handoff fields and loaded TEXT digest, failing
closed on unknown builds.

Firmware layout, ABI, and ADT derivation:
- Add V25G83/V26B123 layout tables for InitData, device-control opcodes,
  queue info, and TA/FS/compute work records, with compile-time
  layout_fits() bounds and collision checks.
- Set POWER_PERFORMANCE +0xa4 = 1 (required power-up state selector)
  with no undocumented static InitData policy words.
- Derive 26B123 power sampling (+4/+8, +0x2b48/+0x2bbc/+0x2c10) and the
  average-power IIR filter (+0x29e4..+0x29f8) from /arm-io/sgx
  gpu-pwr-sample-period-aic-clks, CNTFRQ_EL0, and /arm-io/pmgr/clpc
  cpu-avg-limiter-input-tc; derive the low-peak (PPM) limiter filter and
  PI gains (+0xa80..+0xae0) from cpu-lowpeak-limiter-{input-tc,ki,kp}
  and gpu-power-sample-period (65536.0 PI integrator clamp at +0xaa8).
  Fail closed with EINVAL when any required ADT property is missing or 0.
- Read coredump-copy-buffer from /arm-io/gfx-asc/iop-gfx-nub in the
  preserved ADT to size InitData MAIN +0xfa8 and the 26B123 host
  crash-log buffer (failing closed when absent or invalid).

Start, idle power-off, and runtime:
- Admit 26B123 firmware-owned page tables and perform the PPL magic
  handshake, clearing handoff +8 before RUN and returning ETIMEDOUT if
  the firmware answer does not arrive.
- Start 26B123 without a PMP AGX vote (enabling GFXCAXI2AF and leaving
  loaded DATA to the firmware), hand over the host crash-log buffer
  before AP power-on, and run the standard boot NOP + IMPORT_GLOBALS +
  START sequence while accepting a pending InitData scheduler request.
- Publish the RETENTION table at RUNTIME +0x2c8 (leaving MAIN +0xfa0
  zero) so 26B123 can power the GPU down when idle, and guard all SGX
  MMIO reads/writes (engine busy/fault state, pstate(), and runtime
  set_generation()) inside Session::while_powered() under the PPL lock.
- Attempt all three Globals ceiling selectors without short-circuiting
  in floor_power() at fail-stop, drain all receive rings per pass, read
  the 26B123 queue-info busy flag at +0x54, read compute work ticks from
  compute::Layout::work_ticks with a tear-free hi/lo/hi loop, and check
  the session once per poll pass plus before publish_checked().

Signed-off-by: Diljit Singh <hey@djdev.me>
… tests

Add check-abi-26b123.rs and test-abi-26b123.py to verify 26B123 layout
selection, compile-time policy collision guards, and exact byte-for-byte
InitData/work/queue encoding parity against independent per-field offset
tables.

Extend test-perf.py for ADT power-sampling, low-peak limiter, and
coredump-copy-buffer parsing; extend test-vm.py for 26B123 firmware page
tables, +8 clear before RUN, and ETIMEDOUT on missing magic answer; and
update the remaining host suites for the 26B123 ABI and compute work
tick layout.

Signed-off-by: Diljit Singh <hey@djdev.me>
service_power() logs every change of the cooling decision (governor,
budget, backstop, sensor error, ceiling) with dev_info. Under sustained
heat those inputs move several times a second. On the J713 (M4 Air,
fanless) a desktop load at 97-104 C wrote up to 82 such lines in 10 s,
enough to push older lines out of the kernel log buffer within minutes,
and every boot writes about 15 while the startup hold lets go.

Keep the full decision at dev_dbg. The info log gets only the two edges
a user cares about: the ceiling dropping below the board's top state,
and coming back to it, with the temperature and the number of decisions
in between. The startup hold counts as below the top, so a normal boot
logs one line when it lets go.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

This waits on #2676, which is still a draft; it can be folded into it or land right after it. Still needed: a J713 boot row showing one info line when the startup hold lets go and only the ceiling edge lines under a heat load.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Boot half of the J713 row at 5c1fc1f (13-inch M4 Air): the info lines this change leaves on a normal boot with sleeps.

The kernel is 7.3.0-bj713t6+: integration/aurora cacf355 plus the open J713 heads, including #2676 at ed41e08 and this PR at 5c1fc1f. It booted on the default command line (log in our 20261122-j713tips2-t6 trace, warm boot 3).

  • At boot: exactly one info line when the startup hold lets go: M4 cooling: back at the top S9 at 52500 mC after 17 decisions at 22 s. The per-decision lines stay at debug.
  • 3 s2idle cycles: no cooling lines.
  • Every deep wake: one pair of lines, ceiling S1 below the top S9 at ~43000 mC, then back at the top S9 0.3–0.4 s later. The resume starts at the S1 ceiling and returns to the top. The description doesn't mention this pair; it's one edge each way per deep wake, not a stream.

Still to run: the heat half. That means a sustained GNOME + 3D + video load on a kernel with this commit, counting the M4 cooling info lines, so that only ceiling edges show up and not the decisions.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr changed the base branch from djdev/g16-272 to main November 24, 2026 19:07

This branch has not been deployed

No deployments
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.

2 participants