Home
Home Blogs k4tz's blog
    • Blog
    • Clinic
    • Contact
    • Download
    • Video
    • Login

Poll

Favourite console text editor in Ubuntu:

Archives

July 2009
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311

LXer -- Linux and Open Source News

  • PostgreSQL 8.4 Improves Database Management, Security
  • Linux based Solar-powered networking anywhere
  • PostgreSQL 8.4 now available
  • Reserve Your Space on the Australian Stage
  • GPLv3 Celebrates Two Years, GPLv2 Still in Front
more

Linux Today

  • The Kernel Newbie Corner: Your First Loadable Kernel Module
  • Red Hat inks cloud partnership with Amazon
  • PostgreSQL 8.4
  • 10 Awesome Features of Krunner in KDE 4
  • Changing the World, One Penguin at a Time
more

Linux Insider

  • Is Dell Building an Android PDA?
  • Wikipedia and the Kidnapped Reporter: Censor or Savior?
  • The Business Case for Virtual Business, Part 2
  • Conspiracy Theories and the 'Smoking Gun'
  • What I Need to Help Sell Linux
more

HowTo: Undervolt your notebook CPU for longer battery life

Submitted by k4tz on Sat, 07/05/2008 - 09:19
  • Clinic
  • AMD
  • Intel
  • Ubuntu

Edit: EEEK!! Why is it to wide? Anyone else seeing it too wide? Anyone a clue how to fix it?

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.


Safety:

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

Code:
lsmod | grep acpi_cpufreq

You should see sth. like this:

Code:
acpi_cpufreq           14892  2 
freq_table 5536 3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
processor 36872 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 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

Code:
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"

Code:
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 (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.

Code:
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, 2.6.24-17-generic, 2.6.24-18-generic and 2.6.24-19-generic. To find out what kernel you have open a terminal and type:

Code:
uname -r

So once you know, download the right kernel module for 2.6.24-16-generic or 2.6.24-17-generic or 2.6.24-18-generic or 2.6.24-19-generic.

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

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

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,

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

should give you sth like this:

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

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 (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

Code:
sudo ./linux-phc-optimize.bash

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.

IMPORTANT:
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:

Code:
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:

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

should now give you the new values (after a reboot) compared to before, see above.

 

Source: ubuntuforums.org

  • k4tz's blog
  • Add new comment

Recent blog posts

  • Questions about installing Ubuntu on HP Mini 1000 netbook
  • Epson NX400 driver in Ubuntu
  • Installing Ubuntu Jaunty on HP DV2 laptop
  • How to Install latest version of Midori [Browser] on Ubuntu
  • Download PCLinuxOS 2009.2
  • Download Sabayon Linux 4.2 "GNOME"
  • Map Windows Shares Permanently on Ubuntu with GVFS
  • Ubuntu 9.04 (Jaunty) and Acer Aspire One AOD150-iBb
  • Using Linux Ubuntu on HP HDX 16t Laptop
  • Run a particular program but prevent it from accessing the Internet
more

Linux World

  • Microsoft's Secret Weapon isn't FUD, it's Inertia
  • Will Google Wave revolutionise free software collaboration?
  • Is Android the key to the GNU/Linux desktop? Really?
  • USN-785-1: ipsec-tools vulnerabilities
  • Call it Netbook, Smartbook, or “Low-cost small notebook PC” - It is Great for Linux
  • The Week of the Linux Desktop
  • USN-781-2: Gaim vulnerabilities
  • USN-781-1: Pidgin vulnerabilities
  • USN-780-1: CUPS vulnerability
Archive Syndicate content

Recent comments

  • 1) # ./mkrawdev.sh ./mkrawdev.sh: line 6: ошибка синтаксиса окол
    8 weeks 1 day ago
  • 1) # ./mkrawdev.sh ./mkrawdev.sh: line 6: ошибка синтаксиса окол
    8 weeks 1 day ago
  • Aries Register is the best choice in Europe.
    17 weeks 6 days ago
  • Re: wireless
    20 weeks 3 days ago
  • wireless
    20 weeks 6 days ago
  • Re: Setting up wvdial to support Three
    24 weeks 6 days ago
  • Setting up wvdial to support Three
    26 weeks 1 day ago
  • не проходит built + raw device
    33 weeks 6 days ago
  • Re: Knol is not a Wikipedia clone
    38 weeks 2 days ago
  • Re: THANK YOU SOOOOO MUCH!!!
    38 weeks 2 days ago
All contents copyright © 2008, Dhuha Net. All rights reserved
Ubuntudoctor® is a member of the Dhuha Network. Privacy Policy
RoopleTheme