Repository navigation
thermal/drivers/apple-pmp: sample fast while dark and busy - #3927
Draft
themartiano wants to merge 1 commit into
Draft
themartiano wants to merge 1 commit into
themartiano wants to merge 1 commit into
Conversation
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
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.
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 inapple-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-policy14/14 on arm64 QEMU, including #2774's newfault_disable_origin; withapple_pmp_dark_fast()stubbed to return false,apple_pmp_test_dark_fastfails.test-thermal-policy.pypasses (571828 rows). arm64 W=1 LLVM build ofdrivers/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
apple_pmp_dark_fast()inapple-pmp-hold.h: the raw sample is-ENODATAand the CPUs are not idle (thermal/drivers/apple-pmp: ride out idle dark sensors and preserve zone backoff #2774's idle tracker).apple_pmp_sample()ORs it into the fast-poll decision.J713 rows (J713, fanless, 26.6.2, AC, one run per row):
7.3.0-0.next2(main ba29027 + rebased #2774 + this)-61, peak 49.5 C-61, 0 % at minimum, longest dark 4.4 s-61Dark spans are counted with all six records dark, not per record.
Evidence
tools/testing/kunit/kunit.py run --arch=arm64with KUNIT, THERMAL, APPLE_PMP_POLICY_KUNIT_TEST, filterapple-pmp*: 14/14. Withapple_pmp_dark_fast()returning false:apple_pmp_test_dark_fastfails.tools/testing/selftests/drivers/gpu/asahi-m4/test-thermal-policy.py: passed, 571828 rows.make LLVM=1 ARCH=arm64 W=1 drivers/thermal/, our J713 kernel config, APPLE_PMP_THERMAL=m;apple-pmp-thermal.obuilt, 0 warnings.7.3.0-0.next2: main ba29027 plus our open kernel branches, thermal/drivers/apple-pmp: ride out idle dark sensors and preserve zone backoff #2774 rebased, drm/asahi: g16: admit 25G83 on every T8132 Air with one normalized entry #2672, drm/apple: turn framebuffer damage into a commit #2797 and arm64: dts: apple: t8132-j713-j715: DisplayPort alt mode on both USB-C ports #2807. PMP rows fromidle.py,duty.py(no all-core load, stop at 95 C) and the deep-sleep script with a 60 s RTC wake alarm.