Skip to content

thermal: apple-pmp: ride out long 27.2 dark spans while the SoC is idle (J713, stacked on #2533) - #2554

Merged
DjDeveloperr merged 1 commit into
djdev/t8132-pmp-272from
j713/pmp-dark-span-hold
Nov 20, 2026
Merged

DjDeveloperr merged 1 commit into
djdev/t8132-pmp-272from
j713/pmp-dark-span-hold

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Stacked on #2533 (base djdev/t8132-pmp-272). Please review only the last commit; if #2533 merges first this retargets to integration/aurora as one commit.

Problem

On the macOS 27.2 (26B123) firmware, an idle 13" M4 MacBook Air (J713) keeps all six PMP temperature records invalid for much longer than the 2 s hold that was sized from 26.6.2 (0.46 s worst case there). With #2533 the driver finds the 27.2 records, but every dark span past 2 s returns -ENODATA ("sensor error -61"), the CPU caps drop to the minimum OPP and climb back over seconds. Result on the J713 with #2533 alone: 165 x "sensor error -61" in 150 s, scaling_max_freq stuck at 912000 / 900000, cpu0 measured at 900.6 MHz.

Change

thermal: apple-pmp: ride out long dark spans while the SoC is idle: keep the last cool reading (still below the existing APPLE_PMP_GATED_HOLD_MC) for up to 30 s, but only while the SMC's measured P + E + GPU rails, read no more than 1.5 s ago, add up to under 500 mW. A dark cluster is powered down; the SMC rail reading is the independent proof of that. The 2 s hold, the temperature ceiling for any hold, and every other limit are unchanged. Where the rail poller does not run (no SMC rail budget, e.g. the Mac mini after #2533's first commit), idle_rail_ns stays 0 and only the 2 s hold applies, as before.

Testing (J713, Mac16,12, 27.2 stub, aura Stage 2 c0a50c00, kernel = integration 0abc2f3 + linux#2189 + #2205 + #2533 + this)

  • M4 PMP: fan-based rail budget and self-described 27.2 PMP path #2533 alone (boot b5cb7e54): 165 x -61 in 150 s, caps 912000 / 900000.
  • M4 PMP: fan-based rail budget and self-described 27.2 PMP path #2533 + this (boot ccbbbcda): 0 x -61 after the records are located (only the 10 pre-locate -5 at 1.9 s), caps 4464000 / 2892000.
  • Same hold on the earlier record-lookup variant: measured clocks within 1% of every OPP (P 904..4089 MHz, E 888..2883 MHz), all cores loaded P 4443-4450 MHz / E 2872-2884 MHz; 5/5 warm reboots. One -61 during GNOME start in one boot: rails busy, so the idle hold correctly did not apply, safe caps, recovered within seconds.
  • This branch: the driver file is byte-identical to the one that ran (blob 29c8bc2b); make W=1 drivers/thermal/apple-pmp-thermal.o (LLVM, J713 config) clean; checkpatch --strict 0/0/0.

Still to run

  • A thermal soak with the hold (hot idle, sensors dark above the hold ceiling must still fail safe).
  • s2idle round trips with the hold armed (the J713's sleep rung is not qualified yet).
  • Other T8132 machines on 27.2 (J604, J773g) to see whether their dark spans also exceed 2 s.
Measurement detail
  • Dark-span sampling (read-only valid words of the six records at the driver's 100 ms cool cadence, 120 s, idle): 86% of samples all-dark, 53 spans, max 13.3 s. At 5 ms the poller keeps a cluster awake (max 0.75 s), which is why a fast poll hides the problem.
  • Residual seen on 27.2 even under load: tp002m never valid in 120 s; ta000m / te000m valid 2% of samples. Not addressed here.
  • Thresholds: 500 mW is well above the J713's idle P+E+GPU rail total and well below one busy core; 1.5 s stale limit matches the rail poller period with margin; 30 s covers the longest span seen (13.3 s) with margin while still bounding an unexpected dark period.
  • Earlier hardware row with the same patch: M4 PMP: fan-based rail budget and self-described 27.2 PMP path #2533 (comment)
  • Evidence (lab store): traces/power/20261120-j713-pmp-272/ (pr2533-only-kernel.txt, pr2533-hold-kernel.txt, rung1-k1b-out.txt, pmpvalid-idle100ms-k1.txt), warm series traces/boot/20261119-j713/warm-0{1..5}/.

Assisted-by: LLM (Claude:Opus 5.5)

On the 27.2 firmware a cool, idle J713 keeps all six PMP sensors invalid
far longer than the 2 s hold sized from 26.6.2 (0.46 s worst case there):
sampled at the driver's own 100 ms, 86% of samples were all-dark and the
longest span was 13.3 s. Each span past 2 s latches the minimum CPU caps
again, and the recovery climbs back over seconds, so the machine spends
most of its time well below its clocks.

Keep going from the last cool reading for up to 30 s, but only while the
SMC's measured P, E and GPU rails, read within the last 1.5 s, add up to
under 500 mW. A dark cluster is powered down; the rail reading is the
independent proof that nothing is drawing power while the sensors are
dark. The 2 s hold and every other limit are unchanged.

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

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. On thermal safety the hold reads right to me:

  • It only covers a sample where all six records are dark (-ENODATA). If any record is valid, or any other error comes back, the hold is skipped (apple-pmp-thermal.c:442).
  • Only a reading below 90 C (APPLE_PMP_GATED_HOLD_MC) is held, and never for more than 30 s after it was taken.
  • The idle proof is a successful SMC read from the last 1.5 s showing P + E + GPU < 500 mW (:418-423). A failed, all-zero or out-of-range read is never recorded (:200, :235, :242). If the SMC breaks, the proof ages out within 1.5 s and the driver drops back to the 2 s hold and then fails closed, as it does today.
  • Under load the hold ends at the first rail read that shows the load, or at the 1.5 s staleness limit if reads fail. That means CPUs run on a held value for at most 1.5 s, which is shorter than the 2 s blind hold the driver already accepts.
  • Critical shutdown is unaffected: a dark sample never counted toward it, and any held value is below 90 C.

None of these block the approval:

  1. Description fix: the rail poller also runs on the Mac mini. #2533 turns the mini's budget off but still reads the rails (:276, :800-801). So idle_rail_ns gets set on J773g and the 30 s idle hold applies there too. That fits the no-gates rule, but nobody has tested it on the mini. Please fix that sentence, and the mini lane should take a row when it folds this in.
  2. Optional: clear idle_rail_ns in probe next to valid_ns (:850) and in apple_pmp_thermal_prepare() (:869). Then the long hold always needs a rail read from the current bind or wake. ktime_get_ns() doesn't count suspend time, so a rail read from before a sleep can look fresh right after resume. The die only cools while asleep, so this is tidiness, not a hazard.
  3. For the soak you list: if the SMC rail keys are filtered, a load step will show up late. Please include a step from idle to full load out of a long dark span, and log how long the held value survives after the step.

CI: no workflow ran on 422bc70, because host-tests only triggers for PRs into integration/aurora or aurora-wip. I've noted your local W=1 build. CI will run once this is folded in.

Not merging: #2533 is the M4 mini lane's draft, and that branch may still move. This folds into #2533 once it's finalized.

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