使用 cpufreq 手动设置的 CPU 频率在睡眠后似乎不再有效

使用 cpufreq 手动设置的 CPU 频率在睡眠后似乎不再有效

我已将 CPU 的 4 个核心的频率设置Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz为较低的值 ( 800Mhz),以便在现场使用计算机时节省能源,使用以下命令:

for i in {0..3}; do sudo cpufreq-set -c ${i} -g powersave --min 500Mhz --max 800Mhz; done

第一次运行它就成功了,如下所示watch -n2 'cat /proc/cpuinfo | grep -i "mhz"'

Every 20.0s: cat /proc/cpuinfo | grep -i "mhz"     
Mon Oct 19 06:15:37 2020
cpu MHz         : 798.686
cpu MHz         : 798.694
cpu MHz         : 799.514
cpu MHz         : 798.860

过了一会儿,我合上了盖子,笔记本电脑(Lenovo T440s / Ubuntu 16.04 4.15.0-120-generic x86_64 GNU/Linux+ 另一台在 Ubuntu 18.04 上出现同样问题的笔记本电脑5.4.0-48-generic x86_64 GNU/Linux)照常进入睡眠状态。
几个小时后我把它拿回来,命令似乎不再有效,所以我再次运行它,但现在监视过程总是显示高于允许的频率:

Every 20.0s: cat /proc/cpuinfo | grep -i "mhz" 
Mon Oct 19 12:18:39 2020
cpu MHz         : 2341.501
cpu MHz         : 2261.700
cpu MHz         : 2249.787
cpu MHz         : 2117.165

那时的 CPU 负载实际上不会超过 1-2%。

我还检查了$ sudo 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: 4294.55 ms.
  hardware limits: 800 MHz - 3.30 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 800 MHz and 800 MHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 2.11 GHz.

(所有 4 个核心显示相同)

相同类型的输出如下所示$ sudo cpupower frequency-info

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:  Cannot determine or is not supported.
  hardware limits: 800 MHz - 3.30 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 800 MHz and 800 MHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 2.25 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

这两个命令显示的内容与解析一些 CPU 文件的命令基本相同:

$ cd /sys/devices/system/cpu/cpu0/cpufreq && paste <(ls *) <(cat *)
affected_cpus   0
cpuinfo_max_freq    3300000
cpuinfo_min_freq    800000
cpuinfo_transition_latency  0
related_cpus    0
scaling_available_governors performance powersave
scaling_cur_freq    2241317
scaling_driver  intel_pstate
scaling_governor    powersave
scaling_max_freq    800000
scaling_min_freq    800000
scaling_setspeed    <unsupported>

问题

我该如何修复它(即让它在进入/退出挂起/睡眠模式时工作)?

编辑:

有关英特尔 pstates 的信息:
$ cd /sys/devices/system/cpu/intel_pstate/ && paste <(ls *) <(cat *)

max_perf_pct    30
min_perf_pct    15
no_turbo         1
num_pstates     28
status      active
turbo_pct       25

相关内容