自从我上一个关于这个主题的问题以来:无法使用“userspace”cpufreq 调节器并设置 cpu 频率,我升级了内核几次,然后遇到了另一个问题:cpupower 似乎没有以可靠的方式显示和设置 cpu 频率。
首先,一些信息:
# uname -a
Linux yoga 4.0.5-gentoo #3 SMP Tue Jul 21 08:43:04 HKT 2015 x86_64 Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz GenuineIntel GNU/Linux
# cpupower frequency-info
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 10.0 us.
hardware limits: 782 MHz - 1.70 GHz
available frequency steps: 1.70 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz, 1.10 GHz, 1000 MHz, 900 MHz, 800 MHz, 782 MHz
available cpufreq governors: conservative, ondemand, powersave, userspace, performance
current policy: frequency should be within 782 MHz and 1.70 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 1.70 GHz (asserted by call to hardware).
cpufreq stats: 1.70 GHz:90.12%, 1.70 GHz:0.00%, 1.60 GHz:0.64%, 1.50 GHz:0.00%, 1.40 GHz:0.00%, 1.30 GHz:0.00%, 1.20 GHz:0.00%, 1.10 GHz:0.00%, 1000 MHz:0.00%, 900 MHz:0.00%, 800 MHz:0.00%, 782 MHz:9.25% (267)
boost state support:
Supported: yes
Active: yes
2400 MHz max turbo 4 active cores
2400 MHz max turbo 3 active cores
2400 MHz max turbo 2 active cores
2600 MHz max turbo 1 active cores
现在奇怪的事情是:
# cpupower frequency-info|grep -P "The governor|CPU frequency"
The governor "performance" may decide which speed to use
current CPU frequency is 1.70 GHz (asserted by call to hardware).
# grep MHz /proc/cpuinfo
cpu MHz : 1701.000
cpu MHz : 1701.000
cpu MHz : 1701.000
cpu MHz : 1701.000
# cpupower frequency-set -f 800
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
# cpupower frequency-info|grep -P "The governor|CPU frequency"
The governor "userspace" may decide which speed to use
current CPU frequency is 1.70 GHz (asserted by call to hardware).
# grep MHz /proc/cpuinfo
cpu MHz : 782.000
cpu MHz : 782.000
cpu MHz : 782.000
cpu MHz : 782.000
# cpupower frequency-set -f 1700
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
# cpupower frequency-info|grep -P "The governor|CPU frequency"
The governor "userspace" may decide which speed to use
current CPU frequency is 1.70 GHz (asserted by call to hardware).
# grep MHz /proc/cpuinfo
cpu MHz : 782.000
cpu MHz : 782.000
cpu MHz : 782.000
cpu MHz : 782.000
# cpupower frequency-set -g performance
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
# cpupower frequency-info|grep -P "The governor|CPU frequency"
The governor "performance" may decide which speed to use
current CPU frequency is 1.70 GHz (asserted by call to hardware).
# grep MHz /proc/cpuinfo
cpu MHz : 1701.000
cpu MHz : 1701.000
cpu MHz : 1701.000
cpu MHz : 1701.000
总结一下:
- 当我将频率设置为800时,cpupower将其设置为782,并说它仍然是1700(通过调用硬件来断言!)
- 当我将频率设置回 1700 时,cpupower 没有执行任何操作(仍然显示为 1700)
- 当我将调速器设置为“性能”时,cpupower最终将频率设置为1700
有没有办法让cpupower可靠工作?或者这是一个错误?
答案1
好吧,这有点尴尬......发布问题后不久,我开始研究更多细节,发现我实际上应该在我的数字中添加“MHz”,因为默认单位似乎是kHz。
现在命令cpupower frequency-set -f 800MHz
和cpupower frequency-set -f 1700MHz
似乎可以可靠地工作并cpupower frequency-info
显示预期的信息。
仍然存在一件无法解释的事情:cpupower frequency-info
当实际频率为 782 MHz 时,显示为 1.70 GHz。即使我使用cpupower frequency-set -f 782MHz
.