Lowering power consumption in Ubuntu

In my previous blog post I described my plans to build my perfect HTPC. I want to keep it running 24 hours a day, so one of my requirements was that it had to be low power, green and eco-friendly. I had set my goal at maximum 20 watts on full load and less than 10 watts idle. I didn’t know that it was possible, but after a bit of tweaking, I reached my goal.

Install the correct drivers

First of all something you always have to do: install all the required drivers. The motherboard that I’m using has an integrated AMD HD610 GPU and Ubuntu didn’t had the right drivers to enable hardware accelerated video decoding. Because I had some troubles to get it running, I added my commands below. Note that I’m using Catalyst version 12.10. The beta version promises higher performance but it wouldn’t recognize my Sony HD TV.

## Hardware acceleration support
aptitude install -y libva1 libva-dev xvba-va-driver

## Window manager
aptitude install -y xinit

## Installing AMD HD6310 drivers
wget http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-12.10-x86.x86_64.zip
unzip amd-driver-installer-catalyst-12.10-x86.x86_64.zip
sh amd-driver-installer-catalyst-12.10-x86.x86_64.run --install --force
aticonfig --initial
rm amd-driver-installer-catalyst-12.10-x86.x86_64.run
rm amd-driver-installer-catalyst-12.10-x86.x86_64.zip

Find power hogs with Powertop

At this point my system ran at 15 watt idle. This is nice, but it can better. With Powertop I found out that my system was not so optimized for low power consumption as it could. Powertop lists all issues with power consumption and power management and is able to fix them too. The downside is that those fixes aren’t persistent, so after a reboot you have to apply them again. Luckily I found a way around that: Powertop has the option to export its findings to an html file. That file includes the fixes that Powertop would make. Those commands can be easily scripted or added to sysctl of sysfs. With all the fixes applied I got an idle power consumption of only 8 watt!

Undervolt the CPU

Undervolting can save a bit of power on some systems but the main effect can be seen at the heat generation of the CPU. Because my motherboard doesn’t have any option at all to modify the voltage of the CPU, I had to undervolt using software. This isn’t possible with all CPU’s and chipsets, but I was lucky to find Undervolt. Undervolt is a Linux application to undervolt AMD E-350 APU’s. Compile and install as followed:

wget http://switch.dl.sourceforge.net/project/undervolt/undervolt-0.4.tgz
tar -xzf undervolt-0.4.tgz
rm undervolt-0.4.tgz
cd undervolt-0.4/
./configure
make
cp undervolt /usr/bin/
cd ../
rm -rf undervolt-0.4/
echo "msr" >> /etc/modules
modprobe msr

Undervolting in Linux requires a little more effort than Windows. Look at this formula:

  1.550 - 0.0125 * SviVid

This is the formula for calculating the voltage of the processor(s). The SviVid is the variable we will modify to calculate our own voltage. The SviVid is a hexadecimal value such 0x1A or 0x14 (0x is simply a prefix, what’s after that is what matters). To undervolt you want to increase the hexadecimal values. for example from 0x18 (default P0 SviVid) to 0x19 is an undervolt of about .0125V, while going from 0x18 to 0x1A would be an undervolt of about .025V, so there’s a reference for you.

Start with these values, which should be stable undervolt for just about anyone (but not everyone), go back a step or two if not:

  P0's (1.6Ghz) SviVid: 0x1C (1.200V)
  P1's (1.28Ghz) SviVid: 0x1E (1.176V)
  P2's (800Mhz) SviVid: 0x3A (0.825V)

Because those values weren’t as low as I could go, I tweaked them a little bit further and configured them with the following command:

  undervolt -p 0:0x22 -p 1:0x29 -p 2:0x3D

Checking the current voltage of the CPU can be done with

  undervolt -c

At this point my setup was idling at 7.6 watt. That isn’t such a massive increase as the previous step, but the CPU temperature at full load also dropped from 90° C to 60° C.

Some parts of undervolting were copied and slightly adapted from this topic.

comments powered by Disqus