Repository navigation
thermal: apple-pmp: no Air power budget on fan-cooled boards - #1971
Conversation
|
Tested on a second J604: the Mac from #1931, with OS firmware 26.6.2 like yours. With this PR the fan runs for the whole load, and P+E holds about 13.7 W where the stock budget allowed 7.7 W. Method as yours: ten shell busy loops after 120 s idle, held for 180 s, sampled at about 1 Hz from sysfs and the
This fixes what I reported in #1931 on this Mac. I'll close that issue once this lands. Disclosure: an LLM (Claude) ran these boots and measurements on my Mac and drafted this. I reviewed it and am responsible for it. Assisted-by: LLM |
|
Thanks for the clear write-up and the J604 measurements. In this tree we select behaviour by a hardware property rather than a machine list. The new policy is chosen by Could the "unbudgeted" policy be selected from the device tree instead? For example, it could apply when the SMC hwmon node describes a fan (the J604 one-fan description in #1953 adds exactly that), or when a small If it helps, we can run thermal rows on our fan-cooled M1 Pro and M4 Pro to check that the shared policy code is unchanged there. |
|
The two J604 rows here, yours and the one from #1931, show the budget is what stops the fan. With this PR P+E holds 13.7 W where it was 7.7 W, and the fan keeps running. One request on how the policy is chosen. The reason for dropping the budget is that the machine has a fan the SMC runs on the SoC's heat. That is a property of the hardware, and the device tree already describes it: the fan node under
That keeps the policy tied to what the board has, so it does not grow into a board list as more fan machines run on this driver. The KUnit case does not need to change. |
1df8dfb to
8c9ec70
Compare
|
Updated in 8c9ec70: On the current T8132 DTs that selects the J604, J623 and J624, and also the J773g. You mentioned the J773g has no fan node yet, but Re-tested on the J604 at this head; the PR description has the full table. The boot log shows the DT selection ("no power budget (fan cooled; rail faults still restrict)"). Under ten busy loops, P+E held 16.4 W at 60-180 s (stock: 7.7 W) and 17.4 W at 5-15 min, with the fan reaching 5970 rpm and never stopping. CPU+GPU for 180 s gave P+E 12.7 W and GPU 5.2 W with no errors. KUnit The M1 Pro and M4 Pro won't reach this code, since |
|
Thanks for 8c9ec70, and for the correction about the J773g: |
|
integration/aurora 110861f still applies the fanless budget on every T8132 board, so this is still needed. 8c9ec70 applies cleanly to 110861f. The fan selection by an available SMC hwmon child with Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. |
|
@DjDeveloperr, about the overlap with #2533 (cf45097): both drop the shared rail budget when an available SMC hwmon child describes a fan. A proposal so only one carries it: this PR lands the selection on its own (one commit, J604 rows on this head, accepted on the code), and #2533 rebases onto it and keeps what goes further as its own commit: the hwmon report timestamp for long dark spans, and no restriction on a missing or slow SMC rail read. I'll test that commit on the J604 once it's up. If you'd rather carry it all in #2533, I'll close this one and post the J604 rows there. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at 8c9ec708574a24fd9584dd9437de89cd15ec4a77 against integration/aurora (70a00e583b03):
Switching from of_machine_is_compatible("apple,j604") to DT fan discovery is the right direction, KUnit apple-pmp-policy (8/8) and CI host-tests are green, and the two J604 thermal rows show clear improvement while keeping the die guard intact. However, there are hard blockers before this can merge:
- §4 Clean-room & attribution — BLOCKER (hard): Commit
8c9ec708574acontains a forbidden AI trailer inside the commit message:Commits must carry human identity and humanAssisted-by: LLM Signed-off-by: Friedrich <[email protected]>Signed-off-by:only (zeroAssisted-by:or other AI trailers in commits; keepAssisted-by:at the end of the PR body only). - Code defect in
apple_pmp_unbudgeted()— BLOCKER:of_find_compatible_node(NULL, NULL, "apple,smc-hwmon")returns the first matching node even if itsstatusis"disabled", andfor_each_available_child_of_node_scoped(hwmon, child)only checks the child's ownstatus, not its parent's. If anapple,smc-hwmonnode is disabled in DT, this would falsely disable the power budget. Iterate compatible nodes and requireof_device_is_available(hwmon)before inspecting children. - Dark-sensor interaction & overlap with #2533 — COORDINATION BLOCKER: On current
integration/aurora(with1a925b273afdaand96ea511e2cd79),apple_pmp_power_work()skipsapple_pmp_power_sample()while die sensors are dark (-ENODATA). A dark span > 2 s therefore hitsgap = dt > 2000000000ULL->apple_pmp_power_fail()on the next non-dark sample, clamping P/E/GPU to level 8 and recovering 1 step/s (~24 s) even on a fan-cooled board under this patch. Open PR #2533 (cf450974db28) overlaps and directly conflicts ondrivers/thermal/apple-pmp-thermal.cwhile also checkingof_device_is_available(hwmon)and handling dark-span hwmon timestamps + non-restricting rail reads on fan-cooled boards. Sequencing between #1971 and #2533 needs to be settled before either lands so only one carries the fan-cooled budget policy. - §1 / §5 Evidence (default, high bar): The two J604 rows are thorough, but this head now also enables the unbudgeted path on J773g, J623, and J624 (
hwmon-mini.dtsi/hwmon-fan-dual.dtsi->apple,fan-maximum). Still missing: (1) a regression run line (0 SELinux denials, 0 failed units, 0 new kernel errors), and (2) at least one validation row on another affected T8132 board (J773g/J623/J624) or a fanless Air (J713/J715) no-regression check. - §2 / §3 / §6: No cmdline/module-param hacks (§2 PASS), die guard and critical shutdown remain intact (§3 PASS), naming is clean (§6 PASS).
Assisted-by: LLM (Gemini 4 Neon)
The T8132 PMP thermal driver runs one policy on every M4 Mac on the firmware path: the die guard (cooling from 106 C, target 110 C, full protection 115 C, shutdown after three samples at 120 C) plus the fanless MacBook Air's measured-rail energy budget, a 600 J burst at up to 20 W, then 8 W regulated toward an 85 C filtered die with a 4 W floor. On a Mac with a fan that budget defeats the fan, whose speed the SMC appears to set from the heat the SoC makes. On the J604 (MacBook Pro 14-inch, M4), with ten busy loops for 180 s on Aurora's linux-aurora 7.3.0.aurora1-37 package, the burst ran out after 53 s, the P and E rails (PP0b + PPbb) fell from up to 22.7 W to 5-12 W, the heatpipe power (PHPC) from up to 28 W to 8-17 W, and 19 s later the SMC set the fan target to 0 for the rest of the load. macOS 27.2 on the same Mac, same load: the fan ramps from 2500 rpm to its 6550 rpm maximum and never stops. Drop the budget on every board whose device tree describes a fan: an available child with apple,fan-maximum under an available apple,smc-hwmon node. On the current T8132 device trees that is the J604, the J623 and J624 (iMac) and the J773g (Mac mini); the J713 and J715 (Air) have no fan node and keep the budget. The die guard stays on every board: the rails are still read and reported, a rail fault or a telemetry gap still selects full protection and recovers one step per second, but sustained power no longer restricts. While every die sensor is dark (-ENODATA) during idle and the SMC rails are read cleanly, unbudgeted boards have no temperature-driven energy bucket, so keep the sample timestamp and hwmon rail sum current instead of letting a >2 s dark span trigger the gap fault clamp on wake. The GPU still gets full protection while the sensors are dark, a genuine >2 s telemetry gap still fails closed, and any prior fault remains latched until valid die samples confirm recovery. Signed-off-by: Friedrich <[email protected]>
8c9ec70 to
d3735de
Compare
|
Updated to
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH at d3735de5963f
Blockers:
- Required CI at
d3735de5963fis still pending (kunitandhost-testsin_progress;readiness / readinessand latestpr-text / pr-textqueued); wait for all checks to finish green before approving and merging. - The
Tested:line cites pre-signoff commit7c7190fa7adfrather than literal headd3735de5963f(the tree52a42414b9f3is identical and onlySigned-off-by:changed; please cited3735de5963fexplicitly inTested:so the exact-head SHA match is unambiguous).
Checked: Full diff (drivers/thermal/apple-pmp-thermal.c, include/linux/soc/apple/pmp-power-policy.h, drivers/thermal/apple-pmp-policy-test.c), T8132 DT fan nodes, prior review findings, and pre-PR checklist §1–§6. Code is clean and all prior code, safety, dark-sensor, and commit-metadata blockers are resolved.
Evidence
- §1 No model gating: PASS —
apple_pmp_unbudgeted()iteratesfor_each_compatible_node_scoped(hwmon, NULL, "apple,smc-hwmon"), checksof_device_is_available(hwmon), and inspectsfor_each_available_child_of_node_scoped(hwmon, child)forapple,fan-maximum. Verified against current T8132 DTs: selects J604 (hwmon-fan.dtsi), J623/J624 (hwmon-fan-dual.dtsi), and J773g (hwmon-mini.dtsi->hwmon-fan.dtsi); leaves J713/J715 Airs budgeted. - §2 Production-ready: PASS — default kernel command line, no new writable module parameters (
power_statusremains read-only0400with additivebudget=%d), no magic delays or races. - §3 Safety: PASS — die guard (106 C cooling, 110 C target, 115 C full protection, 3x >=120 C critical shutdown) is unchanged.
apple_pmp_power_dark()keepslast_nsandtotal_mwfresh on unbudgeted boards only during clean-ENODATAdark spans with valid SMC rail reads, while keeping GPU dark protection (apple_pmp_gpu_publish(..., 8, 0)), fail-closed on genuine >2 s gaps or SMC read errors, latched faults until 3 valid die samples confirm recovery, and a strict no-op on fanless Airs. Extractedapple_pmp_power_release()preserves identical Air arithmetic. Covered by KUnitapple_pmp_test_unbudgetedandapple_pmp_test_unbudgeted_dark. - §4 Clean-room & commits: PASS — commit
d3735de5963fcarries human author/committer (Friedrich) and humanSigned-off-by:only, with no prohibited trailers in the commit, PR title, PR body, or diff, and no copyrighted Apple material. - §5 Evidence & CI: J604 180 s load, 30 s idle, and regression check (0 failed units, 0 thermal/telemetry errors, 0 new kernel errors) are recorded for identical tree
7c7190fa7adf(d3735de5963fadds onlySigned-off-by:). Live CI ond3735de5963f:kunitin_progress,host-testsin_progress,pr-text / pr-textpriorsuccess/ latestqueued,readiness / readinessqueued. - §6 Naming: PASS — uses
aura, no legacy naming issues. - Non-blocking: Landing #1971 first and rebasing #2533 onto it is clean (#2533 is still held on the J773g 10GbE cluster-mask setup failure); an owner-run J773g/J623/J624 or J713/J715 Air row remains welcome when available.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at d3735de5963f
Blockers: none
Checked: Required CI at d3735de5963f (kunit, host-tests, pr-text) is now green. Full diff, die-guard/dark-sensor safety, DT fan-child selection, KUnit tests, commit DCO/clean-room metadata, and J604 180 s load / 30 s idle / regression proof on byte-identical tree 52a42414b9f3 (d3735de5963f adds only Signed-off-by:) are all verified.
Evidence
- CI on
d3735de5963f:kunitPASS,host-testsPASS,pr-textPASS (readinessskipped on fork). - Hardware & safety: J604 (M4) 180 s load (15.30 W mean, fan 2500 -> 3825 rpm, die max 109 C) and 30 s idle (0 faults, 0 failed units, 0 new kernel errors) on identical tree
52a42414b9f3; Air path unchanged; fail-closed on >2 s gaps / SMC errors. - Follow-up: #2533 can cleanly rebase onto this once merged.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Resolve conflicts with merged #2676 and #1971: - Keep main's apple_pmp_t8132_retained_board() check (including apple,tunable-soc-device) in include/linux/soc/apple/pmp-display.h. - Keep #1971's unbudgeted fan-cooled power policy (apple_pmp_unbudgeted, apple_pmp_power_init_unbudgeted, apple_pmp_power_dark) in drivers/thermal/apple-pmp-thermal.c alongside this branch's topology/cpufreq cluster discovery. - Keep this branch's self-described 27.2 temperature-record lookup in drivers/soc/apple/pmp-telemetry.c. Signed-off-by: Diljit Singh <[email protected]>
On the J604 (MacBook Pro 14-inch, M4),
apple-pmp-thermalapplies the fanless Airs' energy budget: a 600 J burst at up to 20 W, then 8 W regulated toward an 85 °C filtered die, with a 4 W floor. The SMC appears to set the fan speed from the heat the SoC makes, so under a sustained all-core load the budget starves the fan: it stops during the load and the CPU stays at 5.1–12 W (7.7 W mean over 60–180 s). #1931 reports the same on another J604.This PR drops the budget on every board whose device tree describes a fan, and keeps the die guard as it is. A board counts as fan cooled when an available
apple,smc-hwmonnode (for_each_compatible_node_scoped+of_device_is_available) has an available child withapple,fan-maximum. On the current T8132 DTs that is the J604, the J623 and J624, and the J773g; the J713 and J715 keep the budget.Tested: J604 (M4 MacBook Pro 14") at
d3735de5963f(same tree52a42414b9f3as pre-sign7c7190fa7adf): 180 s load 15.30 W mean, fan 2500 -> 3825 rpm (never 0), die max 109 °C; 30 s idle 0 faults; KUnit 9/9; host-tests 460/501 (0 regressions); 0 failed units, 0 new kernel errors.Risk: two-way · fan-cooled T8132 Macs (J604, J623, J624, J773g); fanless Airs (J713, J715) keep the budget unchanged — a plain revert restores the previous policy.
Changes on those boards:
apple_pmp_power_init_unbudgeted(): the rails are still read and reported (power_statusshowsbudget=0, the hwmon sum channel is labelled "CPU/GPU rail sum"). A rail fault or a telemetry gap still selects full protection and recovers one step per second; sustained power never restricts.apple_pmp_power_dark(): while every die sensor is dark (-ENODATA) during idle and the SMC rails are read cleanly, unbudgeted boards have no temperature-driven energy bucket, so the rail sum and sample timestamp stay current instead of letting a >2 s dark span trigger the gap fault clamp on wake. The GPU still receives full protection (apple_pmp_gpu_publish(..., 8, 0)) while sensors are dark, a genuine >2 s telemetry gap still fails closed, any latched fault stays latched until valid die samples confirm recovery, and fanless Airs are untouched.temp-sensorhas the J713's limits: 110 °C target and 125 °C maximum on Ta000m, Te000m, Te001m and Tp000m-Tp002m.apple_pmp_power_release(), shared by both paths; the Airs run the same arithmetic as before.apple_pmp_test_unbudgeted) and dark-sensor spans (apple_pmp_test_unbudgeted_dark: 10 s dark span without clamping on wake, genuine >2 s gap still failing closed, latched fault preserved across dark samples, no-op on budgeted Airs).Coordination with #2533
Open PR #2533 carries a first commit (
cf450974db28) that also drops the shared rail budget on fan-cooled T8132 boards and handles dark-sensor spans indrivers/thermal/apple-pmp-thermal.c(without modifyinginclude/linux/soc/apple/pmp-power-policy.h), so the two PRs directly conflict onapple-pmp-thermal.c. Because #1971 is a single self-contained commit for currently shipping 26.6.2 boards while #2533 is a 9-commit series for macOS 27.2 PMP support, one option is to land #1971 first and have #2533 rebase onto it (keeping only any additional 27.2/SMC-read behavior on top); alternatively, if maintainers prefer carrying the fan-cooled policy in #2533, #1971 (includingapple_pmp_power_dark()) can be closed in favour of #2533 once that path is ready, and the J604 rows below apply there as well.Tested
Current revision (tested tree
7c7190fa7adfonmain7092b1dca9fd; signed PR head adds onlySigned-off-by)J604 (Mac16,1, Linux stub on 26.6.2 OS firmware, Arch/Omarchy, AC, power profile
performance). Kernel:main7092b1dca9fdplus this commit (stock DT with #1888 intact, booted withapple_dart.j713_*stripped via merged #2189; Stage 2:aura 1.0.0b13.1+u-boot aurora11).apple-pmp-thermal: T8132 provisional policy: ... no power budget (fan cooled; rail faults still restrict).power4_labelreadsCPU/GPU rail sum;power_statusreportsbudget=0,sustainable_mw=0,allowed_mw=0,credit_mj=0.-EAGAINerrors,p_level=0,e_level=0,gpu_level=0.zero_target_after_start=0).budget=0throughout.checkpatch.pl --strictclean (0 warnings, 0 checks); W=1 LLVM build ofapple-pmp-thermal.oandapple-pmp-policy-test.oclean (0 warnings); KUnit (kunit.py run --arch=arm64, QEMU):apple-pmp-policy9/9 passed;tools/asahi/run-host-tests.pyin CI Ubuntu 24.04 container: 460/501 passed on tested tree7c7190fa7adf== 460/501 on base7092b1dca9fd(0 regressions).Earlier A/B comparison on the same J604 (v2 vs stock
linux-aurora 7.3.0.aurora1-37and macOS 27.2)Load: ten shell busy loops after two minutes idle, AC,
performanceprofile. "P+E" is PP0b + PPbb, without the GPU rail.-37)8c9ec708)7c7190fa7adftree)gpubench compute.heavy, depth 8, 180 s: P+E 12.7 W, GPU 5.2 W, die mean 104 °C, fan 2500 -> 4860 rpm, never 0; TB0T <= 29.5 °C, TCHP <= 47.2 °C).