# Why can't I use the ondemand scaling governor?

## RayDude

I had been using cpufreqd, but I couldn't get its bahavior to change so I removed it. I liked speedfreqd, but its no longer supported so I removed it. I used them with the userspace governor, but that only worked if I set it in the kernel config.

I can configure the kernel to use userspace or performance on bootup, but not ondemand (I read that this is done specifically because of boot up issues with the ondemand governor).

I have removed the performance stuff from KDE's control center (as far as I can tell, although ACPI control is still enabled).

Here's what happens:

```
inductor ~ # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

performance

inductor ~ # echo -n ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

inductor ~ # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

performance
```

It doesn't change. If I use cpufreq-set:

```
inductor ~ # cpufreq-set -g ondemand

Error setting new values. Common errors:

- Do you have proper administration rights? (super-user?)

- Is the governor you requested available and modprobed?

- Trying to set an invalid policy?

- Trying to set a specific frequency, but userspace governor is not available,

   for example because of hardware which cannot be set to a specific frequency

   or because the userspace governor isn't loaded?
```

And yet, root has write permission:

```
inductor ~ # ls -las /sys/devices/system/cpu/cpu0/cpufreq/

total 0

0 drwxr-xr-x  3 root root    0 Jun 18 12:30 .

0 drwxr-xr-x  3 root root    0 Jun 18 12:23 ..

0 -r--r--r--  1 root root 4096 Jun 18 12:31 affected_cpus

0 -r--------  1 root root 4096 Jun 18 12:31 cpuinfo_cur_freq

0 -r--r--r--  1 root root 4096 Jun 18 12:31 cpuinfo_max_freq

0 -r--r--r--  1 root root 4096 Jun 18 12:31 cpuinfo_min_freq

0 -r--r--r--  1 root root 4096 Jun 18 12:31 scaling_available_frequencies

0 -r--r--r--  1 root root 4096 Jun 18 12:31 scaling_available_governors

0 -r--r--r--  1 root root 4096 Jun 18 12:31 scaling_cur_freq

0 -r--r--r--  1 root root 4096 Jun 18 12:31 scaling_driver

0 -rw-r--r--  1 root root    0 Jun 18 12:25 scaling_governor

0 -rw-r--r--  1 root root 4096 Jun 18 12:30 scaling_max_freq

0 -rw-r--r--  1 root root 4096 Jun 18 12:30 scaling_min_freq

0 drwxr-xr-x  2 root root    0 Jun 18 12:23 stats
```

If I check to make sure ondemand is availble:

```
inductor ~ # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

ondemand powersave performance
```

And just to make sure scaling is available:

```
inductor ~ # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

2400000 1200000
```

So what the heck am I doing wrong? Its driving me crazy!!!

Thanks in advance,

Raydude

----------

## jmja89

I know this probably isn't your problem, but I'll mention it anyways...your hardware DOES support changing frequencies right?

----------

## RayDude

 *jmja89 wrote:*   

> I know this probably isn't your problem, but I'll mention it anyways...your hardware DOES support changing frequencies right?

 

Its a laptop... And the above cat of /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies proves it...

But now my post isn't unanswered so less people are likely to see it.

Doh!

Raydude

----------

## simkin

Hi, I don't know much about this, but I also can't change the scaling_governor if there is one working at that moment. I can change it only adding the following line to your /etc/conf.d/local.start

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

(Like it's explained on the wiki). Sorry.

----------

## RayDude

 *SiMkiN wrote:*   

> Hi, I don't know much about this, but I also can't change the scaling_governor if there is one working at that moment. I can change it only adding the following line to your /etc/conf.d/local.start
> 
> ```
> echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> ```
> ...

 

Thanks. I tried this. local.start reports errors when this line is present. I have no idea why though...

Raydude

----------

## RayDude

The only fix I've found so far is to install performance and powersave in the kernel, install cpudyn and run it at the default stage of boot. Then the computers (that's two computers, one laptop and an NFORCE 2 server) will automagically switch from powersave to performance during high load times.

I consider it a cludge but at least I'm saving power...

My laptop fan is again mostly quiet...

Raydude

----------

## GaMMa

I'm having the same issue on a Dell Inspiron 5150. I can't set the ondemand governor for some reason, and yes it does support CPUFreq scaling.

----------

## Cintra

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

works fine for me

mvh

----------

## GaMMa

I found out that speedstep-ich doesn't seem to support ondemand, but acpi-cpufreq does.

----------

## RayDude

 *GaMMa wrote:*   

> I found out that speedstep-ich doesn't seem to support ondemand, but acpi-cpufreq does.

 

Thanks. I'll try it out when I get a chance. Does ACPI-cpufreq support voltage adjusting?

Raydude

----------

## MasquedAvenger

Yeah, it does.  I was using the P4 driver in the kernel not knowing much about CPU frquency scaling, and the kernel warned me that it didn't support voltage scaling but that the ACPI driver was among the ones that do.

James

----------

## GaMMa

So is there any difference between the ACPI scaling driver and the speedstep-ich? If there isn't why don't they just drop the speedstep one? I noticed with the acpi-driver gnome couldn't change from powersave to performance via the cpufreq monitor applet. And sometimes my changes didn't register either.

----------

## MasquedAvenger

I have no idea.  Hopefully someone more capable than myself can answer that  :Smile: 

James

----------

## RayDude

I switched my P4M laptop to mm-sources, acpi-pstates driver and ondemand this morning and it seems to be working like a champ.

The laptop still seems to be running cool and pretty quiet so it seems to have the same functionality as speedstep-ich and cpudynd (what I had been using).

I don't use Gnome so I can't help you with its problems.

Raydude

----------

## GaMMa

My laptop runs hot when it's at full speed (due to bad cooling, Dell) and when watching movies ondemand would kick into full speed and the fan would spin out of control which is loud and noisy. Scaling down though keeps things quiet all the time..

----------

## RayDude

 *GaMMa wrote:*   

> My laptop runs hot when it's at full speed (due to bad cooling, Dell) and when watching movies ondemand would kick into full speed and the fan would spin out of control which is loud and noisy. Scaling down though keeps things quiet all the time..

 

Luckilly I don't watch movies on my laptop often. What do you mean by scaling down?

Raydude

----------

## GaMMa

lowering the frequency.

----------

## RayDude

 *GaMMa wrote:*   

> lowering the frequency.

 

Ah. I have two frequencies: 2400 and 1200. Too bad they don't support 1600 and 2000, huh?

Raydude

----------

## GaMMa

Yea I have two frequencies too 1600 and 3100. 1600 works great and quietly, but for emerges I switch to 3100, but the fan is constantly on and it's loud under load.

----------

## RayDude

 *GaMMa wrote:*   

> Yea I have two frequencies too 1600 and 3100. 1600 works great and quietly, but for emerges I switch to 3100, but the fan is constantly on and it's loud under load.

 

1600 is fine for DVD playing. I'm surprized the ondemand governor bumps it to 3100. Seems flawed to me. I'll try a dvd tonight to see if it bumps to 2400 (it shouldn't need to).

Raydude

----------

## GaMMa

I think I can change the sensitivity of the ondemand governor to bump at a different level, but I gave up on the governor  :Razz: . Playing games also switches to the high power when I feel it isn't needed. ondemand is great for overall desktop useage though. I think there's another governor out there as of 2.6.12 kernels too.

----------

## frary

There is: 2.6.12 includes a governor called "conservative". Should do the same Job as "ondemand", but in steps 

( not from min to max in 1 Jump ).

But I have the problem this thread was about in the beginning:

I cannot change the Governor! Starting with "performance" ( default in Kernel ), 

I cannot switch to any other than "userspace" ... and not back to "performance" after that change.

Scaling works, I can change the cpufreq manually, but I did not manage to use 

Powernowd or any other userspace tool without freezing...

Maybe the K7 ( 2400+ in my case ) just do not fully support freq_scaling...

T

----------

## RayDude

 *frary wrote:*   

> There is: 2.6.12 includes a governor called "conservative". Should do the same Job as "ondemand", but in steps 
> 
> ( not from min to max in 1 Jump ).
> 
> But I have the problem this thread was about in the beginning:
> ...

 

Some of the hardware drivers don't support the ondemand or conservative governors.

The ACPI P-States driver does and that's the one I'm using.

Raydude

----------

## frary

On what hardware?

Mine is AthlonXP 2400+ ( Tbred B ) on Asus A7N8x-E Deluxe ( NForce2 ).

T

----------

## RayDude

 *frary wrote:*   

> On what hardware?
> 
> Mine is AthlonXP 2400+ ( Tbred B ) on Asus A7N8x-E Deluxe ( NForce2 ).
> 
> T

 

The hardware I am talking about is a Dell Inspiron 8200 with a P4 Mobile and i845(?) chipset.

I have an nforce2 server running with the nvidia nforce 2 FSB changing driver using the ondemand policy governor. I set its min freq to 1000 KHz and it seems to work like a charm.

Raydude

----------

## frary

Hmm, I tried to use ondemand, but I cannot switch to both dynamic governors ( conservative, ondemand ).

Switching between powersafe and performance seems to work manually, but switching lower than 1300 is not possible and no matter what range I set for fsb, my system freezes sometimes...

T

EDIT: Cut ...

----------

## RayDude

 *frary wrote:*   

> Hmm, I tried to use ondemand, but I cannot switch to both dynamic governors ( conservative, ondemand ).
> 
> Switching between powersafe and performance seems to work manually, but switching lower than 1300 is not possible and no matter what range I set for fsb, my system freezes sometimes...
> 
> T
> ...

 

You may have said previously, but which driver are you using?

Raydude

----------

## frary

cpufreq-nforce2. I read this one

https://forums.gentoo.org/viewtopic-t-273047-highlight-ondemand.html

and it should be possible to clock the cpu down.

As I tried on 2 different Boards in many different ways it seems to me the cpu is somehow broken

( its running very stable, even at 12*166 instead of 15*133, only fsbs-caling freezes it!  )

T

----------

## RayDude

 *frary wrote:*   

> cpufreq-nforce2. I read this one
> 
> https://forums.gentoo.org/viewtopic-t-273047-highlight-ondemand.html
> 
> and it should be possible to clock the cpu down.
> ...

 

What does it say in /var/log/messages?

Mine says this:

```
Jul 16 13:39:52 server cpufreq: FSB changing is maybe unstable and can lead to crashes and data loss.

Jul 16 13:39:52 server cpufreq: FSB currently at 133 MHz, FID 12.5
```

Mine is slowing itself down to 100MHz I believe.

I don't have any of the voltage stuff enabled, I'm just slowing the FSB down. Is it possible the governor is lowering the voltage too much?

I'm not even sure the governor can control voltage...

Just guessing,

Raydude

----------

## frary

Same here, FSB and FID are detected correctly. Default Range for FSB is between 166 and 83,33.

Voltage changing is not possible on my board and the governors do not change it ( as far as I read ).

Voltage scaling is only possible with an atxp1 chip and my MB does not have one ( and is not able to lower 

the voltage: BIOS range is between 1,65 and 1,85; 1,65 is default for my CPU.. ).

As I said, maybe the problem is my CPU. I tried anything possible:

- lowering FSB in smaller steps ( powernowd in sine mode )

- only using governors ( manual switch between powersafe and performance )

- using cpufreqd for changing the governors

- setting FSB manually ( echo 1500000 > ..... )

System seems to be stable with FSB 125 ( --> 1500 MHz ) but doesn`t always manage to step back to 

166 ( 2000 ). I can even set about 108 ( 1300 ) and prime runs fine, but getting back to 2000

seems impossible from that far down...

You are able to set CPUspeed to 100? Even a mobile CPU won`t get that far, are you sure about that?

try to watch your MHz by

```
watch grep \"cpu MHz\" /proc/cpuinfo
```

As athcool is bringing my idle temp down to 40°C, I do not need FSB-scaling, but it would have been a

nice feature...

T

----------

## RayDude

 *frary wrote:*   

> Same here, FSB and FID are detected correctly. Default Range for FSB is between 166 and 83,33.
> 
> Voltage changing is not possible on my board and the governors do not change it ( as far as I read ).
> 
> Voltage scaling is only possible with an atxp1 chip and my MB does not have one ( and is not able to lower 
> ...

 

Its a 1667 MHz Athlon XP (can't remember which core, it has 256KB of cache), it goes as slow as 1042.468 according to /proc/cpuinfo. It switches automatically while I'm doing an emerge up to 1665. According to /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq, its running 1037.500 which is an FSB speed of: 83 MHz (12.5 multiplier for 133 MHz FSB to 1667 MHz processor).

It seems to have no problem doing this. Although I hadn't thought about it, it is asking a lot of the Athlon PLL. I may just be getting lucky.

Its rock stable at either frequency and I'm glad I'm not trying the conservative governor because it will use intermediate values and I wonder how lucky I'd get with the PLL...

I wonder what the specs say about the Athlon PLL's minimum frequency... I guess it depends on how they are doing the M/N frequencies, it would be completely legal for them to crank up the top then divide with a larger number to get the 12.5 multiplier, but I'm pretty sure that the 12.5 is set in silicon and not adjustable.

I wonder why it works for me...

Makes me want to move my Mobile Athlon XP 2500+ with unlocked multiplier into it, however I won't do that as that proc posts at 2600 MHz. Only prime stable at 2300 MHz (too bad).

So theoretically I should be running a minumum frequency of 1250 MHz for a 100 MHz FSB.

Hmmm. Any suggestions? Am I risking things? This is my server, it has 160GB RAID1 with all my pictures and writings on it... I wonder if its in jeopardy...

Raydude

----------

## RayDude

I just realized, I'm not using the ondemand governor on this machine. I'm using cpudyn which changes from performance to powersave governors according to load.

That may make some difference.

Raydude

----------

## RayDude

Bump.

I'm still having a hell of a time... cpudynd is flakey. ondemand is flakey. My fans are running right now even though the CPU is supposed to be running 1200 MHz. This is just not working correctly.

I have caught it lying to me I know that the fans will not run fast and continuously if the cpu is clocked down to 1200 MHz (and lowered voltage), but I can hear them running now.

The fans run too much of the time and if I unplug, the KDE battery monitor indicates that I have just over an hour of power, when I should have well over two hours...

This is simply not working and I'm just a few moments from filing a bug... I don't know where to file it though there's no gentoo-sources in the bug list.

I'm also considering going back to a 2.6.11 kernel because they were rock steady in this regard.

Anyone have any ideas? This is the last hurdle for my Inspiron 8200...

Raydude

----------

