Skip to content

soc: apple: clpc: tune T8142 idle sampling, CPU floor, and GPU busy-share ladder - #3710

Merged
RyanTheTide merged 2 commits into
mainfrom
feat/t8142-clpc-power
Dec 1, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
feat/t8142-clpc-power

Conversation

@sithglan

Copy link
Copy Markdown
Contributor

What: Bring T8142 (M5 MacBook Air J813/J815) CLPC power management in line with T6050 and T8132:

  • Lower the bottom two CPU memory-floor quartiles in apple_clpc_hw_t8142 from {2, 4, 6, 7} / {1, 2, 3, 4} to {1, 3, 6, 7} / {0, 1, 3, 4}, require a three-sample (12 ms) busy streak (.sustain = 3), enable per-CPU deferrable idle timers (.idle_on_time = true), and set .low_power_khz = 2220000 from the J813 ADT cpu-low-power-frequency-max.
  • Add apple,gpu-busy-memory-states = <1 2 5 7>, <0 0 1 4> and apple,gpu-busy-permille = <160 500 800> to &clpc in t8142-j813-j815.dtsi so light desktop compositing and 60 fps workloads drop to DCS 1 / fabric 0 while saturated GPU workloads keep full DCS 7 / fabric 4.
  • Add KUnit coverage (apple_clpc_t8142_policy_test) and direct t8142-j813-j815.dtsi parsing + negative controls in tools/asahi/clpc-gpu-demand-tests.py.

Tested:

  • J813 (13-inch M5 MacBook Air, T8142, fw 27.2) in combined trial kernel 7.3.0-aurora-j813-power+ (carrying this 2-commit series c052e94b0a41..86e5acd29fe4 byte-identically on main b158a197adc9 alongside two independent cpufreq/dcp-audio commits, dpms=On, backlight 400/500):
    • Light 60 fps vkcube --present_mode 2 (26–36‰ GPU busy): CLPC floor dropped from pinned 0x47 (DCS 7 / fabric 4, 8/8 samples, +900 mW over idle on stock 7.3.0-aurora-j813-sgv2+) to 0x01 (DCS 1 / fabric 0, 14/14 samples, +99 to +141 mW over idle) — ~760–800 mW saved on light 60 fps GPU draw.
    • Uncapped vkcube --present_mode 0 (1000‰): immediately lifted to 0x47 (5/5 samples) and returned cleanly to 0x00 on idle.
    • Idle CLPC sampling dropped from 20–70/s to 0–8/s (0/s when quiet); arch_timer dropped 594/s -> 459/s; 0 failed units, 0 new kernel warnings/errors.
  • Host / offline checks: tools/asahi/clpc-gpu-demand-tests.py PASS (all T8142 DT negative controls + ladder checks), ARCH=arm64 LLVM=-19 W=1 drivers/soc/apple/clpc.o (0 warnings), scripts/checkpatch.pl --strict (0/0/0).

Risk: two-way door · T8142 Macs (J813/J815/J704).
Revert: git revert the two commits; restores the prior T8142 floor table and non-ladder GPU floor with no persistent state.
Not yet: Standalone single-PR J813 boot without the two companion commits; live low-power sysfs toggle (the J813 trial config had CONFIG_ACPI / CONFIG_ACPI_PLATFORM_PROFILE disabled); J815 and J704 runs (not on site).

…ceiling

Bring apple_clpc_hw_t8142 in line with the T6050 and T8132 CLPC power
policies:
- Lower the bottom two CPU memory-floor quartiles from {2, 4, 6, 7} /
  {1, 2, 3, 4} to {1, 3, 6, 7} / {0, 1, 3, 4} and require a three-sample
  (12 ms) busy streak (.sustain = 3) so brief background E-core wakeups
  do not lift the fabric rail while top-quartile work keeps full DCS 7 /
  fabric 4 bandwidth.
- Enable per-CPU deferrable idle timers (.idle_on_time = true) so idle
  NO_HZ CPUs take zero CLPC timer wakeups when no floor vote is held.
- Set .low_power_khz = 2220000 from the J813 ADT's
  cpu-low-power-frequency-max so the standard low-power platform profile
  is available on M5 Air.

Add KUnit and host-test coverage for apple_clpc_hw_t8142.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…ates

Give the shared T8142 M5 MacBook Air (J813/J815) CLPC node the GPU
busy-share memory-state ladder: DCS 1, 2, 5, 7 and fabric 0, 0, 1, 4,
split at 160, 500 and 800 permille of the busy share reported by the
G17 GPU driver. The top column matches apple_clpc_hw_t8142's DCS 7 /
fabric 4 floor so saturated GPU workloads keep full memory bandwidth
while light desktop compositing and video playback drop to DCS 1-2 /
fabric 0.

Parse t8142-j813-j815.dtsi directly in tools/asahi/clpc-gpu-demand-tests.py
and verify all four ladder levels, threshold boundaries, negative
controls, and down-step hold against apple_clpc_hw_t8142.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan requested review from a team and DjDeveloperr as code owners November 30, 2026 21:23
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at 86e5acd2: not ready yet

Check Detail
CI at head no failing: KUnit ane-boot, KUnit ane-pm, KUnit dcp-fabric, KUnit dcp-topology, KUnit asahi, KUnit spi-hid-apple
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 86e5acd2
Conflicts ok not computed yet
PR text ok Risk: two-way · T8142 Macs (J813/J815/J704). Revert: git revert the two commits; restores the prior T8142 floor table and non-ladder GPU floor with no persistent state.

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.

@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: HOLD at 86e5acd2

Blockers:

  • Queued CI at 86e5acd2 (2P/0F/25Q): Hosted CI (apple-build, dt-checks, host-tests, source, pr-text, KUnit suites) is still queued/running. Once CI finishes green, this is ready to approve (a live low-power platform-profile toggle on a config with CONFIG_ACPI_PLATFORM_PROFILE=y is recommended if convenient, though .low_power_khz = 2220000 matches J813 ADT cpu-low-power-frequency-max and is covered by KUnit).

Checked:

  • Audited full diff (+159/-13 across arch/arm64/boot/dts/apple/t8142-j813-j815.dtsi, drivers/soc/apple/clpc.c, tools/asahi/clpc-gpu-demand-tests.py):
    • apple_clpc_hw_t8142 lowers bottom two quartiles to {1, 3, 6, 7} / {0, 1, 3, 4}, adds .sustain = 3, .idle_on_time = true, and .low_power_khz = 2220000, preserving top-quartile DCS 7 / fabric 4 and ANE DCS 7 / fabric 3.
    • t8142-j813-j815.dtsi adds apple,gpu-busy-memory-states = <1 2 5 7>, <0 0 1 4> and apple,gpu-busy-permille = <160 500 800> matching the T8142 top-state floor.
    • KUnit (apple_clpc_t8142_policy_test) and clpc-gpu-demand-tests.py (direct t8142-j813-j815.dtsi parsing + negative controls + ladder transitions) cleanly cover the new policy.
  • Verified J813 M5 MBA (T8142, fw 27.2) hardware numbers: 60 fps vkcube dropped 0x47 -> 0x01 (~760–800 mW saved), uncapped vkcube lifted cleanly to 0x47 and returned to 0x00 on idle, idle CLPC sampling dropped 20–70/s -> 0–8/s, 0 failed units, 0 new kernel warnings/errors.
Evidence
  • Head commit: 86e5acd29fe4880d6b2d4232e116e2c06b53a52b (MERGEABLE into main).
  • CI snapshot: 2P/0F/25Q.

@m0d16l14n1

Copy link
Copy Markdown
Contributor

J815 row (MacBook Air 15" M5, T8142, fw 27.2): the two commits at 86e5acd cherry-picked onto a J815 tree based on main e6c7b03 (one context conflict in t8142-j813-j815.dtsi next to the CLPC power-key properties, both kept), default command line, AC power, same backlight level in both runs. Booted fine: 0 failed units, no new kernel warnings or errors, status shows the new maps (dcs 1,3,6,7 / soc 0,1,3,4) and the host_gpu busy ... level ladder.

Total System Power (SMC, median of 40 x 1 s samples), before -> after:

  • idle desktop: 5.90 -> 4.98 W (second idle window 5.95 -> 4.90 W).
  • vkcube --present_mode 2 (60 fps): 6.47 -> 6.27 W; floor 0x47 in 40/40 samples before, 22/40 after (the rest 0x31 / 0x36 / 0x13 / 0x01). The CPU vote kept the floor up in the other samples, since the machine was not quiet while measuring.
  • vkcube --present_mode 0 (uncapped): 17.1 -> 17.7 W, floor 0x47 in 40/40 both.

GPU throughput is unchanged: gpubench-vk render.heavy GPU time 260.9 -> 249.6 us, render.tvb 19.81 -> 19.01 ms; Godot TPS demo (Vulkan, 1920x1080, two runs) 49.7 / 49.9 / 57.6 and 50.2 / 50.0 / 57.4 fps before, 51.3 / 51.1 / 57.7 and 50.2 / 50.2 / 57.6 fps after. A dEQP-VK gate run (11,297 Pass) and 5 more CTS slices (about 470k cases) on this kernel had 0 GPU faults. Not run here: the KUnit/host tests (no host rustc on this machine) and the low-power toggle.

Tested-by: Nick nekreshen@yandex.ru

@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: MERGE at 86e5acd29fe4

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Audited full diff (+159/-13 across arch/arm64/boot/dts/apple/t8142-j813-j815.dtsi, drivers/soc/apple/clpc.c, tools/asahi/clpc-gpu-demand-tests.py):

  • apple_clpc_hw_t8142 lowers bottom two quartiles to {1, 3, 6, 7} / {0, 1, 3, 4}, adds .sustain = 3, .idle_on_time = true, and .low_power_khz = 2220000, preserving top-quartile DCS 7 / fabric 4 and ANE DCS 7 / fabric 3.
  • t8142-j813-j815.dtsi adds apple,gpu-busy-memory-states = <1 2 5 7>, <0 0 1 4> and apple,gpu-busy-permille = <160 500 800> matching the T8142 top-state floor.
  • KUnit (apple_clpc_t8142_policy_test) and clpc-gpu-demand-tests.py (direct t8142-j813-j815.dtsi parsing + negative controls + ladder transitions) cleanly cover the new policy.
  • Verified J813 M5 MBA (T8142, fw 27.2) hardware numbers: 60 fps vkcube dropped 0x47 -> 0x01 (~760–800 mW saved), uncapped vkcube lifted cleanly to 0x47 and returned to 0x00 on idle, idle CLPC sampling dropped 20–70/s -> 0–8/s, 0 failed units, 0 new kernel warnings/errors.

Follow-ups (not blocking): queued CI; optional low-power profile toggle

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 86e5acd29fe4 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at 86e5acd that the readiness check found (PR body or comment). CI: linux train L4 = main (after L3) + 34 approved PRs (#3419 dropped: conflicts): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit ane-boot/clpc/ane-pm/dcp-fabric/dcp-topology/dcp-display/macaudio/asahi/sep all pass, host tests apple-dcp + apple-scaler-recovery pass (the red host-tests on some heads were base failures since fixed on main). The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 2ad014c into main Dec 1, 2026
45 of 82 checks passed
@RyanTheTide
RyanTheTide deleted the feat/t8142-clpc-power branch December 1, 2026 09:06

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

Reviewed 86e5acd. The lower CPU floor and GPU ladder preserve the top DCS/fabric states and the ANE floor. The J813 trial shows the ladder dropping under light load and restoring full bandwidth at saturation. The J815 row covers the 15-inch model. The focused host checks and Apple build passed.

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:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (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.

4 participants