![使用 cpupower 设置 CPU 频率无效](https://linux22.com/image/1199941/%E4%BD%BF%E7%94%A8%20cpupower%20%E8%AE%BE%E7%BD%AE%20CPU%20%E9%A2%91%E7%8E%87%E6%97%A0%E6%95%88.png)
我在桌面版 Ubuntu 22.04.3、23.10、常规版和lowlatency
版本上尝试过。我必须增加核心的最低频率,该核心运行需要高 CPU 时钟的图像捕获过程。以下是示例:
paul@box4x4:~$ sudo cpupower -c 5 frequency-set -d 3000MHz
Setting cpu: 5
它设置了核心#5的最小频率,但是实际频率不会改变:
paul@box4x4:~/profiler$ cpupower -c 5 frequency-info
analyzing CPU 5:
driver: amd-pstate-epp
CPUs which run at the same hardware frequency: 5
CPUs which need to have their frequency coordinated by software: 5
maximum transition latency: Cannot determine or is not supported.
hardware limits: 400 MHz - 5.58 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 3.00 GHz and 5.58 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 400 MHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: no
并保持缓慢的 400MHz。我做错了吗?还有其他方法和工具可以实现它吗?希望不是太麻烦。
我在这里看到的一个危险信号是虚假的最大频率 5.58GHz。这是不可能的。4.9GHz 是我使用的 AMD Ryzen 5 7640U CPU 的最大睿频频率。
我在 Intel N100 PC 上进行了健全性测试,它似乎在那里运行:
paul@cube:~$ sudo cpupower -c 3 frequency-info
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: Cannot determine or is not supported.
hardware limits: 700 MHz - 3.40 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 3.40 GHz and 3.40 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 3.30 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes
核心 #3 频率达到要求的 3.4GHz,但使用 监控时有时读数会较低watch grep \"cpu MHz\" /proc/cpuinfo
。不过,这比 AMD CPU 上的结果要好得多。
答案1
这里的问题是driver: amd-pstate-epp
。它试图表现得过于聪明,所以让我们禁用它:
sudo vim /etc/default/grub
- 找到以下行
GRUB_CMDLINE_LINUX_DEFAULT=
- 在双引号内添加
amd_pstate=disable
。如果还有其他项目,请将其添加到末尾,并用空格将其与前面的项目分开。 - 保存并退出
- 跑步
sudo update-grub
reboot
- 重试原始操作
sudo cpupower -c 5 frequency-set -d 3000MHz
EPPamd-pstate-epp
代表energy_performance_preference
。它还可能与“以相同硬件频率运行的 CPU [...并且...] 需要通过软件协调其频率”有某种交互。根据文档,
如果软件想要向 CPPC 固件偏向性能(0x0)或能源效率(0xff),amd_pstate_epp 驱动程序会向硬件提供提示。然后 CPPC 功率算法将计算运行时工作负载并根据电源和热量、核心电压和其他一些硬件条件调整实时核心频率。
其余模式类似。amd-pstate
属性控制它将使用哪种策略(如果有的话)。
该acpi-cpufreq
驱动程序是旧版。它通常只执行您指示的操作。在这种情况下,您确实希望“增加核心的最低频率”,因为您知道它将用于“图像捕获过程”,因此您需要此驱动程序。