1

I have set the frequencies of the 4 cores of my Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz CPU to lower values (800Mhz) for energy saving when using the computer on the field using this command:

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

and it worked the first time I ran it, as shown by 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

After a while, I closed the lid, and the laptop (Lenovo T440s / Ubuntu 16.04 4.15.0-120-generic x86_64 GNU/Linux + another one where the same issue appears on Ubuntu 18.04 5.4.0-48-generic x86_64 GNU/Linux) went to sleep as usual.
I took it back a few hours later, and the command doesn't seem to be effective anymore, so I ran it again, but the watch process always shows higher-than-allowed frequencies now:

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

There isn't actually much than 1-2% CPU load at that time.

I also checked $ sudo cpufreq-info which shows the same high frequencies, which is strange because they are out of the allowed range for the powersave governor I set using the above command:

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: 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.

(all the 4 cores show the same)

A same kind of output is shown by $ 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

Both these commands show basically the same than this which parse some cpu files:

$ 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>

Question

How could I fix it (i.e. make it work across entering/exiting suspend/sleep modes)?

Edits:

Information about intel 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
s.k
  • 1,170
  • 2
  • 14
  • 44
  • Under/overclocking is really best handled by the motherboard firmware. Does your motherboard allow you to adjust clock speeds? – Nmath Oct 19 '20 at 11:38
  • There have been issues with the intel_pstate CPU frequency driver and limits through suspend. As a test try the latest [mainline kernel](https://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D) ([currently 5.9](https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.9/)) to determine is the issue has been fixed. Also, please edti your question adding the output from `grep . /sys/devices/system/cpu/intel_pstate/*`. – Doug Smythies Oct 19 '20 at 14:54
  • 2
    try this: `for i in {0..3}; do sudo cpufreq -set -c ${i} -g powersave --min 800Mhz --max 1000Mhz; done`. Why? I think, but am not sure, your issue is that the driver never thinks it has to ask for a different pstate, and so never corrects itself after the suspend. This will allow 3 pstates, 8,9,10, without much if any, energy cost. Whereas before only pstate 8 was in play. Note: I never use `cpufreq`, I just copied your command and made changes. – Doug Smythies Oct 19 '20 at 15:11
  • 1
    hmmm... those `/sys/devices/system/cpu/intel_pstate` numbers don't make sense. I would be interested to know your results from testing the mainline kernel. – Doug Smythies Oct 19 '20 at 19:05
  • 1
    Experiencing a very similar issue with an i9-11900h, have tried tlp, cpufreq, cpu power save, kernel adjustments, etc. I may try editing my grub to disable pstates and try again. – Tmanok Jan 12 '22 at 07:44

0 Answers0