我的笔记本电脑(Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz)上的 CPU 频率调节功能无法正常工作。在首次安装 ubuntu 16.04 后,我没有对电源管理或 CPU 频率调节功能进行任何更改。通常我习惯使用 ondemand 调节器。然而,似乎在较新的内核中,该调节器已被某些 pstate 功能和 powersave 调节器所取代。
即使没有负载,CPU 频率也会在 2.x 范围内徘徊,从而导致风扇噪音和设备发热:
$ cat /proc/cpuinfo |grep -i mh
cpu MHz : 3435.468
cpu MHz : 2245.468
cpu MHz : 2800.218
cpu MHz : 2338.765
cpu MHz : 2800.546
cpu MHz : 2801.203
cpu MHz : 2800.875
cpu MHz : 2000.140
$ uptime
14:57:49 up 5:15, 1 user, load average: 0,01, 0,08, 0,16
$ 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 - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.80 GHz.
analyzing CPU 1:
driver: intel_pstate
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.80 GHz.
analyzing CPU 2:
driver: intel_pstate
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.79 GHz.
analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.80 GHz.
analyzing CPU 4:
driver: intel_pstate
CPUs which run at the same hardware frequency: 4
CPUs which need to have their frequency coordinated by software: 4
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.80 GHz.
analyzing CPU 5:
driver: intel_pstate
CPUs which run at the same hardware frequency: 5
CPUs which need to have their frequency coordinated by software: 5
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.78 GHz.
analyzing CPU 6:
driver: intel_pstate
CPUs which run at the same hardware frequency: 6
CPUs which need to have their frequency coordinated by software: 6
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.90 GHz.
analyzing CPU 7:
driver: intel_pstate
CPUs which run at the same hardware frequency: 7
CPUs which need to have their frequency coordinated by software: 7
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 2.79 GHz.
奇怪的是,我还观察到了相反的行为:机器处于高负载状态,但频率一直在降低,直到大约 20-30 秒后,所有核心都达到 ~ 800MHz。我使用 cpufreq-info 进行了检查,配置似乎很好(省电调节器,最小/最大频率处于适当水平)。遗憾的是,我无法重现错误...
知道是什么原因导致了这些扩展问题或可以采取什么措施来解决这些问题吗?
答案1
概括
是的,在某些情况下,当前版本的 intel_pstate 驱动程序可以在相当轻的负载下提高 CPU 频率。但是,通常情况下,这不会导致“风扇噪音大和设备发热”,因为相关 CPU 的工作速度更快,因此会花更多时间处于深度睡眠状态,从而抵消更高的有效功率。我只能将大约 1/2 瓦的额外封装功率归因于此问题。
至于问题的第二部分,关于在高负载下降低 CPU 频率。我只能假设这涉及到某种热节流。
细节
定义“无负载”或“空闲”非常重要。为什么?因为在基于 GUI 的系统上,“空闲”实际上有大量工作要做。在非基于 GUI 服务器的系统上,“空闲”通常实际上意味着几乎没有工作要做。
在基于 GUI 的系统上,此问题的表现取决于:内核的 Hz 速率(100、250、300 或 1000 Hz);视频驱动程序的帧速率;正在进行的后台工作量;调度程序在 CPU 之间轮换的方式;我现在忘记的一些其他事情。
虽然已经添加了临时修复,但它仅涵盖 1% 或更低的实际负载,但负载超过 1% 时也会出现这种情况。另外,我不知道该修复是否已包含在当前的 16.04 内核中,或者是否已反向移植到当前的 16.04 内核中。
更好的修复正在进行中,但发布之前可能还需要一段时间。
在此期间,如果需要,您可以返回 acpi-cpufreq 驱动程序。请参阅这里或者这里如何。
参考
https://bugzilla.kernel.org/attachment.cgi?id=187781
https://bugzilla.kernel.org/show_bug.cgi?id=93521
https://bugzilla.kernel.org/show_bug.cgi?id=115771
http://marc.info/?l=linux-pm&m=147000845531378&w=2
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ffb810563c0c049872a504978e06c8892104fb6c