[TRACKING] Linux battery life tuning

Indeed, it suffices to enable media.ffmpeg.vaapi.enabled. Maybe the opening post should simply link to Firefox - ArchWiki , which I consider almost a canonical source for the correct settings.

2 Likes

In fact, at least on Fedora, firefox is packaged with vaapi enabled by default:

https://fedoraproject.org/wiki/Firefox_Hardware_acceleration#Video_decoding

The packages needed for actually having it active are not installed by default, however, so you still have to undertake some action to actually get it to work (described on the page above).

2 Likes

I installed laptop-mode, acpi on gentoo, setup elogind to use hibernate/suspend, enabled powersave governor in the kernel and max battery (default is max performance) option in bios, the battery estimate shows about 7 hours.

Good enough?

1 Like

I’m not sure how to tune the system. I’m on Arch Linux with kernel version 5.19.10, and have tried s3 without nvme.noacpi=1, s3 with nvme.noacpi=1, and s2 with nvme.noacpi=1. However the best result I can achieve is about 2.x% per hour. And with s2idle + nvme.noacpi=1 I didn’t managed to get better results and sometimes leave the laptop not suspending correctly leading to an about 16% drop in one hour and a half, and the computer feels pretty warm. I’m not sure if there’s anything better I can do.
Other settings enabled:
In TLP:

CPU_SCALING_GOVERNOR_ON_AC="performance"
CPU_SCALING_GOVERNOR_ON_BAT="powersave"
CPU_ENERGY_PERF_POLICY_ON_AC="performance"
CPU_ENERGY_PERF_POLICY_ON_BAT="balance_power"
#CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC="100"
#CPU_MIN_PERF_ON_BAT=0
#CPU_MAX_PERF_ON_BAT="30"
CPU_BOOST_ON_AC="1"
CPU_BOOST_ON_BAT="0"
CPU_HWP_DYN_BOOST_ON_AC="1"
CPU_HWP_DYN_BOOST_ON_BAT="0"
PCIE_ASPM_ON_AC="performance"
PCIE_ASPM_ON_BAT="powersupersave"
PLATFORM_PROFILE_ON_AC="performance"
PLATFORM_PROFILE_ON_BAT="low-power"
USB_AUTOSUSPEND="1"

Thermald enabled
And the expansion cards on the computer include two USB-A and two USB-C.
The nvme drive is SK Hynix P41.
The battery’s current capacity is 87%.

1 Like

@nrp Could you please update, if the issue is resolved or what all subissues are pending? Its 1 year since the post was posted, would be nice to have a summary on the updates.

2 Likes

For those following along at home, can you quote what issue or subissues you’re referencing? This is a general linux battery tuning thread so I think this is primarily a collection of best practices/discussion of workarounds, I don’t think there’s any single resolution expected for this thread.

I think the biggest known remaining battery issues are non-Linux specific:

  • higher-than-average battery drain in suspend, exacerbated by attached USB device expansion cards (Windows generally gets around this by hibernating automatically at 5% battery usage and in Linux you can do something similar with suspend-and-hibernate; I wrote a simple tool to track battery drain in suspend btw).
  • potential RTC boot issues if left off and unplugged for an extended period of time (weeks)

Each of these problems has their own threads and hopefully updates go there (or in this thread that was gathering known issues).

4 Likes

Sorry for the late reply, you might need to select “BAT1” in the config though I don’t recall needing to set it.

2 Likes

I’m seeing something strange: deep is using more power than s2idle. Anyone else see this?

I have a 12th Gen with Debian Bookworm A1 (kernel 5.19.11-1). Letting the system suspend for about 10hrs in s2idle results in about 7% battery loss. If I use deep, an overnight suspend uses 15%. I have not tuned or set any other parameters.

Note that I used echo deep... for testing. I’ll try with a boot variable and initram update. Maybe the setting isn’t completely taking with only the echo change? Also note I used systemctl suspend instead of letting the power manager timer initiate the suspend. Not sure that matters but it is different than my previous tests.

1 Like

In my tests, deep is what made the most radical change (apart from removing costly expansion cards) in standby usage, so no, I haven’t seen that yet. :slight_smile:

1 Like

I didn’t see a significant change after adding that boot option. Debian GNU/Linux testing/bookworm, Linux 5.19.11, WD Blue SN570 1TB SSD version 234100WD. LVFS says it has no pending firmware upgrade.

Detailed notes in this section of my review. I’m seeing fluctuating power usage: I somehow managed to go down to 14mA, but now I’m back at ~75mA, not sure what’s causing it.

1 Like

Wow, what a great writeup! Inspired by your post, I did some more detailed testing.

I’m still seeing backwards behavior in that deep uses about 3x more than s2idle. Specifically I see about 25mA for s2idle and 75mA for deep. This is consistent across multiple tests for various durations of 2-10 hours. I’ve tried various changes like nvme.noacpi, initiating manually/automatically, disabling AX210 radio, nothing seems to make a signifcant difference.

I’m using a 12th Gen, BIOS 3.05, Debian Bookworm A1, Xfce, SN770 1TB.

No one else is seeing this backwards behavior? Maybe I have a bad build or BIOS?

2 Likes

What app is this?

Now that you mention it, I have just tried, and I actually can’t suspend to s2idle anymore, at least not if I printf deep > /sys/power/mem_sleep; the machine just doesn’t suspend at all!

Definitely something fishy going on here… sigh.

update: turns out doing the runtime change doesn’t work. rebooting with mem_sleep_default changed does work though.

i’m doing more thorough tests to analyze what is taking up power during standby now, stay tuned.

1 Like

It’s a Gnome extension called Vitals

5 Likes

Some more testing and it looks like my 2x USBA adapters may be the culprit. Removing them doesn’t affect s2idle much (still about 25mA) but deep is now 19mA. Less than s2idle and nowhere near the 75mA I was seeing. A very strange result but the only correlation I can find. I tried an NVMe firmware update, loading additional i915 firmware, etc. nothing affected deep until I removed the USBA adapters.

1 Like

Actually… back in April, you seemed to be saying that nvme.noacpi=1 had an effect only in s2idle (as opposed to deep) sleep mode, any update on that?

1 Like

I did that here:

It looks like s2idle vs deep doesn’t have as big of an effect as I thought it would, about 50mW difference. nvme.noacpi=1 shaves off only 10mW, possibly within the margin of errors of my measurements.

Still, 50mW, over the whole battery life, means two less days battery, so deep is definitely worth it for me.

1 Like

There are some news about upcoming enhancements in kernel too.

12 Likes

I’ve edited the wiki to reflect that disabling rdd is not only not required to get hardware decoding working, it actively reduces the security of the browser by disabling the sandbox.

5 Likes

Did someone notices worse battery performance with kernel 6.0.6 ?
The camera is sucking power even if not used according to powertop.
I checked if autosuspend was set, and it is.
Manually flipping the hardware switch to off fixes the issue.
But I didn’t have to do that in 6.0.5.

Edit: I rollbacked an old kernel and still have the issue, so it’s something else.
Edit2: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2669

2 Likes