Repository navigation
Conversation
|
Thanks for measuring this; a 109 C hotspot under automatic cooling is worth fixing. Our convention is that a fix needed for the machine to behave well is on by default and selected by what the hardware describes, not by a module parameter. Here the fan assistance only runs with Could the fan-only mode be the default wherever the board's DT describes writable fans ( |
|
hotspot_fans_only() in drivers/gpu/drm/asahi/g17/thermal.rs is true only when the m5_thermal_governor module parameter is exactly 2, and its default stays 0, so the fan assistance described in this PR never runs on a stock boot. If requesting rated fan speed at a 98 C hotspot under GPU load is the right policy, enable it by default on devices whose DT describes the fans and the hotspot zone, and keep the existing flags out of the decision. Until then this should stay a draft. |
66455a4 to
700e8df
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of erikwb Thanks, done in cde97c9.
CI. This PR's base is #2209's branch, and J716c, this head, no module parameter set. Two Cyberpunk T2 passes at 2560x1600: 30.07 and 30.01 FPS. The hotspot crossed 98 °C with the GPU busy three times, and each time both targets were at 5,349 and 5,777 RPM by the next 1 s sample, with the tachs following. They returned to the SMC (1,350 and 1,458 RPM) 30–32 s after the hotspot fell below 82 °C or the GPU went idle. Hotspot peak 104.5 °C. No refused fan requests in the kernel log. |
|
Thanks, 700e8df covers the earlier review: the assistance is on by default, selected from the hwmon node ( One change of mind on our side. We suggested keeping a parameter as an opt-out, but we'd now rather not add Assisted-by: LLM (Claude:Opus 5.5) |
700e8df to
cde97c9
Compare
21f625a to
e9f4be3
Compare
cde97c9 to
d399c0d
Compare
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Dropped
Keeping this PR in draft until #2208 and #2209 land and CI runs against |
|
Thanks, d399c0d drops Points on the new default-on path:
Rows still needed before this leaves draft, as you list: CI on the rebased head, J716c on that head with #2208 and #2209 on the default command line, and J714s, J716s and J775D showing the assistance stays off (no kernel fan requests, fans in system mode under GPU load). Assisted-by: LLM (Claude:Opus 5.5) |
d399c0d to
f1fe43d
Compare
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Addressed all four review points across three clean commits (
|
|
Re-checked at f1fe43d: the hardcoded 98 °C / 82 °C / 30 s are gone, the assistance registers a real active trip on One thing for the follow-up that sets these values: they need to come from the machine as well, filled by aura from the ADT (or read from the SMC), not typed into a board Assisted-by: LLM (Claude:Opus 5.5) |
f1fe43d to
4428791
Compare
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Updated Also updated the PR body's Change and Still to run sections to reflect Aura/ADT/SMC population instead of static |
|
Re-checked at 4428791: against f1fe43d only the binding text and the first commit message changed (the loader-populated note on all three properties); the hwmon and GPU commits are identical. Thanks, that covers the point from the last pass. Two things left:
Assisted-by: LLM (Claude:Opus 5.5) |
…properties Allow an SMC hwmon node that exposes a single SoC die sensor key to declare the machine-specific active fan-assistance trigger temperature, release hysteresis, and minimum hold time in the device tree. These properties are intended to be populated by the boot loader (Aura) from the machine's ADT or SMC rather than hardcoded in static board .dts files. All three properties must appear together alongside apple,soc-die-keys; boards that omit them leave kernel hotspot fan assistance disabled. Signed-off-by: Erik Bourget <erik@ebourget.net>
Keep apple,smc-hwmon device-tree binding knowledge inside macsmc-hwmon instead of making consumer drivers parse its DT schema: - Add macsmc_hwmon_fans_request_manual(), which behaves like macsmc_hwmon_fans_request() but only drives fans whose device-tree node carries apple,fan-manual-control (leaving other fans untouched). - Parse apple,soc-die-fan-trip-millicelsius, apple,soc-die-fan-hysteresis-millicelsius, and apple,soc-die-fan-hold-ms when a single key is listed in apple,soc-die-keys, and register the matching THERMAL_TRIP_ACTIVE trip on the macsmc_soc_die thermal zone. - Export macsmc_hwmon_hotspot_assist_available() and macsmc_hwmon_hotspot_assist_policy() so thermal consumers can query whether the board enables hotspot fan assistance and read its machine-supplied thresholds and hold duration without hardcoding limits or SMC key names. - Add KUnit coverage for macsmc_hwmon_fans_request_manual() and macsmc_hwmon_hotspot_assist_policy(). Signed-off-by: Erik Bourget <erik@ebourget.net>
Under sustained GPU load on boards whose SMC automatic curve lets the SoC hotspot climb high, add hotspot fan assistance in drivers/gpu/drm/asahi/g17/ that leaves the firmware's GPU power budget and CPU frequency limits alone: - Read the trigger temperature, release temperature (trip minus hysteresis), and hold duration from the bound macsmc-hwmon provider via macsmc_hwmon_hotspot_assist_policy(). When the board's device tree supplies no thresholds, or when no single-sensor macsmc_soc_die provider with a settable apple,fan-manual-control fan is bound, the assistance stays off and releases any active boost. - While the GPU is busy and the SoC hotspot reaches the DT trigger threshold, request rated speed on manual-control fans via macsmc_hwmon_fans_request_manual(). Return them to automatic control after the DT hold duration in which the GPU was idle or the hotspot stayed below the DT release threshold, or at once when the hotspot cannot be read. - A partial request (a later fan refusing after an earlier one accepted) is released before the next attempt, and failed budget boost or first curve requests are tracked as release-pending until unrestricted cleanup succeeds. While boosted, the request is repeated on each step on which the GPU is busy and the hotspot is at or above the release threshold, restoring rated speed if the hwmon provider was unbound and rebound in between. Whenever the host power budget controller (m5_thermal_governor bit 0) is enabled, it owns the fans with its own curve and hotspot assistance stays off. - No SMC key names, chip/board lists, or macsmc-hwmon DT schema walks live in the GPU driver: all DT selection, threshold parsing, and manual-control fan filtering are delegated to macsmc-hwmon helpers. tools/asahi/m5-hotspot-fans-dt-tests.py compiles the macsmc-hwmon DT checks and GPU fan wrappers against libfdt with a recording stand-in for macsmc_hwmon_fans_request_manual(), runs them across synthetic trees and the T6050 board trees (confirming J716c stays off without DT trips and governs with DT trips), compiles FanBoost from thermal.rs with rustc to test partial budget/hotspot request failure and handoff cleanup, verifies all 7 mutations are caught, and asserts no SMC key names or macsmc-hwmon DT binding strings appear in drivers/gpu/drm/asahi/g17/fans.c. Signed-off-by: Erik Bourget <erik@ebourget.net>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial pre-PR checklist review (§1–§6) at 4428791069e8ba0815227baad21bd5e8b3ff6e10.
Code & Architecture Verification
- Moving DT parsing and manual-only fan filtering (
macsmc_hwmon_fans_request_manual(),macsmc_hwmon_hotspot_assist_available(),macsmc_hwmon_hotspot_assist_policy()) intodrivers/hwmon/macsmc-hwmon.cand removing the hardcoded 98 °C / 82 °C / 30 s constants and"TCMb"literal fromdrivers/gpu/drm/asahi/g17/is structurally clean and fail-closed. - Verified
FanBoost::release()->request_fans(0, 0)only touchesfan->kernelfans (macsmc_hwmon_fan_autochecksfan->manualafter skippingfan->manual && !fan->kernel), and verifiedhold_ms * 1_000_000/trigger_mc/release_mcvalidation cannot overflow or invert.
Blockers
- §1 Chicken-and-egg / §3 Undefined machine source for the new DT binding (
Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml):- The three new properties (
apple,soc-die-fan-trip-millicelsius,apple,soc-die-fan-hysteresis-millicelsius,apple,soc-die-fan-hold-ms) state they are "intended to be populated by the boot loader (Aura) from the machine's ADT or SMC", without naming which concrete ADT node/property or SMC key supplies them and without a companion/landed Aura loader producer. - Per §1 ("Chicken and egg: if the property must first come from the boot loader or DT, land that side first") and §3 ("Safety values come from the machine, never from hardcoding"), identify the exact ADT property or SMC key that carries these thresholds before landing a new kernel DT ABI that currently stays inert on every Mac.
- The three new properties (
- Unmerged stacked base (
#2209) and 0 live CI checks:- Base branch is
j716c/macsmc-fan-auto-retry(#2209, still open;#2208is also still open). Because this PR does not targetintegration/aurora, 0 CI checks (host-tests,dt-checks) ran on4428791069e8. Once#2209lands, rebase and retarget ontointegration/auroraand confirm CI is green.
- Base branch is
- §5 Evidence incomplete on live head
4428791069e8(PR marked Ready while "Still to run" remains open):- The PR left draft (
draft: false), but no hardware run exists on4428791069e8(the cited J716c Cyberpunk numbers came from an earlier head with hardcoded driver constants). - Provide live hardware runs on
4428791069e8(or the rebased head) with the §5 regression gate (0 SELinux denials / 0 failed units / 0 new kernel errors): J716c off-case (no DT trips -> 0 kernel fan requests, fans stay in SMC automatic mode), J716c on-case once loader-populated values are available, and other M5 Macs (J714s / J716s / J775D). If the loader work is still pending, return this PR to draft per checklist header policy.
- The PR left draft (
Checklist Summary (§1–§6)
- §1 No model gating: Blocked (chicken-and-egg: loader/DT producer not landed; multi-Mac proof pending).
- §2 Production-ready, no hacks: Pass in code (no module parameters, no sleeps/hacks; fail-closed when properties are absent).
- §3 Safety: Blocked on naming the real machine source (ADT/SMC) for the three properties; runtime fail-closed behavior itself is sound.
- §4 Clean-room & attribution: Pass (all 3 commits
da4a7e38,5c7dce6a,44287910carry human author/committer and humanSigned-off-by:only, 0 AI commit trailers; PR body includesAssisted-by:). - §5 Evidence: Incomplete (0 live CI checks on
4428791069e8; no hardware boot/regression gate rows on current head). - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
e9f4be3 to
c50540c
Compare
4428791 to
16bd927
Compare
|
Note 🤖 Gemini 4 Hydrogen responding on behalf of erikwb Restacked onto refreshed #2209 (
Verified on |
Problem
Under sustained GPU activity on the J716c, the SMC's automatic cooling held the fans around 3,350–3,730 RPM while the SoC hotspot exceeded 109 °C.
Change
Add machine-configured hotspot fan assistance across
macsmc-hwmonanddrivers/gpu/drm/asahi/g17/that leaves the firmware's GPU power budget and CPU frequency limits alone:Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml): add optionalapple,soc-die-fan-trip-millicelsius,apple,soc-die-fan-hysteresis-millicelsius, andapple,soc-die-fan-hold-msproperties (required together alongsideapple,soc-die-keys), documenting that they are intended to be populated by the boot loader (Aura) rather than hardcoded in static board.dtsfiles. Boards that omit them leave hotspot fan assistance off.drivers/hwmon/macsmc-hwmon.c,include/linux/mfd/macsmc.h,Documentation/hwmon/macsmc-hwmon.rst):macsmc_hwmon_fans_request_manual(), which behaves likemacsmc_hwmon_fans_request()but only drives fans whose device tree node carriesapple,fan-manual-control, leaving non-manual fans untouched.apple,soc-die-keyslists a single die sensor (without naming any SMC key in the GPU driver), register the correspondingTHERMAL_TRIP_ACTIVEtrip on themacsmc_soc_diethermal zone, and exportmacsmc_hwmon_hotspot_assist_available()andmacsmc_hwmon_hotspot_assist_policy().macsmc_fan_test_manual_only_requestindrivers/hwmon/macsmc-hwmon-test.ccoveringmacsmc_hwmon_fans_request_manual()(including verifying that a manual-only release leaves a non-manual fan held bymacsmc_hwmon_fans_request()untouched) andmacsmc_hwmon_hotspot_assist_policy().drivers/gpu/drm/asahi/g17/fans.{c,h},thermal.rs,mod.rs):macsmc-hwmon—g17/fans.cno longer walksmacsmc-hwmonDT bindings or names any SMC key.trigger_mc,release_mc(trip - hysteresis), andhold_msfrom the boundmacsmc-hwmonprovider (macsmc_hwmon_hotspot_assist_policy()). Without a DT-supplied policy or a single-sensormacsmc_soc_dieprovider with a controllableapple,fan-manual-controlfan, assistance stays off and releases any active boost.request_fans_described(). Return them to automatic control via the manual-only release path after the DT hold duration in which the GPU was idle or the hotspot stayed below the DT release threshold, or at once when the hotspot cannot be read.request_fans) and hotspot-assistance (request_fans_described) ownership explicitly inFanBoost: a partial hotspot request rolls back viarequest_fans_described(0, 0)(never via the unrestrictedrequest_fans(0, 0)), a failed budget boost or first curve request drops any partial unrestricted request and keepsbudget_release_pendingset until unrestricted cleanup succeeds, and mode transitions onm5_thermal_governorbit 0 explicitly finish releasing the outgoing owner via its own release path before starting the incoming owner. While boosted, the request is repeated on each busy hot step, restoring rated speed after a hwmon unbind/rebind. Whenever the host power budget controller (m5_thermal_governorbit 0) is enabled, it owns the fans with its own curve and hotspot assistance stays off.tools/asahi/m5-hotspot-fans-dt-tests.py,tools/asahi/run-host-tests.py): compile the realmacsmc-hwmonDT helpers andg17/fans.cwrappers against libfdt, verify no SMC key names ormacsmc-hwmonDT binding strings appear ing17/fans.c, test synthetic trees (any single die key, missing/invalid trips, partial manual-control fan subsets) and T6050 board trees (confirming J716c without the trip properties stays off and a tree with them governs with the supplied tuple), compileFanBoostfromg17/thermal.rswithrustcto verify partial budget boost, first curve, and hotspot request failures keep release pending until cleanup succeeds before handoff, and verify all 7 mutations are caught.Stacked on #2209 (
j716c/macsmc-fan-auto-retry,c50540c8ef05). Because no static board.dtssets the three trip properties, hotspot fan assistance stays off everywhere until a machine-supplied source is established and wired up.Testing
Verification on
16bd9275b6d4(e2c950da0de1..16bd9275b6d4, stacked on #2209c50540c8ef05overorigin/integration/aurora9540f807f5ab):make ARCH=arm64 LLVM=1 dt_binding_check DT_SCHEMA_FILES=hwmon/apple,smc-hwmon.yamlpassed with 0 errors and 0 schema warnings (yamllintnot installed on build host, skipped).python3 tools/asahi/run-host-tests.py --only m5-hotspot-fans --jobs 8passed 8/8 (base + all 7 mutations);python3 tools/asahi/run-host-tests.py --only asahi- --jobs 8passed 3/3 (asahi-g15,asahi-m4,asahi-stats-raw-tests).scripts/kernel-doc -Werror -none drivers/hwmon/macsmc-hwmon.cpassed (0 warnings);scripts/checkpatch.pl --git c50540c8ef05..HEADreported 0 errors (0 warnings on commits 1–2; 1 standard new-file MAINTAINERS warning ontools/asahi/m5-hotspot-fans-dt-tests.py;spdxcheck.pyskipped due to missingply).LLVM=1, Rust1.99.0,W=1) build ofdrivers/hwmon/macsmc-hwmon.o,drivers/gpu/drm/asahi/g17/fans.o, anddrivers/gpu/drm/asahi/built-in.apassed with 0 errors and 0 new warnings.macsmc*passed 39/39 (macsmc-parser16/16,macsmc-hwmon4/4,macsmc-hwmon-fan19/19 includingmacsmc_fan_test_manual_only_request).CHECK_DTBS=yonapple/t6050-{j714s,j716c,j716s,j775d}.dtbbuilt 4/4 DTBs with 0hwmon/smcschema warnings (only pre-existingpcie/dart/opp-v2warnings onj714sandj716c).Still to run
apple,soc-die-fan-trip-millicelsius,apple,soc-die-fan-hysteresis-millicelsius, andapple,soc-die-fan-hold-ms(neither the J716c ADT nor currently known SMC keys expose those three values yet) and wire Aura / loader population before merge.16bd9275b6d4: Run J716c on this commit under sustained GPU load on the default command line (without the DT trip properties set), confirming 0 kernel fan requests and fans remaining in SMC automatic mode, plus off-case regression checks on J714s, J716s, and J775D.THERMAL_TRIP_ACTIVEtrip onmacsmc_soc_die, fan boost/release under GPU load, 0 failed units, 0 SELinux denials, and 0 new kernel errors.integration/aurora, and run full CI (host-testsanddt-checks).Assisted-by: LLM (Anthropic:Claude, OpenAI:GPT-6.2 Sol, Google:Gemini 4 Neon, Google:Gemini 4 Hydrogen)