Skip to content

cpufreq: apple-soc: park an idle cluster at its slowest state - #3717

Merged
DjDeveloperr merged 5 commits into
mainfrom
feat/apple-cpufreq-park-idle-clusters
Dec 2, 2026
Merged

DjDeveloperr merged 5 commits into
mainfrom
feat/apple-cpufreq-park-idle-clusters

Conversation

@erikwb

@erikwb erikwb commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: When every CPU of a cluster is idle, park the cluster at its slowest performance state, and restore cpufreq's request when the first CPU wakes. cpufreq stays the only owner of the requested speed. The idle table and s2idle are unchanged. Selected by hardware capability (verify_transition: command-state readback and lazy verification), enabling it across T6050, T8140, T8142, and T8152. Based on the design in #1988 by @RyanTheTide; this rewrites it for main's lazily verifying cpufreq (reconciled onto verify_transition, transition_ns, retry_ns, and fast_switch_possible = true in d072461ac9f9, then dropping the T6050-only park_idle table gate in 99fc90dbe301), with KUnit coverage, and replaces that draft.
Tested: Exact head 99fc90dbe301: J716c (T6050, firmware 27.2, desktop up, 0 Oops/WARN/BUG/Call trace) in a composite trial kernel (origin/main d3de772ac0c1 + 99fc90dbe301, #3398/#3410, #3409, #3273, #3289, #3359) passed cluster parking (/sys/kernel/debug/apple-cpufreq/park: enabled 1, failed 0 across all three clusters before/after a 6 s three-cluster load) and DVFS ramp under pinned load (300 / 4044 MHz -> 4380 / 4380 / 4608 MHz within 0.5 s -> 2964 / 300 / 300 MHz 3 s after); dedicated cpufreq KUnit suite (drivers/cpufreq/apple-soc-cpufreq.kunitconfig, arm64 QEMU -smp 2, LLVM): 113/113 passed (apple_soc_cpufreq 56 subtests including all 17 parking cases plus T8140/T8142 park/restore, apple_soc_cpufreq_policy 10 subtests including T8142 get_rate while parked), arm64 LLVM=1 W=1 aurora_defconfig build of drivers/cpufreq/apple-soc-cpufreq.o and drivers/cpuidle/cpuidle-apple.o (0 warnings), checkpatch.pl --strict (99fc90dbe301 and de9aaeb9bb5a 0 errors / 0 warnings), and clean git merge-tree against origin/main. Prior-head baseline checks (J714s M5 Pro T6050 at d072461ac9f9 with physical deep sleep and post-wake Borealis RT; J716c at 27ffbe1aa92a and de9aaeb9bb5a, including 16.61 W vs 16.75 W battery idle power; J713 at 27ffbe1aa92a and de9aaeb9bb5a; J616C by @AxxzyWasTaken with local soc_t6041_info at 27ffbe1aa92a; cpuidle-s2idle 168 assertions at 27ffbe1aa92a) are recorded under Evidence as pre-99fc90dbe301 baseline evidence (drivers/cpuidle/cpuidle-apple.c and include/linux/soc/apple/cpuidle.h are unchanged since de9aaeb9bb5a).
Risk: two-way door · parking: verify_transition SoCs (T6050, T8140, T8142, T8152) · the idle-state change (hooks, RCU-idle flag on index 1): every M4-and-later Mac
Not yet: Exact-head 99fc90dbe301 T6050 (J716c) sleep/wake verification (rtcwake -d /dev/rtc1 -m freeze -s 10 s2idle did not wake without a local key press, matching main; real deep suspend/resume not yet run; J714s not re-tested at 99fc90dbe301); exact-head 99fc90dbe301 T8132 (J713) control pass demonstrating frequency transitions under load with parking inactive plus s2idle and deep sleep (J713 currently off-network/unreachable); T8142 / T8140 / T8152 hardware rows with parking active; hosted CI and independent approving review at 99fc90dbe301.

Details

Two feature commits (fd6138724211, de9aaeb9bb5a), two forward merges (27ffbe1aa92a, d072461ac9f9), and capability-based selection (99fc90dbe301):

  • cpuidle: apple: add hooks for cluster performance-state parking. From M4 on, idle index 1 (a copy of WFI) calls @enter/@exit hooks that the cpufreq driver installs, around its WFI. @enter gets the CPU's next timer event and its CPU latency limit. The state gains CPUIDLE_FLAG_RCU_IDLE and does its own ct_cpuidle_enter/exit. Exit latencies and residencies are unchanged, so the governors and the s2idle selector pick the same state as before; the s2idle entry is plain WFI and calls no hook. apple_cpuidle_park_sync(mask) waits for the CPUs of a mask to be past their hooks (an IPI wakes them from WFI), so a cluster can be freed safely, and CPUs of other clusters don't hold that up.
  • cpufreq: apple-soc: park an idle cluster at its slowest state.
    • A per-cluster 64-bit word counts the idle CPUs taking part (low half) and the wakeups (high half). The last CPU in parks only if nothing has woken since its own increment, no CPU of the cluster has a timer due within 1 ms (APPLE_PARK_MIN_IDLE_NS, a named policy constant), each CPU's latency limit allows a transition, and the cluster is idle as far as cpufreq goes: fast switch in charge, nothing pending, its last request accepted, its verify timer idle.
    • Parking changes nothing cpufreq sees: not policy->cur, not the expected or pending state, not the verify state. ->get() of a parked cluster reports the last state issued to it.
    • The first CPU to wake restores cpufreq's request, clamped to the limits in force then, through the existing lazily verified write. If the park command is still running, the restore waits as a pending request for the verify timer or the next fast switch; nothing in the idle or fast-switch path spins.
    • A request while parked (fast switch, policy or thermal limit) becomes the pending request and is recorded as accepted only when written, as for a request that finds the cluster busy.
    • A refused park turns parking off for that cluster and writes the request once. A park still busy a transition timeout later is a transition failure like any other.
    • Each park and restore command is read back before the cluster lock is dropped.
    • Suspend, policy exit and waited-for requests restore the cluster and stop parking. An offline CPU never counts as idle, so a cluster with an offline CPU never parks.
    • debugfs apple-cpufreq/park: per cluster, parks, restores, failures, enabled.
    • Forward merge d072461ac9f9 (main 5de2a38b404d): adopts main's unified verify_transition flag (replacing lazy_verify), uses per-policy priv->transition_ns in apple_soc_cpufreq_unpark(), preserves priv->retry_ns backoff reset across apple_soc_cpufreq_lazy_issue(), and keeps policy->fast_switch_possible = true.
  • Capability-based selection (verify_transition, 99fc90dbe301): parking needs a SoC whose command register reads back the state the cluster took (verify_transition), so a refused park is detected and every request serialises under priv->lock. Removing the T6050-only park_idle flag enables parking across all verify_transition SoCs (T6050, T8140, T8142, and T8152) and takes priv->lock in ->get() across all of them. On boards with apple,fast-die-effort (T8140, T6050 J714s), fast die-temperature cap updates while parked queue into priv->pending_pstate and apply on restore; on T8142 under /psci, cpuidle-psci handles idle so cpuidle-apple hooks are unused, while non-PSCI cpuidle-apple boots park through apple_enter_wfi_park. Non-verify_transition SoCs (T8132, T8112, T8103, S5L8960X) keep parking disabled.
Evidence

Exact-head checks at 99fc90dbe301

  • J716c (M5 Max, T6050, fw 27.2) on composite trial kernel (origin/main d3de772ac0c1 + 99fc90dbe301 and #3398/#3410, #3409, #3273, #3289, #3359, chained dead-man trial Stage 2, desktop up, 0 Oops/WARN/BUG/Call trace):
    • /sys/kernel/debug/apple-cpufreq/park: enabled 1 on all three clusters, failed 0 throughout (cpus 0-5: 2228/2220 -> 2251/2243, cpus 6-11: 1334/1325 -> 1350/1342, cpus 12-17: 1041/915 -> 1067/941 parks/restores before and after a 6 s three-cluster load).
    • DVFS under load (one busy loop pinned on cpu0, cpu6, cpu12): 300 MHz / 4044 MHz idle -> 4380 / 4380 / 4608 MHz within 0.5 s, settling back to 2964 / 300 / 300 MHz 3 s after.
    • Sleep/wake not yet verified at 99fc90dbe301: rtcwake -d /dev/rtc1 -m freeze -s 10 (s2idle) did not wake without a local key press (matching main), and real deep suspend/resume was not run.
  • Dedicated cpufreq KUnit suite (./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/cpufreq/apple-soc-cpufreq.kunitconfig --qemu_args="-smp 2"): 113/113 passed (0 failed, 0 skipped; apple_soc_cpufreq: 56 subtests including all 17 parking cases and T8140/T8142 park/restore in cft_test_park_restore; apple_soc_cpufreq_policy: 10 subtests including T6050/T8142 cft_test_get_parked; apple-clpc-gpu: 15; apple-clpc-policy: 6).
  • arm64 LLVM=1 W=1 aurora_defconfig build of drivers/cpufreq/apple-soc-cpufreq.o and drivers/cpuidle/cpuidle-apple.o: 0 warnings.
  • scripts/checkpatch.pl --strict --git origin/main..99fc90dbe301: de9aaeb9bb5a and 99fc90dbe301 clean (0 errors, 0 warnings, 0 checks); fd6138724211 has one MAINTAINERS warning for include/linux/soc/apple/cpuidle.h, already covered by F: include/linux/soc/apple/*.
  • git merge-tree --write-tree origin/main 99fc90dbe301: clean (bf0b7dd3c581).

Prior-head baseline evidence (d072461ac9f9, 27ffbe1aa92a, and de9aaeb9bb5a, before 99fc90dbe301)

  • Hosted CI at d072461ac9f9: apple-build, host-tests, pr-text, readiness, KUnit plan, KUnit dcp-topology asahi — all SUCCESS. drivers/cpuidle/cpuidle-apple.c and include/linux/soc/apple/cpuidle.h are unchanged since de9aaeb9bb5a.
  • J714s (M5 Pro, T6050) at d072461ac9f9 (7.3.0-m5-pr3717-d072461ac9f9):
    • Clean boot (16 SLC planes, online=1, SEP writes enabled, 0 GPU/MMU faults or panics).
    • Physical deep sleep (30.36 s via /dev/rtc1 apple-pmu-rtc): suspend_stats success 0 -> 1, fail 0; apple-sleep firmware resume 0 -> 1.
    • Post-wake /sys/kernel/debug/apple-cpufreq/park: all three clusters stayed enabled 1 with failed 0, and all three 300 MHz minima were restored (cpus 0-5: 2,402 / 2,402 -> 2,425 / 2,425; cpus 6-11: 35 / 35 -> 1,658 / 1,640; cpus 12-17: 29 / 28 -> 2,217 / 2,215).
    • Post-wake GPU workload: headless GPUBench Vulkan RT (rt.scene medium, 3 runs, timestamps on, Borealis git-d725cb9a39) passed all 3 runs with CRC32 b541b83e and 403.9 FPS median (431.2 FPS GPU-timed median), 0 GPU/MMU faults or panics in retained journal, clean stock handback.

J716c (M5 Max, T6050) at de9aaeb9bb5a / 27ffbe1aa92a (default command line):

  • Boot: desktop up, idle table unchanged (WFI WFI), no oopses or WARNINGs. One failed unit, aurora-peripherals.service, which fails the same way on the daily without this change.
  • apple-cpufreq/park about a minute after boot: cpus 0-5 parks 2708 restores 2695 failed 0 enabled 1, cpus 6-11 parks 1430 restores 1421 failed 0 enabled 1, cpus 12-17 parks 1712 restores 1536 failed 0 enabled 1.
  • 30 s deep sleep (rtcwake -d rtc1 -m mem -s 30): woke on the RTC, desktop and Wi-Fi back, parking running again on all three clusters, 0 failures.
  • J716c again at 27ffbe1aa92a merged with main 429e7e15f122 (one-shot trial kernel with five other open PR heads, Linux 7.3.0, AC, default command line, default Stage 2): idle table WFI WFI, apple-cpufreq/park enabled 1 on all three clusters (cpus 0-5 parks 14840 restores 14803 failed 0, cpus 6-11 parks 4591 restores 4529 failed 0, cpus 12-17 parks 5249 restores 5064 failed 0, counters rising 10 s apart at idle), checked after 2x pm_test=devices and 1x pm_test=platform suspend cycles, 4x eDP-1 DPMS off/on, vkcube --c 240 --wsi wayland clean, 0 GPU/MMU faults or Oops/WARN, 1 failed unit (aurora-peripherals.service, as on default).

Idle power on battery (J716c, de9aaeb9bb5a). Idle desktop, panel on at the same brightness, 3 min settle then 15 min measured. Drain from the battery coulomb counter (charge_counter) times the mean battery voltage. CPUs 0.13 to 0.14% busy in both runs.

Kernel Drain over 900 s Mean voltage Power
with parking (de9aaeb9) 320 539 µAh 12.954 V 16.61 W
without (the daily) 324 424 µAh 12.907 V 16.75 W

An earlier prototype measured 16.65 W vs 16.76 W the same way. Both pairs ran the parking kernel first.

J616C (M4 Max, macOS 27.2 26B123) at 27ffbe1aa92a (reported by @AxxzyWasTaken with a local soc_t6041_info entry): all three clusters (cpus 0,5-8, 1-4, 9-13) actively parked and restored with failed 0, enabled 1 across cold boot idle (parks 100/223/71, restores 88/221/63) and s2idle + 2x deep sleep (parks 154/13/8, restores 138/13/7), 0 cpufreq/cpuidle warnings or regressions in dmesg.

J713 (M4 Air, T8132), the idle-state change without parking (de9aaeb9bb5a):

Kernel Boot Idle, 5 min on battery, panel on CPU busy
A: without desktop, 0 failed units, no oopses 73 657 µAh, 12.994 V -> 11.48 W 0.20%
B: with this PR (de9aaeb9) desktop, 0 failed units, no oopses, idle table unchanged (WFI WFI), no apple-cpufreq/park (parking off) 74 000 µAh, 12.973 V -> 11.52 W 0.20%

J713 (M4 Air, T8132, 27.2 firmware) at 27ffbe1aa92a in the composite trial kernel (main 429e7e15f122 with #3359, #3560, #3491, #3717, #3297, #3300; Linux 7.3.0, battery, default command line, GRUB one-shot + one-shot Stage 2 carrying composite t8132-j713.dtb): parking stays off on T8132 (no /sys/kernel/debug/apple-cpufreq/park, apple_soc_cpufreq loaded, apple_idle, P-cluster idle at 912 MHz), s2idle (20 s) and deep suspend/resume (25 s) resumed cleanly (suspend_stats fail 0, 0 failed units, 0 AppArmor denials, 0 Oops/WARN).

Prior host tests at 27ffbe1aa92a:

  • cpuidle-s2idle host replay (tools/testing/selftests/drivers/gpu/apple-dcp/idle.py): 168 assertions passed at 27ffbe1a (-Wno-unused-but-set-global under host clang 23 for the existing system_state stub; 35/35 apple-dcp lifecycle replay passed at de9aaeb9).
  • arm64 LLVM=1 W=1 builds of drivers/cpufreq/ and drivers/cpuidle/ at 27ffbe1a: 0 warnings.

An idle CPU cluster keeps the performance state it was last asked for,
and its voltage with it: schedutil only runs from scheduler events on
the cluster's CPUs. The cpufreq driver can park a cluster whose CPUs are
all idle at its slowest state and restore it when the first CPU wakes,
but it needs to know when each CPU enters and leaves idle.

From M4 on, the deepest idle state (index 1) is a copy of WFI. Let it
call a pair of hooks the cpufreq driver installs: @Enter before the WFI,
with the CPU's next timer event (cpuidle_device.next_hrtimer) and its
CPU latency limit, and, if @Enter returned a cookie, @EXIT with it after
the WFI. They run with RCU watching, so the state now has
CPUIDLE_FLAG_RCU_IDLE and leaves RCU itself around the WFI. Neither hook
may wait for the hardware.

No new idle state: the table, the exit latencies and target residencies
stay as they are, so the governors and the s2idle selector pick the same
state as before. The state's s2idle entry is plain WFI and calls no
hook. Index 0 and the M1 to M3 CPU PD state are unchanged.

The cpufreq driver may be a module, and frees what a cookie points to
when a policy goes away. A CPU runs @Enter, its WFI and @EXIT with
interrupts off from start to end, so once it has taken an interrupt it
is past @EXIT, and its next @Enter reads what was stored before the
interrupt was sent. apple_cpuidle_park_sync() sends a function call to
each online CPU of a mask and waits for it to run. A CPU in WFI wakes
for it, so the wait is bounded, and only the CPUs of the mask are
waited for: a CPU of another cluster between its own hooks does not
hold it up. The cpufreq driver calls it on a cluster's CPUs before it
frees the cluster, and clearing the hooks calls it on every CPU.

Update the apple-dcp cpuidle-s2idle host replay for the new entry
functions, and check that index 1 calls the hooks around its WFI, that
index 0 and s2idle do not, that @EXIT gets the cookie of an @Enter that
took part and runs only then, that the CPU has left RCU at its WFI and
is back for the hooks, that interrupts stay off from @Enter to @EXIT,
and that apple_cpuidle_park_sync() calls only the CPUs it is given, and
waits.

Based on the parking design in Ryan Murray's draft
(#1988).

Signed-off-by: Erik Bourget <erik@ebourget.net>
schedutil only runs from scheduler events on a cluster's CPUs, so an
idle cluster keeps the last state it was asked for, and its voltage with
it. A short burst of work, or a real-time task, which runs at full speed
by default, leaves an idle cluster at a high state until its next
wakeup. Move a cluster whose CPUs are all idle to the slowest state of
its frequency table, and back to cpufreq's request when the first of
them wakes.

cpufreq stays the only owner of the request, and does not see a park.
Parking changes neither policy->cur nor the expected state, the pending
request or the verify deadline. ->get() reports the expected state of a
parked cluster, the last state issued to it (a pending request or a
newer limit may change what the restore writes), and reads the cluster
under the lock a park takes. The expected state is cpufreq's last
request, clamped to the limits and accepted by the cluster. The restore
writes cpufreq's pending request if there is one, else the expected
state, clamped to the limits in force then (a QoS ceiling the policy
work has yet to pass on included), as an ordinary lazily verified
request: the verify timer checks it, and a refusal stops requests and is
reported as for any other. A cluster parks only while fast-switch
requests own it, with no request pending, no failure, its last request
accepted and its verify timer idle.

Every request of cpufreq supersedes parking, under the same lock. A fast
switch becomes the pending request, which the restore writes at once,
or, while the park request runs, once it has finished; a fast switch
that restores the cluster itself reports the state the restore wrote,
which a limit newer than its own choice may have lowered; a new policy
or thermal limit becomes the pending request, which the restore writes
when a CPU wakes. Until it is written, such a request is not accepted,
as for a request that finds the cluster busy: policy->cur follows it,
but the time in state and the scheduler's frequency scale only once it
is written, and a failure before then drops it. A waited-for request
restores the cluster before its own, and stops parking until the next
fast switch. Suspend and resume go through waited-for requests, so a
cluster does not park from suspend until the governor runs again.

Last CPU in and first CPU out are found without a new idle state. The
deepest idle state calls hooks around its WFI (previous commit), and the
cluster counts the CPUs idling there atomically. Only the CPU that makes
the count full takes the lock to park. It marks the cluster parked and
reads the count again before it writes the park request; a waking CPU
lowers the count, then reads the mark; both with full barriers. So
either the park is called off, or every CPU that wakes after it sees the
mark, and takes the lock to restore the cluster before it runs anything.
The same word counts the wakeups, and the park is called off unless it
is unchanged since the last CPU counted itself in: the timers that CPU
read are then those of the idle the count describes, not of an earlier
one of a CPU that has woken and gone idle again meanwhile. An offline
CPU is never counted, so a cluster with an offline CPU does not park,
and a CPU coming online never finds its cluster parked.

Each park and restore command is read back before the lock is dropped.
The read completes only once the write has reached the register, so the
next CPU to take the lock reads the command register after it.

Latency: nothing in the idle path waits for the cluster. A waking CPU
takes the cluster's lock only if the cluster is parked, and no holder of
that lock waits for the cluster, so it waits at most for another CPU's
short critical section. The restore is a posted write, and the waking
CPU runs at the slowest state until the transition is done. A CPU that
wakes while the park request is still running does not wait for it: the
restore is owed to the verify timer, which writes it once the park
request has finished, unless a fast switch writes first. A cluster parks
only with its verify timer idle, so the timer of a parked cluster runs
only for an owed restore. A CPU takes part only if its CPU latency limit
allows a transition (policy->cpuinfo.transition_latency), and the
cluster parks only if, as each of its CPUs went idle, none had its next
timer event due within a millisecond of the park: a policy threshold
against the two transitions a park costs. The next timer event is read
as the generic PM domain's CPU governor does. The idle states and their
numbers stay as they are, so the governors and the s2idle selector pick
the same state as before, and s2idle does not park.

Failures: if the cluster did not take the park request, parking stops
for the cluster, and the restore is written once all the same. A park
request still busy a transition timeout after it was written is a
transition failure like any other: requests stop, and nothing more is
written, so the cluster stays where the park request leaves it, its
slowest state if it completes late, as after any timed-out transition. A
waited-for request waits for the park request to finish, for at most
that timeout, without holding the lock. The verify timer reports either
failure, after it drops the lock; nothing prints from the idle path.
There is no other correction; policy->cur changes only to drop a request
the failure left unwritten.

Lifetime: ->init() hands a cluster to the idle hooks through per-CPU
pointers. ->exit(), which the core also calls with the cluster's CPUs
online when a policy fails to come up, clears them, then waits with
apple_cpuidle_park_sync() for the cluster's own online CPUs to leave the
hooks (previous commit) before it frees the cluster. A CPU between them
keeps the cluster its enter hook returned until then. The wait ends once
those CPUs have taken an interrupt, which wakes them from WFI; CPUs of
other clusters, between their own hooks, do not hold it up. The core
holds the CPU hotplug lock around ->exit(), and an offline CPU is never
between the hooks.

Parking is on for T6050 only. It needs a SoC that verifies its requests
lazily: the command register reads back the state the cluster took, so
a refused park is seen, and every request goes through the lock the
idle path takes. T8140 verifies lazily as well, but parking stays off
there until it has been checked against T8140's thermal control on the
hardware; the per-SoC flag lets it be turned on later. The other SoCs
either do not read requests back, or wait for each one, which the idle
path cannot.

A debugfs file, apple-cpufreq/park, gives a line for each cluster that
parks: its CPUs, the park and restore commands written, the failures,
and whether it may park.

The KUnit cases for parking work on a cluster of their own, which the
idle hooks never see, and need two CPUs: run the suite with
--qemu_args='-smp 2', as the kunitconfig says, or they skip. Two of
them run a thread on CPU 1: a CPU waking while a waited-for request
waits for a park request, and a CPU of another cluster between the
hooks while a cluster is taken back.

Based on the parking design in Ryan Murray's draft
(#1988).

Signed-off-by: Erik Bourget <erik@ebourget.net>

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

Blockers:

  • Hosted CI at de9aaeb9bb5a is still queued (22 jobs queued: apple-build, host-tests, kunit, pr-text, readiness, and KUnit suites) — wait for all checks to complete green.
  • M4 regression row (J713, listed under Not yet:) confirming the CPUIDLE_FLAG_RCU_IDLE / index-1 hook change boots and suspends/resumes cleanly on an M4 Mac where park_idle is off.

Checked:

  • Audited drivers/cpuidle/cpuidle-apple.c and include/linux/soc/apple/cpuidle.h:
    • Verified CPUIDLE_FLAG_RCU_IDLE handling matches drivers/cpuidle/cpuidle.c: both normal idle (apple_enter_wfi_park -> apple_enter_wfi_rcu) and s2idle (enter_s2idle_proper skips ct_cpuidle_enter/exit when CPUIDLE_FLAG_RCU_IDLE is set -> apple_enter_wfi_rcu) balance ct_cpuidle_enter() / ct_cpuidle_exit() cleanly without invoking park hooks in s2idle.
    • Verified apple_cpuidle_set_park_ops() (smp_store_release) / apple_enter_wfi_park() (smp_load_acquire) and apple_cpuidle_park_sync() (on_each_cpu_mask) safely drain CPUs past @exit because interrupts remain disabled across @enter, WFI, and @exit.
  • Audited drivers/cpufreq/apple-soc-cpufreq.c:
    • Verified APPLE_PARK_LEAVE = BIT_ULL(32) - 1 atomically decrements the low 32-bit idle CPU count (always >= 1 on park_wake) and increments the upper 32-bit wakeup counter without underflow.
    • Verified the Dekker memory ordering between apple_soc_cpufreq_park() (WRITE_ONCE(priv->parked, true); smp_mb(); atomic64_read(&priv->park_idle) != idle) and apple_soc_cpufreq_park_wake() (atomic64_add(APPLE_PARK_LEAVE); smp_mb__after_atomic(); READ_ONCE(priv->parked)).
    • Verified teardown ordering in apple_soc_cpufreq_exit() (drain() sets waited = true, unparks, and cancels verify_timer before park_withdraw() clears apple_park_priv, runs apple_cpuidle_park_sync(&priv->park_cpus), and frees park_next) and module_exit() (park_unregister() before cpufreq_unregister_driver()).
    • Noted J716c (M5 Max, T6050) exact-head de9aaeb9 boot + 30 s deep sleep + battery idle power proof, 108/108 KUnit (17 parking tests), and 35/35 apple-dcp lifecycle replay.
Evidence
  • Head: de9aaeb9bb5a9182cd413d08acf7f0f8916b174b (base main, MERGEABLE, 2 commits: fd61387242, de9aaeb9bb).
  • No code, concurrency, or RCU defects found; T8140 parking enablement is out of scope for this PR and not a blocker.

@github-actions github-actions Bot added area:power Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (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) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at 99fc90db: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 99fc90db
Conflicts ok none
PR text ok Risk: two-way · parking: verifytransition SoCs (T6050, T8140, T8142, T8152) · the idle-state change (hooks, RCU-idle flag on index 1): every M4-and-later Mac

Areas: area:power
Merge: gh pr merge 3717 --merge (Owners and Core through the bypass: add --admin).

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: MERGE at de9aaeb9bb5a

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 drivers/cpuidle/cpuidle-apple.c and include/linux/soc/apple/cpuidle.h:

  • Verified CPUIDLE_FLAG_RCU_IDLE handling matches drivers/cpuidle/cpuidle.c: both normal idle (apple_enter_wfi_park -> apple_enter_wfi_rcu) and s2idle (enter_s2idle_proper skips ct_cpuidle_enter/exit when CPUIDLE_FLAG_RCU_IDLE is set -> apple_enter_wfi_rcu) balance ct_cpuidle_enter() / ct_cpuidle_exit() cleanly without invoking park hooks in s2idle.
  • Verified apple_cpuidle_set_park_ops() (smp_store_release) / apple_enter_wfi_park() (smp_load_acquire) and apple_cpuidle_park_sync() (on_each_cpu_mask) safely drain CPUs past @exit because interrupts remain disabled across @enter, WFI, and @exit.
  • Audited drivers/cpufreq/apple-soc-cpufreq.c:
    • Verified APPLE_PARK_LEAVE = BIT_ULL(32) - 1 atomically decrements the low 32-bit idle CPU count (always >= 1 on park_wake) and increments the upper 32-bit wakeup counter without underflow.
    • Verified the Dekker memory ordering between apple_soc_cpufreq_park() (WRITE_ONCE(priv->parked, true); smp_mb(); atomic64_read(&priv->park_idle) != idle) and apple_soc_cpufreq_park_wake() (atomic64_add(APPLE_PARK_LEAVE); smp_mb__after_atomic(); READ_ONCE(priv->parked)).
    • Verified teardown ordering in apple_soc_cpufreq_exit() (drain() sets waited = true, unparks, and cancels verify_timer before park_withdraw() clears apple_park_priv, runs apple_cpuidle_park_sync(&priv->park_cpus), and frees

Follow-ups (not blocking): queued CI; J713 M4 regression row

Signed-off-by: Erik Bourget <erik@ebourget.net>
@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Forward-merged origin/main (6e3906ec9937, including #3711) into feat/apple-cpufreq-park-idle-clusters at 27ffbe1aa92a (Signed-off-by: Erik Bourget <erik@ebourget.net>).

Changes in 27ffbe1aa92a:

Verification at 27ffbe1aa92a:

  • drivers/cpufreq/apple-soc-cpufreq.kunitconfig (arm64 QEMU, LLVM=1, --qemu_args="-smp 2"): 109/109 passed (including cft_test_t8142_lazy_fast_switch and all 17 parking tests).
  • arm64 LLVM=1 W=1 builds of drivers/cpufreq/ (CONFIG_ARM_APPLE_SOC_CPUFREQ=m) and drivers/cpuidle/ with CONFIG_ARM_APPLE_CPUIDLE=y and =n (checking include/linux/soc/apple/cpuidle.h stubs): 0 warnings.
  • cpuidle-s2idle host replay (tools/testing/selftests/drivers/gpu/apple-dcp/idle.py): 168 assertions passed (compiled with -Wno-unused-but-set-global on host clang 23 for the existing system_state stub).
  • ./scripts/checkpatch.pl --strict --git origin/main..HEAD: cpufreq commit clean (0 errors, 0 warnings, 0 checks); cpuidle commit has 0 errors and 1 MAINTAINERS warning for include/linux/soc/apple/cpuidle.h, already covered by F: include/linux/soc/apple/*.

Hardware scope:

  • J716c (M5 Max, parking active) and J713 (M4 Air, boot and 5 min idle with parking off) remain recorded at de9aaeb9, with zero runtime driver diff relative to 27ffbe1aa92a beyond main.
  • J716c (M5 Max) was also run at 27ffbe1aa92a merged with main 429e7e15f122 in a one-shot trial kernel: apple-cpufreq/park enabled 1 and failed 0 on all three clusters with the counters rising at idle (checked after 2x pm_test=devices and 1x pm_test=platform suspend cycles), idle table WFI WFI, 0 GPU/MMU faults, 0 Oops/WARN.
  • J713 (M4 Air, T8132, 27.2 firmware) at 27ffbe1aa92a in the composite trial kernel (main 429e7e15f122 with #3359, #3560, #3491, #3717, #3297, #3300): parking stays off on T8132 (no /sys/kernel/debug/apple-cpufreq/park, no apple-cpufreq: idle parking unavailable line, apple_soc_cpufreq loaded, cpuidle driver apple_idle, P-cluster idle at 912 MHz); s2idle (20 s) and deep suspend/resume (25 s) resumed cleanly (suspend_stats fail 0, 0 failed units, 0 AppArmor denials, 0 Oops/WARN, no new err line).
  • T8140 and T8142 rows remain in **Not yet:** before turning parking on there.

@github-actions github-actions Bot removed merge-conflict Conflicts with the base branch (bot) ci-failing A check failed at the PR head (bot) labels Dec 1, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Dec 1, 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.

Reviewed the fully ordered park/wake count, timer handoff on a busy restore, and hook withdrawal before freeing per-CPU state. The exact-head J716c and J713 rows cover parking and the shared idle hooks. Hosted Apple build and KUnit are still pending.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor

Tested #3717 (27ffbe1aa92a, merged into a local 7.3.0 build on J616C / M4 Max, macOS 27.2 firmware 26B123) with a small soc_t6041_info entry for "apple,t6041-cluster-cpufreq" (.verify_transition = true, .lazy_verify = true, .park_idle = true, .transition_timeout_us = 2000, .max_pstate = 31, T8112 cur_pstate mask/shift).

Results on J616C:

  • All three clusters (cpus 0,5-8, 1-4, 9-13) actively park and restore with zero failures:
    • Cold boot idle: parks 100/223/71, restores 88/221/63, failed 0, enabled 1
    • Across s2idle (freeze) and 2x consecutive deep sleep (mem): parks 154/13/8, restores 138/13/7, failed 0, enabled 1
  • Zero cpufreq/cpuidle warnings or regressions in dmesg.

Happy to send the one-commit soc_t6041_info follow-up once #3717 merges (or provide a standalone A/B idle power measurement on J616C if useful).

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 1, 2026
Use verify_transition for the parking path and its invariant test now
that fast-switch verification no longer has a separate flag. Use the
policy's transition latency for park restore and reset retry backoff for
each issued request.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Forward-merged current main at 5de2a38b404d into d072461ac9f9. The resolution uses main’s unified transition-verification flag and per-policy transition latency, and preserves the retry-backoff reset for both queued requests and park restores. The PR still changes the same six files. Fresh CI is running.

The conflict touched runtime code, so the earlier rows are baseline evidence. The next hardware rows are J714s/T6050 for a clean boot, counters advancing with zero park failures, and parking resuming after deep sleep, plus J773g/T8132 for normal frequency switching with parking inactive. Please tie results and re-review to d072461ac9f9.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s / T6050 hardware result at d072461ac9f9 (partial). The candidate booted cleanly and completed the headless RT workload before sleep. CPUs 6–11 advanced from 2,736 to 8,308 parks and from 2,717 to 8,253 restores, with zero parking failures across all three clusters. One 29.97 s physical deep-sleep cycle woke on Apple PMU RTC and resumed the same kernel boot. The retained journal had no GPU/MMU faults or panic. Wi-Fi and KIS did not recover during the trial, so we still need post-resume counters and a GPU workload captured locally. Stock PR67 handback and SSH recovery were verified. The J773g frequency-switching control and independent review at this head remain open.

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

Copy link
Copy Markdown
Contributor

J714s / T6050 hardware result at d072461ac9f9 (complete, local post-wake recorder).

  • Boot & deep sleep: Candidate 7.3.0-m5-pr3717-d072461ac9f9 booted cleanly with 16 SLC planes, online=1, SEP writes enabled, and zero GPU/MMU faults or panics. One physical 30 s RTC deep-sleep cycle (/dev/rtc1, apple-pmu-rtc) measured 30.36 s (30363469705 ns) and resumed on the same boot (suspend_stats success 0 → 1, fail 0; apple-sleep firmware resume 0 → 1; one PM: suspend entry (deep) / PM: suspend exit).
  • Post-wake parking counters (/sys/kernel/debug/apple-cpufreq/park): All three clusters stayed enabled 1 with failed 0 in every snapshot, and all three 300 MHz minima were restored:
    • CPUs 0–5: 2,402 / 2,402 pre-sleep → 2,425 / 2,425 after wake (+23 / +23 across sleep; flat during the short post-wake exercise window)
    • CPUs 6–11: 4,659 / 4,636 pre-sleep → 35 / 35 after wake → 979 / 961 after post-wake workload/default idle → 1,658 / 1,640 after exercise (+1,623 / +1,605 post-wake)
    • CPUs 12–17: 2,843 / 2,816 pre-sleep → 29 / 28 after wake → 1,191 / 1,189 after post-wake workload/default idle → 2,217 / 2,215 after exercise (+2,188 / +2,187 post-wake)
  • Post-wake GPU workload: Captured locally after wake, headless GPUBench Vulkan RT (rt.scene medium, 3 runs, timestamps on, Borealis git-d725cb9a39) passed all 3 runs with CRC32 b541b83e and 403.9 FPS median (431.2 FPS GPU-timed median; pre-sleep 403.2 FPS, stock PR67 403.3 FPS, matching CRC32), with zero GPU/MMU faults or panics in the retained candidate journal.
  • Handback: Clean rollback and reboot to stock 7.3.0-m5-pr67 verified with SSH, 16 SLC planes, stock GPU smoke pass, all 13 slot/Stage 2 and 71 ICD hashes matching, 0 altered Mesa files, and no new failed units.

The J714s/T6050 row at d072461ac9f9 is complete; the J773g frequency-switching control and independent review at this head remain open.

Idle cluster parking requires command-state readback and lazy
verification under priv->lock so refused parks are detected and every
DVFS request serialises with the idle hooks. Now that main uses
verify_transition across all SoCs with that hardware capability (T6050,
T8140, T8142, and T8152), drop the T6050-only park_idle table flag and
enable idle parking wherever verify_transition is set.

Update apple_soc_cpufreq_get_rate() to take priv->lock for all
verify_transition SoCs, and update the KUnit invariants and parking
tests to cover T8140 and T8142 alongside T6050.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review findings in 99fc90dbe301 on top of d072461ac9f9 and updated the PR body:

  • Hardware-capability selection (99fc90dbe301): dropped the T6050-only park_idle flag in drivers/cpufreq/apple-soc-cpufreq.c and selected idle parking directly on info->verify_transition (command-state readback and lazy verification), enabling it across T6050, T8140, T8142, and T8152, and taking priv->lock in apple_soc_cpufreq_get_rate() across all verify_transition SoCs.
  • Board label: corrected J714s from M5 Max to M5 Pro in the PR body.
  • Exact-head KUnit & style checks at 99fc90dbe301: ran ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/cpufreq/apple-soc-cpufreq.kunitconfig --qemu_args="-smp 2" (113/113 passed, 0 failed, 0 skipped, including T8140 and T8142 park/restore and T8142 get_rate while parked), arm64 LLVM=1 W=1 aurora_defconfig build of drivers/cpufreq/apple-soc-cpufreq.o and drivers/cpuidle/cpuidle-apple.o (0 warnings), and scripts/checkpatch.pl --strict --git origin/main..99fc90dbe301 (0 errors, 0 warnings on de9aaeb9bb5a and 99fc90dbe301).
  • Exact-head J716c (T6050) hardware pass at 99fc90dbe301: booted in a composite trial kernel (origin/main d3de772ac0c1 + 99fc90dbe301, #3398/#3410, #3409, #3273, #3289, #3359, desktop up, 0 Oops/WARN/BUG/Call trace). /sys/kernel/debug/apple-cpufreq/park showed enabled 1 and failed 0 on all three clusters (cpus 0-5: 2228/2220 -> 2251/2243, cpus 6-11: 1334/1325 -> 1350/1342, cpus 12-17: 1041/915 -> 1067/941 parks/restores before and after a 6 s three-cluster load), and pinned load across cpu0, cpu6, cpu12 ramped 300 / 4044 MHz -> 4380 / 4380 / 4608 MHz within 0.5 s and settled back to 2964 / 300 / 300 MHz 3 s later.
  • Remaining hardware checks (Not yet): J716c sleep/wake at 99fc90dbe301 (rtcwake -d /dev/rtc1 -m freeze -s 10 s2idle did not wake without a local key press, matching main; real deep suspend/resume not yet run) and the exact-head T8132 (J713) control pass (J713 currently off-network/unreachable).

@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 at 99fc90dbe301.

Earlier findings

  • The T6050-only park_idle flag is gone. Parking is now picked from the verify_transition capability in match data (drivers/cpufreq/apple-soc-cpufreq.c:2429), with no SoC or board check. Fixed.
  • ->get() now reads a parked cluster under priv->lock on every verify_transition SoC (:519). Fixed.
  • The PR text now calls J714s an M5 Pro. Fixed.

The lock in ->get()
priv->lock is a raw spinlock, always taken with irqsave. The core calls ->get() only from process context: sysfs cpuinfo_cur_freq, cpufreq_online(), governor start, cpufreq_get() and the policy refresh. cpufreq_quick_get() never calls it, because this driver has no ->setpolicy. Nothing that holds priv->lock calls back into the core, and the locked section only reads the command register. So there is no sleeping in atomic context and no self-deadlock. On T6050 this commit changes nothing at run time, since park_idle was already set there, so the J714s deep-sleep row at d072461a still covers T6050.

Wider enablement
T8140, T8142 and T8152 read back the accepted state in PS1, like T6050. The park state comes from the OPP table, which init already checks against min_pstate, so state IDs that start at 1 or 2 are fine. A fast die-temperature cap that arrives while a cluster is parked becomes the pending request, as on J714s. Two things differ from T6050:

  • T8140 sets no transition_timeout_us, so a park that is still busy after 400 us (instead of 2000 us) counts as a failure, and requests on that cluster stop until a firmware resume.
  • The hooks never run on T8152 (t8152-j873g.dts has no cpuidle node, and cpuidle-apple.c does not list T8152 for its fallback device). They also never run on T8142 boots that idle through cpuidle-psci (t8142-j813-psci-idle.dtsi). Parking does nothing there, but the park debugfs file still lists those clusters as enabled 1 with no parks.

Not blocking

  1. drivers/cpufreq/apple-soc-cpufreq-test.c:2525: cft_test_get_parked() turns on fast_switch_enabled on the live policy while schedutil is still running. The comment at :2640 warns against exactly that race. Drop the flip (the parked read does not depend on it), or use cft_live_policy_setup().
  2. PR text: say that parking is live on T6050, T8140 and non-PSCI T8142, and does nothing on T8152 and PSCI T8142, so rows there aren't read as parking passes.
  3. No hosted CI has run at this head yet.

Still owed before merge (already in Not yet): a J700 (T8140) row with parking on. That is where parking is new in our fleet. It should show enabled 1 and failed 0 on both clusters with the counters rising, a normal ramp under load and back down, none of the lines "busy timeout", "stopping requests" or "did not park", and a GPU benchmark with no drop against main. Also a T8132 control row at this head.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local CI passed for head 99fc90dbe301 merged with main ef557c14eb37 (tree 31b8c0b702e4).

  • Arm64 Clang W=1 drivers/cpufreq/ drivers/cpuidle/ passed without warnings. Enabled every option in drivers/cpufreq/apple-soc-cpufreq.kunitconfig and used ld.lld -r to link the cpufreq KUnit cases. This check covered compile and link. The author separately reported 113/113 arm64 KUnit tests at the PR head.
  • python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group lifecycle passed 37/37, including the idle.py source replay for cpuidle-s2idle.
  • python3 tools/asahi/run-host-tests.py --jobs 8 passed 969/969 on the preceding main 048505b28dda merge tree. The intervening drm/asahi: g14_v27_2: enable ps_gfx auto-PM when idle power-off is active #3507 GPU/PMGR change passed its own 969/969 host run and leaves the cpufreq, cpuidle and idle fixture sources byte-identical. The build, KUnit link and idle replay above were refreshed on ef557c14eb37.

The J700 parking and J773g control receipts at 99fc90dbe301 are the remaining merge gates.

@DjDeveloperr DjDeveloperr removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 2, 2026
@github-actions github-actions Bot added blast:neo Macs affected, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J773g (M4 mini, T8132, OS FW 27.2 / 26B123) — PASS (T8132 control row)

Tested exact PR head 99fc90dbe301d92b2c09c00800d42281266f6b38 merged --no-ff onto origin/main 048505b28ddaa177b1da6316126d04a7976e6ccc (merge commit 061ccc7974c0063dd482cb729fb973de58d2fb9a, merge tree d5583e14e69493c0d16f61178147a0cb2eb8e9bc, 0 conflicts).

  • Kernel: 7.3.0-j773g-pr3717-99fc90db (panic=10, WDT armed 178 s), boot_id=4c64459c-680b-4691-9d03-6c63f888d088
  • Parking disabled on T8132 (control check):
    • cpuidle driver: apple_idle
    • No park debugfs file present (/sys/kernel/debug/apple-soc-cpufreq and /sys/kernel/debug/apple-cpufreq both absent; parking stays disabled on T8132 via verify_transition)
  • Normal frequency switching under load (both clusters, no scaling_min_freq clamping):
    • policy0 (P-cluster, CPUs 0 7 8 9, apple-cpufreq, schedutil, 912..4464 MHz): total_trans rose 1371 -> 1488 -> 1576 -> 1742 (trans_table 108 non-zero entries, sum 1576 pre-sleep; 16 OPPs exercised; ramped 912 -> 4464 -> 912 MHz before and after s2idle)
    • policy1 (E-cluster, CPUs 1..6, apple-cpufreq, schedutil, 900..2892 MHz): total_trans rose 871 -> 915 -> 976 -> 1105 (trans_table 42 non-zero entries, sum 986 pre-sleep; 7 OPPs exercised; ramped 900 -> 2892 -> 900 MHz before and after s2idle)
    • 0 cpufreq busy/timeout/error lines in dmesg
  • Suspend / resume:
    • s2idle (rtcwake -d /dev/rtc1 -m freeze -s 5): PASS (success 0 -> 1, fail=0, DP-3 connected dpms=On, plasmalogin=active, post-wake load ramped both clusters back to max 4464 / 2892 MHz)
    • mem deep sleep (rtcwake -d /dev/rtc1 -m mem -s 8): refused cleanly by stock J773g 27.2 platform gating (last_failed_dev=48ae00000.dcp, errno=-16: apple-dcp 48ae00000.dcp: no firmware stop for a deep sleep: refusing it; apple-sleep 380700000.sleep-controller: no PCIe tunables for ANS: suspend-to-RAM with it stopped will be refused — same baseline as stock/main on J773g 27.2, 0 cpufreq errors)
  • Health: WARN_BUG_OOPS_SERROR=0, FAILED_UNITS=0
  • Handback: Rebooted cleanly back to verified steady stock 7.3.0-ARCH-m4main-6c83a2a6.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo, T8140): PASS, head vs base, with idle parking on

This is the first board where the PR turns parking on. I ran two one-shot boots on the same J700 on the same day, with the same aurora_defconfig and byte-identical .config files.

Arm Tree Release Boot
head main 048505b28dda merged --no-ff with the exact head 99fc90dbe301: merge c3e0a50b3ee9, tree d5583e14e694 7.3.0-pr3717-99fc90db 18:39 UTC
base main 048505b28dda alone 7.3.0-main-048505b2 18:48 UTC
  • Booting: each arm booted through an aura-try one-shot trial Stage 2 (1.0.0b18-g16648d69). The trial entry used the stock options plus panic=10 only. The kernel took over aura's trial watchdog and kept it fed past the trial period.
  • Proof of the code: the head's apple-soc-cpufreq.ko contains the park strings and the park symbols. The base has neither.

Results (both arms exit 0)

Check Head Base
Park file PASS. One line per cluster (0,5 and 1-4). Every sample had enabled 1, failed 0: start, after the 18 s idle, after the GPU runs, after the ramp, after the sleep, and at the end. Parks rose on both clusters during the idle window (P 409 → 778, E 230 → 443). Absent, as expected.
Frequency ramp PASS. Both clusters hit their top within 0.05 s, and fell to the middle or lower within 0.02 s (P) and 0.17 s (E) of idle. PASS. 0.05 s to the top, 0.02 s back.
dmesg 0 busy-timeout, 0 stopping-requests, 0 park-failure. 0 WARN, BUG, Oops or lockup lines. Same, all 0.
GPU, render.light tri at depth 1 (3 runs × 5 samples, each CRC-checked) Median 138.27 µs/submit. Run medians 138.66 / 138.27 / 138.12. Median 135.21 µs/submit. Run medians 135.14 / 135.21 / 135.21.
s2idle (rtcwake -m freeze, 30 s) PASS. Success 0 → 1, fail unchanged. Panel, all 6 CPUs, both policies and the GPU (CRC valid) came back. 0 failed units. PASS.
Watchdog PASS. Armed throughout. The same boot reached 190 s of uptime. PASS.

GPU A/B: head/base is 1.0227, inside the kit's 1.03 bar. The gap is consistent rather than noise: each arm's three run medians sit within 0.4 % of each other. Depth 1 idles the CPU between submits, so this looks like the wake-up cost of parking: about 3 µs per submit on T8140. Between days and kernels, this case's medians have moved by more than that (126.5–135.0 µs).

Things worth knowing

  • P-cluster frequency cap: in both arms the P cluster ran under a die-temperature cap that moved during the 6 s load. The lowest scaling_max_freq seen was 1620 MHz on the head and 2472 MHz on the base. The P-cluster load medians were 2688 and 2916 MHz. With one boot per arm, I can't tell a thermal-state difference from an effect of the PR. Both reached the capped top in 0.05 s. The E cluster was identical in both arms (top 2424 MHz, load median 2424 MHz).
  • Parks vs restores: on the P cluster, parks ran ahead of restores (2039 parks vs 1565 restores at the end; the E cluster was 740 vs 733). That matches the code: a restore is only counted when it writes a different state.
  • Not kept: the ramp kept only per-policy summaries and the set of caps seen. The raw 20 Hz samples were not saved.

Stock restored after each arm: the return boot ran the configured Stage 2 and stock 7.3.0-41. boot-ctxr.bin was byte-identical to before, no marker was left, and the PMU boot-error count stayed 00.

@DjDeveloperr
DjDeveloperr merged commit b3a5fda into main Dec 2, 2026
@DjDeveloperr
DjDeveloperr deleted the feat/apple-cpufreq-park-idle-clusters branch December 2, 2026 18:58
@DjDeveloperr

Copy link
Copy Markdown
Contributor

PASS J714s (M5 Pro, T6050) linux#3717 head 99fc90d in composite b6002784 (main c2f1583 + #3410 465d7cf + #3334 7be3a9c + #3717 99fc90d + #3970 9b4f688, 7.3.0-m5-comp-3410-3970): apple-cpufreq/park enabled=1 failed=0 all 3 clusters (0-5, 6-11, 12-17), pre-sleep burst parks +316/restores +313, 2x rtcwake -m mem -s 20 clean resumes (20.75s/20.41s, suspend_success 0->2, suspend_fail 0, post-sleep parks 11148 failed=0), 0 Oops/WARN/BUG/GPU/DART faults, WDT armed, clean stock handback (b2c723cd).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:power Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants