Bug 1201013 - intel_pstate: cpu frequency is always above maximum
Summary: intel_pstate: cpu frequency is always above maximum
Status: CONFIRMED
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: Kernel (show other bugs)
Version: Leap 15.4
Hardware: x86-64 Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Giovanni Gherdovich
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-29 14:48 UTC by Alihan Turan
Modified: 2022-09-23 19:15 UTC (History)
5 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
turbostat output (23.22 KB, text/plain)
2022-07-21 07:25 UTC, Alihan Turan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alihan Turan 2022-06-29 14:48:31 UTC
With intel_pstate driver, the cpu frequency never goes under maximum frequency but may go under turbo frequency so it is in range 2.80GHz - 3.40GHz.

Intel® Core™ i5-4200H CPU @ 2.80GHz

with no kernel parameters:

$ 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.40 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 800 MHz and 3.40 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.21 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

$ grep MHz /proc/cpuinfo
cpu MHz		: 2793.606
cpu MHz		: 3058.532
cpu MHz		: 2793.606
cpu MHz		: 2793.606

with intel_pstate=disable:

$ 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: 800 MHz - 2.80 GHz
  available frequency steps:  2.80 GHz, 2.80 GHz, 2.70 GHz, 2.50 GHz, 2.40 GHz, 2.20 GHz, 2.10 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.50 GHz, 1.40 GHz, 1.20 GHz, 1.10 GHz, 900 MHz, 800 MHz
  available cpufreq governors: ondemand performance schedutil
  current policy: frequency should be within 800 MHz and 2.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.03 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

$ grep MHz /proc/cpuinfo
cpu MHz		: 800.000
cpu MHz		: 1073.813
cpu MHz		: 1100.000
cpu MHz		: 800.000

$ uname --kernel-release --kernel-version
5.14.21-150400.22-default #1 SMP PREEMPT_DYNAMIC Wed May 11 06:57:18 UTC 2022 (49db222)
Comment 3 Giovanni Gherdovich 2022-07-19 13:27:02 UTC
Hello, I agree this behavior looks suspicious. Can you let the following command run for 10-20 seconds, capture its output and attach it here? You'll stop it with CTRL+c.

  turbostat --interval 1

That command is from the "cpupower" package. You have a CPU from the Haswell generation, which doesn't have the SpeedShift feature, so the clock frequency is entirely controlled by Linux. In the turbostat output I'll look at the various power management settings it shows, and then at the Busy% column (share of time the CPU isn't in idle state). That's the signal used to set the clock frequency, using the formula

  freq = Busy% * max_turbo_freq * 1.25

From the output you'll post, we'll see why that isn't working.
Comment 4 Alihan Turan 2022-07-21 07:25:52 UTC
Created attachment 860300 [details]
turbostat output
Comment 5 Giovanni Gherdovich 2022-07-21 11:57:17 UTC
Thanks for the output, I'm changing the status to "confirmed". Turbostat shows the minimum and nominal clock frequency,

8 * 100.0 = 800.0 MHz max efficiency frequency
28 * 100.0 = 2800.0 MHz base frequency

and the BzyMHz column (average freq when not idle) looks a little high, it should probably be closer to 800MHz.

Core    CPU     Avg_MHz Busy%  Bzy_MHz  . . .  C7s%    
-       -       7       0.27   2583            99.62   
0       0       9       0.35   2528            99.53   
0       2       7       0.27   2471            99.64   
1       1       8       0.31   2659            99.57   
1       3       4       0.16   2736            99.73   
			               
Core    CPU     Avg_MHz Busy%  Bzy_MHz         C7s%    
-       -       7       0.26   2588            99.51   
0       0       9       0.36   2573            99.13   
0       2       9       0.35   2456            99.56   
1       1       7       0.26   2734            99.57   
1       3       3       0.09   2736            99.79   
			               
Core    CPU     Avg_MHz Busy%  Bzy_MHz         C7s%    
-       -       11      0.45   2501            99.42   
0       0       19      0.89   2109            98.91   
0       2       6       0.22   2672            99.70   
1       1       6       0.23   2776            99.63   
1       3       14      0.46   3048            99.45   

There could be a periodic task demanding CPU and terminating quickly. I need to come up with a debugging command or trace for you to run. I don't have it yet, I'll come back at you.

For the records, the machine is still idle 99.5% of the time; the anomaly is that when the CPUs wake up (in that 0.5% of time) they're going a tad faster than expected. Unless there is some actual work to do. As I'll think of a way to inquire on that, I'll let you know.
Comment 6 Bit Juggler 2022-08-22 16:16:56 UTC
Since Kernel 5.19 I see the same problem as OP.

My system

Operating System: openSUSE Tumbleweed 20220821
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.19.2-1-default (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-7820HK CPU @ 2.90GHz
Memory: 62.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630

I use gkrellm to monitor CPU, etc. and a systemd-service (calling cpupower on system startup) to limit the CPU frequency to a range from 800 to 2900 MHz.

Since Kernel 5.19 I see all cores running at the highest frequency all the time although the system is at 0-2% of CPU usage.

Starting the system with kernel parameter intel_pstate=disable brings the system back to normal (i.e. running at 800 MHz when CPU usage is close to 0).

Starting the system with Kernel 5.18.15 shows normal system behavior  (i.e. running at 800 MHz when CPU usage is close to 0).
Comment 7 Bit Juggler 2022-08-22 16:40:30 UTC
It might be worth noting that another system with (nearly) the identical software configuration but an Intel CoreTM i7-4790K Processor (8M Cache, up to 4.40 GHz) and half the memory does not show this behavior (i.e. works as expected).