Skip to content
July 9, 2012 / jpeg729

Undervolting an intel P8400 CPU in a lenovo x200 thinkpad

First I followed these instructions, with a few differences.

I didn’t use the testing ppa. I did have to install msr-tools to get the analysis page of phctools working.

Then I followed these instructions, with a few differences.

Firstly some useful little scripts.

Here is my script to set the cpu frequency

#!/bin/sh
if [ -n "${1}" ]; then
    sudo echo "Setting at ${1}MHz"
    for i in 0 1; do
        sudo cpufreq-set -c $i -g userspace
        sudo cpufreq-set -c $i -f ${1}MHz;
    done
fi
sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
Run it like this: setcpufreq 800
or without an arg to see what the current frequencies are.

Here is my script to stress the system.

#!/bin/sh
burnP6 &
burnP6 &
burnMMX &
burnMMX &

function ctrl_c() {
    killall burnP6
    killall burnMMX
}
trap ctrl_c INT

while sleep 5s; do
    date > still_running
    cat still_running
done

While it is stressing out the system it writes the time & date to the file still_running every 5 secs and when you do Ctrl-c it kills the CPU hogs.

Here is my script to set the vids.

#!/bin/sh
sudo echo "Setting vids to ${1} ${2} ${3} ${4}"
vids="${1} ${2} ${3} ${4}"
for i in 0 1; do
    cmd="echo '${vids}' > /sys/devices/system/cpu/cpu${i}/cpufreq/phc_vids"
    sudo sh -c "${cmd}"
done
cat /sys/devices/system/cpu/cpu*/cpufreq/phc_vids
done
Use: setvids 43 35 23 17
It then shows you the values that have been stored, which aren’t necessarily taken into account by the CPU, see the analysis page of phctools to see what is really happening.

My simpler test procedure

My vids were 43 35 23 17 to begin with.
The vids for 800MHz are already as low as they can be, so we won’t worry about those.
The system seems to be only able to put one cpu in 2267MHz and then only sometimes and just for a mo or two. So we won’t worry about that one yet.
So I put the system in 2266MHz, started stressing the system and lowered the vids for 2266MHz every 15-30 secs until the system starts going pear-shaped. For me it just showed a few strange characters on a black screen and then showed me the login screen again. That was at 17.
Next I upped the vids by 2 steps and tested for a good while at 19. Then I put the cpu at 1600MHz and the vids for 1600 at 18, and tested for a good while.
Final result, I decided to put them at 22 19 18 17. I fixed on 22 for 2267MHz to give it some margin. I don’t really know what is going on for 2267MHz nor how to test it properly. I think it might be the strange turbo mode that exists in some Intel CPUs.
Finally to make things permanent I added the following to /etc/rc.local
# Undervolt the cpu cores.
echo '22 19 18 17' > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
echo '22 19 18 17' > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids

Next challenge – make it work on a realtime kernel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: