Replace userspace CPU governor with kernel scaling governors#695
Replace userspace CPU governor with kernel scaling governors#695pvaibhav wants to merge 2 commits intoLoveRetro:mainfrom
Conversation
|
We should probably push this out as an alpha build, so people can give feedback. |
|
Go for it. Definitely need feedback. I'm just not sure the settings I've chosen are good for a wide variety of games and cores. My own usage is limited, although I've been using it for several weeks now. Also for tg5050, I don't have the device to test. As far as I understand it has little and big cores and the GPU can also be freq-scaled. I've copied the tg5040 scripts for tg5050 also but someone with more experience with that device should have a look. |
pvaibhav
left a comment
There was a problem hiding this comment.
Some near future improvements can be made.
Remove all manual CPU frequency control via the userspace governor and scaling_setspeed. Instead, three shell scripts (auto_governor.sh, powersave_governor.sh, performance_governor.sh) configure the kernel governor and frequency range dynamically at runtime. - auto: ondemand, min to one step below max frequency - powersave: conservative, min to midpoint frequency - performance: schedutil, min to max frequency The minarch CPU Speed menu is reduced from four options (Powersave, Normal, Performance, Auto) to three (Auto, Performance, Powersave). Selecting a profile executes the corresponding script via an absolute path constructed from SYSTEM_PATH. The auto governor is always restored on minarch exit, including early-exit paths. The userspace PLAT_cpu_monitor frequency-scaling loop is removed from both tg5040 and tg5050 platform.c; the thread is retained for CPU usage measurement only. PLAT_setCPUSpeed and PLAT_setCustomCPUSpeed are now no-ops so existing callers (ledcontrol, bootlogo, etc.) are unaffected.
* Simplify the CPU Speed description in MinArch * Switch the governor scripts to the shared policy0 path * Remove the unrelated diff about rom_path Also stop running the CPU monitor when it is not needed by gating it behind the Debug HUD setting and removing the NextUI-side thread launch. Previously, nextui.c was launching this thread in teh back- ground and detaching from it. Now, it's launched conditionally in minarch.c only when the Debug HUD switch is turned on. The platform monitor loop now checks the shared enabled state so the sampling work shuts down when the HUD is off. Hope this squeezes a little more performance out of the cpu.
ca8b478 to
4bcf0bb
Compare
|
Is anything need to prepare to make a nightly build like the miyoo one |
I cant say. I’ve only really tested it on TrimUI Brick. |
Remove all manual CPU frequency control via the userspace governor and scaling_setspeed. Instead, three shell scripts (auto_governor.sh, powersave_governor.sh, performance_governor.sh) configure the kernel governor and frequency range dynamically at runtime.
The minarch CPU Speed menu is reduced from four options (Powersave, Normal, Performance, Auto) to three (Auto, Performance, Powersave). Selecting a profile executes the corresponding script via an absolute path constructed from SYSTEM_PATH. The auto governor is always restored on minarch exit.
The scripts are installed in
/mnt/SDCARD/.system/{tg5040,tg5050}/bin/.The userspace PLAT_cpu_monitor frequency-scaling loop is removed from both tg5040 and tg5050 platform.c; the thread is retained for CPU usage measurement only. PLAT_setCPUSpeed and PLAT_setCustomCPUSpeed are now no-ops so existing callers (ledcontrol, bootlogo, etc.) are unaffected.
As described in #497 (comment) this PR is intended to start a discussion and testing by the community before we settle on the exact frequency governor settings for each of the 3 modes, or perhaps add more modes.
In my opinion, there should not be any need for any option except "Auto" and at best a Powersave mode → that is how for example our phones and laptops work.
For now, the biggest positive impact of this PR is significant reduction in CPU usage by the userspace governor thread and correspondingly significant reduction in core temperature of the order of 5-10°C.