Repository navigation
cpufreq: apple-soc: verify every SoC's transitions lazily on fast switch - #2302
Open
RyanTheTide wants to merge 1 commit into
Open
RyanTheTide wants to merge 1 commit into
RyanTheTide wants to merge 1 commit into
Conversation
Lazy verification was enabled by a separate lazy_verify flag set only on T8140. The other SoCs whose command register reads back the accepted state (T8142, T8152, T6050) still waited about a transition per request on every frequency change, and so kept schedutil off the fast-switch path: every change woke the governor kthread, which then busy-waited on the register. Nothing in the lazy scheme is specific to T8140. It needs what verify_transition already describes: a command register whose PS1 field reads back the accepted state and a BUSY bit. It uses the per-SoC transition timeout for its deadline, so T8152 and T6050 keep their 2 ms bound, and it still stops all requests when the accepted state is not the one last written, so an unexpected owner is caught as before, one request later. Waited-for requests (initial check, static governors) are unchanged; suspend first settles a pending request, as on T8140. Drop lazy_verify and key the lazy path on verify_transition. Every policy can now switch from the scheduler, and a lowered fast die-temperature limit is applied to the cluster at once on all of them, as on T8140. The lazy scheme itself is Diljit Singh's. Fixes: b11a5e9 ("cpufreq: apple: verify T8140 transitions on the next request") Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
marked this pull request as ready for review
November 19, 2026 21:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Lazy transition verification on the fast-switch path is enabled by a
lazy_verifyflag that onlysoc_t8140_infosets (drivers/cpufreq/apple-soc-cpufreq.c:300, from b11a5e9 "cpufreq: apple: verify T8140 transitions on the next request"). The other SoCs withverify_transition(T8142, T8152, T6050) getfast_switch_possible = false(line 1540). On them every schedutil frequency change wakes the governor kthread, which then busy-waits for the transition.Change
Drop
lazy_verifyand key the lazy path onverify_transition, the match-data property that says the command register's PS1 field reads back the accepted state. Every policy now setsfast_switch_possible = true.The lazy path needs nothing beyond what
verify_transitionalready requires: the BUSY bit and the PS1 readback. Its deadline is the per-SoC transition timeout, so T8152 and T6050 keep their 2 ms bound. It still stops all requests when the accepted state is not the one last written, so an unexpected owner is caught as before, one request later. Waited-for requests (initial check, static governors, suspend) are unchanged.The lazy verification scheme is by Diljit Singh (b11a5e9 and follow-ups); this only extends it to the SoCs that already verify transitions.
Testing
Build:
drivers/cpufreq/apple-soc-cpufreq.owith W=1 (arm64, LLVM=1, release config): builds, no warnings.SoCs that gain fast switch (T8142, T8152, T6050) are not bootable in our lab; the safety argument is from code and DT review below.
Hardware (one-shot test kernel 7.3.0-aurora-swl1 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):
Still to run
cat /sys/devices/system/cpu/cpufreq/policy*/scaling_driver=apple-cpufreq; schedutil active;cpu_frequencytrace events under load from task context (nosugov:kthread wakeups); no "stopping requests" in dmesg.verify_transitionand already used fast switch.Per-SoC impact and safety
m6_pm_cpufreqin t8152-j873g.dts), so one policy owns each command register. It has a fast die-temperature limit; a lowered limit is now also applied to the cluster at once, as on T8140.apple,firmware-managed-thermal); the resume path that re-reads the state after a firmware sleep already ran for everyverify_transitionSoC.Not changed here
of_machine_is_compatible("apple,t8112")in module init): measured, turbo states do not raise the delivered P-core clock there. Its reason is in the comment.needs_thermal_owner, which only T8132 sets. It could be derived from match data, but those lines are the context of the open boost-control change (cpufreq: apple-soc: offer no boost control without turbo-mode OPPs #2199), so it is left for after that lands.Assisted-by: LLM (Claude:Opus 5.5)