Page 1 of 2

Howto get CPU frequency scaling to work in 2.xx

Posted: Sat 21 Oct 2006, 16:38
by pakt
Here's how to get CPU frequency scaling to work in Puppy 2.xx:
(these examples are for a 'centrino' laptop with a Pentium-M, but modules are included for many types of CPU)

For 2.13 and 2.14, you don't need to download anything - the necessary modules are already included in zdrv_2.13/2.14. Just make sure that file is copied to the same location as your pup_213/214 file.

-----------------------------------------------------------------------
Only for 2.11/2.12:
Download http://www.puppyos.com/test/all-modules ... 202.tar.gz

From the file all-modules-k2.6.16.7-PUP202.tar.gz, extract the modules from

all-modules/kernel/arch/i386/kernel/cpu/cpufreq/
and
all-modules/kernel/drivers/cpufreq/

and copy them all into a new Puppy folder /lib/modules/2.6.16.7/cpufreq/

Run depmod so Puppy will find the new modules
# depmod
-----------------------------------------------------------------------
Also see HairyWill's post further down on this page

Load these modules:
# modprobe cpufreq_userspace
# modprobe speedstep_centrino

See what CPU frequency settings are avaiable:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
1600000 1600000 1600000 1400000 1200000 1000000 800000 600000

Check the current frequency setting:
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
1600000

I chose to lower the CPU freq to 1GHz (lower heat, quieter fan but still snappy response on my Dell Inspiron 510m with 1.6GHz Dothan Pentium-M)
# echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Check again the current frequency setting:
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
1000000

This is how you would set the CPU freq manually. There are other "governors" (ie, mechanisms to steer the CPU frequency) available:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
userspace performance

If you also load modules "cpufreq_powersave" and "cpufreq_conserative" you'll get even more governors to play with:
# modprobe cpufreq_powersave
# modprobe cpufreq_conservative
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative powersave userspace performance

I can't remember exactly how the governors work but info can be found on the net. "conservative" "powersave" "performance" all adjust the CPU freq automatically using different algorithms.

To use a different governor, e.g. "powersave":
# echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

To have the settings I want at bootup, I put these lines in /etc/rc.d/rc.local:

modprobe cpufreq_userspace
modprobe speedstep_centrino
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Paul

Posted: Mon 29 Jan 2007, 12:46
by nilsja
hi pakt,

i extracted the files from
all-modules/kernel/arch/i386/kernel/cpu/cpufreq/
and
all-modules/kernel/drivers/cpufreq/

to /lib/modules/2.6.18.1/cpufreq
than made depmod

and when i try to modprobe, i get the error "invalid module format".
Does only work with kernel 2.6.16.7 ?

Posted: Mon 29 Jan 2007, 15:37
by pakt
nilsja wrote: i get the error "invalid module format".
Does only work with kernel 2.6.16.7 ?
Those modules will not work with kernel 2.6.18.1

The good news is that the modules you want are included in zdrv_213.sfs. Just make sure you put that file in the same directory as pup_save.2fs. Then when you reboot, the modules will be available to you. :)

Paul

Posted: Tue 30 Jan 2007, 00:39
by nilsja
pakt,
you are a magician.

thx Image

Posted: Tue 30 Jan 2007, 07:16
by pakt
nilsja wrote:pakt,
you are a magician.
Thanks, but it is BarryK who is the magician ;)

Thanks!

Posted: Thu 01 Feb 2007, 14:20
by brad_chuck
Thanks. This is GREAT! I have made so much progress on getting all the "iches" to work on my laptop and this was a big one that I don't have to fix!


Battery, LCD Brightness, SMP, Suspend 2 Disk, CPU scaleing.............


Thanks so much Paul.

Posted: Thu 08 Mar 2007, 18:37
by headfound
I get the same problem as nilsja! could someone please explain in simple terms what file i need to put into the zdrv directory?
I'm running on usb stick so i guess the right directory is
initrd/mnt/dev_save
(it shows pup save, zdrv etc)
Im using puppy 2.15ce alpha, with athlon 3200+
Thanks!

Posted: Fri 09 Mar 2007, 09:48
by HairyWill
headfound
You don't need to do anything to the zdrv file you just need to have it stored next to your pup_215.sfs all the necessary modules are probably in there.
I use 2.14, I'm assuming that nothing has been removed for 2.15.
When you try a modprobe for a driver that isn't in the main file the system automatically checks to see if you have a zdrv file and then loads it from there.
So all I do is:

Code: Select all

modprobe cpufreq_userspace
modprobe acpi-cpufreq #this line is processor dependant
modprobe cpufreq_conservative
modprobe cpufreq_ondemand
modprobe cpufreq_powersave
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
You can enter these in a terminal, this is actually copied from my /etc/rc.d/rc.local. Every boot this sets my system to manage my processor speed ondemand ie speeds up when the load is heavy.

To find out which processor you should be modprobing for I suggest you do cat /proc/cpuinfo and then hit google.

Pakt
I know the thread title says 2.11, you might want to consider stating this again in this first post so that those with later kernels don't use your file. Probably better would be to change the thread title to something less version specific and then giving some options. Its your thread, just my opinion. Thanks for the advice by the way, without your explanation I'd never have have considered it was this easy, now I get another 15 minutes of battery life.

Posted: Fri 09 Mar 2007, 10:47
by pakt
Thanks for the tip, Will. I'll modify my first post.

Paul

Posted: Fri 09 Mar 2007, 12:09
by headfound
Thanks for your help HairyWill, your code seemed to work ok, unfortunately when i try to modprobe current frequencies etc it can't find anything. Never mind! Now to try to get lm-sensors working to slow down the power supply fan....

Posted: Fri 09 Mar 2007, 19:07
by EdFromHouston
This is what I get on my home computer, a HP a310n pavilion with Puppy 2.14-all-modules installed to the hard drive (PUPMODE 2):

sh-3.00# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Celeron(R) CPU 2.70GHz
stepping : 9
cpu MHz : 2691.425
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips : 5385.52

sh-3.00# modprobe cpufreq_userspace

sh-3.00# modprobe acpi-cpufreq
sh-3.00# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies: No such file or directory
sh-3.00#

Posted: Fri 09 Mar 2007, 19:54
by HairyWill
Ed
I think the driver for your processor should be p4_clockmod
so instead of

Code: Select all

modprobe acpi-cpufreq (this generally seems a last resort)
try

Code: Select all

modprobe p4_clockmod
good link showing different processor modules here:
http://doc.gwos.org/index.php/CPUFreq

headfound
Thanks for your help HairyWill, your code seemed to work ok, unfortunately when i try to modprobe current frequencies etc it can't find anything.
I'm not sure what you mean by modprobe current frequencies. After loading all the modules doing

Code: Select all

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
should get you your current processor speed

Posted: Fri 09 Mar 2007, 20:39
by headfound
Success!! :D
Thanks Will. I think before I must've done something in the wrong order, but I just followed everything from both posts and now i'm down by half!
Thanks again!

Posted: Fri 09 Mar 2007, 20:52
by EdFromHouston
That worked Will.

I put this in rc.local:

Code: Select all

modprobe cpufreq_userspace
modprobe p4_clockmod
echo 2362500 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Thanks everyone. Now I'm off to try to solve the processor fan speed problem I'm having. It seems my processor temperture is always -236C and the fan runs slow.

This should help that as well.
Ed

Posted: Fri 09 Mar 2007, 21:17
by HairyWill
headfound
Glad it works. I just happen to be going through the learming curve 5 minutes ahead of you. The first time I tried this was yesterday.

All credit to pakt for putting the drivers up in the first place, I presume it was him that got them included in the zdrv.

Posted: Sat 10 Mar 2007, 07:06
by pakt
HairyWill wrote:All credit to pakt for putting the drivers up in the first place, I presume it was him that got them included in the zdrv.
Thanks :) I did get the ball rolling by being the first to recompile Puppy's kernel with the CPU frequency scalling options enabled and getting it to work on my Pentium-M laptop. Barry then enabled the options in the next Puppy, and eventually added the extra modules in zdrv_2xx.sfs.

Glad you guys got it working too ;)

Paul

Posted: Tue 20 Mar 2007, 10:34
by davidY
Hi, I tried your methods and failed. I have v2.14 - so i should use the zdrv_214 file somehow. I am unsure of how to do it.

I am currently booting from usb. The zdrv_214 file is in /initrd/mnt/dev_save/zdrv_214.sfs - however, when I modprobe it says that the speedstep_centrino does not exist
Scratch what I just said, I did a big error. my bad

Posted: Tue 20 Mar 2007, 10:58
by HairyWill
Assuming that you are managing to load the other modules. My guess is that you are not loading the right module for your processor.
HairyWill wrote:To find out which processor you should be modprobing for I suggest you do cat /proc/cpuinfo and then hit google.
HairyWill wrote:good link showing different processor modules here:
http://doc.gwos.org/index.php/CPUFreq

Posted: Tue 24 Apr 2007, 20:48
by Bassking
*sorry wrong topic*

Posted: Sat 08 Mar 2008, 18:40
by Kazm
I made script for cpu power save. And it my first script :lol: !
And localize it :)
Please try it and tell me about bugs.
But I do it in PuppyRus 3.01.

It run from command line:
cpu_power_save --options