6

I want to change the cpu frequency. I have install cpufrequtils. the command "cpufreq-info" give me information

cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 1.20 GHz - 2.40 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 1.20 GHz and 2.40 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.

when I try to run the command: "sudo cpufreq-set -f 1500000". I am getting error:

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?

Can you give any idea how to approach this problem?

Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156
user2805242
  • 155
  • 1
  • 11
  • 1
    This question appears to be off-topic because it is about configuring CPU governors under Linux. should be moved to unix.se – Matt Sieker Jul 23 '14 at 14:01

2 Answers2

6

Direct HOWTO answer

  1. Disable intel_pstate in grub configure file:

    $ sudo vi /etc/default/grub
    

    Append "intel_pstate=disable" to GRUB_CMDLINE_LINUX= option

  2. Refresh grub boot configuration file:

    For Ubuntu:

    $ sudo update-grub
    

    For Fedora:

    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    
  3. Reboot.

    $ sudo reboot
    
  4. Set CPU power governor to userspace:

    $ sudo cpupower frequency-set --governor userspace
    
  5. Set CPU frequency:

    $ sudo cpupower --cpu all frequency-set --freq 1.5GHz
    
  6. Verify:

    $ cpupower frequency-info
    

    You should see line: "current CPU frequency is 1.50 GHz."

Verbose Answer

The reason why you can't set CPU frequency is because of the driver you are using is "intel_pstate", which is the default driver now and only provides "performance" and "power save" policy. None of them supports directly manipulation of CPU frequency from user space. Also recent Intel CPU implements Hardware P-States, which is a hardware module that offloads monitoring CPU usage and regulating P states directly in CPU die.

So in order to control frequency as you wish, the option is to disable "intel_pstate" driver and use older "acpi-cpufreq" driver, which has "userspace" policy that allows CPU frequency control from userspace.

Since recent Linux Kernel build "intel_pstate" directly into the kernel instead of as a module, there is no easy way to "rmmod" it. So you have to provide kernel cmdline parameter "intel_pstate=disable" to do that.

More Info

https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt

Wei Shen
  • 2,014
  • 19
  • 17
  • To install `cpupower`, [this](https://unix.stackexchange.com/a/462083/54994) worked for me. – Garrett Jul 01 '21 at 22:44
  • Followed all the steps on my Dell Precision with Ubuntu 18.04. It seemed to all be going fine and the second last step said `Setting cpu: 0`, `Setting cpu: 1`, etc. Then when I did the final step, I got output: `current CPU frequency: Unable to call hardware` and below that `current CPU frequency: 581 MHz (asserted by call to kernel)`. – Garrett Jul 01 '21 at 22:46
  • `$ cpupower frequency-info` consider running this with sudo else the frequency readings might be wrong – lava_07 Mar 11 '22 at 15:21
0

Try sudo cpufreq-set -g performance

C.Jacobs
  • 11
  • 1