Howto get CPU frequency scaling to work in 2.xx

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

Howto get CPU frequency scaling to work in 2.xx

#1 Post 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
Last edited by pakt on Fri 09 Mar 2007, 11:05, edited 1 time in total.

nilsja
Posts: 19
Joined: Sun 21 Jan 2007, 22:32

#2 Post 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 ?

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#3 Post 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
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

nilsja
Posts: 19
Joined: Sun 21 Jan 2007, 22:32

#4 Post by nilsja »

pakt,
you are a magician.

thx Image
Nils
[size=84]puppy addicted, currently running [color=royalblue]pizzapup beta 3 (2.6.18.1) on a R51[/color][/size]

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#5 Post by pakt »

nilsja wrote:pakt,
you are a magician.
Thanks, but it is BarryK who is the magician ;)
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

Thanks!

#6 Post 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.

User avatar
headfound
Posts: 371
Joined: Sun 25 Jun 2006, 00:58
Location: England
Contact:

#7 Post 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!
Download a better Computer :)
[url=http://uk.youtube.com/watch?v=rDTLJYDHX3g]Puppy Linux Song[/url]
[url=http://www.letterbyletter.co.uk]www.letterbyletter.co.uk[/url]

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#8 Post 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.
Last edited by HairyWill on Wed 14 Jan 2009, 17:41, edited 1 time in total.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#9 Post by pakt »

Thanks for the tip, Will. I'll modify my first post.

Paul
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

User avatar
headfound
Posts: 371
Joined: Sun 25 Jun 2006, 00:58
Location: England
Contact:

#10 Post 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....
Download a better Computer :)
[url=http://uk.youtube.com/watch?v=rDTLJYDHX3g]Puppy Linux Song[/url]
[url=http://www.letterbyletter.co.uk]www.letterbyletter.co.uk[/url]

EdFromHouston
Posts: 176
Joined: Fri 07 Apr 2006, 06:21

#11 Post 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#

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#12 Post 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
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
headfound
Posts: 371
Joined: Sun 25 Jun 2006, 00:58
Location: England
Contact:

#13 Post 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!
Download a better Computer :)
[url=http://uk.youtube.com/watch?v=rDTLJYDHX3g]Puppy Linux Song[/url]
[url=http://www.letterbyletter.co.uk]www.letterbyletter.co.uk[/url]

EdFromHouston
Posts: 176
Joined: Fri 07 Apr 2006, 06:21

#14 Post 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

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#15 Post 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.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#16 Post 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
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

davidY
Posts: 2
Joined: Tue 20 Mar 2007, 09:56

#17 Post 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

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#18 Post 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
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

Bassking
Posts: 17
Joined: Mon 29 Jan 2007, 16:58

#19 Post by Bassking »

*sorry wrong topic*

Kazm
Posts: 29
Joined: Mon 14 Jan 2008, 21:53
Location: Russia, Ufa
Contact:

#20 Post 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
Attachments
cpu_power_save_loc.pet
(1.68 KiB) Downloaded 585 times

Post Reply