You are not logged in.

#1 2006-08-27 17:53:42

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

undervolting startup scripts

Hi all,

it seems a lot of pentium-m processors (most notably banias and dothans) can safely be undervolted. The beyond kernel has the undervolting patch included to do that. I have written a small startup script that automatically undervolts the cpu when started and reverts it when stopped. It would be nice to include a bunch of possible suggestions for a variety of processors. There's a list of alleged safe voltages over at the gentoo wiki (OK, include normal disclaimers; nothing here is safe, your computer might crash and your dog might get raped if you run the scripts and undervolt your cpu). Anyway, what I'm trying to say is: what do you think? and what can I improve?

The 753 cpu figures that I have are for my own cpu and they work fine so far. If anyone uses any other table they want to recommend for any other cpu, do tell.

/etc/conf.d/undervolt

# voltage table sysfs interface
VTABLE_SYSFS="/sys/devices/system/cpu/cpu0/cpufreq/voltage_table"
# CPU type
CPU_TYPE="753"
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/undervolt


# Will add various cases of CPU_TYPE in due time
case "$CPU_TYPE" in
  715)
    VTABLE="700,700,764,812,924"
    ;;  
  753)
    VTABLE="828,796,764,732,716,700"
    ;;  
  *)
    VTABLE=`cat $VTABLE_SYSFS`
    ;;
esac

case "$1" in
  start)
    stat_busy "Undervolting CPU"
    if [ -e $VTABLE_SYSFS ]; then
      cat $VTABLE_SYSFS > /tmp/undervolt.orig
      echo $VTABLE > $VTABLE_SYSFS
      add_daemon undervolt
      stat_done
    else
      echo "Cannot find $VTABLE_SYSFS. Make sure your running kernel is appropriately patched."
      stat_fail
    fi
    ;;
  stop)
    stat_busy "Reverting to original volt table"
    if [ -e /tmp/undervolt.orig ]; then
      cat /tmp/undervolt.orig > $VTABLE_SYSFS
      rm_daemon undervolt
      stat_done
    else
      echo "You do not seem to have undervolted your CPU yet, cannot find /tmp/undervolt.orig"
      stat_fail
    fi
    ;;
  *)
    echo "usage: $0 {start|stop}"
    ;;
esac

Offline

#2 2006-08-28 15:58:53

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: undervolting startup scripts

Very nice.  Is there a better way to look up the VTABLE entries or are those only the exceptions to the rule (cat  $VTABLE_SYSFS)?

Offline

#3 2006-08-28 18:49:28

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: undervolting startup scripts

Thanks for the comment smile

I'm not sure I understand what you mean with the VTABLE... Is there something wrong with looking up the VTABLE entries through the sysfs interface?

Offline

#4 2006-08-28 20:03:28

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: undervolting startup scripts

I meant with those "exceptions"... ok let me rephrase: hardcoding the VTABLEs for those two processors seems a little goofy, is there a better way to do this, or are these processors which don't expose entries like that?

Offline

#5 2006-08-28 20:34:42

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: undervolting startup scripts

Oh, alright, I see. The thing is that the VTABLES I've hardcoded are just VTABLES that people have reported as working well on those particular processors. There's a table of such user reported VTABLES at gentoo's wiki, and I've just used those.

There's really no way to figure out how much a cpu could be undervolted and still function as expected. My ideas was to add some figures that people have tested and tie them to a CPU model that is entered in the conf file.  I've just added two CPU types but the idea is to add all of the entries that I can find at the gentoo wiki.

My problem with tying various VTABLES to CPU models is that they might just crash the system anyhow, and that's not very good. Perhaps the VTABLES should be defined in the conf file and the CPU model case just skipped...? Something in the lines of this:


# voltage table sysfs interface
VTABLE_SYSFS="/sys/devices/system/cpu/cpu0/cpufreq/voltage_table"

# CPU type. DISCLAIMER: these VTABLES are reported to work well by some users 
# on the coresponding CPUs. They might not be safe for your system and might in worst
# case scenarios cause hard crashes. It is advised that you use [some script] and mprime (?)
# to test your new VTABLE. 

#VTABLE="828,796,764,732,716,700" # Pentium-M Ultra Low Voltage (600MHz - 1.2GHz), Model P-M 753
#VTABLE="" # Add more CPU models
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/undervolt


case "$1" in
  start)
    stat_busy "Undervolting CPU"
    if [ -e $VTABLE_SYSFS ]; then
      cat $VTABLE_SYSFS > /tmp/undervolt.orig
      echo $VTABLE > $VTABLE_SYSFS
      add_daemon undervolt
      stat_done
    else
      echo "Cannot find $VTABLE_SYSFS. Make sure your running kernel is appropriately patched."
      stat_fail
    fi
    ;;
  stop)
    stat_busy "Reverting to original volt table"
    if [ -e /tmp/undervolt.orig ]; then
      cat /tmp/undervolt.orig > $VTABLE_SYSFS
      rm_daemon undervolt
      stat_done
    else
      echo "You do not seem to have undervolted your CPU yet, cannot find /tmp/undervolt.orig"
      stat_fail
    fi
    ;;
  *)
    echo "usage: $0 {start|stop}"
    ;;
esac 

Offline

#6 2006-09-05 21:13:03

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: undervolting startup scripts

Hi,
I modified your script a bit for use with Intel Core Duo T2300.

/etc/conf.d/undervolt

OP_TABLE="1660000:1050,1660000:1050,1660000:1050,1660000:1050,1660000:1050,1660000:1050,1660000:1050,1660000:1050,1328000:960,996000:960"

[i]/etc/rc.d/underbolt[i]

#!/bin/bash

 . /etc/rc.conf
 . /etc/rc.d/functions
 . /etc/conf.d/undervolt



 case "$1" in
   start)
     stat_busy "Undervolting CPU"
     if [ -e /sys/devices/system/cpu/cpu0/cpufreq/op_points_table ]; then
       cat /sys/devices/system/cpu/cpu0/cpufreq/op_points_table > /tmp/undervolt.orig
           for tables in  /sys/devices/system/cpu/cpu*/cpufreq/op_points_table; do
         echo -n "$OP_TABLE" > $tables;
           done;
       add_daemon undervolt
       stat_done
     else
       echo "Cannot find /sys/devices/system/cpu/cpu0. Make sure your running kernel is appropriately patched."
       stat_fail
     fi
     ;;
   stop)
     stat_busy "Reverting to original volt table"
     if [ -e /tmp/undervolt.orig ]; then
           for tables in  /sys/devices/system/cpu/cpu*/cpufreq/op_points_table; do
         cat /tmp/undervolt.orig > $tables;
           done;
       rm_daemon undervolt
       stat_done
     else
       echo "You do not seem to have undervolted your CPU yet, cannot find /tmp/undervolt.orig"
       stat_fail
     fi
     ;;
   *)
     echo "usage: $0 {start|stop}"
     ;;
 esac

They say that undervolting is pointless on Yonah since the lowest voltage you can get is 0.950 (thats true hmm) and it doesn't give you much in terms of battery saving. However, being able to undervolt the maximum clock is really useful. While compiling the kernel I'm usually at ~72C and with undervolting it drops to 64C (just under the 65C fan limit). So I can do heavy computing quietly smile

Offline

Board footer

Powered by FluxBB