Saving power in Porteus

Non release banter
User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Saving power in Porteus

Post#1 by Ahau » 29 Jun 2011, 15:16

Hi all,

So, I read a thread over at linuxquestions.org, which inspired me to start on some research and a little project. You can read that thread here: http://www.linuxquestions.org/questions ... ost4399191

Over the next few days, I'm going to be searching for ways to reduce my power consumption and extend my battery life. More battery life for Ahau means more docs for Porteus :)

Speaking of docs, I plan on making a "porteus tweaks' doc out of my experience. I think I'll be recompiling the kernel as well, so that means I'll be trying out and sprucing up the kernel compile HOWTO, which has been the source of confusion for a couple folks (I believe, starting with the fact that it doesn't mention modprobing your current configs :P).

I'll post some links and tips here as I go along. If any of you have ideas to add, let me know. If I'm successful in compiling a kernel that provides additional power savings, I'll post it for others to download and test (and maybe some suggestions will make it into the kernel for 1.1).

Links so far:

http://www.lesswatts.org/projects/powertop/
http://www.gentoo.org/doc/en/power-management-guide.xml
http://www.linuxfordevices.com/c/a/News ... orkaround/
That link has info on a regression specific to kernel 2.6.38, with the "pcie_aspm=force" kernel parameter fix
http://www.thinkwiki.org/wiki/How_to_re ... onsumption

I'm going to compile powertop against the Porteus Kernel to see if I can get better recommendations out of it. If I get that working well, I'll post a module for that as well.

Cheers!
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Saving power in Porteus

Post#2 by brokenman » 30 Jun 2011, 00:35

Interesting stuff. i knew i wasn't going nuts when my i7 laptop burned through the battery in record time. I'll give this a good testing. My focus now will be on getting the switcheroo function in dual graphics laptops to play nice on porteus.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Saving power in Porteus

Post#3 by Ahau » 01 Jul 2011, 15:17

Thanks, brokenman -- your input on the switcheroo (and in testing anything I'm able to come up with) will be greatly appreciated :)

I don't have a lot of good news so far this morning -- I recompiled the kernel yesterday to implement some of the kernel options that were suggested online and by powertop. However, some of those options were not available in the configs for 2.6.38, so I need more up-to-date information. Powertop can't provide me with much info because it's based on an older kernel. I don't see any development happening on that project over the last year.

My new kernel doesn't offer any power savings that I can find -- but it might be giving more reporting functions (which powertop can't read, but maybe I can find a way!).

I'm going through more links today and will try some things out. Some notes for now:

My lcd backlight is a major power-suck. It defaults to around 50% when I startup Porteus. That uses about 5 extra watts vs turning off the backlight. Of course, I can't exactly work without seeing my screen...

Powertop implements a function to autosuspend noninput USB devices. This actually seems to save me 3 watts or so. I've poked through the source code for this action a little bit, and it appears to be going into /sys/bus/usb/devices, and for each usb device that is not an input device, it goes in to usb*/power and adds a file called 'control' containing the text 'auto'. If I knew how to script better, I might be able to write something up to do this at startup...maybe this will be impetus for me to learn how to script.

I burned WattOS to a CD last night. It doesn't seem to offer a substantial power savings over Porteus, but powertop functions better within it. Maybe my system is already pretty efficient and I'm grasping at straws here, lol. Interestingly enough, the WattOS ISO is about twice the size of Porteus, runs LXDE, and seems to have far fewer applications available...one more reason to love Porteus :)

Ok, time to get back to testing...I need to figure out how to turn off my hard drive :D

For posterity's sake, here's my changelog for the kernel config:

Code: Select all

Old:
CONFIG_PM_DEBUG is not set

New:
CONFIG_PM_DEBUG=y
CONFIG_PM_ADVANCED_DEBUG=y
CONFIG_PM_VERBOSE=y
CONFIG_CAN_PM_TRACE=y
CONFIG_PM_TRACE=y
CONFIG_PM_TRACE_RTC=y

Added line:
# CONFIG_PM_SLEEP_ADVANCED_DEBUG is not set

Old:
CONFIG_ACPI_BATTERY=m

New:
CONFIG_ACPI_BATTERY=y

Old:
#CONFIG_ACPI_DEBUG is not set

New:
CONFIG_ACPI_DEBUG=y
CONFIG_ACPI_DEBUG_FUNC_TRACE=y

Old:
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=m

New:
CONFIG_CPU_FREQ_DEBUG=y
CONFIG_CPU_FREQ_STAT=y

Old:
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

New:
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
(no change to CONFIG_CPU_FREQ_GOV_ONDEMAND)

Old:
#CONFIG_PCIEASPM_DEBUG is not set
New:
CONFIG_PCIEASPM_DEBUG=y
Posted after 3 hours 3 minutes 51 second:
Yet another update -- I think I was wrong about not being able to set CONFIG_TIMER_STATS...I kept looking for that in the config file, when I should have been looking for CONFIG_DEBUG_KERNEL, which was not set. I'm going to set that in my config and recompile the kernel...unfortunately, I don't have enough time for that right now. That should help me out a lot!

Also, I tried the ZEN kernel, as compiled by beny. at first, it didn't work with nouveau, so I ran it with vesa. It's power consumption was about the same. Then, I added the nVidia proprietary driver, and everything fired up. And, in fact, it uses 2 or 3 fewer watts than my old configuration!

Posted after 21 hour 29 minutes 19 seconds:
Some more good news this morning -- I found out that PowerTOP is being actively developed and they're working on a new 2.0 release. Just yesterday, they released 12 new patches for their beta release. I've compiled their beta (aka 1.98), which had some errors out of 'make install' but still seems to run (but I'm not sure if it's fully functional). This release will allow users to send output from the program to an html document that gives tons of information -- it's pretty cool. However, I haven't found a way to implement their suggestions (such as autosuspending non-input USB's) so for the time being, I'm running both versions of PowerTOP at the same time. tee hee.

I also was able to compile a kernel with CONFIG_DEBUG_KERNEL and CONFIG_TIMER_STATS, which gives a lot more info (in Powertop1, at least) about processes and devices that are consuming power. I found some example kernel configs, and I think that our kernel from V1.0 (I'm using 64-bit for all of this) will work with only the above two options enabled, with some of the existing modules modprobed by the users. I'll keep tooling around with the config (though I am getting a little tired of the 90-minute kernel compile sessions!)

I confirmed that adding the nVidia driver instead of nouveau saves power with both the vanilla and ZEN kernels (on my machine at least -- ymmv). On my system, nVidia makes all of the font much larger and bold, which I don't like, because it makes all of the windows, esp consoles) open up larger -- I'll see if I can modify that for my own happiness (if anyone has any quick ideas for that, I'm all ears).

All told at this point -- By reducing my backlight from ~57% (default) to ~28% (what I can read indoors as long as the sun isn't shining in), using the nVidia graphics driver, and autosuspending my USB devices, I have gotten my power consumption to go down from ~25 Watts to ~16-17 Watts when my system is idling. This corresponds to about a 50% increase in battery lifetime.

Because all systems will have different power wasters, my HOWTO will probably wind up being about installing and using powertop (I'll provide a module), and once I get the kernel config sorted out, I'll make recommendations to the developers for use in the V1.1 kernel.
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Saving power in Porteus

Post#4 by fanthom » 02 Jul 2011, 05:25

@Ahau
I'm glad to see that you are looking after this. Unfortunately 2.6.38.x kernel (up to 3.0) has some known bugs regarding power usage which can be worked around as per Phoronix:
http://www.phoronix.com/scan.php?page=a ... aspm&num=1
older kernels has some regressions as well - pls find the links to other articles on the last page.

Nvidia binary is a must for those who cares about battery life. Nouveau is not that advanced in this matter yet.

Use 'make -j4' to shorten compilation time (it's going to eat more CPU power for this task). You can also make recompilations on already compiled sources to get new kernel faster. Also - i would recommend you to use 'make menuconfig' instead of editing the .config file manually.
Let me know about all your recommendations regarding changes to kernel config and kernel compilation HOWTO. please post your kernel related findings in this thread:
http://porteus.org/forum/viewtopic.php?f=53&t=50

Cheers

EDIT:\\
another tip:
boot Porteus with 'copy2ram' and put your hd into sleep state with 'hdparm -Y /dev/sda' command. in case of booting from the stick you can plug it out completely.
Please add [Solved] to your thread title if the solution was found.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Saving power in Porteus

Post#5 by Ahau » 03 Jul 2011, 06:29

Great, thanks fanthom!

I'd heard about that issue with ASPM. luckily, my BIOS doesn't seem to be affected (issuing that boot parameter doesn't change my power usage), but it will definitely make it into my documentation :)

I used make -j3, but will step it up to -j4. I was using make menuconfig, and crosschecking the .config file to ensure things were enabled properly. I did do some manual edits in there first, but thought better of it when I realized that enabling some things in menuconfig turned on some other options automatically. In my last compile, I only enabled from menuconfig, and only the few items I needed. However, my 000-kernel.xzm is about 5 MB larger than stock Porteus, so I don't think my options should be added to the official release.

Thanks again for all the info!
Please take a look at our online documentation, here. Suggestions are welcome!

Post Reply