Skip to content

soc: apple: clpc: add DT-driven all-core window, slow-cluster cap, and J604 sustained power limit - #3988

Open
IronsideXXVI wants to merge 9 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604/apple-clpc-j604-limits
Open

IronsideXXVI wants to merge 9 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604/apple-clpc-j604-limits

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What: Add optional, DT-driven per-cluster all-core ceilings, a slow-cluster busy cap, and a sustained all-core SMC CPU-rail power limit to apple-clpc, and enable J604's limits in t8132-j604.dts (zero runtime module parameters, zero machine-name matching):

  1. dt-bindings: cpufreq: apple,cluster-cpufreq: document optional per-cluster properties apple,all-core-frequency-max-mhz, apple,slow-cluster-busy-max-mhz, and apple,sustained-frequency-min-mhz directly on the cluster cpufreq domain node (&cpufreq_p / &cpufreq_e), validated against that cluster's OPP table.
  2. dt-bindings: power: apple,pmc: document optional apple,sustained-power-mw and apple,sustained-power-key-ids (required together with apple,smc via dependentRequired) on performance-controller, separate from the low-power profile's apple,power-key-id (PHPC).
  3. soc: apple: clpc:
    • Read per-cluster apple,all-core-frequency-max-mhz, apple,slow-cluster-busy-max-mhz, and apple,sustained-frequency-min-mhz from each cluster's performance-domains node and warn (dev_warn) if any configured frequency is not a valid OPP in that cluster's table.
    • Evaluate all-core occupancy over the full 100 ms APPLE_CLPC_POWER_MS window (80% per-CPU busy threshold, 200 ms release hold) outside the low-power profile (both balanced and performance profiles, on AC and battery).
    • Cap a cluster with apple,slow-cluster-busy-max-mhz only while a faster cluster is busy — leaving slow-cluster-only workloads (e.g. 6-thread E-only with P idle) completely uncapped.
    • Regulate sustained all-core CPU power against apple,sustained-power-mw by summing the dedicated CPU cluster SMC power rails listed in apple,sustained-power-key-ids (e.g. PP0b + PPbb on J604, excluding GPU PP1b and display), with an explicit per-cluster floor (apple,sustained-frequency-min-mhz, or a >= max_freq / 2 fallback if unset) and 92% step-up hysteresis. Polls SMC only while all-core load holds a faster cluster (zero SMC reads at idle or single-core load) and releases when all-core load ends.
    • Keep sampling on time while one of these ceilings is held, so it drops within about 200 ms of the load ending. On T8132 the idle sampler is deferrable and would otherwise leave the ceiling on until an idle CPU wakes.
    • Expand apple-clpc-policy KUnit coverage for OPP validation, explicit/fallback floors, uncapped 6-thread E-only load, and busy-P E-cap.
  4. arm64: dts: apple: t8132-j604: configure &cpufreq_p (3936 MHz all-core max, 3096 MHz sustained min), &cpufreq_e (2808 MHz slow-cluster busy max only), and &clpc (apple,smc = <&smc>, apple,sustained-power-key-ids = "PP0b", "PPbb", apple,sustained-power-mw = <13500>). Note: wiring apple,smc = <&smc> on J604 &clpc also enables the existing low-power SMC PHPC power-budgeting loop whenever the boot loader passes Low Power mode values from ADT.

Measurement basis for control constants (J604, T8132):

  • 80% per-CPU busy across 100 ms: Under 7zz b 3 mtall (~915% total CPU on 4P+6E), active P-cores run ~88–96% busy per 100 ms window while brief 20 ms scheduling dips previously caused ~6–9.5% turbo leak at 4464 MHz. 80% over 100 ms cleanly separates sustained all-core load from single/few-thread bursts.
  • 200 ms release hold (two 100 ms windows): Bridges brief I/O or lock dips between all-core blocks without spiking to 4464 MHz, while releasing within 200 ms so subsequent single-thread runs hit 4464 MHz immediately.
  • 92% step-up threshold (8% deadband): Parallels the low-power profile's 90% deadband, sized to the 13.5 W CPU-rail budget so one P-cluster OPP step (~120 MHz / ~1.0 W) does not oscillate between adjacent OPPs.
  • 13500 mW (PP0b + PPbb) target & 3096 MHz floor: Matches J604's ~15.5 W PHPC sustained envelope minus ~1.5–2.3 W non-CPU SoC/fabric/display draw inside PHPC (measured on J604: PP0b = 10.77 W, PPbb = 2.38 W under heavy 10-thread burn vs PHPC ~ 15 W), with 3096 MHz (a verified J604 P-cluster OPP) preventing deep CPU throttling.
  • Profiles & power source: Applies outside PLATFORM_PROFILE_LOW_POWER (both balanced and performance, on AC and battery; J604 has no High Power mode).

Tested:

  • Offline at 136204e3ee9b (two small commits on top of 5a4e1824503e), merged with main 5d5060423c0e:
    • KUnit on UML (apple-clpc*): 26/26 (apple-clpc-policy 10/10, apple-clpc-gpu 16/16).
    • clpc-gpu-demand-tests.py (with the new held-ceiling case and its negative control), clpc-high-power-cleanup-tests.py and clpc-ane-cpu-opp-tests.py pass.
    • arm64 GCC 16.2 W=1 clpc.o with KUnit off and on: no warnings. checkpatch --strict clean on both commits.
    • dt_binding_check for both bindings clean; t8132-j604.dtb CHECK_DTBS W=1 output identical to main (DT files unchanged since 5a4e1824503e).
  • Offline at 5a4e1824503e (forward-merged origin/main 49fa570626f5 including #2856 and #3801):
    • ARM64 QEMU KUnit (drivers/soc/apple/clpc.kunitconfig, Clang 18.1.8 LLVM=1, KASAN+UBSAN): 26/26 CLPC subtests passed (apple-clpc-gpu 16/16 + apple-clpc-policy 10/10, including apple_clpc_t6050_gpu_fabric_test, apple_clpc_all_core_window_test, apple_clpc_sustained_power_test, and apple_clpc_all_core_and_e_cap_test).
    • ARM64 Clang 18.1.8 LLVM=1 W=1 build of drivers/soc/apple/clpc.o: 0 warnings, 0 errors with both CONFIG_KUNIT=n (CONFIG_MFD_MACSMC=y) and CONFIG_KUNIT=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 dt_binding_check DT_SCHEMA_FILES=cpufreq/apple,cluster-cpufreq.yaml: 0 errors, 0 warnings.
    • make ARCH=arm64 LLVM=1 CHECK_DTBS=y apple/t8132-j604.dtb: 0 new warnings (output identical to main).
    • tools/asahi/clpc-high-power-cleanup-tests.py and tools/asahi/clpc-ane-cpu-opp-tests.py: PASSED.
    • scripts/checkpatch.pl --strict --git 9f09f0787..5a4e1824503e: 0 errors, 0 warnings, 0 checks across all 3 rework commits.

Risk: two-way · J604 (T8132) only — all new behavior is strictly opt-in via the optional DT properties on &cpufreq_p, &cpufreq_e, and &clpc in t8132-j604.dts. Other T8132 (e.g. J773g) and non-T8132 boards (e.g. J714s / T6050) have has_all_core == false and take the exact existing code path. A plain revert restores uncapped all-core behavior on J604.

Not yet: hardware rows at the current head. J604: all-core on/off A/B (score, P/E clock residency, PP0b+PPbb and PHPC), four P-only threads, a SIMD-heavy all-core load, CPU+GPU load (P clock and fps vs base), six E-only threads at 2892 MHz, single thread right after an all-core load, low-power (new PHPC loop), balanced and performance profiles, battery, s2idle and deep sleep. J773g (T8132 without the properties) and J714s (T6050, shared probe path): no change against base.

Commit list & offline verification summary

Forward commits atop origin/main merge 9f09f0787 (49fa570626f5):

  • 47f942d2f1f2 dt-bindings: apple: move CLPC limits to cpufreq domains and add CPU keys
  • e450562323cc soc: apple: clpc: regulate sustained CPU power on CPU rails with OPP limits
  • 5a4e1824503e arm64: dts: apple: t8132-j604: use per-cluster CLPC limits and CPU rails
  • 6dc15236ba6e soc: apple: clpc: sample on time while a board ceiling is held
  • 136204e3ee9b soc: apple: clpc: look up the SMC and its power key in one block

KUnit summary (qemu-system-aarch64, Clang 18.1.8, KASAN+UBSAN):

# apple-clpc-gpu: pass:16 fail:0 skip:0 total:16
# apple-clpc-policy: pass:10 fail:0 skip:0 total:10

…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>
@IronsideXXVI
IronsideXXVI requested review from a team as code owners December 2, 2026 20:31
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at 136204e3: not ready yet

Check Detail
CI at head ok 11 checks passed
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes ok none
Hardware row at head ok comment at 136204e3
Conflicts no merge conflicts with main: merge it in (no force push)
PR text ok Risk: two-way · J604 (T8132) only — all new behavior is strictly opt-in via the optional DT properties on &cpufreqp, &cpufreqe, and &clpc in t8132-j604.dts. Other T8132 (e.g. J773g) and non-T8132 boards (e.g. J714s / T6050) have hasallcore == false and take the exact existing code path. A plain revert restores uncapped all-core behavior on J604.

Areas: area:bringup, area:gpu, area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 2, 2026

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

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

  1. The sustained loop counts the GPU against the CPU. PHPC covers the GPU and display as well (apple_clpc_profile_step_busy_test says 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 is low_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.
  2. Frequency matching is fragile. apple,all-core-frequency-max-mhz gives 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 the cpu-map cluster), and warn if it isn't an OPP.
  3. "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.
  4. apple,smc is 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.
  5. 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.

…limits

# Conflicts:
#	drivers/soc/apple/clpc.c
Address review feedback on CLPC all-core and sustained power bindings:

- Move apple,all-core-frequency-max-mhz and
  apple,slow-cluster-busy-max-mhz from &clpc to the individual
  apple,cluster-cpufreq domain nodes alongside the new
  apple,sustained-frequency-min-mhz floor so each limit binds explicitly
  to its cluster and validates against that cluster OPP table.
- Add apple,sustained-power-key-ids (required alongside
  apple,sustained-power-mw and apple,smc) so sustained CPU regulation
  sums dedicated CPU cluster rails instead of package PHPC (which
  includes GPU and display power).
- Clarify that these optional limits apply outside the low-power
  platform profile (balanced and performance, on AC and battery).

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
…limits

Address review feedback on CLPC all-core and sustained CPU limits:

- Regulate sustained all-core CPU power using the summed SMC CPU rails
  listed in apple,sustained-power-key-ids (separate from the low-power
  profile PHPC power_key) so GPU and display loads never throttle CPU.
- Enforce an explicit per-cluster sustained frequency floor
  (apple,sustained-frequency-min-mhz, with a >= max_freq/2 fallback if
  unset) instead of falling back to the second OPP (1260 MHz).
- Read per-cluster apple,all-core-frequency-max-mhz,
  apple,slow-cluster-busy-max-mhz, and apple,sustained-frequency-min-mhz
  from each cluster performance-domains node and warn if any value is
  not a valid OPP in that cluster frequency table.
- Keep slow-cluster-only workloads uncapped when only
  apple,slow-cluster-busy-max-mhz is configured on the slow cluster.
- Document the J604 measurement basis for the 80% busy threshold, 200 ms
  release hold, and 92% step-up hysteresis next to the constants, and
  expand apple-clpc-policy KUnit coverage for OPP validation, explicit
  and fallback floors, and uncapped E-only load.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
Update J604 CLPC limits to address review feedback:

- Place the P-cluster all-core ceiling (3936 MHz) and sustained floor
  (3096 MHz) on &cpufreq_p, and the slow-cluster busy cap (2808 MHz)
  only on &cpufreq_e so 6-thread E-only work stays uncapped while P is
  idle.
- Regulate sustained CPU power at 13.5 W summed across the CPU cluster
  rails (PP0b P-cluster + PPbb E-cluster, excluding GPU PP1b and
  display).
- Clarify that these limits apply outside low-power (balanced and
  performance, AC and battery; J604 has no High Power mode) and that
  wiring apple,smc on &clpc also enables the existing low-power SMC PHPC
  loop when the boot loader supplies Low Power mode values.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr Thanks for the thorough review and merge guidance. Forward-merged origin/main (49fa570626f5, picking up #2856 with the exact single apple_clpc_policy_nb_register(clpc) resolution and keeping both sides of the KUnit hunks in 9f09f0787) and pushed forward commits 47f942d2f1f2, e450562323cc, and 5a4e1824503e addressing all 5 items:

  1. Regulate sustained CPU power on CPU rails (PP0b + PPbb) with a real floor: Added apple,sustained-power-key-ids (required with apple,sustained-power-mw and apple,smc via dependentRequired) and apple_clpc_read_sustained_power(), keeping sustained CPU regulation strictly separate from the low-power PHPC power_key. J604 now sums PP0b (P-cluster) + PPbb (E-cluster) against 13500 mW so GPU (PP1b) and display power never count against CPU. Added an explicit per-cluster apple,sustained-frequency-min-mhz floor (3096 MHz on J604 &cpufreq_p, plus a safe >= max_freq / 2 driver fallback if unset) so the loop never drops toward the second OPP (1260 MHz).
  2. Explicit per-cluster DT binding + OPP validation warning: Moved apple,all-core-frequency-max-mhz and apple,slow-cluster-busy-max-mhz (alongside apple,sustained-frequency-min-mhz) from &clpc onto the cluster cpufreq domain nodes (apple,cluster-cpufreq.yaml: &cpufreq_p and &cpufreq_e). apple_clpc_cluster_dt_limits() resolves each cluster via its CPU's performance-domains phandle and calls apple_clpc_validate_opp_khz(), emitting dev_warn() and ignoring any value that is not a valid OPP in that cluster's table.
  3. E-only 6-thread workloads genuinely untouched: Removed the all-core ceiling from E-cluster (&cpufreq_e carries only apple,slow-cluster-busy-max-mhz = <2808>). With all 6 E-cores busy and P idle, E-cluster now has max_khz == 0 (uncapped up to 2892 MHz), and apple_clpc_e_cap() caps E at 2808 MHz only while a faster cluster is busy (verified in apple_clpc_all_core_and_e_cap_test).
  4. apple,smc low-power loop interaction: Documented explicitly in the DTS comment, commit message, binding, and PR body that wiring apple,smc = <&smc> on J604 &clpc also enables the existing low-power SMC PHPC power-budgeting loop whenever the boot loader passes Low Power mode values, and separated clpc->sustained_power_mw from clpc->power_mw so the low-power PHPC loop and non-low-power CPU-rail loop never interfere across profile switches.
  5. Measurement basis for 80%/200 ms/92% and AC/battery/profile scope: Documented the J604 measurement basis directly beside the constants in drivers/soc/apple/clpc.c and in the PR body, and corrected the DT comment/binding/PR body to state accurately that these limits apply outside low-power (both balanced and performance profiles, on AC and battery; J604 has no High Power mode).

Verified offline at 5a4e1824503e:

  • scripts/checkpatch.pl --strict --git 9f09f0787..5a4e1824503e: 0 errors, 0 warnings, 0 checks across all 3 commits.
  • make ARCH=arm64 LLVM=1 dt_binding_check for both power/apple,pmc.yaml and cpufreq/apple,cluster-cpufreq.yaml: 0 errors, 0 warnings.
  • make ARCH=arm64 LLVM=1 CHECK_DTBS=y apple/t8132-j604.dtb: 0 new warnings (identical to main).
  • ARM64 Clang 18.1.8 LLVM=1 W=1 drivers/soc/apple/clpc.o: 0 warnings, 0 errors (CONFIG_KUNIT=n with CONFIG_MFD_MACSMC=y, and CONFIG_KUNIT=y).
  • ARM64 QEMU KUnit (drivers/soc/apple/clpc.kunitconfig, Clang 18.1.8, KASAN+UBSAN): 26/26 CLPC subtests passed (apple-clpc-gpu 16/16 + apple-clpc-policy 10/10).
  • tools/asahi/clpc-high-power-cleanup-tests.py and tools/asahi/clpc-ane-cpu-opp-tests.py: PASSED.

Live J604 hardware rows at 5a4e1824503e (all-core A/B, concurrent CPU+GPU P clock & fps, 6-thread E-only, low-power/performance profiles, battery, s2idle/deep sleep) will follow in a hardware verification comment.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
The all-core, slow-cluster and sustained ceilings drop only when the
sampler runs. 32 ms after the last CPU demand the memory floor is
released and the T8132 sampler turns deferrable, so it runs again only
when the CPU that owns the timer takes a tick. The all-core hold is
200 ms: once the load stops, the ceilings outlive it until that CPU
wakes, and a thread that starts on another CPU meanwhile runs at the
all-core ceiling, or down to the sustained floor, for that long.

Keep sampling on time while a ceiling is held, as for a held vote. It
drops at most two 100 ms windows later and the sampler is deferrable
again. After a sleep take the first sample on time as well: the reset
clears the recorded ceiling but not the frequency QoS request.

Boards without the properties sample as before. The host test runs
apple_clpc_sample() with a held ceiling and fails without the check.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The nested condition guards settings that nothing reads without a
low-power ceiling or High Power mode, so boards do not need it. Keep the
block as it was and only add the sustained limit's keys to its
condition. This also drops a misindented store that the DT setup has
already done.

The ceilings' comment still said the sustained limit reads the package
power; it reads the CPU rails.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) labels Dec 3, 2026

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

Verdict: FINISH, then merge, at 136204e3ee9b. The five points from the earlier review are fixed in code, so I'm clearing it. Only hardware rows are left.
Blockers: none in the code. The rows below.
Checked: merged with main 5d506042; no parameters, no chip or board gates in the driver; KUnit, host tests, W=1 and DT checks.

The earlier points

  1. The sustained loop reads PP0b + PPbb, so GPU and display power no longer count. Both keys are 4-byte flt watts on T8132 (apple-pmp-thermal already checks that). Any failed read fails the whole sum and the step is skipped; an unchanged sum takes no step. The floor is 3096 MHz on J604, half of max without the property.
  2. The limits sit on each cluster's cpufreq node. A value that isn't an OPP warns and is ignored.
  3. Six E threads with P idle get no ceiling.
  4. The Low Power loop that apple,smc brings is described. Testing it is a row.
  5. 80 %, 200 ms and 92 % have their basis next to them, and the text now says which profiles and power sources apply.

I pushed two small commits

  • 6dc15236ba6e: the sampler turns deferrable 32 ms after the CPU demand ends, but the ceiling is held for 200 ms. On T8132 it then stayed on until the CPU with the timer woke, so a new thread on another CPU ran capped, down to 3096 MHz. It now samples on time while a ceiling is held, and once after a wake. The host test covers it and fails without the fix.
  • 136204e3ee9b: the SMC setup in probe is main's block again with one more condition, plus a stale comment.

No change without the properties: traced for T6030, T6050, T8140 and T8132: same SMC setup, same profile ceilings, same sampling, and the policy notifier from #2856 is registered in the same cases.

The J604 values. 3936/2808 match what macOS 27.2 held on our J773g with ten threads, and #524 measured 4416/4464 MHz at 5.0-5.4 W a core against 3.1 W at 3936. 13.5 W is derived (about 15.5 W PHPC less the non-CPU share) and 3096 is a chosen floor, so the A/B decides them.

Rows at this head

  • J604 (author), base vs head on AC: all-core score, P/E time in state, PP0b + PPbb, PHPC; the same with four P-only threads and a SIMD-heavy all-core load. Pass: more efficient than base, and no score below macOS on the same load. #524 has 3876 MHz drawing more than 3936, so if the clock flips between 3756 and 3876 in a steady run, say so.
  • J604 also: CPU+GPU load (P clock and fps vs base), six E-only threads reach 2892 MHz, single thread right after an all-core load reaches 4464 MHz, low-power with the new PHPC loop, balanced, performance, battery, s2idle and deep sleep.
  • J773g (T8132) and J714s (T6050): no change against base.
Evidence
  • Merge tree b3fa7f87d8cd at 5a4e1824503e equals GitHub's test merge; main 1ab453e8 adds only a workflow file.
  • KUnit on UML apple-clpc* 26/26 at this head's clpc.c. clpc-gpu-demand-tests.py, clpc-high-power-cleanup-tests.py, clpc-ane-cpu-opp-tests.py pass; negative control board-ceiling-deferrable fails as it should.
  • arm64 GCC 16.2 W=1 clpc.o with KUnit off and on: no warnings. checkpatch --strict clean on both commits.
  • dt_binding_check clean for both bindings. t8132-j604.dtb CHECK_DTBS W=1 output identical to main; the DTB differs only by the new properties and phandle numbers.

Nit: the 92 % comment says one step is about 1 W. By #524's model four cores from 3756 to 3876 MHz is about 1.7 W.

@DjDeveloperr
DjDeveloperr dismissed their stale review December 3, 2026 02:00

All five points are fixed at 136204e; only hardware rows are left (see the review at that head).

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Dec 3, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES at 136204e

Failure: apple_clpc_profile_limit() at clpc.c:1762 only takes a sustained-power step when the milliwatt value changes. The exact controller arithmetic with the J604 OPPs and 13,500 mW target steps from 3936 to 3876 MHz on the first valid 14,000 mW sample. Five more valid 14,000 mW samples leave it at 3876 MHz, while 14,001 mW immediately steps to 3756 MHz. The controller stops moving toward the target while power is still over budget and the frequency is above the configured floor. Let valid repeated over-budget samples continue the existing step-down.

Checked: Both changed bindings pass dt-doc-validate. Reviewed the per-cluster property lookup, OPP bounds, CPU-rail selection, slow-cluster cap and QoS release. The exact CLPC host suite and its held-ceiling control passed.

Follow-ups: Please split the larger production change into smaller reviewable PRs where dependencies permit.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

On the review at 136204e3ee9b: skipping an unchanged reading is on purpose, and it is the rule main already uses for the low-power ceiling (clpc->power_mw, "The SMC updates the reading less often: act on a new one only"). The limiter runs every 100 ms. If it also stepped on an old reading, it would take several steps for one SMC update and go well past the target. The two rails are flt watts converted to mW, so the same sum several updates in a row is an old reading in practice, and a stuck sensor should not walk the CPUs down to the floor.

One thing to add to the J604 A/B set: power_reads and power_updates from the debugfs file at the start and end of the load. If updates stop while the power is over the target, I will change this.

@DjDeveloperr
DjDeveloperr dismissed aurora-silicon-review[bot]’s stale review December 3, 2026 02:31

Intended, same rule as the low-power ceiling on main; answered in the thread. The J604 set will show power_reads/power_updates.

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr Thanks for clearing the code review, pushing the held-ceiling timer and probe cleanups (6dc15236ba6e, 136204e3ee9b), and clarifying the unchanged-reading rule. I will include debugfs power_reads and power_updates at the start and end of load alongside the full J604 A/B set at 136204e3ee9b (all-core, 4 P-only, SIMD-heavy, CPU+GPU, 6 E-only, post-all-core single-thread, low-power/balanced/performance profiles, battery, and s2idle/deep sleep).

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Re-checked 136204e3ee9b on main 00c7aaf971fd, because #3882 landed in the same file after the review: it merges clean and nothing needs to change here. A held ceiling is still sampled on time (apple_clpc_queue() takes the timer path only when idle is set, and apple_clpc_board_limited() clears that). clpc host tests on the merge: 8 of 9 pass, with board-ceiling-deferrable still caught; the ninth reads an old commit from git history and fails the same way on plain main in this checkout.

One thing for the J604 A/B: use a base that has #3882, and the head merged with that same main. Otherwise the idle and single-thread numbers also contain #3882's timer change. The row list is unchanged.

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Thanks for re-checking 136204e3ee9b against main (00c7aaf971fd) with #3882 landed, @DjDeveloperr — confirmed we will run the J604 A/B on a base containing #3882 and the matching merge head.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Follow-up note from J604 (linux-aurora 1.1704, boot 40439634):

On J604, we found that applying apple_clpc_e_cap() whenever any faster cluster is busy also caps partially loaded mixed workloads (e.g. 6-thread inference running 4P+2E or 3P+3E) from 2892 MHz to 2808 MHz (-2.9%, -2.07 tok/s measured) even though 2808 MHz and 2892 MHz share the same 910 mV rail on T8132. Gating apple_clpc_e_cap() on the slowest cluster itself being near all-core saturation (slow_busy >= online - 1 in the active evaluation window or all_core_held) keeps sustained all-core loads (5-6 busy E-cores) capped while leaving 2-4 core partial E-cluster loads at 2892 MHz.

Keeping the reviewed head 136204e3ee9b here undisturbed for the pending J604 A/B verification; once #3988 lands, I will send that slow-cluster concurrency gate (with KUnit coverage, already 22/22 PASS under 16K_PAGES + KASAN + UBSAN) as a clean follow-up PR on top of main.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 4, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Additional follow-up note from J604 (linux-aurora-next 1.1705, boot 4eb0512e):

In 1.1705, we also scoped the machine-table sustained_mw default (15.5 W PHPC on J604) to non-performance profiles so balanced keeps the 15.5 W sustained efficiency target while performance runs uncapped by that balanced target (still preserving all_core_khz, e_cap_khz, and any explicit positive sustained_power_mw override) and resets power_khz/power_mw across balanced <-> performance transitions.

Keeping the reviewed head 136204e3ee9b here untouched for the pending J604 A/B verification; once #3988 lands, I will send this performance-profile scoping (with KUnit coverage) as a clean follow-up PR on top of main.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Dec 4, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

@IronsideXXVI This branch now conflicts with main (1da341136110) in:

  • drivers/soc/apple/clpc.c

Could you forward-merge main into this branch (normal git merge, no rebase/force-push)? If you haven't had a chance within 24 hours, a maintainer can forward-merge main on top for you.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 5, 2026

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

area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants