LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2004, 09:47 AM   #1
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Rep: Reputation: 0
Is CPUFreq built into kernel 2.6.x?


I'm trying to get my mobile AMD processor to work with dynamic speedsettings under Madrake 10, and I've been searching for the correct way to do this. My kernel is 2.6.3. I've looked around on the forum, but have not found an answer that's workable for me as a beginner.

I read that you need CPUFreq in your kernel, and that you should patch your kernel or something to enable this. Now, I'm very new to Linux and really don't know how to do that, but fortunately I read somewhere that kernel 2.6 has CPUFreq built in, is this correct? If so, what steps do I have to take in order to enable it, and set my CPU (AMD Athlon XP 2500+, mobile) to a lower speed when the system is idle? I found a little program named CPUSpeed, would that do the trick?

Last edited by Vandaahl; 08-01-2004 at 12:18 PM.
 
Old 08-01-2004, 05:16 PM   #2
Corey
LQ Newbie
 
Registered: Jul 2003
Location: North Idaho - Where Big Brother gets his ass kicked.
Distribution: MDK 10, Peanut 9.2
Posts: 3

Rep: Reputation: 0
Frequency Scaling

CPUSpeed: haven't tried it.....however:



Frequency Scaling support for AMDs is built into kernel 2.6.7 (just built one). To enable it, follow the normal kernel building procedure (using 'make xconfig', specifically) and check the appropriate boxes. Follow the Kernel How-To, or README on kernel.org. Make sure you select the right processor type.

Tip: Make some caffiene available to yourself and take your time configuring (look at every option if you've never done that before). You want to get the configure done correctly, because the build process will probably take hours (on an Athlon XP Mobile 2500, 768MB DDR 400).

If you're trying to extend your battery life - let me know if you succeed. From my recent experiences with laptops, all different models and brands seem to have defective batteries, as if it's just a lie that the battery technology is available to make a laptop worth using. I'll never buy another laptop again unless it comes with a lifetime-warranted battery. My Athlon XP-M is not very Mobile :-\

I hope my comments help you! Good luck!
 
Old 08-01-2004, 05:42 PM   #3
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks Corey, you make it all sound so easy Maybe I should just install Slackware Linux, which I think I read has kernel 2.6.7 build in. What do you think? Sounds like the easiest thing for me to do, because I've only been using Mandrake Linux for a few days, so I won't lose much data...
 
Old 08-01-2004, 06:07 PM   #4
bitspike
LQ Newbie
 
Registered: Jul 2004
Location: canberra, australia
Distribution: slackware 10
Posts: 7

Rep: Reputation: 0
Quote:
Maybe I should just install Slackware Linux, which I think I read has kernel 2.6.7 build in.
slackware 10 doesn't really have the 2.6.7 kernel 'built in'. it is, however, on the second install cd for you to configure after you have actually installed slackware 10 with the 2.4.26 kernel.

it's not too much trouble though. i hadn't done it before myself, but i found a lot of online help and it was much easier to do tahn expected.

you then have the problem that you could go to all of this trouble, when it is just as easy to upgrade the kernel on your existing mandrake install.

so, i guess it comes down to whether you would prefer slackware 10, or mandrake, for whatever your purposes are.

i like them both (for different reasons), but i prefer slackware because itrequires a bit more work, resulting in me understanding more.

- andrew
 
Old 08-01-2004, 09:45 PM   #5
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 64

Rep: Reputation: 18
Hold on! Don't delete that Mandrake partition yet! :-) The cpufreq has been built into the official Mandrake kernel 2.6.x.

To activate, you need to become the superuser and simply type:

# modprobe powernow-k7

And voila! The PowerNOW! feature is now installed. Check it with demsg:

# dmesg

....

There should be some information about PowerNOW! and frequency scaling on the dmesg output.

If you want this to be activated every time you boot up, then you need to load it from /etc/modules.conf (can it? I'm not sure--I myself am not an expert in this field). My alternative is to put a statement in your /etc/rc.d/rc.local. Add the following statement in that file (as the last line, to be safe):

modprobe powernow-k7

I think kernel 2.4.x also has PowerNOW if you are willing to patch it. I am not. :-) I tried it once and oh.. it's so painful since the patch conflicts a lot with the modified kernel (at that time, I was using Red Hat 7, I think).

Now, by default the Linux PowerNOW module is set so that the CPU speed is determined automatically depending on the CPU load. I have a laptop (Sony VAIO with AMD Athlon XP 1400+). When PowerNOW is installed, you can tell that if you `ls' a directory, usually it lists slowly at the beginning, then becomes faster at the end.

There are some `control` you can get with Linux PowerNOW feature. It is located in /sys subdirectory. I don't have the laptop with me as of the time of writing, so I have to wait for tomorrow if I want to post some more detail. IIRC, it is something like /sys/devices/system/... . You may want to see some documentation in /usr/src/linux if you've installed kernel-source package. The documentation tells you how to scale the CPU frequency manually. Basically there are 2 available modes (which the kernel folks termed "scaling governor"): "performance", i.e. the CPU freq is adjusted to maximize the performance, and "userspace", which basically is manual adjustment. Of course all these changes can be done by the root user only.

Just a side comment, not to disappoint you: I noticed that the PowerNOW feature does not really save the battery life on my laptop. Of course my judgement could be wrong. The lithium battery in my laptop is already > 2 years old in the age, and so the performance may be bad. I noticed once that even if I slow the CPU down to 500 MHz (which was the minimum for my laptop), the battery juice seemed to run as quickly as if I use 1.2GHz speed. Of course all these with the ACPI being activated, which does save some more power by not running full-throttle all the time.

Good luck and have fun with your PowerNOW! Let me know if you notice a better battery life or whatever! I'd love to hear how this new feature performs. I do not have any other "datapoint", as the laptop is the only AMD machine accessible to me.

Wirawan
 
Old 08-02-2004, 06:29 AM   #6
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
You may want to try cpufreqd, a demon which makes use of the cpufreq kernel-feature. I am not sure if this is included in the Mandrake distro, but I am sure you will find it somewhere.

Other distros, like SuSE use another demon called powersaved, but it actually does the same thing. No need to change distros!
 
Old 08-02-2004, 06:42 AM   #7
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Hold on! Don't delete that Mandrake partition yet! :-)
Okay! I'm glad I didn't do anything yet Great news! I will try your suggestions, and report. Thanks!
 
Old 08-02-2004, 08:27 AM   #8
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
To activate, you need to become the superuser and simply type:

# modprobe powernow-k7

And voila! The PowerNOW! feature is now installed. Check it with demsg:

# dmesg
Well, I tried the above, but unfortunately it did not work. Am I doing it right? I go to a terminal, type 'su', become root, then I type 'modprobe powernow-k7', but nothing happens. The command 'dmesg' doesn't do anything either
 
Old 08-02-2004, 08:41 AM   #9
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
Does nothing happen? If you don't get an error, the module maybe was loaded sucessfully.
You can check with lsmod if the driver is loaded.

Anyway, the module does nothing by itself. It needs to be controlled by a demon.
 
Old 08-02-2004, 10:53 AM   #10
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 64

Rep: Reputation: 18
Just to make sure: you did not prepend the command with `#', did you? That's shell comment character. If you did, try the commands without those letters again. The `#' just mean that you are in the superuser mode. Could you post the last, say, 50 lines of the dmesg command?
 
Old 08-02-2004, 12:49 PM   #11
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
I did a reboot, and ran dmesg, and now it did do something! I get a whole list with info on my cpu, and it shows the minimum and maximum speed! I guess I should now look for a deamon to control the cpu speed? Those aren't hard to find, so I'll take a look and report afterwards

Last edited by Vandaahl; 08-02-2004 at 12:52 PM.
 
Old 08-02-2004, 01:55 PM   #12
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
Well, I tried CPUfreqd and Powernowd, but no luck: I can't get them to run properly. I installed CPUfreqd, and try to run it as a su with #cpufreqd, but nothing seems to happen. So I installed Powernowd, and when I run it, I get this errormessage:

powernowd: Found 1 cpu:
Couldn't open file: No such file or directory
Couldn't open file: No such file or directory
Couldn't open file: No such file or directory
couldn't open govn's file for writing: No such file or directory
Couldn't get per-cpu data: Illegal seek
PowerNowd encountered and error and could not start.
Please make sure that:
- You are running a v2.5/v2.6 kernel or later
- That you have sysfs mounted /sys
- That you have the core cpufreq and cpufreq-userspace
modules loaded into your kernel
- That you have the cpufreq driver for your cpu loaded,
and that it works. (check dmesg for errors)

I have no idea what that meanse, is sysfs something I need to install seperately?
 
Old 08-02-2004, 02:00 PM   #13
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 64

Rep: Reputation: 18
I'm not sure if you need a daemon for that. At least mine does not run a daemon. Here's the directory that contains the "control" for the PowerNOW thing:

/sys/devices/system/cpu/cpu0/cpufreq

And in there, you'll see the following files:

cpuinfo_max_freq
cpuinfo_min_freq
scaling_available_governors
scaling_driver
scaling_governor
scaling_max_freq
scaling_min_freq

The meaning is pretty obvious. The first two contains the min/max allowable CPU freqs. Try to print scaling_available_governors. On my computer it says:

userspace performance

It's now set on "performance". To set to "userspace" (and back and forth), echo the word to file scaling_governor, like this (anything up to the `#' are the shell prompt; remember to `cd' to the right subdir first!):

/sys/devices/system/cpu/cpu0/cpufreq # echo userspace > scaling_governor

Now see it again:

/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_governor
userspace

You can control the CPU frequency by echoing the desired frequency to file scaling_setspeed in that subdir, for example:

/sys/devices/system/cpu/cpu0/cpufreq # echo 1000000 > scaling_setspeed

This sets the CPU freq at 1.0 GHz. Remember that the numbers are in kilohertz!

The following documentation is your best friend right now:

/usr/src/linux/Documentation/cpu-freq/user-guide.txt

which exists on your computer if you have kernel-source package installed.
 
Old 08-02-2004, 02:02 PM   #14
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 64

Rep: Reputation: 18
Hi Vandaahl,

Do you have /sys in your Linux root directory? If yes, you have sysfs installed, up and running.
 
Old 08-02-2004, 02:23 PM   #15
Vandaahl
LQ Newbie
 
Registered: Jul 2004
Location: Netherlands
Distribution: Mandrake 10
Posts: 15

Original Poster
Rep: Reputation: 0
I do have a sys directory, but my /sys/devices/system/cpu/cpu0 folder is empty. There are no files in there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel-source-2.6.5-7.src.rpm requires kernel-dummy to build!? fizzdandantilus SUSE / openSUSE 5 12-02-2004 12:48 PM
New FAQ topic: Should I edit my kernel configuration?/Should I build a custom kernel? chort *BSD 10 09-10-2004 11:15 PM
Unable to build NVIDIA kernel module / determin kernel version Night Ink Fedora 2 05-31-2004 04:54 PM
2.6 Kernel on Dell 5150, cpufreq throttling issues Neo8234 Linux - Software 2 02-09-2004 06:43 PM
cdrom and cpufreq on kernel 2.6.0 navarre9 Linux - Laptop and Netbook 1 01-14-2004 01:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration