Linux Undervolting, any news?

All about them.

Moderators: NeilBlanchard, Ralf Hutter, sthayashi, Lawrence Lee

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Linux Undervolting, any news?

Post by ryboto » Mon Oct 01, 2007 8:36 pm

I'd really like to fold in Linux, what with the SMP client being a little more efficient with the OS. I don't see a point in folding if I don't undervolt though. There's no reason to waste those extra watts when the CPU can run perfectly stable at lower power levels. So, does anyone know of any new programs that can manipulate processor voltage?

Also, what are some good, easy to use, possibly GUI based system monitoring utilites, for voltages/fan speeds/temperatures? Do any exist?

klegg
Posts: 45
Joined: Mon Jul 25, 2005 8:56 pm
Location: Swden

Post by klegg » Mon Oct 01, 2007 10:21 pm

I'm not using it at the moment, but for temps and fan speeds there is lm-sensors, with GUI-extensions, ksensors (as well as possibly xsensors and others).

A question: in windows, are there an application that can control the voltage? I thought that was only possible to do in BIOS?

Regards,

/jon

floffe
Posts: 497
Joined: Mon May 08, 2006 4:36 am
Location: Linköping, Sweden

Post by floffe » Mon Oct 01, 2007 11:07 pm

For Linux, undervolting has to be either done at BIOS level (not possible on all boards), or using an experimental kernel patch that currently works with Pentium M and to some extent Core Solo/Duo. I think I've seen someone testing it out on Core 2 too. Not sure if that's only with the mobile versions, though.

And to klegg: Yes, you can undervolt with software in windows. RMClock and Notebook Hardware Control are two apps who can do this.

aaa
Posts: 167
Joined: Tue Jul 11, 2006 7:23 pm

Post by aaa » Tue Oct 02, 2007 2:00 am

I think there's a linux-phc patch for AMD too, hidden somewhere in the mentioned link. It's been there for a while, but they don't mention it on the front page (probably because of bugginess).


nightmorph
Posts: 316
Joined: Thu Aug 10, 2006 11:07 am

Post by nightmorph » Tue Oct 02, 2007 11:24 am

--
Last edited by nightmorph on Fri Apr 21, 2023 11:19 pm, edited 1 time in total.

trxman
Posts: 145
Joined: Wed Dec 15, 2004 5:45 pm
Location: system

Post by trxman » Tue Oct 02, 2007 11:31 am

anything set in the BIOS gets lost fist time cpufreq kicks in as it reads freq:voltage pairs for specific CPU from fixed table.

I used to modify powernow-k8.c to manualy set both voltages for my Athlon64: 0.9V @1GHz and 1.175V @1.8GHz

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Tue Oct 02, 2007 11:42 am

my bios doesn't undervolt. I use Crystal CPUID in windows. CnQ is disabled in the Bios, so I don't think the linux kernel can adjust the cpu dynamically at the moment. How did you modify the powernow-k8.c exactly? I'm not very adept to linux language, so bare with me.

trxman
Posts: 145
Joined: Wed Dec 15, 2004 5:45 pm
Location: system

Post by trxman » Tue Oct 02, 2007 11:59 am

this is diff for 1.0 and 1.275V (kernel 2.6.20):

Code: Select all

598a599,600
>       data->powernow_table[0].index = data->powernow_table[0].index + (5 << 8); // 1.275V 
>       data->powernow_table[1].index = data->powernow_table[1].index + (4 << 8); // 1.000V 
665a668,670
>       return 0; /* allow override of VID values in print_basics() */
>
something similar would be for 0.9 and 1.175V - only difference would be number of steps we shift in first two lines.

jaganath
Posts: 5085
Joined: Tue Sep 20, 2005 6:55 am
Location: UK

Post by jaganath » Tue Oct 02, 2007 12:06 pm

Really, though, smart frequency scaling will probably save you more power than undervolting.
this is for Folding, so max freq all the time. in any case undervolting saves more power than downclocking. the reduced clocks are usually just done to enable lower Vcore.

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Mon Oct 08, 2007 6:42 pm

trxman wrote:this is diff for 1.0 and 1.275V (kernel 2.6.20):

Code: Select all

598a599,600
>       data->powernow_table[0].index = data->powernow_table[0].index + (5 << 8); // 1.275V 
>       data->powernow_table[1].index = data->powernow_table[1].index + (4 << 8); // 1.000V 
665a668,670
>       return 0; /* allow override of VID values in print_basics() */
>
something similar would be for 0.9 and 1.175V - only difference would be number of steps we shift in first two lines.
I know, it's been a while, but I'm still not sure how/what exactly all that refers to. The forum link posted earlier seems to apply to Pentium M systems. I'm not well versed in linux command line/code manipulations, so a nice simple step-by-step how to would be helpful, or just point me in the direction of someone who's already done it and has documented their progress, and I can try to learn that way.

matt_garman
*Lifetime Patron*
Posts: 541
Joined: Sun Jan 04, 2004 11:35 am
Location: Chicago, Ill., USA
Contact:

Post by matt_garman » Wed Oct 10, 2007 9:17 am

klegg wrote:I'm not using it at the moment, but for temps and fan speeds there is lm-sensors, with GUI-extensions, ksensors (as well as possibly xsensors and others).
There's also gkrellm, which I've been using for many years.

aaa
Posts: 167
Joined: Tue Jul 11, 2006 7:23 pm

Post by aaa » Wed Oct 10, 2007 6:35 pm

ryboto wrote:
trxman wrote:this is diff for 1.0 and 1.275V (kernel 2.6.20):

Code: Select all

598a599,600
>       data->powernow_table[0].index = data->powernow_table[0].index + (5 << 8); // 1.275V 
>       data->powernow_table[1].index = data->powernow_table[1].index + (4 << 8); // 1.000V 
665a668,670
>       return 0; /* allow override of VID values in print_basics() */
>
something similar would be for 0.9 and 1.175V - only difference would be number of steps we shift in first two lines.
I know, it's been a while, but I'm still not sure how/what exactly all that refers to. The forum link posted earlier seems to apply to Pentium M systems. I'm not well versed in linux command line/code manipulations, so a nice simple step-by-step how to would be helpful, or just point me in the direction of someone who's already done it and has documented their progress, and I can try to learn that way.
First off, this requires a kernel recompile, which is a whole question on it's own if you don't know how to do it already. Once you figure out how to do that (what distro are you using BTW?), you edit the file arch/i386/kernel/cpu/cpufreq/powernow-k8.c , and look for this:

Code: Select all

        for (j = 0; j < data->numps; j++) {
                powernow_table[j].index = pst[j].fid; /* lower 8 bits */
                powernow_table[j].index |= (pst[j].vid << 8); /* upper 8 bits */
                powernow_table[j].frequency = find_khz_freq_from_fid(pst[j].fid);
        }
And change to what trxman did, or whatever voltage you decide.

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Wed Oct 10, 2007 7:31 pm

so, there's no other way to do it? you have to recompile the kernel? I have no clue how to do that...I'm using the beta of the 7.10 ubuntu at the moment, but I haven't been using it for the sole reason that I cannot undervolt.

jaganath
Posts: 5085
Joined: Tue Sep 20, 2005 6:55 am
Location: UK

Post by jaganath » Thu Oct 11, 2007 12:50 am

you could sell your current mobo and buy one that undervolts in BIOS, IIRC there were lots of undervoltable 939 boards.

aaa
Posts: 167
Joined: Tue Jul 11, 2006 7:23 pm

Post by aaa » Thu Oct 11, 2007 2:28 am

ryboto wrote:so, there's no other way to do it? you have to recompile the kernel? I have no clue how to do that...I'm using the beta of the 7.10 ubuntu at the moment, but I haven't been using it for the sole reason that I cannot undervolt.
The only other way (other than switching mobos) is recompiling the ACPI DSDT table. Not really an easier way huh...

With Ubuntu you can compile the powernow driver only. So...

Code: Select all

sudo apt-get install linux-source build-essential
tar xjf /usr/src/linux-source-2.6.22.tar.bz2
cd linux-source-2.6.22
cp /boot/config-`uname -r` .config
#^^^ those are backquotes
make prepare
#^^^ answer no to random question
make scripts
mkdir .tmp_versions
gedit arch/i386/kernel/cpu/cpufreq/powernow-k8.c
#^^^ make driver edits here
make arch/i386/kernel/cpu/cpufreq/powernow-k8.ko
sudo modprobe -r powernow-k8
sudo insmod arch/i386/kernel/cpu/cpufreq/powernow-k8.ko
After that you should be undervolting. Or it'll crash because you put the wrong voltage in or something.

Jan Kivar
Friend of SPCR
Posts: 1310
Joined: Mon Apr 28, 2003 4:37 am
Location: Finland

Post by Jan Kivar » Thu Oct 11, 2007 10:11 am

One could also use k8fq. It's a command line utility that allows one to set the frequency and voltage of K8 processors. It is, unfortunately, at alpha stage, but it works (at least for me). I'm using it to set my dear 3000+ to 1,6 GHz/1,1 V during startup.

It requires MSR support in kernel (module is msr.ko), and all cpufreq utils must be turned off to allow proper operation.

I must emphasis that k8fq is ALPHA software, and should be used with proper care.

And if it does work properly, please report back (and give a pat on the back to the author of k8fq for such a fine utility :)).

Cheers,

Jan

Zed Lopez
*Lifetime Patron*
Posts: 51
Joined: Sat Apr 09, 2005 10:35 am
Location: Berkeley, CA
Contact:

Post by Zed Lopez » Thu Oct 11, 2007 3:40 pm

You might like to check out LessWatts.org, a site dedicated to tips for saving power in Linux.

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Thu Oct 11, 2007 6:49 pm

aaa wrote:
ryboto wrote:so, there's no other way to do it? you have to recompile the kernel? I have no clue how to do that...I'm using the beta of the 7.10 ubuntu at the moment, but I haven't been using it for the sole reason that I cannot undervolt.
The only other way (other than switching mobos) is recompiling the ACPI DSDT table. Not really an easier way huh...

With Ubuntu you can compile the powernow driver only. So...

Code: Select all

sudo apt-get install linux-source build-essential
tar xjf /usr/src/linux-source-2.6.22.tar.bz2
cd linux-source-2.6.22
cp /boot/config-`uname -r` .config
#^^^ those are backquotes
make prepare
#^^^ answer no to random question
make scripts
mkdir .tmp_versions
gedit arch/i386/kernel/cpu/cpufreq/powernow-k8.c
#^^^ make driver edits here
make arch/i386/kernel/cpu/cpufreq/powernow-k8.ko
sudo modprobe -r powernow-k8
sudo insmod arch/i386/kernel/cpu/cpufreq/powernow-k8.ko
After that you should be undervolting. Or it'll crash because you put the wrong voltage in or something.
see, that's amazing, thanks for the info! now, the only issue is that I don't know what code corresponds to what vcore/frequency....preferrably I'd only want to run 1 frequency, can I configure the driver to only have 1 power state?

Palindroman
Posts: 247
Joined: Fri Oct 20, 2006 1:00 am

Post by Palindroman » Tue Oct 16, 2007 1:18 am

Here's an article on power consumption of different releases of Ubuntu: http://www.phoronix.com/scan.php?page=a ... =878&num=1

Tommy Jefferson
Posts: 43
Joined: Wed Oct 10, 2007 11:46 am

Post by Tommy Jefferson » Thu Oct 18, 2007 8:17 am

Zed Lopez wrote:You might like to check out LessWatts.org, a site dedicated to tips for saving power in Linux.
Cool link! Thank you.

DanceMan
Posts: 287
Joined: Sun Aug 11, 2002 3:26 pm
Location: Burnaby, BC, Canada

Post by DanceMan » Thu Oct 18, 2007 10:48 am

Zed Lopez wrote:You might like to check out LessWatts.org, a site dedicated to tips for saving power in Linux.
LessWatts? Is that a subsidiary of BadEnglish.org? (Should be fewer) /pedant

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Thu Oct 18, 2007 12:02 pm

I'm still curious if anyone can point me to information regarding the actual editing of the powernow.c file. I haven't had time to attempt it yet, but I really am not sure what I'm going to change when I finally get there.

highlandsun
Posts: 139
Joined: Thu Nov 10, 2005 2:04 am
Location: Los Angeles, CA
Contact:

Post by highlandsun » Thu Oct 18, 2007 1:33 pm

My Asus A8V-Deluxe doesn't recognize my Opteron 185 so I had to write a custom DSDT for it anyway. So I have the entire frequency/voltage table in my DSDT, undervolted at each step. No patching of kernel files needed, but of course you still have to reboot to install a different DSDT. I guess it would still be nice to have the corresponding linux-phc patch, but I remember writing to AMD about it and they said they would never endorse a patch like that going into the mainstream kernel. They will never support end-users tweaking their PowerNow/C'n'Q tables. Oh well.

jojo4u
Posts: 806
Joined: Sat Dec 14, 2002 7:00 am
Location: Germany

Post by jojo4u » Thu Oct 18, 2007 3:39 pm

I can conform that linux-phc is working for a Core 2 Duo. My BIOS is probably buggy, so I had to change the source a tiny bit. If you get a "not such device" error, just ask me. About AMD support: I asked the developer and they are on it. At the moment, they move to a new server.

Howto: Download the release and try the inluded binary modules. If that's not working, follow this HOWTO: https://www.dedigentoo.org/trac/linux-p ... ubuntu_001

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Thu Oct 18, 2007 5:20 pm

well, that's nice, but what about amd processors?

jackylman
Posts: 784
Joined: Sun May 22, 2005 8:13 am
Location: Pennsylvania, USA

Post by jackylman » Fri Oct 19, 2007 6:01 am

ryboto wrote:I'm still curious if anyone can point me to information regarding the actual editing of the powernow.c file. I haven't had time to attempt it yet, but I really am not sure what I'm going to change when I finally get there.
Remember, you need to download your kernel source, navigate to the source directory and look at arch/i386/kernel/cpu/cpufreq/powernow-k8.c

Look at the above quote from trxman for the two lines you need to change. They're at about line 600 in his example, but they could be at a different location depending on what kernel you're running. Just search for the print_basics function.

As for the actual editing, there's a good discussion in this thread on how to do it. If you still can't figure it out, post back with the values you want and we'll help you out.

ryboto
Friend of SPCR
Posts: 1439
Joined: Tue Dec 14, 2004 4:06 pm
Location: New Hampshire, US
Contact:

Post by ryboto » Fri Oct 19, 2007 9:49 pm

i read through that discussion...it may be that I'm just stupid, but I can't for the life of me figure out what they're actually editing. I see that they change the for loop to 3 single power states, but I have absolutely no idea how they're determining the voltage from the language in the code. I've gotten to the point of editing the powernow-k8.c using aaa's amazing list of commands(that have worked without issue up to this point!), but I'm stuck here. yep...i just tried reading through the end of the thread, I'm lost. If anyone can translate it, I'd appreciate it, maybe I just need some sleep.

aaa
Posts: 167
Joined: Tue Jul 11, 2006 7:23 pm

Post by aaa » Sat Oct 20, 2007 4:19 am

The frequency and voltage are represented by id numbers, fid and vid:
frequency = 800 + fid * 100
millivolts = 1550 - vid * 25

Well, back to this:

Code: Select all

        for (j = 0; j < data->numps; j++) {
                powernow_table[j].index = pst[j].fid; /* lower 8 bits */
                powernow_table[j].index |= (pst[j].vid << 8); /* upper 8 bits */
                powernow_table[j].frequency = find_khz_freq_from_fid(pst[j].fid);
        }
        //Add a few lines looking like this, for each frequency:
        data->powernow_table[0].index = data->powernow_table[0].index + (1 << 8);
        data->powernow_table[1].index = data->powernow_table[0].index + (1 << 8);
So with those last lines of code, you can subtract from the original voltage. Now there's a a one there (at 1 << 8), subtracting 1*25mv. Then you just need to remember that original voltage will be 1.1v at 1ghz instead of 1.35v or whatever for full speed. Run "dmesg | grep powernow" to see your original freq/voltage table, so you know how many lines to add.

Palindroman
Posts: 247
Joined: Fri Oct 20, 2006 1:00 am

Post by Palindroman » Sat Oct 20, 2007 4:44 am

jojo4u wrote:About AMD support: I asked the developer and they are on it.
This is very good news. Thanks for asking them, jojo4u! I've been eagerly awaiting a Linux version of RMClock. Do you have any idea how long it might take them to include AMD procs in linux-phc?

Post Reply