Skip to contentSkip to conversation

Changing CPU Speed while running Linux

DISCUSSION Sven Geggus 8 participants 8 messages Jun 13, 2001 – Jun 16, 2001

lore
Share & tools
lore
#0 lore raw

Hi there,

on my Elan410 based System it is very easy to change the CPU clock speed by means od two outb commands.

I was wondering, if it does some harm to the Kernel if the CPU is reprogrammed using a different CPU clock speed, while the system is up and running.

If so, is there a possibility to tell the Kernel that the clock speed has been changed by means of a particular Kernel call?

If not, where would I put some code to do this at system boot?

Is /usr/src/linux/arch/i386/boot/setup.S the right place for something like this?

Thanks for hints

Sven

Signature · 4 lines
Sven Geggus @ Fraunhofer IITB, Karlsruhe (http://wsd.iitb.fhg.de/)
Phone: +49 721 6091-422, Fax: +49 721 6091-213
Linux powered DATA aquisition and evaluation, embedded systems,
combustion engine diagnosis
#1 lore raw
Quoted 9 lines · Sven Geggus

Hi there,

on my Elan410 based System it is very easy to change the CPU clock speed by means od two outb commands.

I was wondering, if it does some harm to the Kernel if the CPU is reprogrammed using a different CPU clock speed, while the system is up and running.

I have a module for the K6 PowerNow which allows you to do

echo 450 > /proc/sys/cpu/0/frequency

and does the right thing wrt udelay / bogomips etc..
I can dig it out if you want.. sounds like this should be a more generic thing.

Greetings,
Arjan van de Ven

#2 lore raw

Hi,

I have a brand new Dell Inspiron 8000, laptop. It can run in 700 MHz or 850 MHz. The manual says that the machine/BIOS switches speed dependent on CPU load. I have not installed Linux yet, but it works with Win2000.

It is also possible to force the BIOS to one speed if the OS don't like speed changes.

Would Linux accept sudden changes of CPU clock rate or is it only the the OS initiate the change of speed it is accepted?

I agree with you that it should be a generic thing. I guess that more and more laptops will get dual-speed CPUs.

                                  _\\|//_
                                  (-0-0-)
/-------------------------------ooO-(_)-Ooo------------------------------\
| Magnus Sandberg                    Email: [email protected]  |
| Network Engineer, BlueLabs AB                  http://www.bluelabs.se/ |
| Phone: +46-8-470 2155                             FAX: +46-8-470 2199  |
\------------------------------------------------------------------------/
                                  ||   ||
                                 ooO   Ooo

----- On 13th of June 2001 Arjan van de Ven wrote; -----

Quoted 9 lines · Geggus

Hi there,

on my Elan410 based System it is very easy to change the CPU clock speed by means od two outb commands.

I was wondering, if it does some harm to the Kernel if the CPU is reprogrammed using a different CPU clock speed, while the system is up and running.

I have a module for the K6 PowerNow which allows you to do

echo 450 > /proc/sys/cpu/0/frequency

and does the right thing wrt udelay / bogomips etc..
I can dig it out if you want.. sounds like this should be a more generic thing.

Greetings,
Arjan van de Ven

#3 lore raw
Quoted 3 lines · Magnus Sandberg

I have a brand new Dell Inspiron 8000, laptop. It can run in 700 MHz or 850 MHz. The manual says that the machine/BIOS switches speed dependent on CPU load. I have not installed Linux yet, but it works with Win2000.

Intel Speedstep iirc. My Vaio also has it. My findings so far:

On mains it runs at 700MHz, whilst on batteries it drops to ~550MHz. If I boot an ACPI enabled kernel, the speed changes according to CPU load, but with a smaller window. I've seen it go as low as 50MHz,
but only up to a maximum of 200MHz. The fact that it only has a maximum
of 200MHz in this mode probably explains the need for the no-idle switch in the current ACPI implementation.

As there are no public documents on Speedstep, it's not clear to me whether this is a limitation of Speedstep, or the ACPI implementation. Judging by the fact that Windows seems to run at full speed, I'd be inclined to think the latter.

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#4 lore raw
In reply to Sven Geggus

Hi

Quoted 7 lines
Quoted 6 lines

on my Elan410 based System it is very easy to change the CPU clock speed by means od two outb commands.

I was wondering, if it does some harm to the Kernel if the CPU is reprogrammed using a different CPU clock speed, while the system is up and running.

Quoted 7 lines

I have a module for the K6 PowerNow which allows you to do

echo 450 > /proc/sys/cpu/0/frequency

and does the right thing wrt udelay / bogomips etc..
I can dig it out if you want.. sounds like this should be a more generic thing.

Can you dig that out? I'd like to take a look.

[Of course, problem is *not* solved: you still have short time when kernel runs with wrong bogomips.]

Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
#5 lore raw
Quoted 8 lines · In article <[email protected]> you wrote:
Quoted 3 lines

and does the right thing wrt udelay / bogomips etc..
I can dig it out if you want.. sounds like this should be a more generic thing.

Can you dig that out? I'd like to take a look.

[Of course, problem is *not* solved: you still have short time when kernel runs with wrong bogomips.]

But the kernel controls that time ..... It's not perfect, and it might be aleviated by going in small steps at a time.
Disabling interrupts isn't fun as the bogomips code kind of needs that ;)

Greetings,
Arjan van de Ven

#6 lore raw
In reply to Pavel Machek
Quoted 4 lines

Can you dig that out? I'd like to take a look.

[Of course, problem is *not* solved: you still have short time when kernel runs with wrong bogomips.]

Not really. WHen you do the speed change on most of these cpus you have to do it with IRQs off and with the PCI bridge temporarily disabled as the CPU disconnects from the bus during speed transititions and cannot take part in cache coherency

#7 lore raw
Quoted 10 lines
Quoted 5 lines

Can you dig that out? I'd like to take a look.

[Of course, problem is *not* solved: you still have short time when kernel runs with wrong bogomips.]

Not really. WHen you do the speed change on most of these cpus you have to do it with IRQs off and with the PCI bridge temporarily disabled as the CPU disconnects from the bus during speed transititions and cannot take part in cache coherency

Though it's been a while, last time I read the elan sc400 (or was it the 410, always get those two mixed up), datasheet, there were no special procedures needed, just change the speed.
This may have been because there is no external PCI bus.