[TRACKING] Linux battery life tuning

One thing to remember is that you really need to compare total consumed power over time for a job run; especially when paired with the epp prefered cores patches (basically ‘good cores’ on zen dies are ones that can boost higher for lower power input) means you have cores boosting high and finishing jobs quickly and drawing less power.

3-4W idle seems pretty good considering that’s as low (or lower) than a recent ARM SBC like an rk3588 - which can’t get anywhere near the same performance states as the zen4.

Doing a timed kernel compile test run and watching power use and time for it is going to provide a better reference point than monitoring idle ‘hypermile’ use.

My main usecase for battery is ‘can I get through several site vists in 2hr blocks without needing to reach for a Power Plug’ which I think this configuration manages pretty well.

Would I like a couple more hours runtime, yes. But Hopefully at some point battery Cell replacement with a higher ah rating might become an option.

8 minutes of video played back with the power usage averaged over it is relatively equal to that no?

@tlvince is cm32181 loaded in your modules ? i.e lsmod |grep cm32181

and does the sensor disappear if you force-ably unload it?

I have the 7840U, I wouldn’t expect chip variations to make much difference but … from what I understand the iio/i2c bus is part of the webcam assembly; hardware button toggling the camera etc doesn’t seem to change anything for me - does the ALS disappear if you hardware toggle the webcam on your machine

i.e :[ 2180.543662] usb 3-1: USB disconnect, device number 2 [ 2182.593725] usb 3-1: new high-speed USB device number 3 using xhci_hcd [ 2182.748389] usb 3-1: New USB device found, idVendor=0bda, idProduct=5634, bcdDevice= 0.21 [ 2182.748403] usb 3-1: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [ 2182.748409] usb 3-1: Product: Laptop Camera [ 2182.748413] usb 3-1: Manufacturer: Generic [ 2182.748417] usb 3-1: SerialNumber: 200901010001 [ 2182.758202] usb 3-1: Found UVC 1.00 device Laptop Camera (0bda:5634)

The only other thing I can think of is do you have secureboot/TPM on or off in the bios. I’m running with it off

I am starting to think this is hardware issue:

Either:

a) The Assembly has bad/misconfigured solder points for the ALS sensor in my Unit or
b) They have substituted the Chip for a newer equivalent that is not as equivalent as they think.

Very keen to hear from other amd FW users wether they do or do not get the als populated in their sysfs

@Adrian_Joachim Not even a comparable/close test. Video playback is fraught with custom ASIC IP blocks and various optimizations. You need to test with compiling stuff that feeds the CPU - which is why kernel compilation is sort of the benchmark for this (phronix test suite has a kernel timed compilation test which is quick and easy to run up and monitor rapl power against).

One of the big advantages of PPD over TLP is that it can launch a job in performance boost states independent of the system set power .

i.e I can run

powerprofilesctl launch make bzImage

and it will run the job in a performance state without needing to tune global power bits. Super useful for i.e Steam etc ; and this is IIRC integrated with Gnome Out of the box (like run on dGPU is)

Well yeah and that looks quite unobtimized at this point.

I am not doubting the amazing performance per watt at heavier loads these awesome zen4 and rdna3 cores have but for battery optimization playing back a fullscreened video in kodi or a youtube video in firefox are pretty realistic use cases. It’s cool that I can compile the linux kernel for a third of the watt hours, that doesn’t really help when watching a movie and the hardware decoder decides it needs like double the power for it.

That does sound pretty neat but also like something I can easily live without, I can just shift tlp into ac mode while on battery if I actually want to do that.

Have created a thread/poll wrt ALS sensor here : [POLL] AMD FW 13 als/Illuminance sensor - present/populated

One interesting anecdote I found testing power consumption. I actually had ‘HIGHER’ iby a watt or so dle draw in airplane mode i.e with wireless disconnected than connected. BT does result in some drop in draw. I’m guessing that it’s to do with polling the interface and will retest after forceably unloading the wifi driver module . Because that was unexpected.

Seems not:

❯ lsmod | grep cm32181           

~
❯ echo $?
1

does the ALS disappear if you hardware toggle the webcam on your machine

Nope, iio:device0 persists between toggles.

do you have secureboot/TPM on or off in the bios.

Yep, Secure Boot’s off.

Linux 6.6.1 btw. Let me know if there’s anything else you’d like me to test.

I have found surprisingly little difference between wifi and bt off and wifi and bt on (and wifi connected) but not doing anything with the ax210. The difference was measurable but it was way less than 0.5W.

Was hoping the be200 would be even better but that one doesn’t even post XD

Despite some niggles I’m much happier with the mtk79xx cards than the ax2xx ones I have; still not quite at ath9k level of support/open but considerably more stable and featureful than anything else i’ve had through my boxes. (I build Openwrt things for a hobby)

Once I get the power tuned better I plan on doing actual a/b testing between the 2, on my initial test the mediatek was signifficantly faster but also used signifficantly more power.

Yeah unless some miracle happens we are never getting something that open again and with the trajectory wifi standards are going it doesn’t become more likely.

I just use openwrt XD

I did some further testing on the hardware accelerated video side, using amdgpu_top I was able to verify that the hardware decoder actually engages, I see 4% VCN usage for 4k 60 and 1% for 720 30, both in kodi and firefox.

The I uninstalled the vaapi driver so noone gets hardware acceleration anymore and got some very intriguing results. First of all there was as expected no more VCN load which lends some credibility to the readings. It also did show the amazing performance per watt of those zen4 cores, it actually outperformed the t480s with hardware acceleration in one test using only cpu decoding. Also interresting was that the higher bitrate 4k 60 I use for the kodi test used signifficantly more power than the low bitrate youtube one with cpu decoding while it doesn’t seem to make a big difference with the hw decoder.

Here are the measurements (with hw acceleration/sw decode):

  • firefox youtube 720p 30hz windowed: 8.5W/6.8W
  • firefox youtube 4k 60hz windowed: 12.8W/16.1W
  • kodi 720p fillscreen from ssd: 8W/6.8W
  • kodi 4k 60hz fullscreen from ssd: 10.6W/20.5W

The hardware decoder definitely hardware decodes well but it seems to have quite a lot of overhead at this point. Having only 4% VCN load for high bitrate 4k 60 does tell me either the reading is bs or the thing comes on way too hard when it comes on.

Edit:
Just for laughs I tried a rediculous 8k 60 youtube video in firefox and managed to get VCN usage to go to a full 14% the whole thing consumed barely half a watt more (13.3W) than the 4k 60 test did. Cpu decoded was a bit of another story, it played back but just barely with a few dropped frames here and there and pulled a whopping 43W doing so.

So current conclusion is the hardware decoder definitely decodes well but it’s base consumption/overhead is quite high. If anybody knows of a way to improve that let me know.

1 Like

I suspect the use case for such an “overpowered” video engine is decoding/encoding multiple streams like being in a big video conference. Also encoding in general is a lot harder than decoding.

My point here is that it’s most likely running it at full tilt when a lot less than full tilt would do.

2 Likes

ffmpeg6.1 added vulkan layer HW decode support ; rather than having to go via libva directly. I am expecting(hoping) that potentially this might help with decode performance/PPW - but it’s really based on only a vague assumption of what is going on in those subsystems.

I think the actual fix is going to be somewhere in mesa, according to the thinkpad subreddit this does not happen on windows so it’s probably a driver issue on some level.

Hi all,
I just setup my AMD 13 (7840u) yesterday, and I’m…disappointed by the battery life estimation.
When idling with a terminal open, powertop would read values around 6-8W. My previous Dell XPS 13 (11th gen intel) would go as low as 3W in the same situation.

Has anyone had a similar experience, and have you managed to improve battery life dramatically?

I’m using the Crucial 2x16GB DDR5-5600Mhz kit and a Lexar NM790 1TB.
opensuse Tumbleweed (kernel 6.6.2), 30% screen brightness (barely usable on a sunny day).
Connected to WiFi, BT on but not connected.

I know that this HW is rather new, but I’m also on a bleeding edge distro and was hoping I’d get all the optimizations already.
I also tried to boot a live media with fedora 39, but I couldn’t spot any significant differences (not to mention there’s probably less I/O going on because of the ‘live’ nature of the medium).

I’ve run sudo powertop --auto-tune already, and TBH didn’t notice much of a difference.
I was expecting to get an idle absorption in the 2-4W range, but not this.

Thanks :slight_smile:

2 Likes

You need to run sudo powertop --calibrate , the --auto-tune option merely changes the settings, --calibrate will run it in calibration mode and eventually get to the point that the measurements are accurate. Not running --calibrate often/almost always results in high measurements.

For linux mint users; the system-tray applet called “batterypower@joka42” is very useful.
Continuously showing the power consumption in the system tray.

It had an issue with the framework laptop, but together with the author we resolved it,
and an updated version should be available within a few days.

I currently have disabled ppd, compliled the newest TLP, and running that with the config from Michael_Wu.
To be honest; so much is going on in this area, that as a “novice” user I don’t know what to do anymore.

This is so frustrating. FW13, AMD 7840u.
I’ve been off the charger for 1h30’ and lost 32% of battery.
Screen brightness set to 30%, power profile set to Balanced, WiFi AP 5 meters/15 ft away.
No BT connected.
I’m running like 6 docker compose containers, Firefox, IntelliJ idea, postman, teams, and power is never below 10W.

I have even taken out the HDMI expansion card, and a single RAM 32GB Crucial module should arrive today to replace the 2x16 kit (yeah, I’m that desperate).

Quite sure that my 1165g7 would’ve performed better.

Truth is I bought this because my DELL had soldered (16GB) memory, and I said no more.

But maybe I should have saved some serious cash and gotten myself a 11th or 12th gen intel in this machine. The performance benefit is also very marginal for programming, maybe 5-10% off while compiling code and 20% off when starting spring boot apps. I dunno, maybe my expectations were too high, but since I was otherwise content with my Dell’s performance, maybe I could’ve really settled for an older but maybe more established CPU/mainboard combo.
Temperatures are also considerably higher than on my XPS. At idle CPUs would sit around 28/32C. Here I am never below 40C.

Let’s hope people at AMD and FW make some magic happens, because as it stands I’m 200% disappointed with the battery life.

I’m running opensuse tumbleweed (KDE) with kernel 6.6.2 (the one that ships with it).

2 Likes