# cant change my frequency via echo into scaling_setspeed P4HT

## johnnyICON

I am trying to adjust my CPU frequency, but when I try to change it via echo into scaling_setspeed I get permission denied. Why?

Take a look:

```
iconnb cpufreq # echo -n 1000000 > scaling_setspeed

-bash: scaling_setspeed: Permission denied
```

I am logged in as root as you should notice.

Any ideas?

----------

## Earthwings

You've got to enable the userspace governor before scaling_setspeed exists.

```

echo userspace > scaling_governor

echo 1000000 > scaling_setspeed
```

----------

## johnnyICON

I did that line as well, I should of mentioned that.

However, I suspect that I didnt enable userspace in my kernel because the powere management guide did not show it as compiled in or as a module. Could that be the reason?

----------

## darkfolk

I thought you had to use a userspace tool for that purpose? Check:

https://forums.gentoo.org/viewtopic.php?t=287989

----------

## johnnyICON

But do I need to enable the userspace governor in my kernel?

----------

## darkfolk

Yes you do.

Also set the default governor to (userspace).

----------

## johnnyICON

Does CPU Scaling work with HyperThreading/SMP?

I've managed to get past the permission denied problem by compiling userspace into the kernel, but I still do not see any changes in my frequency. The power management guide notes that there are problems with updating the frequency, so it tells me to emerge x86info. I don't think that did the trick either, you can have a look:

```
iconnb cpufreq # echo -n 1500000 > scaling_setspeed

iconnb cpufreq # grep "cpu MHz" /proc/cpuinfo

cpu MHz         : 3000.542

cpu MHz         : 3000.542
```

x86info -mhz:

```
iconnb cpufreq # x86info -mhz

x86info v1.12b.  Dave Jones 2001-2003

Feedback to <davej@redhat.com>.

Found 2 CPUs

--------------------------------------------------------------------------

CPU #1

/dev/cpu/0/cpuid: No such file or directory

Family: 15 Model: 2 Stepping: 9 Type: 0 Brand: 9

CPU Model: Pentium 4 (Northwood) [D1] Original OEM

Processor name string: Intel(R) Pentium(R) 4 CPU 3.00GHz

Instruction TLB: 4K, 2MB or 4MB pages, fully associative, 64 entries.

Data TLB: 4KB or 4MB pages, fully associative, 64 entries.

L1 Data cache:

        Size: 8KB       Sectored, 4-way associative.

        line size=64 bytes.

No level 2 cache or no level 3 cache if valid 2nd level cache.

Instruction trace cache:

        Size: 12K uOps  8-way associative.

L2 unified cache:

        Size: 512KB     Sectored, 8-way associative.

        line size=64 bytes.

Number of logical processors supported within the physical package: 0

3.0Ghz processor (estimate).

--------------------------------------------------------------------------

CPU #2

Family: 15 Model: 2 Stepping: 9 Type: 0 Brand: 9

CPU Model: Pentium 4 (Northwood) [D1] Original OEM

Processor name string: Intel(R) Pentium(R) 4 CPU 3.00GHz

Instruction TLB: 4K, 2MB or 4MB pages, fully associative, 64 entries.

Data TLB: 4KB or 4MB pages, fully associative, 64 entries.

L1 Data cache:

        Size: 8KB       Sectored, 4-way associative.

        line size=64 bytes.

No level 2 cache or no level 3 cache if valid 2nd level cache.

Instruction trace cache:

        Size: 12K uOps  8-way associative.

L2 unified cache:

        Size: 512KB     Sectored, 8-way associative.

        line size=64 bytes.

Number of logical processors supported within the physical package: 0

3.0Ghz processor (estimate).

--------------------------------------------------------------------------

WARNING: Detected SMP, but unable to access cpuid driver.

Used Uniprocessor CPU routines. Results inaccurate.
```

----------

## Earthwings

Can you emerge cpufrequtils and post the output of cpufreq-info?

----------

## darkfolk

After you emerge it, you should be able to see changes. (other progs do not see the Frequency change)

Or you could run:

```

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

# It's in hertz.

# or

cpufreq-info -c 0 -m -f
```

And yes, frequency scaling works with SMP/HT.

----------

## johnnyICON

#cpufreq-info:

```
iconnb root # cpufreq-info

cpufrequtils 0.2-pre1: cpufreq-info (C) Dominik Brodowski 2004

Report errors and bugs to linux@brodo.de, please.

analyzing CPU 0:

  driver: p4-clockmod

  CPUs which need to switch frequency at the same time: 0 1

  hardware limits: 375 MHz - 3.00 GHz

  available frequency steps: 375 MHz, 750 MHz, 1.13 GHz, 1.50 GHz, 1.88 GHz, 2.25 GHz, 2.63 GHz, 3.00 GHz

  available cpufreq governors: ondemand, powersave, userspace, performance

  current policy: frequency should be within 375 MHz and 3.00 GHz.

                  The governor "userspace" may decide which speed to use

                  within this range.

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

analyzing CPU 1:

  driver: p4-clockmod

  CPUs which need to switch frequency at the same time: 0 1

  hardware limits: 375 MHz - 3.00 GHz

  available frequency steps: 375 MHz, 750 MHz, 1.13 GHz, 1.50 GHz, 1.88 GHz, 2.25 GHz, 2.63 GHz, 3.00 GHz

  available cpufreq governors: ondemand, powersave, userspace, performance

  current policy: frequency should be within 375 MHz and 3.00 GHz.

                  The governor "userspace" may decide which speed to use

                  within this range.

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

#cpufreq-info -c 0 -m -f

```
iconnb root # cpufreq-info -c 0 -m -f

3.00 GHz
```

----------

## Earthwings

Can you get successfull changes using cpufreq-set?

----------

## johnnyICON

I will give it another try later tonight.

But until then what would you guys recommend me to use as a power management monitor program? Powernowd "supports" SMP/HT, or the author says it should theortically. Is powernowd the only program that has support for HT/SMP?

----------

## Earthwings

cpufreqd is the most powerful, though the default config file could be better. It's actively developed and therefore a good choice. Not sure about SMP support though.

I'm currently using speedfreq which is also nice, but I might give cpufreqd another chance soon.

----------

## wdconinc

 *darkfolk wrote:*   

> And yes, frequency scaling works with SMP/HT.

 

Correct, but the userspace programs (cpufreqd and cpudyn, at least here) don't handle it correctly (for cpudyn: a single job, running on 1 'cpu', will always have a load <50% and the frequency will stay low; cpufreqd didn't even start here).

However, you can try the governor 'ondemand'.  The scaling of cpu frequency is then handled by the cpu itself.  For info about the variables in /sys/.../cpufreq/ondemand see the intel speedstep page.

Wouter

----------

