Repository navigation
Mobile APUs: allow deep P-state floor and faster step-down - #195
Closed
totemofwolf wants to merge 1 commit into
Closed
totemofwolf wants to merge 1 commit into
totemofwolf wants to merge 1 commit into
Conversation
- PSTATE_LIMIT 1 -> 2: the governor could never request below P1, and pmRyzen_init_PState() rewrites P1 to 80% of P0 (3.4GHz on a 5800H), pinning every core near base clock at idle (~24W, ~90C). - PSTATE_STEPDOWN_TIME 16 -> 4, PSTATE_STEPDOWN_MP_GAIN 5 -> 0: the step-down threshold of 16 + hpcpus*5 windows (8.4s with all cores in P0) is never met under normal desktop background load, so cores never left P0 at all. With this, an idle 5800H reaches the firmware P2 state (1.2GHz, ~9W) and boosts back to P0 instantly on load.
Owner
|
I need to hear your reasoning and review of the code. Not from AIs. |
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
On mobile APUs the governor can effectively never leave P0/P1:
PSTATE_LIMITis 1, soset_PState()clamps requests to P1.pmRyzen_init_PState()rewrites P1 to 80% of P0 — on a Ryzen 7 5800H that is ~3.4 GHz.PSTATE_STEPDOWN_TIME + hpcpus * PSTATE_STEPDOWN_MP_GAINwindows. With all cores in P0 that is 16 + 40 = 56 windows (~8.4 s) of consecutive sub-12% per-core activity — never met under normal desktop background load, so cores never step down at all.Net result on a Cezanne laptop (Ryzen 7 5800H): every core sits near base clock at desktop idle, ~24 W package power and 85–90 °C.
Fix
PSTATE_LIMIT1 → 2: on Cezanne the firmware P2 state is the deep idle state (1.2 GHz).PSTATE_STEPDOWN_TIME16 → 4,PSTATE_STEPDOWN_MP_GAIN5 → 0: cores can leave P0 after ~0.6 s of quiet.pmRyzen_PState_reset()normalize path now usesPSTATE_LIMITinstead of a hardcoded 1.Result (Ryzen 7 5800H, Legion R7000P 2021, Ventura 13.7.8)
Desktop idle drops from ~3.4 GHz / 24 W / 90 °C to the firmware P2 state (1.2 GHz, ~9 W, and the machine is finally cool); stepping back up to P0 + boost on load remains instantaneous.
Note
Firmware P2 (and P1/P0) definitions are read from the PstateDef MSRs at init and are safe targets — these are the same states Windows/Linux request through CPPC/legacy P-state interfaces.