# [solved] can't change scaling governor

## matroskin

Hi

I'm trying to change scaling governor and get "invalid argument" error.. Actually I can't change any value under cpufreq directory. While I run ubuntu on that comp, everything works.

Here is a bash session

```

# uname -a

Linux localhost 3.14.3-aufs-r1-rt4 #2 SMP PREEMPT RT Tue Oct 21 17:31:40 IDT 2014 i686 Intel(R) Core(TM) i7-3612QE CPU @ 2.10GHz GenuineIntel GNU/Linux

# cd /sys/devices/system/cpu/cpu0/cpufreq

# pwd

/sys/devices/system/cpu/cpu0/cpufreq

# grep "" *

affected_cpus:0

bios_limit:2101000

cpuinfo_cur_freq:2101000

cpuinfo_max_freq:2101000

cpuinfo_min_freq:1200000

cpuinfo_transition_latency:10000

freqdomain_cpus:0 1 2 3 4 5 6 7

related_cpus:0

scaling_available_frequencies:2101000 2100000 2000000 1900000 1800000 1700000 1600000 1500000 1400000 1300000 1200000 

scaling_available_governors:conservative ondemand userspace powersave performance 

scaling_cur_freq:2101000

scaling_driver:acpi-cpufreq

scaling_governor:performance

scaling_max_freq:2101000

scaling_min_freq:1200000

scaling_setspeed:<unsupported>

# echo ondemand > scaling_governor

-bash: echo: write error: Invalid argument

# echo performance > scaling_governor

-bash: echo: write error: Invalid argument

# echo 2000000 > scaling_max_freq

-bash: echo: write error: Invalid argument

# grep FREQ /boot/config-3.14.3-aufs-r1-rt4

CONFIG_CPU_FREQ=y

CONFIG_CPU_FREQ_GOV_COMMON=y

CONFIG_CPU_FREQ_STAT=y

CONFIG_CPU_FREQ_STAT_DETAILS=y

CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

CONFIG_CPU_FREQ_GOV_POWERSAVE=y

CONFIG_CPU_FREQ_GOV_USERSPACE=y

CONFIG_CPU_FREQ_GOV_ONDEMAND=y

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

CONFIG_X86_PCC_CPUFREQ=y

CONFIG_X86_ACPI_CPUFREQ=y

# CONFIG_X86_ACPI_CPUFREQ_CPB is not set

# CONFIG_X86_AMD_FREQ_SENSITIVITY is not set

# CONFIG_X86_CPUFREQ_NFORCE2 is not set

# CONFIG_PM_DEVFREQ is not set

```

----------

## netixen

Try 

```
cpufreq-set -c0 -g ondemand
```

----------

## Roman_Gruber

for some reason only cpupower works here.

example

```
localhost roman # cpupower frequency-set -g ondemand

Setting cpu: 0

Setting cpu: 1
```

----------

## matroskin

Thank you for the answers, but both cpupower and cpufreq-set  fails

----------

## Roman_Gruber

well you could compare ubutnu kernel config with your current kernel config and check wheres the difference.

also check which modules are loaded in both distributions and compare.

also maybe a userspace issue. ... could be /dev related too but thats just a guess

----------

## matroskin

Well, I think I came close to the answer - the config is ok, the combination of patches brings problem

I run kernel with aufs and RT patch

kernel with RT patch alone works ok

Kernel with aufs patch alone works ok

The problem arise only on a kernel with both patches

----------

## matroskin

The final answer is this: the RT kernel prevents changing scaling governor

Here is an explanation found on RT mailing list discussing exactly same problem

Thread http://www.spinics.net/lists/linux-rt-users/msg12170.html

They dug into the code and found that RT patch holds additional lock preventing taking semaphore needed to change a governor. Calling code returns EINVAL if taking semaphore fails - this is the reason for "invalid argument" error

Details are here http://www.spinics.net/lists/linux-rt-users/msg12207.html

----------

