Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old September 1st, 2006   #1
pharcyde
A Carafe of Ubuntu
 
pharcyde's Avatar
 
Join Date: Dec 2005
Location: U.S.
Beans: 110
Ubuntu 6.10 Edgy
Post HOWTO: CPU Frequency Scaling w/ Kernel Module

I thought I would write a little howto on how to get cpu frequency scaling to work directly with the kernel modules. These modules are generally more efficient for performance computing and battery life.

Prerequisites
kernel >= 2.6.9

Step 1: Enable BIOS Support
Enter your BIOS at boot and make sure Cool'n'Quiet (AMD) or SpeedStep (Intel) is enable for you CPU. Some BIOS may not have option at all. If that is the case it is probably enabled by default. Other BIOS may have the option but it is listed as another name altogether. If that is the case check your BIOS manual for more info.

Step 2: Remove Userspace Scaling Software
powernowd
Code:
sudo apt-get remove powernowd
cpudyn
Code:
sudo apt-get remove cpudyn
Step 3: Install CPU Module
Identify your cpu type by runnig the command
Code:
cat /proc/cpuinfo
You can also Check the following links
AMD CPU Chart - http://www.tomshardware.com/2005/11/...05/page20.html
Intel CPU Chart - http://www.tomshardware.com/2005/11/...05/page21.html

AMD Sempron/Athlon/MP ( K7 )
Socket Types: A, Slot A
Code:
sudo modprobe powernow-k7
AMD Duron/Sempron/Athlon/Opteron 64 ( K8 )
Socket Types: 754, 939, 940, S1 ( 638 ), AM2 ( 940 ), F ( 1207 )
Code:
sudo modprobe powernow-k8
Intel Core Duo
Code:
sudo modprobe speedstep-centrino
Intel Pentium M
Code:
sudo modprobe speedstep-centrino
Others (Unknown)
I'm not entirely sure which cpus are supported using this module. If your cpu doesn't work with one of the above methods try this one.
Code:
sudo modprobe acpi-cpufreq
Step 4: Scaling Modules
Code:
sudo modprobe cpufreq_conservative
sudo modprobe cpufreq_ondemand
sudo modprobe cpufreq_powersave
sudo modprobe cpufreq_stats
sudo modprobe cpufreq_userspace
Step 5: Testing/Configuration
Show Available Governors
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
You should see output similar to
Code:
powersave conservative ondemand performance
conservative
Description: CPU frequency is scaled based on load in incremental steps up and down.
Code:
sudo -s
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Advanced Configuration Options
Code:
cd /sys/devices/system/cpu/cpu0/cpufreq/conservative
ondemand
Description: CPU frequency is scaled based on load.
Code:
sudo -s
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Advanced Configuration Options
Code:
cd /sys/devices/system/cpu/cpu0/cpufreq/ondemand
performance
Description: CPU only runs at max frequency regardless of load.
Configuration Dir: N/A
Code:
sudo -s
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave
Description: CPU only runs at min frequency regardless of load.
Configuration Dir: N/A
Code:
sudo -s
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Step 6: Load Modules at Boot
Add the following lines to the end of /etc/modules
Code:
cpufreq_conservative
cpufreq_ondemand
cpufreq_powersave
cpufreq_stats
cpufreq_userspace
[Module from Step 3]
Step 7: Configure Modules at Boot
This step needs to be done in order for the modules to retain your settings.
Make sure you have sysfsutils installed
Code:
sudo apt-get install sysfsutils
Then add the following lines to /etc/sysfs.conf
Code:
devices/system/cpu/cpu0/cpufreq/scaling_governor=ondemand
Where ondemand can be changed to another governor type (i.e. conservative, powersave, etc.). You can also add other configuration options that are specific to the governor selected.

Useful Links
http://ubuntu.wordpress.com/2005/11/...uency-scaling/
http://martin.ankerl.org/category/linux/
http://gentoo-wiki.com/HOWTO_Undervolt_a_Pentium_M_CPU
http://wejp.k.vu/projects/howto_cnq_athlon_64_x2/

Last edited by pharcyde; September 8th, 2006 at 07:55 PM..
pharcyde is offline   Reply With Quote
Old September 2nd, 2006   #2
gumbeto
5 Cups of Ubuntu
 
gumbeto's Avatar
 
Join Date: Jun 2006
Beans: 29
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

Hi, I was trying to follow your "How To" because, since yesterday, the cpu governors stoped working for me and I get always the maximum frequency, regardless of the load.
When I got to step 4, however, I got this error:

FATAL: Error inserting speedstep_centrino (/lib/modules/2.6.15-26-386/kernel/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.ko): Device or resource busy

I have no idea what I am doing wrong and I would apreciate any help.
Thanx a lot
gumbeto
gumbeto is offline   Reply With Quote
Old September 2nd, 2006   #3
foxy123
Dark Roasted Ubuntu
 
Join Date: Apr 2005
Beans: 1,129
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

Quote:
Step 4) Intel CPU Module
Code:

sudo modprobe speedstep-centrino
I have an Intel CPU, but it uses acpi_cpufreq instead of speedstep-centrino. I am not sure if it is important.
__________________
NEC Versa M400 Laptop, Intel Pentium 4 2.8GHz, 768Mb memory, 855GM Graphic Chip, RT2500 wireless chip
Ubuntu Karmic
foxy123 is offline   Reply With Quote
Old September 2nd, 2006   #4
gumbeto
5 Cups of Ubuntu
 
gumbeto's Avatar
 
Join Date: Jun 2006
Beans: 29
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

do u know how can I check if my cpu is like yours in that aspect?
thanks
gumbeto is offline   Reply With Quote
Old September 2nd, 2006   #5
gumbeto
5 Cups of Ubuntu
 
gumbeto's Avatar
 
Join Date: Jun 2006
Beans: 29
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

do u know how can I check if my cpu is like yours in that aspect?
thanks
gumbeto is offline   Reply With Quote
Old September 2nd, 2006   #6
HAARP
Ubuntu Extra Shot
 
HAARP's Avatar
 
Join Date: Jun 2006
Location: Germany
My beans are hidden!
Edgy Eft Testing
Send a message via ICQ to HAARP
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

Athlon user should use powernow-k7
Athlon 64 users powernow-k8

Doesn't work for me tho. Probably because I have a Mobile CPU on an old desktop board

Code:
FATAL: Error inserting powernow_k7 (/lib/modules/2.6.15-26-k7/kernel/arch/i386/kernel/cpu/cpufreq/powernow-k7.ko): No such device
Frequency scaling worked under Windoze.
HAARP is offline   Reply With Quote
Old September 2nd, 2006   #7
pharcyde
A Carafe of Ubuntu
 
pharcyde's Avatar
 
Join Date: Dec 2005
Location: U.S.
Beans: 110
Ubuntu 6.10 Edgy
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

Thanks for replies guys. I've updated the how-to with better information related to different devices. I only have a AMD64 k8 and Intel Pentium M Centrino. These two work for me with the methods I've outlined here in Breezy 32bit and 6.06 64bit installs. I will try to update it with more information related to other AMD and Intel chips once I have more info from others.

Last edited by pharcyde; September 2nd, 2006 at 06:07 PM..
pharcyde is offline   Reply With Quote
Old September 2nd, 2006   #8
gumbeto
5 Cups of Ubuntu
 
gumbeto's Avatar
 
Join Date: Jun 2006
Beans: 29
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

hi again. In my case, the contents of /proc/cpuinfo is the following:

Code:
gumbeto@gumbeto-laptop:/lib/modules/2.6.15-26-386/kernel/arch/i386/kernel/cpu/cpufreq$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Pentium(R) M processor 2.00GHz
stepping        : 8
cpu MHz         : 798.116
cache size      : 2048 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 sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe est tm2
bogomips        : 1598.35
As I said, the module speedstep-centrino didn't work for me so I tried

Code:
sudo modprobe acpi-cpufreq
It didn't complain and I continued with the tutorial but unfortunatly it didn't solve my problem. I think I'll post my problem in a separate thread when I have time, after searching for any related posts.
Anyway, thanks for the tutorial and for the replies

Gumbeto
gumbeto is offline   Reply With Quote
Old September 3rd, 2006   #9
rigor
First Cup of Ubuntu
 
Join Date: Aug 2006
Beans: 5
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

Hi friends,
for my centrino i use this utility on winxp
http://www.pbus-167.com/, to control not only cpu multipler, but also CPU multipler, and bus of ati card.

and i find this for linux
http://gentoo-wiki.com/HOWTO_Undervolt_a_Pentium_M_CPU

of course ... i'm very noobye....of linux, so i'm waiting for your comments.
rigor is offline   Reply With Quote
Old September 3rd, 2006   #10
nolodude
5 Cups of Ubuntu
 
Join Date: Jan 2005
Location: Finland
Beans: 25
Ubuntu 9.10 Karmic Koala
Re: HOWTO: CPU Frequency Scaling w/ Kernel Module

I have Asus K8V-MX mobo with Sempron 2600+ which does support Cool 'n Quiet in Windows, but apparently it doesn't work well with Powernowd in Linux.

I tried modprobe powernow-k8, modprobe acpi-cpufreq and even modprobe powernow-k7 but they all give the same error:
Code:
# modprobe powernow-k8
FATAL: Error inserting powernow_k8 (/lib/modules/2.6.15-26-k7/kernel/arch/i386/kernel/cpu/cpufreq/powernow-k8.ko): No such device
Guess I'm out of luck here, or what?
nolodude is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:43 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry