Skip to content

soc: apple: clpc: hold the M4 (T8132) memory, fabric and P-cluster floors for ANE work - #2856

Open
RyanTheTide wants to merge 6 commits into
integration/aurorafrom
clpc/t8132-ane-floor-r2-20261123
Open

RyanTheTide wants to merge 6 commits into
integration/aurorafrom
clpc/t8132-ane-floor-r2-20261123

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

This supersedes #2671. It carries the same six commits, rebased onto integration/aurora after #2816 (low-power ceiling from apple,low-power-frequency-max-mhz, High Power mode from apple,high-power-mode). #2671 no longer merged and its branch can't be rewritten without a force push, so this is a new branch. The only conflict was in apple_clpc_probe(), and the range-diff is below.

Problem. On the M4 (T8132) the CLPC takes no Neural Engine input, so ANE work runs with the memory controller and fabric wherever the CPUs leave them. On an idle M4 Air (J713) MobileNetV1 takes 0.92 ms an EXECUTE. With every CPU busy, which makes the CLPC hold its M5/F3 busy floor, the same program takes 0.35 ms. The M4 Pro, whose CLPC already holds an ANE floor, takes 0.27 ms.

Change.

  • Make the T8132 CLPC an ANE provider.
  • Hold its one qualified busy floor (M5/F3, the state the GPU already gets while it has work in flight) while ANE work is in flight. It is released 32 ms (HOLD_MS) after the last request ends, as on the other SoCs.
  • As on the M4 Pro, the engine runs at a speed set by one CPU cluster's frequency, here the P cluster. Hold that cluster at 2.616 GHz while ANE work is in flight, through the existing cluster floor. That's where the firmware time reaches its plateau: 0.44 ms at or below 1.512 GHz, 0.32 ms at 2.616 GHz, and 0.29-0.31 ms from there up to 4.104 GHz.
  • The cluster and the floor come from the device tree, not from a SoC table or a machine check. The CLPC node's new apple,ane-cpu-opp names an OPP; the cluster is the one whose CPUs use that OPP's table, and the floor is its opp-hz, which must be at most S32_MAX kHz so that a frequency QoS request can hold it. t8132.dtsi points it at the P cluster's 2.616 GHz OPP. Without the property there is no cluster floor. T6040 keeps its existing table entry until its tree carries the property.
  • Register the cpufreq policy notifier (one helper, apple_clpc_policy_nb_register()) only after the apple_clpc_stop devm action is in place, so a probe error can't leave a freed clpc on the notifier chain. Both users go through the helper: the ANE cluster floor and the low-power profile ceiling, which since soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816 comes from the DT and may now sit next to the "apple-smc" (High Power mode only) profile.
  • Fix the CLPC KUnit config, which did not link: it was missing the SMC driver.

#2630 (which makes the T8132 ANE run on 27.2 firmware) is merged and is part of the base.

Testing.
All on a J713 (M4 Air), macOS 27.2 firmware, lab kernels on the stock cmdline, MobileNetV1 H16G, 2000 timed runs with the CPUs idle:

kernel EXECUTE p50 firmware time top-1
#2630 only 0.918 ms 0.697 ms 16/16
+ M5/F3 floor (commit 1) 0.682 ms 0.445 ms 16/16
+ P-cluster floor (commit 2) 0.457 ms 0.315 ms 16/16
#2630 only, every CPU busy 0.348 ms 0.310 ms 16/16
  • The add-128 program output is unchanged (sha256 a001d87e...a839, the same as on the M4 Pro), 0 WARN, oops, DART faults or AVCs.
  • With commit 1 only: E cluster busy gives 0.579 ms (firmware 0.476), P cluster busy gives 0.430 ms (firmware 0.287). That's what pointed at the P cluster.
  • KUnit (drivers/soc/apple/clpc.kunitconfig, arm64 qemu): 12 pass, 1 skip.
  • At 9736f57 (device-tree floor, soc: apple: clpc: hold the M4 (T8132) memory, fabric and P-cluster floors for ANE work #2671): tools/asahi/clpc-ane-cpu-opp-tests.py runs the production parser over a fake tree. It covers the CPU from the OPP's table, kHz from opp-hz, refusals for an OPP no CPU uses or one with no usable frequency, CPUs without a node, and balanced node refs. The any-cpu, hz and leak mutants are killed. KUnit apple-clpc 10/10 (arm64 qemu). W=1 clean on clpc.o, t8132-platform-handoff.o and t8132-platform-data.dtb.o. dtbs_check adds nothing on t8132-j713/j773g, and dt_binding_check passes for apple,pmc.yaml.
  • This head (a3ff203, on integration/aurora 95a13cf):
    • drivers/soc/apple/clpc.o, W=1, LLVM, arm64 fleet config: 0 warnings.
    • run-host-tests.py --only clpc: 9/9. That includes the clpc-ane-cpu-opp-tests.py cases for an opp-hz of (S32_MAX + 1) kHz (refused), S32_MAX kHz and 1 kHz (held) and an OPP with no parent table (refused), with all five mutants killed (any-cpu, hz, leak, u32, no-parent). clpc-high-power-cleanup-tests from soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816 passes too.
    • run-host-tests.py --only pmp: 22/22.
    • checkpatch.pl --strict: 0 errors and 0 checks on all six commits. The one warning is the usual "does MAINTAINERS need updating?" for the new host test file.

Still to run.

  • KUnit apple-clpc (arm64 qemu) on this head.
  • A J713 row on this head with a Stage 2 DTB built from this tree: the 2.616 GHz floor held during MobileNetV1 and released after, with the same EXECUTE times as the table version (0.457 ms p50). A boot whose device tree lacks the property shows no cluster floor and nothing else changes.
  • On the same J713 boot: the low-power and performance platform profiles from soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816 still behave as before, and a thermal or scaling_max_freq cap below 2.616 GHz still wins over the ANE floor.
  • Idle power with the floors released after ANE work, and package power while the floors are held under a sustained ANE load.
range-diff against #2671 (a0dcf61)

git range-diff integration/aurora..a0dcf61c 95a13cf6..a3ff2033:

1:  ecbae6bd051c ! 1:  ce425375e6ba soc: apple: clpc: give T8132 ANE work the M5/F3 floor
    context only: integration/aurora now also lists apple,t6041-max-clpc among the ANE providers
2:  d08c13b7c091 = 2:  2b4248d1523b soc: apple: clpc: hold the T8132 P cluster up for ANE work
3:  207078c711e8 = 3:  76aa6bbd5484 dt-bindings: power: apple,pmc: add the CLPC's apple,ane-cpu-opp
4:  e39f180440ad = 4:  ce7fbbfccacd arm64: dts: apple: t8132: name the P-cluster OPP the ANE needs
5:  9736f5760811 ! 5:  60dd04604a66 soc: apple: clpc: take the ANE cluster floor from the device tree
    context only: run-host-tests.py gained dcp-bw-scratch-window-tests.py next to the new entry
6:  a0dcf61c5ebd ! 6:  a3ff20338afe soc: apple: clpc: register the policy notifier after the stop action
    apple_clpc_probe(): the locals keep #2816's `bool high_power; u32 mhz;` next to `ane_khz`;
    in the platform-profile block the inline notifier registration that #2816 guarded with
    `clpc->low_power_khz` becomes `if (clpc->low_power_khz) apple_clpc_policy_nb_register(clpc);`
    (#2671 had replaced the older unconditional one with the helper); #2816's DT low-power
    ceiling, High Power mode and "apple-smc" profile logic are unchanged.
    run-host-tests.py: context only, as in 5.

The registration still runs after devm_add_action_or_reset(dev, apple_clpc_stop, clpc), and both callers go through the helper, so the notifier is registered at most once.

Assisted-by: LLM (Claude:Opus 5.5)

The M4 (T8132) CLPC takes no ANE input, so Neural Engine work runs with
the memory controller and fabric at whatever the CPUs ask for. On an
idle J713 MobileNetV1 takes 0.92 ms an EXECUTE (firmware 0.70 ms). With
every CPU busy, which makes the CLPC hold its M5/F3 busy floor, the same
program takes 0.35 ms (firmware 0.34 ms). The M4 Pro, whose CLPC holds
an ANE floor, takes 0.27 ms.

Make the T8132 CLPC an ANE provider and hold that one qualified busy
floor, M5/F3 (the state the GPU gets while it has work in flight),
while ANE work is in flight.

Also add the SMC dependency the CLPC KUnit config was missing (the test
kernel did not link without it).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
As on the M4 Pro, the M4's Neural Engine runs at a speed set by the
frequency of one CPU cluster, whatever runs on it: here the P cluster
(cpu-map cluster1). With the M5/F3 floor held, MobileNetV1 on a J713
spends 0.44 ms in the firmware with the P cluster at or below 1.512 GHz,
0.32 ms at 2.616 GHz and 0.29-0.31 ms from there up to 4.104 GHz.

Hold the P cluster at 2.616 GHz, the start of that plateau, while ANE
work is in flight, through the existing cluster floor.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The Neural Engine on M4-generation SoCs runs at a speed set by the
frequency of one CPU cluster, whatever runs on it. Let the CLPC node
name an OPP of that cluster's table: while ANE work is in flight the
cluster is held at or above that OPP's frequency.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On a J713, MobileNetV1 spends 0.44 ms in the ANE firmware with the P
cluster at or below 1.512 GHz, 0.32 ms at 2.616 GHz and 0.29-0.31 ms
from there up to 4.104 GHz. Point the CLPC's apple,ane-cpu-opp at the
P cluster's 2.616 GHz OPP, the start of that plateau.

The property goes in t8132.dtsi, not in t8132-memory.dtsi with the rest
of the CLPC node: the T8132 platform-data adapter shares that file
without the CPU OPP tables, so a boot that takes its nodes from the
adapter gets no ANE cluster floor.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8132 ANE cluster floor came from the CLPC's hardware table (cluster
1, 2616000 kHz) and was applied only on machines compatible with
"apple,t8132". Both are already in the device tree: the cluster is the
one whose CPUs use the OPP table, and the floor is an OPP in it.

Read the CLPC node's apple,ane-cpu-opp at probe: the cluster is a CPU
whose operating-points-v2 is the OPP's table, the floor is its opp-hz.
Without the property there is no cluster floor on T8132. T6040 keeps
its table entry until its tree carries the property.

tools/asahi/clpc-ane-cpu-opp-tests.py runs the production parser over a
fake tree: the CPU comes from the OPP's table and the floor from its
opp-hz, an OPP no CPU uses or without a usable frequency is refused, a
CPU without a node is skipped, and every node it gets is put. Taking
any CPU, reporting hertz or leaking the OPP node each fail it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Probe registered the cpufreq policy notifier for the ANE cluster floor
before apple_clpc_stop() was installed as a devres action. Any probe error
in between (a bad apple,gpu-power-state, no PMC parent, no reg, a bad rail
count, an allocation failure) freed the CLPC data with its notifier still
on the global policy chain, and the notifier would also have taken
sample_lock before mutex_init(). Register it from one helper, used by the
ANE floor and by the platform profile, only once apple_clpc_stop() is in
place to unregister it. The ANE floor and its ane_cluster_khz debugfs
file now exist only when the notifier is registered.

apple,ane-cpu-opp accepted any opp-hz up to UINT_MAX kHz, but the floor
is a frequency QoS request, which is an s32: a value above S32_MAX kHz
turned into a negative request that failed on every sample. Refuse it,
compare the CPU's OPP table before putting it, and cover both bounds
(1 kHz, S32_MAX kHz), an OPP outside a table and a CPU without a table
in clpc-ane-cpu-opp-tests.py, with mutants for the bound and the
missing parent check.

Also put the T8132 ANE KUnit expectations under their own comment.

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

Copy link
Copy Markdown
Contributor Author

Review at a3ff203.

The DT shape for the cluster floor is the right direction, but the series still carries a SoC gate, the floor value comes from a benchmark, and the head mechanism has not run on hardware.

  1. arch/arm64/boot/dts/apple/t8132.dtsi:1446: apple,ane-cpu-opp = <&donan_p_opp_2616> is a tuning choice taken from one model's plateau (MobileNetV1 on one J713). It is not a hardware fact. The OPP exists in the table, but nothing in the machine says the ANE needs 2.616 GHz. Is there an ADT/firmware source for the ANE-to-cluster dependency or a minimum perf state (ANE or CLPC node, perf-state list)? If so, take it from there. If not, the property should be documented as a policy choice, and a second workload (a conv-heavy model, not only MobileNetV1) should show the same plateau before it goes into the shared dtsi.
  2. drivers/soc/apple/clpc.c:1474-1477 plus the T6040 table (.ane_cluster = 2, .ane_cluster_khz = 3756000, .ane_cluster_machine = "apple,t6040", ~1774): the of_machine_is_compatible() fallback stays. Now that the property exists, add it to the T6040 dtsi in this series and drop ane_cluster, ane_cluster_khz, ane_cluster_machine, apple_clpc_cluster_cpu() and the fallback. Otherwise a second path for the same feature stays behind a machine gate.
  3. clpc.c:1568: ane_cluster_khz is still a writable u32 in debugfs. The S32_MAX bound that commit 6 adds to the DT parser can be bypassed there, and a write above S32_MAX kHz brings back the negative QoS request that fails on every sample. Make it read-only, or clamp it in a custom setter.
  4. Commit 2 adds a T8132 table entry with a machine-compatible gate, and commit 5 removes it. Squash 2 into 5 so that no commit adds a gate.
  5. clpc.c:403-407: apple_clpc_ane_providers repeats what hw->ane already says, and apple_clpc_ane_get() already checks clpc->ane. Each new SoC now needs two edits. Consider matching against the driver's of_match table instead and relying on clpc->ane (follow-up is fine).
  6. Hardware rows owed at this head (the J713 numbers are from the table version):
    • J713, Stage 2 DTB from this tree: ANE EXECUTE p50 A/B (no floor, M5/F3 only, M5/F3 + DT cluster floor), with ane_cluster_khz reading 2616000 while busy and the QoS request back at its default about 32 ms after the last EXECUTE.
    • J713 idle package power after the ANE device is closed, against a kernel without the series (floors must not stick).
    • J713 sustained ANE load for 10+ minutes on the fanless chassis: package power, die temperatures and whether thermal/scaling_max_freq caps win over the 2.616 GHz floor and the DCS/fabric floor.
    • J713 low-power profile: the profile ceiling still wins over the ANE floor.
    • No regression from commit 6's probe reordering on one other CLPC Mac: M4 Pro (T6040) ANE floor still held through the fallback, platform profiles still working. Also one T6041 or T8140 probe/unbind cycle with no notifier left on the chain.
    • Other T8132 boards inherit the floor from t8132.dtsi (J773g, etc.). Either one boot row there or a note that only J713 was tested.

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

Adversarial pre-PR checklist review (§1–§6) at a3ff20338afe6fd8190de3151a6569a468c20b96 (REQUEST_CHANGES).

Checklist Summary

  • §1 (No model gating): Pass — at head a3ff2033, T8132's ANE cluster floor is driven purely from the DT property apple,ane-cpu-opp = <&donan_p_opp_2616> in arch/arm64/boot/dts/apple/t8132.dtsi (documented in Documentation/devicetree/bindings/power/apple,pmc.yaml), with apple_clpc_hw_t8132.ane_cluster_khz = 0 and .ane_cluster_machine = NULL. T6040 retains its existing table entry only as a fallback when apple,ane-cpu-opp is absent (-ENOENT), per §1 chicken-and-egg rules.
  • §2 (Production-ready / default cmdline): Pass — works on default command line with no module parameters or hacks.
  • §3 (Safety & concurrency): Pass (with one pre-existing non-blocking concurrency note below) — apple_clpc_ane_cpu_opp() validates opp-hz in [1 kHz, S32_MAX kHz] (preventing negative s32 PM QoS requests), compares cpu_table == table before of_node_put(), and balances all OF node references (verified by clpc-ane-cpu-opp-tests.py + 5 mutations). Moving apple_clpc_policy_nb_register() after devm_add_action_or_reset(dev, apple_clpc_stop, clpc) and mutex_init(&clpc->sample_lock) closes the probe-error UAF / uninitialized-mutex race and prevents double registration when both ane_cpu >= 0 and low_power_khz are set. clpc->ane kref + apple_clpc_ane_detach() remain safe across removal.
  • §4 (Clean-room & attribution): Pass — all 6 commits carry human author/committer and human Signed-off-by: only; PR body includes Assisted-by:.
  • §5 (Evidence): Blocked — see Blocker below.
  • §6 (Naming): Pass — clean Aurora/Linux naming throughout.

Blocker

  1. §5 (Evidence) — No J713 hardware run or arm64 KUnit run at head a3ff2033 (and CI still running):
    • The J713 MobileNetV1 table in the PR body was collected on the earlier table-based commits (prior to apple,ane-cpu-opp DT parsing, the apple_clpc_policy_nb_register() / apple_clpc_stop() reordering, and the rebase onto #2816).
    • As listed under **Still to run.**, please post the head a3ff2033 evidence:
      1. arm64 QEMU KUnit (drivers/soc/apple/clpc.kunitconfig) on a3ff2033.
      2. J713 run on a3ff2033 with a Stage 2 DTB built from this tree: 2.616 GHz P-cluster floor held during MobileNetV1 and released after, matching EXECUTE latency, plus a boot without apple,ane-cpu-opp showing no cluster floor and no regressions.
      3. On the same J713 boot: #2816 low-power/performance platform profiles still behave as before, thermal/scaling_max_freq cap below 2.616 GHz still wins over the ANE floor, idle/sustained package power, and regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).
    • Also wait for CI dt-checks and kunit to finish green (currently IN_PROGRESS; host-tests, source, rust-build, and DWC3/ATC builds are green).

Non-blocking Technical Notes

  • Pre-existing lock race between apple_clpc_halt() and apple_clpc_policy_notify() (drivers/soc/apple/clpc.c:1196-1199, 1221-1230, 1252-1262): apple_clpc_halt() reads clpc->ane_qos_khz and calls freq_qos_update_request(&clpc->ane_qos, FREQ_QOS_MIN_DEFAULT_VALUE) without holding clpc->sample_lock, and in apple_clpc_stop() it runs before cpufreq_unregister_notifier(). A concurrent CPUFREQ_REMOVE_POLICY callback (which takes sample_lock and calls freq_qos_remove_request(&clpc->ane_qos)) can race with apple_clpc_halt() on suspend or unbind. Wrapping the ane_qos update in apple_clpc_halt() with sample_lock (and checking freq_qos_request_active(&clpc->ane_qos)) would close this cleanly.
  • apple_clpc_ane_cpu_opp() missing-vs-invalid phandle (clpc.c:1288-1290): If apple,ane-cpu-opp is present in DT with a broken phandle, of_parse_phandle() returns NULL and the helper returns -ENOENT, which on a fallback-capable SoC (like T6040) would silently fall back to the table instead of returning -EINVAL. Checking of_property_present() first would distinguish absent from malformed.
  • Intermediate commit gating: Commit 2 (2b4248d1523b) temporarily adds .ane_cluster_machine = "apple,t8132" before commit 5 (60dd04604a66) replaces it with apple,ane-cpu-opp. Net state at a3ff2033 is clean.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at a3ff203: BLOCKERS:

  1. Hardware: no boot with a DTB that lacks apple,ane-cpu-opp (requested in the soc: apple: clpc: hold the M4 (T8132) memory, fabric and P-cluster floors for ANE work #2671 review, item 3). Without that row, nothing shows that a T8132 boot whose CLPC node comes from the legacy-loader adapter, or from an older ESP DTB, probes cleanly with no cluster floor. Fix: boot J713 with the property removed from the Stage 2 DTB (fdtput -d, DTB-only trial). Check that ane_cluster_khz is absent, that the P policy minimum stays at 912000 under MobileNetV1, and that the M5/F3 ANE floor still shows in status.
  2. Hardware: the idle power reading 60 s after release, with the panel dark, against a kernel without this series (item 4 of that review) is still missing. The 11-22 run says its own idle number is unusable because the panel lit up. Fix: interleaved A/B with the panel held off through Mutter PowerSaveMode.
  3. Hardware: the series has not run at this head. The J713 rows are from 9736f57, before the probe reordering and the rebase onto soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816. Fix: one J713 boot at a3ff203 that shows the floor is held and then released, the soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816 low-power and performance profiles still working, and a scaling_max_freq/thermal cap below 2616000 still beating the floor. A second T8132 board (J773g, item 5) inherits the property from t8132.dtsi, so it needs one boot row too, or the PR body should say that only J713 was tested.

The two code findings from the #2671 review are fixed at this head, and I found no new code defect. The blockers above are the hardware rows that review asked for, which are still owed.

Full review

Code findings from the #2671 review (9736f57), checked at a3ff203:

  • Policy notifier UAF on a probe error: fixed. apple_clpc_policy_nb_register() (clpc.c:1266) is the only way the notifier gets registered. Both callers come after devm_add_action_or_reset(dev, apple_clpc_stop, clpc) (clpc.c:1560): the ANE floor at 1565 and the low-power profile at 1616. Probe now resolves only the OPP and kHz before that point, so an early error return frees clpc with nothing on the chain. The mutex_init(&clpc->sample_lock) at 1534 also comes before registration, so the notifier's guard(mutex) can no longer take an uninitialised lock. Teardown runs in reverse devm order: the platform profile (registered later) goes first, then apple_clpc_stop() (halt, then unregister the notifier, then remove ane_qos and max_qos), then the ane and gpu owner puts. No path leaves a request or notifier behind.
  • opp-hz above S32_MAX kHz: fixed. apple_clpc_ane_cpu_opp() refuses hz < 1000 and div_u64(hz, 1000) > S32_MAX, so a DT value can no longer reach freq_qos_update_request() as a negative s32.
  • Nits: cpu_table == table is now compared before of_node_put(). ane_cluster_khz and its debugfs file exist only when the notifier is registered. The T8132 KUnit expectations sit under their own comment.
  • accel/ane: run the T8132 (M4) Neural Engine on macOS 27.2 firmware #2630 (item 6) has landed. Merge base = integration/aurora 95a13cf.

Replay onto #2816: the only conflict, if (clpc->low_power_khz && !clpc->policy_nb_added) {inline register}, became if (clpc->low_power_khz) apple_clpc_policy_nb_register(clpc). The helper returns early when the notifier is already added, so the two are the same. The low-power DT ceiling, apple,high-power-mode and the "apple-smc" profile are untouched.

Other Macs: when the property is absent, -ENOENT falls back to the existing T6040 table entry. T8140/T6041 have ane_cluster_khz == 0, so ane_cpu stays negative and nothing is registered. SoCs without hw->ane never parse the property. The final tree adds no chip or machine gate: the only of_machine_is_compatible() left is the pre-existing T6040 fallback. Commit 2 adds a T8132 machine-gated table entry that commit 5 removes. That is not a blocker for the merged result, but squashing them would keep the gate out of history. No new module or cmdline parameter, no new delay. apple_clpc_ane_get() gains apple,t8132-clpc as a provider. It creates no device link and never defers, so a T8132 boot without the CLPC driver loses nothing.

Lifetime/refcount: the cpufreq_cpu_get() in apple_clpc_ane_cluster() always has its cpufreq_cpu_put(). ane_qos is added once (guarded by freq_qos_request_active) and removed in the REMOVE_POLICY notifier or in stop. Every of_node_put in the new parser is balanced: the host test checks 84 gets/puts, and its leak mutant is killed. ane_cluster_khz is written before platform_set_drvdata() and before the first apple_clpc_queue(), so no sample can read it half set up. Minor, non-blocking: the 0600 debugfs ane_cluster_khz still accepts a value above S32_MAX kHz from root. That only counts update_errors on each sample, and T6040 has the same behaviour today.

DT/binding: apple,ane-cpu-opp is documented as a phandle in the performance-controller node (additionalProperties: false). In all six T8132 DTBs (j604, j623, j624, j713, j715, j773g) it resolves to the phandle of opp-2616000000 in the P table (donan_p_opp, used by the four donan-p CPUs). The property sits in t8132.dtsi, so t8132-platform-data.dts (memory dtsi only) does not reference the CPU OPP tables.

Mechanics: every commit in integration/aurora..a3ff203 carries only Signed-off-by: Ryan Murray, with no Co-Authored-By/Assisted-by/session trailers. The body ends with Assisted-by:. git merge-tree onto integration/aurora is clean. CI: source, host-tests, rust-build and 3x DWC3/ATC pass; kunit and dt-checks are still pending on Actions.

Run here at a3ff203:

  • clpc-ane-cpu-opp-tests.py: PASS.
  • run-host-tests.py --only clpc: 9/9, with the any-cpu/hz/leak/u32/no-parent mutants killed.
  • KUnit apple-clpc* (arm64 qemu, drivers/soc/apple/clpc.kunitconfig, KASAN+UBSAN): 11/11 passed, no KASAN/UBSAN reports.
  • make W=1 dtbs for the six T8132 boards: they build. The dtc warnings are the existing dcp/pmgr/aliases ones, none in clpc.
  • dt_binding_check: not run (no dtschema here).

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

arm64 KUnit at a3ff203 (§5 item 1): kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/soc/apple/clpc.kunitconfig 'apple-clpc*' on qemu, with the PR's kunitconfig (KASAN generic + UBSAN bounds): 11/11 passed, no KASAN/UBSAN/BUG/WARNING lines. Cases include apple_clpc_ane_cluster_test, apple_clpc_ane_no_provider_test, apple_clpc_ane_wake_removal_test and apple_clpc_t8132_gpu_input_test. The J713 rows at this head are still to come.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J713 rows at a3ff203 (13-inch M4 Air, 27.2), for item 3 of the review.

The kernel is integration/aurora 95a13cf plus open heads, including this PR at a3ff203, booted as a one-shot on the default command line. The ANE load is MobileNetV1 looped on the H16G. policy0 is the P cluster (CPUs 0, 7, 8, 9). Values were sampled every 50 ms.

Step P scaling_min_freq P scaling_max_freq
idle 912000 4464000
ANE load 2616000 in 181/181 samples 4464000
5 s after the load stops 912000 in 91/91 4464000
ANE load, P cpufreq cooling device at state 13 1800000 (clamped to max) 1800000
ANE load, cooling device back to 0 2616000 back to 4464000
platform profile low-power, idle 912000 2088000
low-power with ANE load 2088000 (clamped to the ceiling) 2088000
performance / balanced 912000 4464000
  • The floor is held during ANE work and released when the work stops.
  • A cooling limit below 2616000 wins over the floor, and so does soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) #2816's low-power ceiling.
  • The apple-clpc platform profile still switches between all three profiles.
  • Boot counts: SELinux Enforcing, 0 AVC denials, 0 failed units. The 2 kernel error lines are the existing dwc3 genpd_prepare returns -11 refusals during s2idle; s2idle 1/1.

Still to run: the boot with a DTB that lacks apple,ane-cpu-opp, and the dark-panel idle power ABAB against a kernel without this series.

Assisted-by: LLM (Claude:Opus 5.5)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants