Skip to content

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

Draft
themartiano wants to merge 1 commit into
aurora-silicon:mainfrom
themartiano:fix/apple-pmp-dark-fast-main
Draft

themartiano wants to merge 1 commit into
aurora-silicon:mainfrom
themartiano:fix/apple-pmp-dark-fast-main

Conversation

@themartiano

Copy link
Copy Markdown
Contributor

What: 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.

Replaces #3267, which was stacked on #2774 and closed automatically when #2774 merged and its branch was deleted (no review on it). Same commit, rebased onto main: the only conflict was a textual one in apple-pmp-hold.h, where #2774's review fixes added the fault-reader helpers at the same spot. Both are kept, unchanged. The 100 ms slow poll, 2 s busy hold and 5 ms fast cadence it relies on are the same on main.

Tested: Host side at 8bbd02c, on main 9177b2d: KUnit apple-pmp-policy 14/14 on arm64 QEMU, including #2774's new fault_disable_origin; with apple_pmp_dark_fast() stubbed to return false, apple_pmp_test_dark_fast fails. test-thermal-policy.py passes (571828 rows). arm64 W=1 LLVM build of drivers/thermal/ (APPLE_PMP_THERMAL=m), 0 warnings. checkpatch --strict clean. Hardware: J713 13-inch M4 Air (fanless, firmware 26.6.2, on AC) with this same diff on top of #2774 rebased onto an older main (before #2774's review fixes), not at this head. Rows below. erikwb also carries it with #2774 on their J713 daily kernel (comment on #3267 and #2774).

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 J713s.

Not yet: a hardware row at this exact head (with #2774's review fixes). ANE-only load, 30 min idle, a deep sleep right after a hot load, a soak on battery, and all-core and GPU-only load on a current kernel (they exist only from an older tree, below). Rows from a Mac with a fan.

Details

J713 rows (J713, fanless, 26.6.2, AC, one run per row):

Row 7.3.0-0.next2 (main ba29027 + 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

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>

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.

1 participant