如何解决cpufreqset错误

use*_*242 6 kernel driver frequency cpu-speed

我想改变CPU频率。我已经安装了 cpufrequtils。命令“ cpufreq-info”给我信息

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.
Run Code Online (Sandbox Code Playgroud)

当我尝试运行命令时:“ sudo cpufreq-set -f 1500000”。我收到错误:

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?
Run Code Online (Sandbox Code Playgroud)

您能给出如何解决这个问题的想法吗?

Wei*_*hen 7

直接 HOWTO 答案

  1. 在 grub 配置文件中禁用 intel_pstate:

    $ sudo vi /etc/default/grub
    
    Run Code Online (Sandbox Code Playgroud)

    将“intel_pstate=disable”附加到 GRUB_CMDLINE_LINUX= 选项

  2. 刷新grub启动配置文件:

    对于Ubuntu:

    $ sudo update-grub
    
    Run Code Online (Sandbox Code Playgroud)

    对于费多拉:

    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    
    Run Code Online (Sandbox Code Playgroud)
  3. 重启。

    $ sudo reboot
    
    Run Code Online (Sandbox Code Playgroud)
  4. 将 CPU 电源调节器设置为用户空间:

    $ sudo cpupower frequency-set --governor userspace
    
    Run Code Online (Sandbox Code Playgroud)
  5. 设置CPU频率:

    $ sudo cpupower --cpu all frequency-set --freq 1.5GHz
    
    Run Code Online (Sandbox Code Playgroud)
  6. 核实:

    $ cpupower frequency-info
    
    Run Code Online (Sandbox Code Playgroud)

    您应该看到一行:“当前 CPU 频率为 1.50 GHz。”

详细答案

无法设置CPU频率的原因是您使用的驱动程序是“intel_pstate”,该驱动程序现在是默认驱动程序,仅提供“性能”和“省电”策略。它们都不支持从用户空间直接操作 CPU 频率。最近的 Intel CPU 还实现了硬件 P-States,这是一个硬件模块,可以减轻 CPU 使用情况监控和直接在 CPU 芯片中调节 P 状态的负担。

因此,为了按照您的意愿控制频率,可以选择禁用“intel_pstate”驱动程序并使用较旧的“ acpi-cpufreq ”驱动程序,该驱动程序具有“用户空间”策略,允许从用户空间控制 CPU 频率。

由于最近的 Linux 内核将“intel_pstate”直接构建到内核中而不是作为模块,因此没有简单的方法来“rmmod”它。因此,您必须提供内核命令行参数“intel_pstate=disable”才能执行此操作。

更多信息

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


小智 0

尝试 sudo cpufreq-set -g 性能