Linux kernel 2.6.38 and 2.6.39 power regression workaround
Recently I've been referencing Linux 2.6.38 and 2.6.39 kernel power drain regression in many of my articles. Fortunately Phoronix has found the root cause of this issue and has suggested a workaround for the affected systems. Also because of the Linux kernel 3.0 merge window closed this power regression will not be properly fixed until Linux kernel 3.1 release. In this article I'm bringing you two ways to work around this problem on your laptop or desktop system running Linux kernel 2.6.38 or newer.
Workaround using Sysfs (temporary, use for testing)
Notice:It seems that in the most recent kernel revisions ASPM is disabled on pre PCIe 1.1 devices and must be manually enabled using pcie_aspm=force kernel argument (the second method in this article). So if it happens that when you try Sysfs method you receive
Operation not permitted error, then you can skip to the "Workaround by editing GRUB" method.
Sysfs is virtual file system used amongst other things to configure Linux hardware options from userspace. In plain words you can control your hardware options in real time by writing into the simple text files. First lets check the state of things by running following command:
The output of this command will probably be something like this:
[default] performance powersave
This means that the default PCIe ASPM (Active State Power Management) profile is selected. This "default" is where the problem lies. To work around Linux kernel 2.6.38 power regression we must force PCIe ASPM to be enabled. For ASPM to be enabled we must make sure that it stays off the "default" and "performance" profiles. This is how you can do it using Sysfs on Ubuntu based Linux distributions:
sudo -i echo powersave > /sys/module/pcie_aspm/parameters/policy exit
For other non-Ubuntu based distros you would use
su instead of
sudo -i. Controlled this way, this setting remains until you change it again using sysfs or until you reboot. This is actually good thing because before enabling this setting at boot time, users should test is PCIe ASPM working fine on their configuration. This is necessary because there are reports of PCIe ASPM causing lockups when enabled on systems with buggy ASMP BIOS implementation. If this option isn't causing problems on your laptop or desktop system you can proceed to the configuring ASPM by editing GRUB or you can use sysfs to enable this option using init script like I've described here.
Workaround by editing GRUB (permanent)
After you've make sure that PCIe ASPM isn't causing problems on your configuration you can apply this workaround for good by editing GRUB configuration like this:
gksudo gedit /etc/default/grub
Now you find the
GRUB_CMDLINE_LINUX_DEFAULT line that might look like this:
You should edit this line to look like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force"
This way you are passing
pcie_aspm=force kernel argument to force PCIe ASPM. This settings will be applied every time you boot your laptop or desktop. At the and you should do following to update GRUB configuration using this command:
After reboot you're all set. Your laptop should now spend a lot less juice than without this workaround. Lets all thanks Phoronix for finding the root cause of this Linux kernel 2.6.38 power regression. And feel free to share results for your configuration. Cheers!