Skip to content
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

Add support for setting "Platform Profile" #752

Merged
merged 2 commits into from
Aug 4, 2024

Conversation

BOOTMGR
Copy link
Contributor

@BOOTMGR BOOTMGR commented Jul 28, 2024

Allow overriding/setting Platform Profile on supported platform for battery and charger profiles. Setting this profile could help avoid throttling issues in high performance mode on charging profile (like throttling due to lap-mode on ThinkPads) and save some power in battery mode if firmware supports.

Support for setting this in TLP: https://linrunner.de/tlp/settings/platform.html#platform-profile-on-ac-bat

Closes #468

@BOOTMGR BOOTMGR marked this pull request as ready for review July 28, 2024 15:19
@AdnanHodzic
Copy link
Owner

AdnanHodzic commented Jul 29, 2024

This is great and a true game changer, as it resolved throttling issues I had on my X1 Carbon! Added a single comment, if you could address it that'd be great.

I'm also thinking it would be amazing if this could be extended so Platform Profiles would be used by default even if they are not defined in config file (if they exist on users system).

@AdnanHodzic
Copy link
Owner

Also, I've been using Linux for 20+ years, but I never seen load this high 😁

So this bit troubling when on powersave governor, with using balanced platform profile (with low-power its even worse). Can you confirm you something similiar?

---------------------------- CPU frequency scaling ----------------------------

Battery is: discharging

Setting to use: "powersave" governor
Setting to use: "power" EPP
Setting to use: "balanced" Platform Profile

Total CPU usage: 19.6 %
Total system load: 229.18
Average temp. of all cores: 53.00 °C 

High CPU load (load average: 229.25, 216.40, 159.20)
Optimal total CPU usage: 19.6%, high average core temp: 53.0°C
Setting turbo boost: off

After plugging in computer back in power, load cleared up and got to "normal" levels in matter of minutes:

---------------------------- CPU frequency scaling ----------------------------

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP
Setting to use: "performance" Platform Profile

Total CPU usage: 9.3 %
Total system load: 1.52
Average temp. of all cores: 64.75 °C 

Load optimal (load average: 1.52, 50.65, 103.22)
Optimal total CPU usage: 9.3%, high average core temp: 64.75°C
Setting turbo boost: off

@BOOTMGR
Copy link
Contributor Author

BOOTMGR commented Aug 1, 2024

@AdnanHodzic Thanks for having a look, I have added reference to Kernel API specs in example configs.

Regarding high load, even on low-power profile, It is normal for me on my Thinkpad L14 with 11th gen CPU.

Battery is: discharging

Setting to use: "powersave" governor
Setting to use: "power" EPP
Setting to use: "low-power" Platform Profile

Total CPU usage: 56.7 %
Total system load: 5.13
Average temp. of all cores: 44.75 °C

High CPU load (load average: 5.13, 2.51, 1.82)
Setting turbo boost: on

Are you suggesting that we set a default platform profile if the user hasn't specified one? I was considering not enforcing this for now to avoid disrupting the current user experience. However, if you feel differently, I can create a patch to enable this by default.

If we decide to go with a default setting, I would like your input on the default values for both profiles. The ABI specs list profile names but don't require any specific ones. Would it be reasonable to assume and set "performance" for the charging profile and "low-power" for the battery profile?

@AdnanHodzic
Copy link
Owner

AdnanHodzic commented Aug 4, 2024

Regarding high load, even on low-power profile, It is normal for me on my Thinkpad L14 with 11th gen CPU.

Battery is: discharging

Setting to use: "powersave" governor
Setting to use: "power" EPP
Setting to use: "low-power" Platform Profile

Total CPU usage: 56.7 %
Total system load: 5.13
Average temp. of all cores: 44.75 °C

High CPU load (load average: 5.13, 2.51, 1.82)
Setting turbo boost: on

After throughout testing, for on battery settings, this works best for me and keeps my load at minimum:

[battery]
# see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
# preferred governor
governor = powersave

# EPP: see available preferences by running: cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences
energy_performance_preference = power

platform_profile = default

But I guess everyone's mileage might and will vary.

Are you suggesting that we set a default platform profile if the user hasn't specified one? I was considering not enforcing this for now to avoid disrupting the current user experience. However, if you feel differently, I can create a patch to enable this by default.

I'm going to merge these changes, this will be a great feature to have with upcoming release.

What I was trying to say, it would be great that Platform Profiles are included in auto-cpufreq "by default", so if user doesn't enable it in auto-cpufreq.conf file they would still use it. To play it safe I would probably go with default settings? We would need to be testing to establish what is the best profile to go with it. As on battery I go with "default" but on power I go with "performance".

Either way, that's why it's the best to introduce these kind of changes with config file, as people can they play with it first, and we can determine what works the best for everyone. I also asked everyone on auto-cpufreq Discord community to give it a try so we can get as much data as possible.

Thank you for your contribution, you will be credited for your work as part of future release and I look forward to a new PR to have PP on by default :)

@AdnanHodzic AdnanHodzic merged commit 7ac5519 into AdnanHodzic:master Aug 4, 2024
2 checks passed
shadeyg56 added a commit that referenced this pull request Aug 5, 2024
* added the abilty to ignore certain power supplies

* changed config file for ignoring power supplies

* updated exapmle config file for ignoring power supplies

* updated docs with ignoring power supplies

* Update README.md

Update image URL's

* Add support for setting "Platform Profile" (#752)

* Add support for setting "Platform Profile"

* Add reference for Platform Profile

* Fix unsafe access to PATH (#756)

* Fix unsafe access to PATH

* Fix leading separator if PATH is empty

* Unpin psutil and requests (#759)

* Remove network-online.target as a systemd-service dependency (improve boot time). Closes: #739

* minor grammer correction.

* removed wonky file

---------

Co-authored-by: Adnan Hodzic <adnan@hodzic.org>
Co-authored-by: Harsh Panchal <BOOTMGR@users.noreply.github.com>
Co-authored-by: BowDown097 <42720004+BowDown097@users.noreply.github.com>
Co-authored-by: shadeyg56 <31134255+shadeyg56@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

revisiting platform/power profiles
2 participants