-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init: move cpufreq tuning to systemd service #3896
Conversation
Added the rpi set-cpufreq script to amlogic as well. This assumes amlogic has only the one cpufreq policy (/sys/devices/systems/cpu/cpufreq/policy0). |
I haven't been able to test this PR due to travels but the changes look sane. However I think we need to avoid duplicating scripts among multiple project folders - I guess the same will be needed for Allwinner and Rockchip too? .. also is |
I believe avoiding duplication is probably best done with a symlink between the projects. It's not a standard naming convention, as far as I know. The name comes from a Ubuntu VM (same purpose; different script), and I've seen cpupower.service too. There are no other set-* scripts that I saw on the VM. |
In this case I'd rather accept a small duplication than adding a sym link from one file/project to another, which always "feels" bad to me (and likely to cause confusion/problems). In this case it's a small file, and could easily change in future (to better tune/optimise performance for RPi, which might be different from Amlogic - or vice versa). |
b9ebc5d
to
b699985
Compare
Rename complete. The commits here were essentially to make the current changes done during busybox's init into systemd files for the live system. Thoughts on instead having the RPi version of cpufreq here be the 'default' in the systemd package scripts dir instead? I'd also like to change it such that checks if the cpu governor is ondemand and then making changes. This is so that the default cpu governor in the kernel .config is respected. Such a script could also be extended to cover schedutil or other governors if necessary. |
Should there be a default? If we have a default it should be nothing, or something that is guaranteed to work safely for all projects and devices (regardless of kernel version, governors etc.). If a "safe for everyone" default is not possible then don't provide a default script, and make enabling of the service conditional on the presence of a I think I'd rather not have a default script - just allow each project to implement their own script if they want to. And if they don't, then |
The default script for LE is in users' interests, in my opinion. At present, it is only adjusting For LE, my expectation for high CPU load is software decoding, so being more aggressive at increasing CPU frequency should reduce stutter on high bitrate scenes. I have some cleanup patches for this that I will try to push shortly. |
Cleanup commits pushed: Only try to enable the cpufreq.service if the script has been installed. |
Thinking about it, there's probably a "more systemd" way to make the service conditional, by adding For example: https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/mediacenter/kodi/system.d/kodi-autostart.service#L5 |
9e242ac
to
7d0902d
Compare
Commits squashed. Only change from when last seen is to the service file to use the ConditionPathExist for executing and RemainAfterExit should something ever decide to depend on this. |
@antonlacon find_file_path was adjusted to |
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
7d0902d
to
2118568
Compare
Fixed. |
@chewitt only H3 has frequency scaling table in DT and even that is very simple. A64 and H6 don't have it (yet). I don't plan to add any out-of-tree patches for this at all, because current defaults are choosen carefully to be stable and when using HW decoding, high CPU frequency is not required at all. Anyway, since those settings are only for "ondemand" governor, it shouldn't change anything for Allwinner images, because default governor is "performance". And there is that: https://www.phoronix.com/scan.php?page=news_item&px=CPUFreq-Schedutil-Future-Maybe |
This converts this existing cpufreq configuration done in busybox/init and platform_init for rpi into a systemd service script. Tuning choices can be made based on device / proejct / distro / package. This should match what is currently done for different images. The RPi path has been tested.
@kszaq I'm not sure what device you were targeting for with #3538 but this should be a good restarting point for you.