Skip to content

thermal/drivers/apple-pmp: sample fast while dark and busy - #3267

Closed
themartiano wants to merge 1 commit into
aurora-silicon:djdev/apple-pmp-thermal-idle-enodatafrom
themartiano:fix/apple-pmp-dark-fast-sampling
Closed

themartiano wants to merge 1 commit into
aurora-silicon:djdev/apple-pmp-thermal-idle-enodatafrom
themartiano:fix/apple-pmp-dark-fast-sampling

Conversation

@themartiano

Copy link
Copy Markdown
Contributor

What: On top of #2774 and relies on it: the base is its branch, so only this commit shows. A light load runs its cluster for only part of each 100 ms slow poll. A load with a matching period can keep every sample in the gated part until the 2 s hold expires, and both clusters then drop to their minimum frequency. This samples at the fast 5 ms cadence while all sensors are dark and the CPUs have work, so a real reading is found before the hold expires. The hold, its caps and every temperature limit stay as they are. An idle machine keeps the slow cadence.

Tested: Host side at 472a67f: arm64 build of drivers/thermal/ (W=1, LLVM 18, Rust 1.99, edge config, APPLE_PMP_THERMAL=m), 0 warnings. KUnit apple-pmp-policy 11/11 on arm64 QEMU; the new apple_pmp_test_dark_fast fails with the helper stubbed out (10/11). Host tests --only pmp 20/22 (the two pmp-agx-vote-tests jobs need setarch, which the build container denies). test-thermal-policy.py passes (571828 rows). checkpatch --strict clean. Hardware: J713 13-inch M4 Air (fanless, 26.6.2, on AC) with this diff, not at 472a67f itself: #2774 conflicts with main, so the kernel (7.3.0-0.next2) was main ba29027 plus #2774 rebased onto it, this commit on top (96fb3e5ede28, same diff), and all our other open branches combined. Result: idle, 0 % of 1200 samples with P or E at minimum, 5 all-dark spans over 2 s (longest 3.3 s), 0 -61; job after 8 s idle (15x) median 87 ms, worst 101 ms; one P and one E core pinned at 20/30/60 %, 0 of 6 clamped, P and E at maximum throughout, peak 80 C, 0 -61; 10 of 10 deep sleeps, 0 kernel errors, 0 failed units.

Risk: two-way · M4 (T8132) Macs that run the PMP sampler: J713, J715, J604, J773g, J623, J624. More 5 ms polls while the sensors are dark and the CPUs are busy; no limit changes.

Other Macs: The sampler only registers under apple,t8132-pmp-v2, so only the M4 Macs above run this code; no other Mac is affected. On the M4 Macs with fans (J604, J773g, J623, J624) the same light-load clamp can happen when the clusters gate, and this helps the same way. It cannot raise a limit or lengthen any time without a reading; dark-and-busy time without one can only get shorter. The cost is 5 ms polls while dark and busy. Rows so far come only from the J713.

Not yet: a row at this exact head. From the J713 rows asked for on #2774: ANE-only load (the ANE does not start on main with the current boot loader), 30 min idle, a deep sleep right after a hot load, a soak on battery, and all-core and GPU-only load on today's kernel (they exist only from an older tree, below). Rows from a Mac with a fan.

Details

J713 rows asked for on #2774, and where they stand (J713, fanless, 26.6.2, AC, one run per row):

Row Today, 7.3.0-0.next2 (main + rebased #2774 + this) Older tree (base + #2699 + #2774 + this, as a module)
Long idle 1200 samples: 0 % at minimum, 5 dark spans over 2 s (longest 3.3 s), 0 -61, peak 49.5 C 150 s: 0 -61, 0 % at minimum, longest dark 4.4 s
Job after 8 s idle (15x) median 87 ms, worst 101 ms median 83 ms, worst 99 ms (stock kernel: 307 / 442 ms)
P and E core pinned at 20/30/60 % 0 of 6 clamped, peak 80 C 0 of 6 (with #2774 alone: 3 of 6)
Sustained all-core not run 300 s soak, peak 109.75 C; 5x (10 s all-core, 3 s idle) peak 108.25 C; no shutdown request
GPU-only not run 60 s 4K, one core busy: peak 81 C, longest all-dark 0.2 s, 0 -61
ANE-only not run: the ANE does not start on main with the current boot loader not run
Deep sleeps 10 of 10 (60 s each), 0 kernel errors not run
Deep sleep right after a hot load not run not run
30 min idle, soak on battery not run not run

Dark spans are counted with all six records dark, not per record.

Evidence

A light load runs its cluster for only part of each 100 ms slow poll
period. A load with a matching period can keep every sample in the gated
part until the 2 s hold expires, and both clusters then go to their
minimum frequency.

Measured on an older tree on a J713 with the idle hold but without this:
3 of 6 loads pinned to one P or E core at 20, 30 and 60 % were clamped
or lost the sensors (P30, E30, E60). With this, 0 of 6.

Sample at the fast cadence while the sensors are dark and the CPUs have
work, so a real reading is found before the hold expires. The hold and
its limits are unchanged, and an idle machine keeps the slow cadence.

Signed-off-by: Eduardo <git@martiano.me>
@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

We carry this PR on top of #2774 in our J713 (M4 Air, T8132) daily kernel.

Even with #2774 in place alongside #3546, light periodic workloads that wake a cluster for only part of each 100 ms slow poll can beat against the poll interval so every sample lands while the cluster is power-gated (-ENODATA) until the 2 s busy hold expires, clamping CPU frequencies to minimum. Switching to the 5 ms fast cadence while sensors are dark and CPUs are busy catches a valid reading before the hold expires.

Running smoothly together with #2774 on our J713 daily kernel without light-load dark-sensor frequency clamps.

@RyanTheTide
RyanTheTide deleted the branch aurora-silicon:djdev/apple-pmp-thermal-idle-enodata December 1, 2026 18:05
@RyanTheTide RyanTheTide closed this Dec 1, 2026
@themartiano

Copy link
Copy Markdown
Contributor Author

Continued on main as #3927 (same commit, rebased onto #2774 as merged; this PR closed when #2774's branch was deleted).

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.

3 participants