Ken Moffat wrote:
> On Sat, Jan 05, 2013 at 05:30:43PM -0500, Baho Utot wrote:
>>> As for cpu frequency, I think that mine is by default set to "ondemand"
>>> on this machine.
>> Just loading the module or building it into the kernel won't suffice.
>>
>   Please note that I don't build the driver as a module.  For my
> x86_64 machines I've always used ondemand and just set up a
> bootscript.
>
>   The following is what I'm using for LFS-7.2.  On a multiprocessor
> system it needs to be repeated for each cpu [ cpu0..3 in my case ].
>
> #!/bin/sh
>
> . /lib/lsb/init-functions
>
> case "${1}" in
>       start|demand)
>               log_info_msg "Enabling ondemand cpu frequency"
>               echo ondemand 
> >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
>               evaluate_retval
>               ;;
>       powersave)
>               log_info_msg "Enabling powersave cpu frequency"
>               echo powersave 
> >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
>               evaluate_retval
>               ;;
>       performance)
>               log_info_msg "Enabling performance cpu frequency"
>               echo performance 
> >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
>               evaluate_retval
>               ;;
>       *)
>               echo "Usage: ${0} {start|demand|powersave|performance}"
>               exit 1
>               ;;
> esac
>
>   I wasn't intending show you my code to modify this after it has been
> copied in, because it is really ugly, but in the end it's easier to
> show it as one way which works to copy and alter the relevant lines.
> The debugging info is there in case it fails - only ever tested with
> 4 CPUs.
>
> # if more than 1 cpu, replicate for all of them - print debug info while it 
> checks
> echo -n "searching to see if more than one cpu... "
> let EXTRACPUS=`cat /proc/cpuinfo | grep MHz | wc | awk '{ print --$1 }'`
> if [ $EXTRACPUS -gt 0 ]; then
>       echo "yes"
>       PREV=0
>       THIS=1
>       echo "entering loop for $EXTRACPUS pass(es), copying $PREV to $THIS"
>       while [ $EXTRACPUS -gt 0 ]; do
>               echo "adding cpufreq for processor $THIS"
>               sed -i "/cpu$PREV/s/\(^.*\)$PREV\(.*$\)/\1$PREV\2\n\1$THIS\2/g" 
> \
>                       /etc/rc.d/init.d/cpufreq
>               # let returns zero for non-zero result and vice versa
>               let PREV=$PREV+1
>               let THIS=$THIS+1
>               let EXTRACPUS=$EXTRACPUS-1
>               echo "debug, after this pass values are $EXTRACPUS $PREV $THIS"
>       done
> fi
>
> My old ppc64 was much more involved - had to load powernowd to be
> able to control the frequency.
>
> I'll also note that you can specify a default governor in the
> kernel.
>
> ĸen
In the kernel source code there is a app called cpupower that one just 
needs to build.   It can then be used as a user not root to set what 
ever governor that you want.  This could be included on the kernel build 
page or made standalone.  the cpupower app just requires  cpupower 
frequency-set -g <governor> and it sets for all cpu cores,  you can also 
change on the fly.  One just needs the governor modules loaded or built 
into the kernel for this to work.
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to