An Update On The Linux Power Situation In Ubuntu

Written by Michael Larabel in Software on 7 October 2011 at 01:38 PM EDT. Page 1 of 6. 13 Comments.

While I was away for three weeks, there was an update on LP bug #760131, the infamous bug report on the power consumption being raised significantly higher in Ubuntu Natty. This bug report of high importance now indicates a fix being committed to Natty and a fix being released for Oneiric, but what has changed? Here is an update.

As indicated on Phoronix back in April, there was a big kernel power regression in Linux 2.6.38, which showed up during some Ubuntu power testing. I ended up narrowing the biggest increase in power consumption down to a change in how PCI Express ASPM (Active State Power Management) is handled. ASPM used to be enabled on more systems, but with Linux 2.6.38 it's more conservative as otherwise problematic systems could hang. There is a workaround though and that is setting pcie_aspm=force at the kernel command line. It's worked for many users to increase their battery life, as indicated by many of the 189+ comments in the LaunchPad bug report, but it's still far from ideal. The proper solution though is for more Linux drivers to set the ASPM bits directly, for hardware where this PCI-E power management feature is properly supported. As of early October, no widespread work on this has been done upstream yet.

What changed in mid-September is that Tim Gardner, a Canonical employee part of the Ubuntu kernel team, requested an SRU (Stable Release Update) to get a commit from the upstream Linux kernel into Natty's 2.6.38 kernel. The commit in question is "abe48b108247e9b90b4c6739662a2e5c765ed114" from upstream, which is entitled "x86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS."

This is a patch that has been upstream in the mainline Linux kernel since the end of July, immediately following the Linux 3.0 kernel release and pushed during the Linux 3.1 kernel merge window. This patch was then sent to the stable tree as well, which was then released in the Linux 3.0.1 point release. This will be an SRU in Ubuntu 11.04 and is found in Ubuntu 11.10 since its kernel is based on Linux 3.0.1+, which has this stable back-port upstream.

What this patch does is initialize the MSR_IA32_ENERGY_PERF_BIAS machine state register to a value of "normal" by default. Most BIOS do not initialize that MSR, but when that does not happen, the default is to act as if MSR_IA32_ENERGY_PERF_BIAS is in its "performance" mode. When in the performance mode, the hardware will run at maximum performance, but not for maximum energy efficiency. What this patch does is just make sure the hardware starts out in the "normal" mode while later it can be switched to the "performance" mode.


Related Articles