[TRACKING] Linux battery life tuning

After reading all of this thread, I’m fairly convinced that mouse interrupts are the main problem. I exactly replicate the dstat -t --top-int output described by a couple other users: putting a finger on the trackpad changes worst-offender interrupts from < 100 to > 2500.

The people in that thread talk about this issue across various systems, so I’d really like to hear who on linux doesn’t experience absurd mouse-related interrupts.

1 Like

Fedora 37 on the 11th gen i5, purely stock, gets better battery life than my tuned Windows 10 install. It went 24 hours in s2idle and was at 96% when I woke it up. Haven’t checked mouse interrupts but I’ll do so later today.

@Aidan -

Fellow EndeavourOS user here on my 11th Gen i5, KDE on X11, tlp, several boot command line options, etc. My record is ~1.5w idle at graphical desktop, but that was doing crazy get the power down limbo type things. Normal just stop using the mouse idle is 3-4W give or take. I’m away from my machine at the moment so I can’t copy config specifics for you, but it definitely can be done in Endeavour.

Getting PSR working to get the processor to end up in C10 idle will make a pretty big difference by itself, nearly a watt in my testing.

1 Like

@D.H That’s both encouraging and maddening to hear. Looking at powertop’s “idle stats” page and the CSV report it generates, I see contradictory indicitations. I don’t know how to properly read these things; all I can see is that in some places it seems to show that the cores are spending a lot of time in C10, and in others it seems to show that they’re stopping at C6 or C7. Here’s that CSV file.

Is this supposed to imply that you, too, see a dramatic power increase when you touch the trackpad? What’s your dstat -t --top-int readout?

I’d like to hear what your “several boot command line options” are, if you think they’re relevant to power consumption.

I got PSR working, and it didn’t make a big difference. Power consumption is still around 6W at idle.

At what point do I start to consider that this may be a hardware issue? Could I just have a defective chip? Remember: power consumption, and those 2000+/s mouse interrupts, are both fairly consistent across different distros.

I set up my 13 Gen framework last week with Fedora 38 and followed the battery optimization guide by @Matt_Hartley to set up TLP.

With display at 1%, power button LED set to low, 3 x USB C and 1 x USB A, I’m getting an idle just below 3w.

With the display brightness at 20%:

  • Firefox open and idle - 4w
  • Scrolling through Firefox - 9w
  • 1080p video in Firefox - 10w

I’m really impressed how straightforward it was to get set up and super happy with the battery life.

Thank you to the framework team for all the work put into making battery life improvements since launch.

8 Likes

I have not taken power stats in quite some time, so, take all of this with a grain of salt:

HW: 11th gen i5, SK Hynix P31 SSD, 8GBx2 SK Hynix DDR4-3200 RAM
kernel: 6.3.6-arch1-1

I boot via rEFInd, using these cmdline options: root=UUID=99d3cbdf-e1ca-46c2-94e6-xxxxxxxxx rw quiet loglevel=3 nowatchdog acpi_ - Pastebin.com . There is quite possibly no longer needed stuff in there…

I am only using tlp, no ppd, powertop, etc.
tlp.conf: # ------------------------------------------------------------------------------ - Pastebin.com

This is the way (little Star Wars humor).

Appreciate that. :grinning:

2 Likes

Okay, took power measurements again. I have a very specific methodology to look at true idle, and get rid of as many variables as possible.

Hardware as given in my last post.
Booted to arch, plasma graphical desktop over X11
1% screen brightness, keyboard backlight off
Only USB-C expansion cards in
Airplane mode

Nothing running except a konsole terminal running watch cat /sys/class/power_supply/BAT1/current_now

Current_now settled to ~144000, very close to my all time record low of 133000 IIRC. Single touchpad-induced mouse movements spiked the current to ~180000, far better than the spikes to 300000+ I used to see in kernels near 5.18 or so.

Seems like my RZ608 wifi card is a bit more power hungry than the AX210 was, especially with bluetooth turned on. Powertop is reporting almost 4 watts for idle but connected wifi only, nearly 7 with bluetooth turned on. I know powertop’s guesstimates are kind of a wag, but still: Ugh.

Wow less than 3W! I never seem to drop below 8W. Looks like I need to actually tweak tlp with that guide rather than just leaving it as-is. I’m pretty sure I did set the flags for limiting CPU speed on battery at some point though.

I have iwlwifi using over 7W alone though, so maybe something funny is up?

That does not seem right.
For reference, i run F38 KDE on my 12th gen (i5-1240p) and havent done any tinkering (also no tlp).
With Wifi enabled + connected, screen at 30%, i idle at about 3.5w.

If your iwlwifi is using over 7w alone, your system is probably not idle.

2 Likes

What expansion cards were you using? I’m curious whether this idle power is possible with the notorious HDMI card, which on my machine draws a full 1.5 watts.

1 Like

2x USB-A + 2x USB-C
Dont think it’s possible with the „old“ hdmi cards…

1 Like

Got my i7 1370p recently and I can’t get idle power draw to go below like 11w… any ideas (or is this just normal and I don’t know?)
Other hardware:
2x usb-c expansion cards, 2x usb-a expansion cards
64G 3200MT/s teamgroup memory (TEAMGROUP-SD4-3200,) I know that having this much ram might negatively affect battery, but it shouldn’t be this bad, no?
2TB Samsung 980 pro SSD

I have TLP running with settings mostly taken from the wiki page (config below,) nvme acpi off (for suspend,) and deep suspend enabled (because s2idle is trash.) I’m running Kali Linux, which is forked from debian, and running the latest kernel it provides (6.3.)

Relevant Configs:

┌──(gido5731㉿gframe)-[~]
└─$  grep -v -e '^$' -e '^#' /etc/tlp.conf
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=power
CPU_MIN_PERF_ON_AC=100
CPU_MAX_PERF_ON_AC=50
CPU_MIN_PERF_ON_BAT=0
CPU_MAX_PERF_ON_BAT=40
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
CPU_HWP_DYN_BOOST_ON_AC=1
CPU_HWP_DYN_BOOST_ON_BAT=0
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1
NMI_WATCHDOG=
PLATFORM_PROFILE_ON_AC=performance
PLATFORM_PROFILE_ON_BAT=low-power
INTEL_GPU_MIN_FREQ_ON_AC=800
INTEL_GPU_MAX_FREQ_ON_AC=1500
INTEL_GPU_MAX_FREQ_ON_BAT=500
INTEL_GPU_BOOST_FREQ_ON_AC=1500
RADEON_DPM_PERF_LEVEL_ON_AC=
RADEON_DPM_PERF_LEVEL_ON_BAT=
RADEON_POWER_PROFILE_ON_AC=
RADEON_POWER_PROFILE_ON_BAT=
WIFI_PWR_ON_BAT=off
PCIE_ASPM_ON_AC=default
PCIE_ASPM_ON_BAT=default
USB_DENYLIST="046d:c52b"
RESTORE_THRESHOLDS_ON_BAT=1
                                                                                                                                                                
┌──(gido5731㉿gframe)-[~]
└─$  grep -v -e '^$' -e '^#' /etc/default/grub   
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT='nvme.noacpi=1 module_blacklist=hid_sensor_hub  i915.i915_enable_fbc=1 i915.lvds_downclock=1 drm.vblankoffdelay=1 acpi_osi="!Windows 2020" intel.iommu=on mem_sleep_default=deep'
GRUB_CMDLINE_LINUX=""

Thanks in advance, I will say that, unlike my last laptop (a Tuxedo Pulse 15 Gen 1,) this laptop is way less anxiety inducing on the battery life front because it charges properly from a usb-c brick under 100w, and also has an effective battery life over 20Wh (seriously, the battery is like a year old and at under 25% capacity. I did test it externally as well to make sure the software reading is correct.)

The guide only focusses on TLP, whereas auto-cpufreq seems to be the “modern” approach.
Is there a specific reason why TLP should be preferred?
In addition: for most optimized settings, should TLP and auto-cpufreq be run combined for maximum benefit on a framework?

Auto-cpufreq is often mentioned and I have tested it in the past, and found it wanting. I have much better runtimes with a properly configured TLP than any other option out there. Also TLP allows for other modifications to the behavior of all the parts that go into making a complete power saving solution. Want your usb ports to suspend, but don’t want your dock to fall asleep? TLP can do that, auto-cpufreq cannot. The only thing auto-cpufreq is good at is if you don’t want to take the time to configure TLP. It is plug and play, and will get you within striking distance of TLP…but I want to squeeze out every minute I can when I am on battery so TLP wins every time.

On my last laptop a Thinkpad T480s the difference was a full hour. I did not even bother comparing the two on the Framework.

1 Like

I do agree with this. It’s possible I totally misunderstood the goal of auto-cpufreq, but I saw very few configuration options and no improvement to power use. It’s possible that maybe it could have a use, but I would need TLP running for other reasons anyway, so I don’t really see a benefit for me. I uninstalled it within like 20 minutes of trying it, as it seemed to not do much of anything.

1 Like

Bumping this, still the best I can get is about 9w on idle, with a load average of 1.3. Any ideas on what is making this so awful? People seem to be getting 2w on the 12th gen, so this is sorta maddening…

Looking into this further, it looks like it’s not my cpu but something else? Reading the RAPL measurements, it’s listed as platform power, so maybe my samsung SSD is the problem? I think tomorrow I’ll try booting off of a USB and seeing how it goes, and maybe removing a ram stick?

source: GitHub - deater/uarch-configure: tools for setting and accessing advaned low-level CPU features

└─$ sudo ./rapl-read -p      

RAPL read -- use -s for sysfs, -p for perf_event, -m for msr

Found Unsupported model 186
 Processor type
	0 (0), 1 (0), 2 (0), 3 (0), 4 (0), 5 (0), 6 (0), 7 (0)
	8 (0), 9 (0), 10 (0), 11 (0), 12 (0), 13 (0), 14 (0), 15 (0)
	16 (0), 17 (0), 18 (0), 19 (0), 
	Detected 20 cores in 1 packages


Trying perf_event interface to gather results

	Event=energy-cores Config=1 scale=2.32831e-10 units=Joules 
	Event=energy-gpu Config=4 scale=2.32831e-10 units=Joules 
	Event=energy-pkg Config=2 scale=2.32831e-10 units=Joules 
	Event=energy-psys Config=5 scale=2.32831e-10 units=Joules 

	Sleeping 1 second

	Package 0:
		energy-cores Energy Consumed: 1.171814 Joules
		energy-gpu Energy Consumed: 0.061340 Joules
		energy-pkg Energy Consumed: 3.301392 Joules
		energy-psys Energy Consumed: 12.147766 Joules

If your load average is 1.3, your system is definitely not idle. That would mean either at least one CPU core is fully loaded, or at least one process is fully saturating some IO device. Check out htop and iotop to look for potential culprits.

As a point of comparison, my machine running nothing but Xorg, Awesome WM, htop, and powertop has a load average of 0.18 and a power consumption of 4 watts (wifi connected, screen at 1% brightness).

2 Likes