# Speedstep on Centrino

## dredd

Hi

I own a hp nx7000. currently I'm running mm sources 2.6.0-test10.

I have been reading many threads here about speedstepping on centrino notebooks, but none of them helped me to understand how to get it working on my notebook. I have activated the cpu scaling in the kernel options, but now I don't know, do I need another program or daemon to make it work? I've read something about cpufreqd, but it doesnt seem to do anything when I run it....

also, like ine some threads described, I do not find "Pentium M enhanced speedstep" in the kernel options.....

hope somebody can clear things up a bit...

----------

## dulljeff

 *dredd wrote:*   

> I own a hp nx7000

 

Me too   :Smile: 

I got SpeedStep running, not perfectly and I don't know if it is the only way to get there, but the cpu runs with 600MHz and I can switch it manually.

 *dredd wrote:*   

> also, like ine some threads described, I do not find "Pentium M enhanced speedstep" in the kernel options..... 

 

There is no such option, just enable "SpeedStep", the info says btw that this is the option to choose if you got a centrino cpu.

I would advise you to compile all the acpi stuff into the kernel, not as modules.

You have to create a directory "/sys" as root for things to work.

After booting the new kernel, type 

```
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
```

Your cpu should run then with 600MHz only and the fun shouldn't be heard at all.

If you want to get more speed again, type 

```
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
```

That's how I'm doing speedstepping at the moment, until I get to know a better way.

----------

## thundersteele

```
ACCEPT_KEYWORDS="~x86" emerge speedfreq
```

Then have a look at the man page. I personally like the dynamic policy, cpu is held in 600 MHz mode when Idle, but will increase frequency when it is needed. 

Kernel:

```
Power management options (ACPI, APM)  --->

   CPU Frequency scaling  --->

      Intel Enhanced SpeedStep (NEW)
```

----------

## dredd

 *thundersteele wrote:*   

> 
> 
> ```
> ACCEPT_KEYWORDS="~x86" emerge speedfreq
> ```
> ...

 

thanks to both of you for your answers... it sounds good with the dynamic policy.... but if I want to start the speedfreqd I get:

Need sysfs mounted on /sys, and kernel configured with cpufreq driver

so... do I need to add an entry to fstab to mount sysfs? and do I need to be running the cpufreqd as well?

phil

----------

## dredd

ok.. I had to reboot.. now I got the tree in the /sys folder.... but still when trying to run

```

/usr/sbin/speedfreqd -p dynamic

```

I now get....

```

/usr/sbin/speedfreqd: can't open /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed: No such file or directory

```

so still there's missing something

hope you can help...

----------

## tuxlover

I guess there's still something missing from your kernel...

Does your kernel .config's  CPU Freq scaling section look like this (this is mine, and it works, on test11):

```

#

# CPU Frequency scaling

#

CONFIG_CPU_FREQ=y

# CONFIG_CPU_FREQ_PROC_INTF is not set

CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set

CONFIG_CPU_FREQ_GOV_USERSPACE=y

CONFIG_CPU_FREQ_24_API=y

CONFIG_CPU_FREQ_TABLE=y

#

# CPUFreq processor drivers

#

CONFIG_X86_ACPI_CPUFREQ=y

CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y

# CONFIG_X86_POWERNOW_K6 is not set

# CONFIG_X86_POWERNOW_K7 is not set

# CONFIG_X86_POWERNOW_K8 is not set

# CONFIG_X86_GX_SUSPMOD is not set

CONFIG_X86_SPEEDSTEP_CENTRINO=y

# CONFIG_X86_SPEEDSTEP_ICH is not set

# CONFIG_X86_SPEEDSTEP_SMI is not set

# CONFIG_X86_P4_CLOCKMOD is not set

# CONFIG_X86_LONGRUN is not set

# CONFIG_X86_LONGHAUL is not set
```

----------

## optilude

You'll need all the ACPI stuff + Intel Enhanced SpeedStep + Userspace policy governor compiled into the kernel or as modules. I always use modules wherever possible, and make sure I load the ACPI modules at startup.

emerge speedfreq with ACCEPT_KEYWORDS="~x86" and do "rc-update speedfreq add boot".

Have a look at this thread: https://forums.gentoo.org/viewtopic.php?t=106835&highlight=

It will give you a set of scripts to manage power profiles. The defaults there should work for you if you use speedfreq to control your CPU speed, although the LCD brightness is dependent on ASUS ACPI extensions.

Martin

----------

## pilla

I am using cpudyn with cpufreq patches to get most of my battery, and it seems to work fairly well.

----------

## dredd

 *tuxlover wrote:*   

> I guess there's still something missing from your kernel...
> 
> Does your kernel .config's  CPU Freq scaling section look like this (this is mine, and it works, on test11):
> 
> ```
> ...

 

Hi

I was missing those two settings.. gonna recompile the kernel and see if it works.... will let you know

phil

----------

## dredd

 *optilude wrote:*   

>  I always use modules wherever possible, and make sure I load the ACPI modules at startup.
> 
> 

 

well, don't you think as it is a notebook I always gonna use the ACPI features, so I can directly compile them into the kernel? or do you see a big advantage of running them as modules?

phil

----------

## dredd

ok guys.. seem to be getting closer... after using the newly compiled kernel, I could use the speedfreq command... but I don't think it had any effect... so here's my question:

where can I see the speed at which the cpu currently is running? just entering speedfreq tells me actual policy... but I would like to see the actual cpu speed to be sure....

(I still don't have the 'performance' file in /proc/acpi/processor/CPU0/)

ah yeah, why do I have to run speedfreq at boot and not the daemon speedfreqd?

phil

----------

## optilude

The /etc/init.d/speedfreq script starts the speedfreqd daemon. The speedfreq command doesn't work unless speedfreqd is running.

I always modularise my kernel as much as humanly possible. It (usually) reduces boot times, and gives me a lot more control about what goes into the kernel and when. It probably doesn't make much difference in this case, though.

"speedfreq -c" tells you the current speed of the CPU. If you use gnome or XFCE4 or another compliant DE/WM, have a look at gdesklets.gnomedesktop.org for my SpeedfreqMon and SpeedfreqTemp gdesklets, which will give you a pretty display of how fast your CPU is running.

Martin

----------

## dredd

hi

thanks again for your help.. now i got it finally working..... so finally the fan stays off if nothings happening  :Smile: 

besides the speedfreqd I also have the cpufreqd running, is this correct?

can I use the policies and rules from the /etc/cpufreqd.conf somehow... seems to be pretty good, seems to me like cpufreqd can see if ac is on or off and choosing the according profile....

for me, dynamic is actually best, though on battery (no ac) i sill like being able to choose between performance or powersave myself too....

thanks

phil

ps: do you kow about standy or suspende modes on nx7000?

ps2: how about auto shutoff LCD or HD?

----------

## dredd

hi

thanks again for your help.. now i got it finally working..... so finally the fan stays off if nothings happening  :Smile: 

besides the speedfreqd I also have the cpufreqd running, is this correct?

can I use the policies and rules from the /etc/cpufreqd.conf somehow... seems to be pretty good, seems to me like cpufreqd can see if ac is on or off and choosing the according profile....

for me, dynamic is actually best, though on battery (no ac) i sill like being able to choose between performance or powersave myself too....

do you know if 600 MHZ is the absolute min frequency of a pentium-m 1500?

thanks

phil

ps: do you kow about standy or suspende modes on nx7000?

ps2: how about auto shutoff LCD or HD?

----------

## dulljeff

600 MHz is definitely not the lowest frequency. Windows slows down the cpu to 240MHz when idle.

I was also wondering how to get the speed lower than 600MHz.

And I'm interested in the suspend and auto-off questions (or better answers) as well.

----------

## dulljeff

As i just figured out you can set the frequency to 240MHz fixed, but that is not the right way - setting your cpu speed manually.

Does anyone know how to get set the min frequency of the daemon?

----------

## tuxlover

 *dulljeff wrote:*   

> 600 MHz is definitely not the lowest frequency. Windows slows down the cpu to 240MHz when idle.

 

Ok... then why does intel's centrino datasheet only list powersaving modes from 600MHz up? (go to page 22 ff to see the frequency table).

Note that I didn't read anything in this paper really, so if I totally misunderstood how the pentium m works, tell me  :Smile: 

----------

## tuxlover

 *dulljeff wrote:*   

> As i just figured out you can set the frequency to 240MHz fixed

 

as you just figured that out... please tell us how  :Smile:  no matter what intel says

(sorry to come up with two posts in two minutes I guess I didn't reload the page for an hour or so)

----------

## dulljeff

Thats easy, its described in speedfreq itself:

```
Usage: speedfreq [-cmqsDV] [-p policy]

        -c      get info about CPU

        -m      monitor daemon for policy and CPU speed changes

        -p P    set policy to P

        -q      tell server to quit

        -s      get current status

        -D      print debug messages

        -V      version information

 

Available policies:

        powersave       maximise power savings

        performance     maximise performance

        dynamic         adjust speed according to CPU load (default)

        NNN             set CPU to a fixed speed of NNN MHz
```

So you gotta type 

```
speedfreq -p 240
```

I don't know why Intel's datasheet tells us this. I only opened the system properties dialog in Windows and was quite often told about a cpu frequency of ~239MHz.

----------

## tuxlover

 *dulljeff wrote:*   

> So you gotta type 
> 
> ```
> speedfreq -p 240
> ```
> ...

 

I had used cpufreq(d) up to now, so I hadn't even seen that.

But I figure that it doesn't work quite right. Some tests show this:

I made a little c program which basically goes n times through a loop (n being a large number), then stops. I made a couple of "benchmarks":

```
speedfreq -p 240

time ./finite 

real    0m12.564s

user    0m11.989s

sys     0m0.034s

speedfreq -p 300

time ./finite 

real    0m12.571s

user    0m12.001s

sys     0m0.041s

speedfreq -p 600

time ./finite 

real    0m12.618s

user    0m11.998s

sys     0m0.042s

speedfreq -p 700

time ./finite 

real    0m9.354s

user    0m9.062s

sys     0m0.021s

speedfreq -p 800

time ./finite 

real    0m9.350s

user    0m9.022s

sys     0m0.020s

speedfreq -p 900

time ./finite 

real    0m7.445s

user    0m7.169s

sys     0m0.027s

speedfreq -p 1000

time ./finite 

real    0m7.442s

user    0m7.201s

sys     0m0.020s

speedfreq -p 1100

time ./finite 

real    0m6.144s

user    0m6.018s

sys     0m0.019s

speedfreq -p 1200

time ./finite 

real    0m6.147s

user    0m5.983s

sys     0m0.013s

speedfreq -p 1300

time ./finite 

real    0m5.675s

user    0m5.560s

sys     0m0.011s

```

So speedfreq isn't working quite right. It also reports the wrong cpu frequency, namely the one it was told to set, when invoked with the -c option:

```
speedfreq -p 1

speedfreq -c

CPU speed: min 600MHz, max 1300MHZ, current 1MHz; 97.62% idle

```

Yeah, right  :Smile:  And of course, X is still running wonderfully at 1 MHz...

Oh, and here goes the finite program in case you want to try it:

```
int main(int argc, char **argv) {

  long i = 0;

  for( ; i < 1000000000; i++ )

          ;

  

  return 0;

}
```

[edit]Btw, I emailed the speedfreq author about this.[/edit]

----------

## dulljeff

Sorry, but I don't the point of your argumentation. It the runtime of the c program goes down proportionally with the cpu speed getting higher, speedfreq seems to work correctly, doesn't it?

But of course, youre right about the 1MHz-killer-machine   :Wink: 

That cannot be possible.

----------

## tuxlover

 *dulljeff wrote:*   

> It the runtime of the c program goes down proportionally with the cpu speed getting higher, speedfreq seems to work correctly, doesn't it?

 

Oh well, yes... I didn't say that speedfreq doesn't work in general. It simply doesn't really set some of the speeds it seems to...

If you look at the runtimes of 600 MHz and below, they are all the same, which suggests that the cpu really never runs below 600 MHz, even though speedfreq seems to be able to set it to a value lower than 600.

Also, if you set the cpu freq to 700, it will actually run at 800 (same runtime of c program). The same goes for 900 and 1100 (it rounds up the speed).

----------

## hulk2nd

have a look at /sys/devices/system/cpu/cpu0/cpufreq/. for example if you cat scaling_setspeed then you'll see the actual frequency your cpu is running atm.

greets,

hulk

----------

## thundersteele

```
cat /proc/cpuinfo
```

also gives cpu speed

----------

## tuxlover

 *hulk2nd wrote:*   

> have a look at /sys/devices/system/cpu/cpu0/cpufreq/. for example if you cat scaling_setspeed then you'll see the actual frequency your cpu is running atm.

 

this relies on cpufreq detecting the right cpu speed.

 *thundersteele wrote:*   

> cat /proc/cpuinfo
> 
> also gives cpu speed

 

True but this again relies on cpufreq (the kernel) to detect the right frequency. Both ways could be as wrong as speedfreq in my opinion.

I'm just saying this to defend my method from above  :Smile:  But basically, you are right.

----------

## thundersteele

I didn't want to attack your method how to find out the real speed. Benchmarking will always be more exactly than reading information that the kernel or anything else gives out. eg 2.4 kernels liked to tell me that my centrino has no L2 cache. 

I had a look at "System" in Windows, and it also told me that the cpu was staying at 240 MHz. Don't know if I should believe it. 

But:

Pentium M at 600 MHz uses very few power. Clocking it down to 240 Mhz will only give some additional minutes, because at this low frequencies the cpu power usage makes only a little part of total power usage, as display, HD, CDROM and any other card is also using power. Personally I found out That spinning the harddrive down gives some additional time. 

Also shutting down the cdrom completly would safe some power, but I didn't find any way to do this until now (hdparm -Y doesn't work, and I can't take it out). It is possible in windows.

----------

## hulk2nd

there is a real strange thing that i experienced when i started windows right now:

if i go to the control panel -> system i get the following:

```
...

Intel(R) Pentium(R) M

processor 1500MHz

238 MHz

512 MB RAM

...
```

like dulljeff said, 600 mhz is not the lowest frequency.

but, if i open a program called sony notebook setup, there is a window called about this computer. there i get the following:

```
Intel(R) Pentium(R) M-Prozessor

1500 / 600 MHz

512 MB

...
```

so what does this say? which one is right? shouldn't both programs get their information from the same device / driver?

greets,

hulk

----------

## dulljeff

That is indeed weird. I cannot see a reason for either of the utilities to display wrong values.   :Question:   :Question: 

/proc/cpuinfo says:

```
stepping:     5
```

Does this point to the number of possible speed steps?

----------

## tuxlover

 *hulk2nd wrote:*   

> which one is right? shouldn't both programs get their information from the same device / driver?

 

I don't see a reason for them to take this info from the same device/driver... 

And of course, who do we trust?

I say lets trust the Intel specifications... which says 600 MHz  :Smile: 

 *dulljeff wrote:*   

> 
> 
> ```
> stepping:     5
> ```
> ...

 

I think the stepping is like a more exact type of revision number of the chip.

So you can properly identify your chip with the following information:

```
cpu family      : 6

model           : 9

stepping        : 5
```

(from /proc/cpuinfo)

----------

## hulk2nd

 *tuxlover wrote:*   

> I don't see a reason for them to take this info from the same device/driver...

 

no? then tell me from what else. i mean these dialogs change if the fruequency changes and from where should they get the information that this happened if not from the driver or from the device???

i think that it is possible to step it lower than 600mhz, but it will take the same power if it is on 300 or 600, thats what this performance stepping means. even if you can change the frequency without steps, the power consumption is controlled in steps. and these power steps are mentioned here cause it is not interesting how low can the processor run, it is interesting how low can his power consume be.

so the sony programs shows the active speed- or powerstep and the system dialog of windows shows the actual frequency.

probably windows only sets the cpu to the lowest possible frequency, cause it keeps the cpu as cool as possible and this prevents the fan from running.

greets,

hulkLast edited by hulk2nd on Mon Dec 08, 2003 6:52 pm; edited 2 times in total

----------

## dulljeff

That sounds like a possible explanation to me.

Besides I am very happy now with the performance management. The fan never turns on and I have brilliant performance.   :Very Happy: 

----------

## dredd

@dulljef:

are you managing it with the speedfreq tool?

for me it seems to work as well, even though its quite confusing with the diferent informations about the actual speed of the cpu, because my fan is only running when the computer is doing some hard work, not like before where it has always been running....

anybody could fix the problem with the calculated remaining time in klaptop? the percentage is working quite well, but not the time calculation.... it's going crazy.....

anybody tested the standby or suspend to disk modes in the new kernel?

cheers

phil

----------

