Repository navigation
soc: apple: clpc, arm64: dts: t6041: M4 Max CLPC policy, GPU/DCS wiring, and macsmc fan lock fix - #1951
Conversation
c3b1f12 to
660079a
Compare
|
Thanks for this. The J616c numbers are a big improvement, and the idle-sampling and fan-lock fixes help every chip. One change on how the T6041 profile is selected. Could you point that entry at Separately, if the DCS 5 / fabric 3 floors come from a fabric limit that differs from the M4 Pro, a one-line comment saying so would help. If the M4 Pro should get the same floors, we can run rows on our M4 Pro. |
660079a to
5115765
Compare
|
Thanks for the review! Updated the series as requested:
|
|
Thanks for the update. The |
|
Review of 5115765 against integration/aurora e0ee46a. It merges cleanly. CI is green on this head, and the combination is being built on today's base in #2532 (CI only). The
Everything else can go in as it is once those two are settled. @RyanTheTide's M4 Pro row covers the |
hwmon_attr_store() holds the chip-wide hwdev->lock across ->write() callbacks. On Apple Silicon machines whose SMC starts fans in system mode (mode 3), transitioning a fan into manual mode via Ftst=1 or releasing Ftst=0 back to firmware control in macsmc_hwmon_set_fan() polls the SMC mode key every 100 ms for up to 10 s (MACSMC_FAN_MODE_TIMEOUT_MS). Holding hwdev->lock across that poll loop blocks all concurrent hwmon reads on the same chip, stalling thermal zone temperature polling (hwmon_thermal_get_temp()) and userspace telemetry for the duration of the SMC mode transition. Fan state transitions and individual SMC key transactions are already serialized by hwmon->fan.lock and smc->mutex, and kernfs pins the sysfs attribute across hwmon_attr_store() until ->write() returns. Drop the chip-wide hwmon lock around macsmc_hwmon_set_fan() in macsmc_hwmon_write_fan() so temperature and power reads proceed without stalling during fan mode transitions. Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
T6040 (M4 Pro) and T6041 (M4 Max) share t604x.dtsi's apple,t6041-clpc voter node, while M4 Max's wider memory subsystem adds SoC fabric state 3 and needs its own CLPC policy table. Allow apple,t6041-max-clpc ahead of the apple,t6041-clpc fallback, matching t6041.dtsi's apple,t6041-max-avd convention and T6050's CLPC fallback. Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
T6040 (M4 Pro) and T6041 (M4 Max) share the apple,t6041-clpc compatible
in t604x.dtsi, which previously mapped both SoCs to apple_clpc_hw_t6040
(DCS {1, 2, 5, 5}, fabric {0, 1, 2, 2}, sustain = 3).
Unlike M4 Pro (4 AMCCs, 256-bit LPDDR5X-8533, fabric states 0-2), M4
Max's 6/8-AMCC 384/512-bit memory subsystem reaches SoC fabric state 3
(VOVD; ADT clpc fabric-mem-separation-max = 3) for full 410/546 GB/s
bandwidth, and macOS 27.2.1 votes DCS 5 and fabric 3 immediately for
active CPU demand without a multi-sample busy streak, raising 12-thread
CPU DRAM read bandwidth on J616c from ~256 GB/s at fabric state 2 to
~297 GB/s.
Add a dedicated apple_clpc_hw_t6041 table (DCS 5, fabric 3 across all
quartiles, sustain = 0, host GPU input enabled) matched directly via
apple,t6041-max-clpc in apple_clpc_of_match[] while keeping T6040 on
apple,t6041-clpc. Enable idle_on_time on apple_clpc_hw_t6041 (as on
T6050): with a single busy core and the remaining 15 CPUs idle on M4
Max, a deferrable timer waits on an idle CPU and leaves single-threaded
memory loads stuck at DCS state 0 (~284 ns per load on J616c instead of
~166-187 ns once sampled), while leaving all other SoCs on deferrable
idle timers. Preserve T6041's DCS 5 / fabric 2 ANE floor, move T6041's
2808 MHz Low Power platform profile ceiling onto apple_clpc_hw_t6041,
and retire the now-unused low_power_machine selector.
Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
T6041 boards already enable the PMC and CLPC voter interface, but shared t604x.dtsi's apple,t6041-clpc compatible with T6040 and left two links unwired on M4 Max: 1. Give &clpc in t6041.dtsi the apple,t6041-max-clpc compatible ahead of its apple,t6041-clpc fallback (matching &avd) so J614c, J616c, J575c, and any future T6041 board select apple_clpc_hw_t6041 directly from the CLPC node while T6040 stays on apple_clpc_hw_t6040. 2. Link the GPU node in t6041.dtsi to &clpc via apple,clpc, matching t6040.dtsi and t8132-gpu.dtsi, so G17 submissions in flight hold the DRAM controller and SoC fabric floors while GPU work is active. On J616c this raises 256 MiB GPU copy throughput from ~43 GB/s to ~230 GB/s and sustained Vulkan LLM token generation from ~18.9 to ~55.9 tok/s. 3. Declare #cooling-cells = <2> on &pmc in t6041.dtsi and bind &pmc to cpu-die-thermal's passive backstop trip on J614c/J616c so non-power- actor thermal policies such as step_wise can step down the DCS rail if die temperature reaches the backstop behind the PMP fast die loop. Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
5115765 to
5f3bca9
Compare
|
Thanks for the thorough review, @DjDeveloperr and @RyanTheTide! Rebased onto current
Re-verified with |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review of 5f3bca9, which sits on integration/aurora 2e1b085. None of the 20 commits that have landed since touch a file in this series.
Both points from the 06:42 review are addressed:
- The cpufreq boost-at-init commit is gone. Thanks for answering the boost question: with f677f7c on the base, both P-cluster policies come up at 4512 MHz with
boost=1, so nothing here needs it. INIT_DEFERRABLE_WORKand@idle_on_timeare back as they were, and.idle_on_time = trueis set only inapple_clpc_hw_t6041. T8140, T8132, T6040, T8142 and T8152 keep their deferrable idle timer, T6050 keeps its opt-in, and both the KUnit case and the host test assert it.
I also re-read the rest on this head:
- No change on the M4 Pro.
apple_clpc_hw_t6040loses only thelow_power_khz/low_power_machinepair, which was gated toapple,t6041and never applied to T6040. - The ceiling move removes a machine gate. The 2808 MHz ceiling moves onto the T6041 table and
low_power_machineis dropped. That's one fewerof_machine_is_compatible()gate. - Device match.
apple,t6041-max-clpcis a compatible on the CLPC node itself, which is how this tree selects behaviour. macsmc-hwmonlocking. The unlock and relock are balanced, and kernfs keeps the attribute alive across the window.
Three notes, none blocking:
map-dcsdoes nothing under the default governor.asahi.configdefaults to power_allocator. The J616c PMC node has noapple,dcs-power-microwatt, so the PMC registers its cooling device without power ops, and power_allocator skips it as a non-power actor. The map only acts under step_wise, as your commit message says. One side effect: once the zone is switched to step_wise, switching it back to power_allocator fails, becausecheck_power_actors()rejects a non-actor on the control trip. If you want the DCS backstop under the default governor, a follow-up could add a measuredapple,dcs-power-microwatttable, ast8140-j700.dtshas. That file's note on the zone oscillating between DCS 1 and 4 under GPU load is worth reading first.- Idle power on T6041. With
.idle_on_timeandsustain = 0, the T6041 samples every 4 ms at idle, and any busy sample votes DCS 5 / fabric 3. An idle-power and idle-wakeups row from the J616c, this head against the base, would be good to have on record, as T6050 has for dcabb8e. It only affects T6041, so it can come after the merge. - Redundant compatibles.
apple_clpc_gpu_get()andapple_clpc_ane_providers[]now also listapple,t6041-max-clpc. The node'sapple,t6041-clpcfallback already matches there, so these entries are redundant but harmless.
CI is green on this exact head (dt-checks, host-tests, source, kunit, rust-build, DWC3/ATC), and it merges cleanly, so I'm merging it. Post-merge verification: @RyanTheTide's M4 Pro no-regression row for the T6040 side, and our J700 idle row (wakeups per second, idle power, deep sleep), although nothing on this head changes the J700. A revert is ready if either turns something up.
Thanks for turning this around so quickly, and for the J616c numbers.
5d68bcc
into
aurora-silicon:integration/aurora
Separate T6041 (M4 Max) from T6040 (M4 Pro) in
apple-clpc, wire the M4 Max GPU and thermal DCS backstop in DT, and preventmacsmc-hwmonfan mode polling from blocking concurrent temperature/power reads.Summary of changes
hwmon: macsmc: drop chip hwmon lock across fan mode transitionsDrop the chip-wide
hwdev->lockaroundmacsmc_hwmon_set_fan()inmacsmc_hwmon_write_fan()so SMC fan mode transitions (Ftst=1/Ftst=0, which poll up toMACSMC_FAN_MODE_TIMEOUT_MS= 10 s) do not stall concurrent thermal zone polling (hwmon_thermal_get_temp()) or sensor telemetry. Fan state transitions and SMC key transactions remain serialized byhwmon->fan.lockandsmc->mutex.dt-bindings: power: apple,pmc: add the T6041 M4 Max CLPC compatibleAllow
apple,t6041-max-clpcahead of theapple,t6041-clpcfallback, matchingt6041.dtsi'sapple,t6041-max-avdconvention andapple,t6050-clpc.soc: apple: clpc: give T6041 its own top-state policy tableAdd a dedicated
apple_clpc_hw_t6041table matched viaapple,t6041-max-clpcwhile keeping T6040 (M4 Pro) onapple,t6041-clpc:VOVD; ADTclpcfabric-mem-separation-max = 3) across all quartiles withsustain = 0and.gpu_input = true..idle_on_time = trueonapple_clpc_hw_t6041(as onT6050): with a single busy core and the remaining 15 CPUs idle on M4 Max, a deferrable timer waits on an idle CPU and leaves single-threaded DRAM loads stuck at DCS state 0 (~284 ns/load vs ~166–187 ns/load once sampled), while leaving all other SoCs on deferrable idle timers.2808000kHz Low Power platform profile ceiling ontoapple_clpc_hw_t6041, and retire the now-unusedlow_power_machineselector.arm64: dts: apple: t6041: select M4 Max CLPC and wire GPU/DCS cooling"apple,t6041-max-clpc", "apple,t6041-clpc"on&clpcint6041.dtsi.t6041.dtsito&clpcviaapple,clpc, matchingt6040.dtsiandt8132-gpu.dtsi.#cooling-cells = <2>on&pmcint6041.dtsiand bind&pmctocpu-die-thermal's passive backstop trip onJ614c/J616c.Measurements on J616c (MacBook Pro 16", M4 Max, T6041)
.idle_on_time = true(macOS 27.2.1: ~204 ns/load)apple,clpc) → ~230 GB/s (DCS 5 / fabric 3)Verification
python3 tools/asahi/clpc-gpu-demand-tests.py(including all 12 negative controls) andpython3 tools/asahi/clpc-high-power-cleanup-tests.pyarm64KUnit underqemu-system-aarch64:apple-clpc-gpu(11/11 passed, includingapple_clpc_t6041_policy_test),macsmc-hwmon(3/3 passed), andmacsmc-hwmon-fan(13/13 passed)ARCH=arm64 LLVM=1(CONFIG_WERROR=y,CONFIG_KUNIT=y) build ofdrivers/soc/apple/clpc.o,drivers/hwmon/macsmc-hwmon.o,apple/t6041-{j616c,j614c,j575c}.dtb, andapple/t6040-{j616s,j614s,j773s}.dtbdt_binding_check(DT_SCHEMA_FILES=power/apple,pmc.yaml) andCHECK_DTBS=yont6041-{j616c,j614c,j575c}.dtbandt6040-{j616s,j614s,j773s}.dtb./scripts/checkpatch.pl --strict(0 errors, 0 warnings, 0 checks)