Repository navigation
soc: apple: clpc: add DT-driven all-core window, slow-cluster cap, and J604 sustained power limit - #3988
soc: apple: clpc: add DT-driven all-core window, slow-cluster cap, and J604 sustained power limit#3988IronsideXXVI wants to merge 3 commits into
Conversation
…ower limits Document three optional board-level CLPC properties on the PMC performance-controller child node for non-low-power sustained multi-core regulation: - apple,all-core-frequency-max-mhz: per-cluster-type frequency ceilings when all online CPUs of a cluster are busy across the 100 ms window. - apple,slow-cluster-busy-max-mhz: frequency ceiling for the slowest cluster while a faster cluster is busy. - apple,sustained-power-mw: sustained all-core SMC package power target in milliwatts while all-core load holds a faster cluster. Update the apple,smc description to cover sustained package power regulation alongside the low-power profile and High Power mode. Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…tained power limit On T8132 (J604), sustained heavy multi-core workloads such as 7-Zip mtall (~915% CPU) hit two efficiency regressions against macOS on AC: 1. E-cluster 2892 MHz power cliff: brief per-core dips let the E-cluster jump to 2892 MHz while P-cores are active, paying a ~2.1x power jump over 2808 MHz for +3% clock. 2. Unbounded 3936/4464 MHz P-cluster power: macOS regulates sustained heavy all-core workloads on J604 around 15.5 W PHPC (~3600 MHz active P clock, die ~77 C), whereas uncapped Linux draws 17.3-25+ W PHPC (die up to 95-100 C), losing ~6% MIPS/W and inducing thermal droop on subsequent single-core runs. Add three optional, DT-driven controls in apple-clpc (inactive unless configured by board DT; zero runtime module parameters and zero machine name matching): - Integrated 100 ms all-core busy window (80% per-CPU busy threshold, 200 ms release hysteresis) applying apple,all-core-frequency-max-mhz per matching cluster outside the low-power profile. - Slow-cluster busy cap (apple,slow-cluster-busy-max-mhz) while a faster cluster is busy outside the low-power profile, leaving E-only workloads and Low Power mode untouched. - Sustained all-core SMC package power ceiling (apple,sustained-power-mw, using apple,smc and apple,power-key-id / PHPC) that polls SMC only while all-core load holds a faster cluster (zero SMC reads at idle or single-core load) and releases immediately once all-core load ends. Add KUnit tests in apple-clpc-policy covering the all-core window hold, sustained power stepping and floor/release behavior, all-core table matching, and slow-cluster busy capping. Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…power limits Wire apple,smc and the J604 all-core/sustained CLPC power limits matching macOS on AC: - apple,all-core-frequency-max-mhz = <3936 2808> - apple,slow-cluster-busy-max-mhz = <2808> - apple,sustained-power-mw = <15500> Leaves single-core bursts (4464 MHz P), E-only workloads, and idle zero-SMC behavior unchanged. Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Review at 899e6ebcde40. It's opt-in from the board DT, with no parameters and no machine names. Boards without the new properties keep the same decisions (I followed the probe and profile_limit refactor). The design needs changes before it can land.
Must change
- The sustained loop counts the GPU against the CPU. PHPC covers the GPU and display as well (
apple_clpc_profile_step_busy_testsays so). While the P cores are all busy and the GPU is working, the loop steps the P cluster down every 100 ms toward a target the CPU can't reach alone. The only floor islow_power_khz. T8132 has no table value, so unless the loader sets one, the floor is the second OPP (1260 MHz). A game, or a CPU+GPU render, would sit there. Regulate on the CPU rails (PP0b + PPbb), or take the GPU out of the reading, and set a real floor. Your rows are CPU-only, so they can't show this. - Frequency matching is fragile.
apple,all-core-frequency-max-mhzgives each entry to "any cluster whose table contains it". That only works on J604 because no P row equals 2808, and an entry that is in no table is ignored silently. Put the ceiling on the cluster it belongs to (the cpufreq domain or thecpu-mapcluster), and warn if it isn't an OPP. - "E-only workloads untouched" isn't what it does. With all six E cores busy and P idle, the all-core entry caps E at 2808, as your own KUnit case shows. Change the text or the behaviour.
apple,smcis a second change on J604. Where the loader passes Low Power mode values, the node now also gets the low-power SMC loop. Split it out, or describe and test it.- 80 %, 200 ms and 92 % need a basis next to them: what was measured, and why these values. The caps also apply on battery and in the performance profile, while the DT comment says "matching macOS on AC".
Conflict with main: #2856 is in now. Three hunks in clpc.c, binding and DTS merge clean. Resolution: drop your own notifier registration and the one in has_profile, call if (clpc->low_power_khz || clpc->has_all_core) apple_clpc_policy_nb_register(clpc); once, and keep both sides of the two KUnit hunks. I built that tree. I haven't pushed it, because this needs a new head anyway. #3868, #3873, #3741 and #3882 edit the same file (#3882 needs its own small merge too), so whichever lands second merges again. #4008 and #4009 merge clean with the DTS.
Checked on main 2c667a4b + this head, resolved as above: clpc.o W=1 clean with KUnit off and on, dt_binding_check for apple,pmc.yaml clean, t8132-j604.dtb CHECK_DTBS output identical to main, clpc-high-power-cleanup-tests.py passes, no checkpatch errors. KUnit not run here (arm64 only); hosted CI shows as skipped at this head.
Rows at the next head: J604 (yours): all-core on/off A/B, CPU+GPU load (P cluster clock and fps vs base), six E-core-only threads, low-power and performance profiles, battery, s2idle and deep sleep. J773g (T8132, no properties): boot, clpc status and all-core clocks same as base. J714s (T6050): platform profiles and the High Power record unchanged, since the probe path is shared.
What: Add optional, DT-driven all-core frequency ceilings, a slow-cluster busy cap, and a sustained all-core SMC package power limit to
apple-clpc, and enable J604's AC limits int8132-j604.dts(zero runtime module parameters, zero machine-name matching):dt-bindings: power: apple,pmc: document optional board-level propertiesapple,all-core-frequency-max-mhz,apple,slow-cluster-busy-max-mhz, andapple,sustained-power-mwon theperformance-controllernode, and note sustained power regulation inapple,smc.soc: apple: clpc: evaluate all-core cluster occupancy over the full 100 msAPPLE_CLPC_POWER_MSwindow (80% per-CPU busy threshold, 200 ms release hold) outside the low-power profile; apply matchingapple,all-core-frequency-max-mhzceilings; cap the slowest cluster atapple,slow-cluster-busy-max-mhzwhile a faster cluster is busy (avoiding the J604 E-cluster 2892 MHz 2.1x power cliff while leaving E-only workloads and Low Power mode untouched); and regulate faster clusters againstapple,sustained-power-mwvia SMC (apple,power-key-id, defaultPHPC) only while all-core load holds a faster cluster (zero SMC reads at idle or single-core load, immediate release when all-core load ends). Add 3 KUnit cases toapple-clpc-policy.arm64: dts: apple: t8132-j604: wireapple,smc = <&smc>and J604's macOS-matched limits (3936/2808MHz all-core,2808MHz slow-cluster busy cap,15500mW sustained PHPC).Tested:
899e6ebcde40(atopaurora-silicon/linuxmain33dbc9a6c6d):drivers/soc/apple/clpc.kunitconfig, Clang 18.1.8LLVM=1, KASAN+UBSAN): 25/25 passed (apple-clpc-gpu16/16 +apple-clpc-policy9/9, including newapple_clpc_all_core_window_test,apple_clpc_sustained_power_test, andapple_clpc_all_core_and_e_cap_test).LLVM=1 W=1build ofdrivers/soc/apple/clpc.o: 0 warnings, 0 errors (tested with bothCONFIG_KUNIT=yand!CONFIG_KUNIT+CONFIG_MFD_MACSMC=y).make ARCH=arm64 LLVM=1 dt_binding_check DT_SCHEMA_FILES=power/apple,pmc.yaml: 0 errors, 0 warnings.make ARCH=arm64 LLVM=1 CHECK_DTBS=y apple/t8132-j604.dtb: 0 new warnings onperformance-controller@3.tools/asahi/clpc-high-power-cleanup-tests.py: PASSED.scripts/checkpatch.pl --strict --git origin/main..HEAD: 0 errors, 0 warnings, 0 checks across all 3 commits.101cb8285carried on J604 shipping kernels1.1683–1.1687,n=10like-for-like vs native macOS 26B123):7zz b 3mtall): 3317.85 MIPS/W vs native macOS 3240.8 MIPS/W (102.4%, 0 faults; low-power leg 4627.35 MIPS/W).pwrspin chain1062 s): 3678.1 MHz/W vs native macOS 3715.0 MHz/W (99.0%, 0 faults).7zz b 3mt1): 11225.5 MIPS vs native macOS 11264.5 MIPS (99.7%,p0_4464_pct=100.0%on 10/10 runs, 0 faults).Risk: two-way · J604 (T8132) only — all new behavior is strictly opt-in via the new optional DT properties on
&clpcint8132-j604.dts. Other T8132 and non-T8132 boards havehas_all_core == falseand take the exact existing code path. A plain revert restores uncapped all-core behavior on J604.Not yet: exact-head
main(899e6ebcde40) bare-metal J604 hardware boot +n=10re-read row (will be posted as a follow-up comment after booting this exact commit on J604 with the updated Stage 2 DTB).Commit list & offline verification log summary
Commits atop
33dbc9a6c6d:dc8572f1c5ecdt-bindings: power: apple,pmc: document CLPC all-core and sustained power limits32458d8676c0soc: apple: clpc: add all-core window, slow-cluster busy cap, and sustained power limit899e6ebcde40arm64: dts: apple: t8132-j604: configure CLPC all-core and sustained power limitsKUnit summary (
qemu-system-aarch64, Clang 18.1.8, KASAN+UBSAN):