无法使用“用户空间”cpufreq 调节器并设置 cpu 频率

无法使用“用户空间”cpufreq 调节器并设置 cpu 频率

我正在尝试更改笔记本电脑(运行 Linux)上的 cpu 频率,但没有成功。
以下是一些细节:

# uname -a
Linux yoga 3.12.21-gentoo-r1 #4 SMP Thu Jul 10 17:32:31 HKT 2014 x86_64 Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz GenuineIntel GNU/Linux

# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], 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: 800 MHz - 2.60 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 2.60 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 2.42 GHz (asserted by call to hardware).
(similar information for cpus 1, 2 and 3)

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave

我最初将用户空间调控器内置到内核中,但后来我也尝试将其构建为模块(具有相同的结果);它是在运行上述命令时加载的(加载时我找不到任何系统消息):

# lsmod
Module                  Size  Used by
cpufreq_userspace       1525  0
(some other modules)

以下是我尝试更改频率的命令:

# cpufreq-set -f 800MHz
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?

# cpufreq-set -g userspace  
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?

有任何想法吗?

答案1

这是因为您的系统正在使用名为的新驱动程序intel_pstate。使用此驱动程序时只有两个调速器可用:powersaveperformance。调速
userspace仅适用于较旧的驱动程序(如果您在启动时acpi-cpufreq禁用,则会自动使用调速器;然后使用 设置调速器/频率):intel_pstatecpupower

  • 禁用当前驱动程序:添加intel_pstate=disable到您的内核引导行
  • 启动,然后加载userspace模块:modprobe cpufreq_userspace
  • 设置州长:cpupower frequency-set --governor userspace
  • 设置频率:cpupower --cpu all frequency-set --freq 800MHz

答案2

答案就在你的问题中:

for core in $(seq 0 "$(($(getconf _NPROCESSORS_ONLN) - 1))"); do
echo {performance|powersave} >/sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor ;
done

它和内核必须在启用用户空间调控器的情况下进行编译。

相关内容