Linux-PHC CPU undervolting (for Intel processors)

Undervolt your notebook CPU for longer battery life

Undervolting is the practice of reducing the supply voltage of a computer’s CPU. There are mainly three reasons to do so:

  1. Reduce power consumption
  2. Reduce heat generation
  3. Reduce fan noise
Performance will not be affected as the energy you will save was just wasted (as heat) before.
Security is not affected, however you may experience some instability and unreliability while testing the best undervolting/underclocking settings (lockups and freezes may also occour). After you have tweaked it well you are not going to face any stability issue any more.

1. This howto depends on the kernel module acpi-cpufreq to control your cpu. To find out if you’re using it:

lsmod | grep acpi_cpufreq

acpi_cpufreq           10796  2
freq_table              5536  3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
processor              37384  4 acpi_cpufreq,thermal
In case you don’t see anything, you don’t use acpi-cpufreq, but maybe the speedstep.centrino module. Then this howto is not for you unfortunately. speedstep.centrino is in theory supported as well, but I have no experience with it. If someone knows how to do it with speedstep.centrino please tell me and I will add it here.

2. You need to get a modified version of your acpi_cpufreq module, one with PHC (processor hardware control) support build in. There are several ways to get this module.

a) You can download a patch or a precompiled module on the official forum and official website and compile it yourself.

You can also download the precompiled modules from the authors’ subversion repository, however these are not updated regularly:

svn co http://phcpatches.googlecode.com/svn/trunk/acpi-cpufreq phcpatches/cpufreq
svn co http://phctool.googlecode.com/svn/trunk/ phctool

Note: To find out what kernel you have open a terminal and type:

uname -r

Mini-Howto for compilation (from Ares Drake thread)

sudo apt-get install build-essential linux-source

extract the tar from /usr/src to /home/”your-username”/”kernelversion”
download latest patch to /home/”your-username”/”kernelversion”
copy /boot/config-$(uname -r).config to /home/”your-username”/”kernelversion”

cd /home/”your-username”/”kernelversion”
patch -p1 < linux-phc*.patch
make oldconfig
make prepare
make scripts
make M=./arch/x86/kernel/cpu/cpufreq

The finished module should be in /home/”your-username”/”kernelversion”/arch/x86/kernel/cpu/cpufreq
Proceed as if you had downloaded this module with copying it to the right place.  After all is done you can savely remove the folder /home/”your-username”/”kernelversion” and uninstall linux-source to save harddisk space.

REMEMBER: First backup your old module (basically copies it to a new name ending with .old)

sudo cp /lib/modules/`uname -r`/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko /lib/modules/`uname -r`/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko.old

b) Then copy the downloaded file to the right place:

sudo cp acpi-cpufreq.ko /lib/modules/$(uname -r)/kernel/arch/x86/kernel/cpu/cpufreq

So once you know, download the right kernel module from Ares Drake thread at Ubuntuforums.net

Kernel modules are also copiled by the THC crew and available on the main download site as well as on the official forum.

You have to redo the entire Step 2 every time you update your kernel, so you might want to save your downloaded module file, as it might work again after a kernel upgrade, i.e. the version -16 worked with -14 and -15 as well, but not with -17.

3. Reboot. If the module is installed correctly, then look here for phc related files

/sys/devices/system/cpu/cpu0/cpufreq/

One should be like this one (values would be of course different):

12:38 10:30 8:24 6:18

In order to minimize any possibility of data corruption I advise you to run this script from Ubuntu Safe Mode / Recovery mode (choose this at boot menu, then root terminal when prompted). Here you will have a terminal only environment, which also lacks any cpu management module. Remember you are in a root environment, here you may also do system wide damages! Be careful with the commands you type in!

First you have to load acpi_cpufreq:

# modprobe acpi_cpufreq

If you haven’t granted execution to the script before do it now

# chmod u+x linux-phc-optimize.bash

cat /sys/devices/system/cpu/cpu0/cpufreq/phc_controls

Then run the scripts the terminal with

The value before the: stands for the frequency, the later for the voltage.

4.
Okay, now we need to find the lowest save voltages. We will use this optimizer script.
Download it then right-click the files, open the permissions tab, and and down at the bottom check the box that says “allow executing the file…”.

It needs cpuburn installed, so you might want to install it in advance with synaptic. If you haven’t done so yet

$ sudo ./linux-phc-optimize.bash

# apt-get install cpuburn

What this scipt does is: It stresses your cpu while lowering the cpu voltage step by step unil your system crashes. Then the script knows what is too low and will stay safely above. The script needs to run once for every frequency step your cpu is capable of, usually around 4-6 times. It will tell you, just run it so often until it tells you finished.

In case you have a dual core CPU it is advisable to run two instances of cpuburn,

first run

cpuburn &

then run the script (which will run the other instance)

NOTICE:
This script will crash your system. Several times. This is normal and intended. No harm to your hardware is to be expected. However in case you have open files and / or mounted filesystems data loss or corruption might occur. So be advised to unmount as many partitions as possible and open as few files as necessary while doing this. After a reset the fsck utility will check your partitions for data corruption so be strongly advised to let that check run!

All this is not going to occour if you run the script from the recovery mode

Second, the script stresses only one cpu core. In case you have a dual core, open a terminal and type “burnMMX” to run a second thread to stress the second core while doing this.

When you’re finished with the script, you will have a text file with the new and optimized frequency : voltage pairs.

5. To use these optimized values, you will need to echo them to /sys/devices/system/cpu/cpu0/cpufreq/phc_controls. An easy way to do it automatically every reboot is to add a line like this:

echo “12:21 10:1 8:1 6:1″ > /sys/devices/system/cpu/cpu0/cpufreq/phc_controls

to your /etc/rc.local file. Of course you have to replace the values with your own. Any second core should automatically use the same voltages.

6. Check if it works:

cat /sys/devices/system/cpu/cpu0/cpufreq/phc_controls

should now give you the new values (after a reboot) compared to before, see above. It is tested for intel Core2Duo and CoreDuo cpus. This does not work with AMD yet, also no precompiled modules are available at the project page at present. Feel free to check and experiment with them anyway!

A note on minimum voltage by chuck232:

Core 2 Duos should have a min voltage of 15. The minimum for Core 2’s is 0.9V (so 712mV + 15*12.5mV. This is a documented lowest voltage.As for the 136: xx number people are seeing, this is a setting available for many of the 800MHz FSB Core 2 Duo’s. Typically the lowest multiplier is 6, and for a 800MHz quad-pumped FSB CPU, that equates to 6*200MHz = 1.2GHz. However these 800MHz Core 2 Duos can also drop the FSB. At its lowest operating power state, it downclocks to 8 multiplier * 100MHz FSB (400MHz quad-pumped), or 800MHz. That’s why it’s listed as the last entry. The 136 number is just the represenation of that power state. I’d go out on a limb and say that every 800MHz FSB Core 2 Duo should be able to do that state at 136:15 (or 0.9V i.e. the lowest operating voltage).

You may check for your own processor details at http://processorfinder.intel.com/Default.aspx

In case of an Intel Core2Duo T7300 processor the lowest working voltage is 0.85 which corresponds to 11 vID.

Hence the working and stable phc vIDs are these: 22 22 11 11 11

PHC-tool

There is no package, you have to download a subversion snapshot via:

sudo apt-get install subversion

svn co http://phctool.googlecode.com/svn/trunk/ phctool

The tool has a Analysis tab as you can see in the screenshot.

To get this to work, you first need to

sudo modprobe msr

| Print This Post Print This Post | Email This Post Email This Post
RSS 2.0 | Trackback | Comment

One Response to “Linux-PHC CPU undervolting (for Intel processors)”

  1. quirks

    I’d recommend running the linux-phc-optimize.bash script in a Live CD environment.
    This way you can be sure, that none of you filesystems get corrupted, when the system crashes.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Page visits

    • 1409
  • Polls

    Did you manage using the internal modem?

    View Results

    Loading ... Loading ...
  • Categories

  • Meta

  • Recent Comments

  • Archives

  • Linux On Laptops

    -->