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


22

我试图更改笔记本电脑(运行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 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: 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?

有任何想法吗?


@don_crissti谢谢,呵呵,我尝试echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo了一下,立即引起了内核恐慌:p然后我重新启动,intel_pstate=disable现在它正在使用acpi-cpufreq,但我仍然无法设置频率(尽管我不再收到错误消息了)。顺便说一句,为什么不将您的评论作为答案?
aditsu

@don_crissti我对cpupower不了解;它的语法有点令人讨厌,但似乎比cpufreq更好。我现在可以设置频率了:)非常感谢,并记得发布答案(除非您真的不想要分数)。
aditsu

Answers:


41

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

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

谢谢,顺便说一句,频率设定似乎在没有的情况下也能做同样的事情--cpu all
aiditsu

3
使用较旧的驱动程序肯定有一些缺点。这些是什么?
kontextify

2
@kontextify更加高兴的用户,不太愿意自愿充当试验新版本的实验鼠。
Mephisto

0

答案在您的问题中:

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

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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.