# ondemand CPUFreq governor not usable in kernel 2.6.38 ?

## C00lHandLuke

I've found a lot of conflicting information via various wikis and bug reporting sites regarding the ondemand CPUFreq governor - specifically in kernels >=2.6.38.

It would be extremely helpful to know if anyone running a kernel >=2.6.38 is able to use the ondemand governor.

Even though I have the required modules, I am stuck using the userspace governor with powernowd...

Thanks in advance!

----------

## aderesch

 *C00lHandLuke wrote:*   

> Even though I have the required modules, I am stuck using the userspace governor with powernowd...

 

What's supposed to be broken with the ondemand governor? Works just as before for me. Especially, what happens when you try it?

ad

----------

## C00lHandLuke

I run:

cpufreq-set -c 0 -g ondemand

cpufreq-set -c 1 -g ondemand

However, cpufreq-info results with:

cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009

Report errors and bugs to cpufreq@vger.kernel.org, please.

analyzing CPU 0:

  driver: p4-clockmod

  CPUs which run at the same hardware frequency: 0

  CPUs which need to have their frequency coordinated by software: 0

  maximum transition latency: 10.00 ms.

  hardware limits: 425 MHz - 3.40 GHz

  available frequency steps: 425 MHz, 850 MHz, 1.28 GHz, 1.70 GHz, 2.13 GHz, 2.55 GHz, 2.98 GHz, 3.40 GHz

  available cpufreq governors: userspace, conservative, ondemand, performance

  current policy: frequency should be within 425 MHz and 3.40 GHz.

                  The governor "performance" may decide which speed to use

                  within this range.

  current CPU frequency is 3.40 GHz (asserted by call to hardware).

  cpufreq stats: 425 MHz:0.00%, 850 MHz:0.00%, 1.28 GHz:0.00%, 1.70 GHz:0.00%, 2.13 GHz:0.00%, 2.55 GHz:0.00%, 2.98 GHz:0.00%, 3.40 GHz:100.00%

analyzing CPU 1:

  driver: p4-clockmod

  CPUs which run at the same hardware frequency: 1

  CPUs which need to have their frequency coordinated by software: 1

  maximum transition latency: 10.00 ms.

  hardware limits: 425 MHz - 3.40 GHz

  available frequency steps: 425 MHz, 850 MHz, 1.28 GHz, 1.70 GHz, 2.13 GHz, 2.55 GHz, 2.98 GHz, 3.40 GHz

  available cpufreq governors: userspace, conservative, ondemand, performance

  current policy: frequency should be within 425 MHz and 3.40 GHz.

                  The governor "performance" may decide which speed to use

                  within this range.

  current CPU frequency is 3.40 GHz (asserted by call to hardware).

  cpufreq stats: 425 MHz:0.00%, 850 MHz:0.00%, 1.28 GHz:0.00%, 1.70 GHz:0.00%, 2.13 GHz:0.00%, 2.55 GHz:0.00%, 2.98 GHz:0.00%, 3.40 GHz:100.00%

I can run the following with the desired output:

cpufreq-set -c 0 -g userspace

cpufreq-set -c 1 -g userspace

Are you running >= 2.6.38 ?

----------

## aderesch

 *C00lHandLuke wrote:*   

> Are you running >= 2.6.38 ?

 

Yes (otherwise I wouldn't have answered or at least mentioned it), my laptop (Pentium-M, using acpi-cpufreq) has been running 2.6.39 (git-cloned from kernel.org with very few local changes) with the ondemand governor for about a month (with occasional switches to powersave and performance governors).

Did you build cpufreq-ondemand into the kernel or as module (and if so is it really loaded)? What is the output of "cpufreq-info -g"?

ad

----------

## C00lHandLuke

cpufreq-info -g output is:

userspace conservative ondemand performance

It did show the governor available in my previous paste as well.  It's compiled into the kernel this time.  Previously I compiled it as a module.  Either way I end up with an unusable governor.  Very weird....

----------

## aderesch

 *C00lHandLuke wrote:*   

> It did show the governor available in my previous paste as well.

 

Ah, right -- it's in the full output as well  :oops:.

Could it be that p4-clockmod doesn't fulfill some governor requirements (switching latency, whatever...) and that parsing of ACPI tables has changed on your system? There used to problems like that a few years back. Does conservative work?

Edit: Although I would still have expected some kind of message when refusing to change the governor. What's the exit code of cpufreq-set?

ad

----------

## C00lHandLuke

No exit code at all...  It seems I do have the exact same issue with the conservative governor as well.  Joy

----------

## aderesch

 *C00lHandLuke wrote:*   

> No exit code at all...

 

There always is one and in bash it can be acquired by running "echo $?" right after the command. Or did you mean to say it is 0, i.e. success?

 *C00lHandLuke wrote:*   

> It seems I do have the exact same issue with the conservative governor as well.  Joy

 

And in 2.6.37 (or some earlier version?) everything works? Userspace is the same I presume? Any noticeable change in boot messages regarding cpufreq and/or ACPI? Which kernels >=2.6.38 did you try?

If it's broken in all newer versions, I guess you'll have to find the exact commit that is responsible.

ad

----------

## DirtyHairy

The ondemand governor works for me without any problems, also in 2.6.39 and 3.0.rcx. The frequency scaling can be controlled directly, without any userspace tools in between, via pseudofiles in /sys/devices/system/cpu/cpu[n]/cpufreq (where [n] is the CPU index). Specifically, what are the contents of scaling_available_frequencies, scaling_available_govenors and scaling_governor?

----------

## [n00b@localhost]

The ondemand governor also works for me under tuxonice-2.6.38-r2.

I am currently having separate issues with cpufreq scaling (although it may be related in some way to the ACPI table parsing problem mentioned above).

----------

## C00lHandLuke

/sys/devices/system/cpu/cpu0/cpufreq/ contains:

affected_cpus                  related_cpus                   scaling_governor

cpuinfo_cur_freq               scaling_available_frequencies  scaling_max_freq

cpuinfo_max_freq               scaling_available_governors    scaling_min_freq

cpuinfo_min_freq               scaling_cur_freq               scaling_setspeed

cpuinfo_transition_latency     scaling_driver                 stats/

/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies contains:

425000 850000 1275000 1700000 2125000 2550000 2975000 3400000 

/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors contains:

userspace conservative ondemand performance 

/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor contains:

userspace

cpufreq-set -c 0 -g ondemand ; echo $? outputs:

0

This is a new install of 2.6.38-gentoor6.  All of my searching was specifically for this kernel or newer.  I do greatly appreciate letting me know it SHOULD function.  Therefore, I will continue to dig a bit deeper.

Any and all pointers are appreciated.  Maybe it is related to limitations of the latency for setting the frequency?  It's interesting the conservative governor is unusable for me as well....

----------

## aderesch

DirtyHairy has a good point, though. You should try setting the governor via

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

I doubt it will change anything, but it at least takes the userspace programs out of the equation.

Edit: Also have a look at these forum posts.

Which leads us to the question whether acpi-cpufreq has any effect for you, and which powersaving mechanisms are listed in /proc/cpuinfo or any manuals (PC, mainboard, CPU) you might have.

ad

----------

## DirtyHairy

@aderesch: Exactly what I aimed at  :Wink:  If controlling scaling directly via the sysfs files doesn't work either, you can try to change the default governor in the kernel configuration and see what happens.

----------

## C00lHandLuke

Yes - In kernel changes result in the same limitations.  Really interesting.  Maybe understanding if this a Pentium-D limitation would be more specific?

Anyone running a Pentium D using CPUFreq ondemand successfully?

----------

## aderesch

 *C00lHandLuke wrote:*   

> Maybe understanding if this a Pentium-D limitation would be more specific?

 

Please read the forum posts I linked to, and show us your /proc/cpuinfo (although if your CPU supports any better frequency scaling there should be messages in the kernel log as well).

Here is a code snippet from the 2.6.37 p4-clockmod.c for you (so, no it has nothing to do with >=2.6.38):

```

  /* the transition latency is set to be 1 higher than the maximum

   * transition latency of the ondemand governor */

```

In short:

- p4-clockmod will not work with ondemand

- p4-clockmod doesn't do you much good anyway

- you may get something useful if your CPU can be controlled by acpi-cpufreq

ad

----------

