tuned icon indicating copy to clipboard operation
tuned copied to clipboard

tuned-ppd: Detect battery change events

Open superm1 opened this issue 11 months ago • 9 comments

power-profiles-daemon has the ability to detect battery change events using upower and to apply different tuned settings based upon whether plugged into power or not.

In PPD this is used specifically to set the energy performance preference differently in the 'balanced' profile, but there is no reason that this concept can't actually apply to all profiles.

Add support for detecting battery change events and apply a profile specified in ppd.conf for battery in the different PPD states.

CC @smallorange

superm1 avatar Apr 02 '24 04:04 superm1

Sure let me explain the background of it. The PPD daemon does use upower to monitor for battery changes and some "PPD drivers" will react to this and make changes "within" their given profile. GNOME and KDE aren't notified over D-Bus when this happens. It's all internal to PPD.

The reason for bringing this functionality to tuned-ppd is so that when a distro changes to tuned and tuned-ppd the power consumption on battery doesn't go up.

superm1 avatar Apr 02 '24 11:04 superm1

Sorry I realized I didn't answer your question. In terms of what GNOME does at low power (at least with PPD) it's tangential.

I think it's best to think of it as a "subprofile" for a given profile.

superm1 avatar Apr 02 '24 12:04 superm1

Sorry I realized I didn't answer your question. In terms of what GNOME does at low power (at least with PPD) it's tangential.

I think it's best to think of it as a "subprofile" for a given profile.

Thanks for the explanation. I'm also wondering whether the dynamic part of #601 shouldn't also be moved here, as part of the "subprofiles".

zacikpa avatar Apr 02 '24 13:04 zacikpa

Sorry I realized I didn't answer your question. In terms of what GNOME does at low power (at least with PPD) it's tangential. I think it's best to think of it as a "subprofile" for a given profile.

Thanks for the explanation. I'm also wondering whether the dynamic part of #601 shouldn't also be moved here, as part of the "subprofiles".

Yup; that was already on my mind. If this one gets accepted first I'll modify that one. If that one gets accepted first I'll modify this one.

superm1 avatar Apr 02 '24 13:04 superm1

Thanks for the update.

:+1:

Do I understand it correctly that power-profiles-daemon does not change its profile set when on battery? If so, I'd enforce that here as well, as suggested in one of the comments.

Sounds good. I've made that change and your other suggested ones.

superm1 avatar Apr 03 '24 14:04 superm1

Yup; that was already on my mind. If this one gets accepted first I'll modify that one. If that one gets accepted first I'll modify this one.

I've made the changes to plugin_video on another branch that has both PRs merged to stop using upower and to instead have the separate profiles for balanced vs balanced-battery. It works well. Here is what that diff looks like: https://github.com/redhat-performance/tuned/commit/30dc23a74b3ccbacf76fe574487afb4d36e40058

superm1 avatar Apr 03 '24 15:04 superm1

Perfect, LGTM.

I think the cleanest solution now would be to adjust #601 (keeping just the new video plugin option), and split this PR into two commits, one adding the battery functionality, the other updating ppd.conf with the new battery profiles.

Btw, is panel_power_savings=0 the default value? If yes, I think we don't need to add it to existing profiles at all.

zacikpa avatar Apr 04 '24 13:04 zacikpa

Btw, is panel_power_savings=0 the default value? If yes, I think we don't need to add it to existing profiles at all.

What does default mean? I want to make sure that no matter what value it is set before starting tuned that it gets corrected to 0 if balanced.

superm1 avatar Apr 04 '24 14:04 superm1

Btw, is panel_power_savings=0 the default value? If yes, I think we don't need to add it to existing profiles at all.

What does default mean? I want to make sure that no matter what value it is set before starting tuned that it gets corrected to 0 if balanced.

Oh, right, that makes sense.

zacikpa avatar Apr 04 '24 15:04 zacikpa