Edit: This Post is outdated! The underlying principles still apply, but newer Ubuntu versions requiere a slightly different approach.
- Ubuntu 10.04 LTS
A newer guide for Ubuntu 10.04 LTS Lucid Lynx can be found at: http://openmindedbrain.info/09/05/20...-04-lucid-lts/
- Recent versions
An even more recent guide for the most recent Versions of Ubuntu is linked here: http://linuxsolver.blogspot.com/2011...in-ubuntu.html. It offers a graphical utility to set the voltages for you, but only covers installation. Afterwards, you still have to find and test your individual voltages. Therefor you can use this method from the same author or the method in this post. Whitchever method you choose, be sure to read the short chapter on safety below. Especially important are points 3 and 4 and these still aply to all current and future methods.
This howto is based on own experiences and this german wiki page, so thx to them.
It is tested for intel Core2Duo and CoreDuo cpus. I have no clue if it works for AMD as well. Some answers I received suggest that it currently doesn't work with AMD cpus however.
From wikipedia: Undervolting is the practice of reducing the supply voltage of a computer's CPU. There are many reasons to perform this sort of modification, but a common one is to reduce power consumption and thus heat generation in laptop computers. Lower heat generation provided by undervolting and underclocking is also helpful in making computers quieter.
Performance will not suffer as the energy you will save was just wasted (as heat) before.
Undervolting notebook processors is not uncommon. My older notebook (Toshiba S1) even came with a Windows utility that did automatic undervolting preinstalled. So the "undervolted" processor is nothing dangerous.
The way to get there might be, if no care is taken.
What might happen:
1) The voltage controls stability and temperature. The higher the voltage the higher the temp, but without enough voltage the cpu wont be stable and your PC will lock up. In fact with the following procedure we are trying to find the minimum stable voltage to get the cpu as cool as possible. The energy saved will increase battery life as well.
2) So if you were to INCREASE the voltage, you would rise the temperature. This might damage the cpu in case it got too hot - obvious one. (Though all Intel (probably AMD as well) mobile chips are equiped with safety cut off mechanisms afaik) However with the optimizer scipt it automatically REDUCES the voltage so harm to your hardware is very unlikely.
3) To find the named "minimum" voltage, the optimizer scipt needs to test if the cpu runs stable at every voltage setting. So in case it gets too low, your notebook will lock up. Then afterwards the script knows what is too low and will stay safely above.
That sth gets damaged by locking up is rather unlikely - overclocking my desktop machine in younger years I experienced it at least a hundred times and never fried anything.
4) While locking up however your linux and all open applications crash as well. Wich might result in data loss. Be prepared to see the fsck utility at next boot up checking for data integrity. And let it run!
Furthermore, don't open any files while running the optimizer script and, before doing this optimization, unmount as many partitions as possible to reduce the risk. (unmounted partitions cannot be corrupted during the lockup)
Once the scipt finishes (you need to run it several times, once for every freqency your cpu is capable of), no more lock-ups are to be expected as the script now knows the individual critical voltage for your cpu and will stay savely above.
With all these precautions I think it is rather save to undervolt.
Still there? Then let's get on to it! Step by step:
1. This howto depends on the kernel module acpi-cpufreq to control your cpu. To find out if you're using it try
You should see sth. like this:
lsmod | grep acpi_cpufreq
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.
acpi_cpufreq 14892 2
freq_table 5536 3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
processor 36872 4 acpi_cpufreq,thermal
2. You need to get a modified version of your acpi_cpufreq module, one with PHC support build in. PHC means processor hardware control and is the magic that makes it going. There are several ways to get this module.
a) You can download a patch on their website
and compile it yourself
. If you have never compiled anything, this is not for you as there are easier ways (see b) ). However as I hardly find the time to post updates here I will give a mini-howto for compilation here in case a kernel update breakes compatibility with old modules. You need to compile yourself in case you are running 64 bit as well as the precompiled modules I offer below are 32bit only.
Mini-Howto for compilation
sudo apt-get install build-essential linux-source
extract the tar from /usr/src to /home/"your-username"/"kernelversion"
download latest patch
copy /boot/config-$(uname -r).config to /home/"your-username"/"kernelversion"
patch -p1 < linux-phc*.patch
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 (see 2.
c) ). After all is done you can savely remove the folder /home/"your-username"/"kernelversion" and uninstall linux-source to save harddisk space.
b) Download a precompiled module
. It has to match your kernel.
1) First backup your old module.
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
(basically copies it to a new name)
2) There are right now versions for kernel 2.6.24-16
-generic and 2.6.24-19
-generic. To find out what kernel you have open a terminal and type:
So once you know, download the right kernel module for 2.6.24-16-generic
c) Then copy the downloaded file to the right place:
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.
sudo cp acpi-cpufreq.ko /lib/modules/$(uname -r)/kernel/arch/x86/kernel/cpu/cpufreq
3. Reboot. If the module is installed correctly,
should give you sth like this:
The value before the : stands for the frequency, the later for the voltage.
12:38 10:30 8:24 6:18
4. Okay, now we need to find the lowest save voltages. We will use this optimizer script.
Download it (you will need this file as well), then right-click the files, open the permissions tab, and and down at the bottom check the box that says "allow executing the file....." Then run it from the terminal with
It needs cpuburn installed, so you might want to install it in advance with synaptic. 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.
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!
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:
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.
echo "12:21 10:1 8:1 6:1" > /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
6. Check if it works:
should now give you the new values (after a reboot) compared to before, see above.