Bug 27191 - Kernel upgrade makes powersave CPU governor not work correctly
Summary: Kernel upgrade makes powersave CPU governor not work correctly
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard: FOR_RELEASE_NOTES
Keywords:
: 28173 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-24 21:56 CEST by Davide Nifosi
Modified: 2021-01-20 15:58 CET (History)
5 users (show)

See Also:
Source RPM: kernel-5.8.3-1.mga8.src.rpm
CVE:
Status comment:


Attachments

Description Davide Nifosi 2020-08-24 21:56:31 CEST
Description of problem:

After upgrading from kernel-desktop-5.7.12-1.mga8, with the powersave CPU governor (Intel Sandy Bridge CPU laptop) the clock always stays low (at about 800 MHz) even when doing intensive work: this obviously slows down all activities and is most noticeable with Web videos and games

Version-Release number of selected component (if applicable): kernel-desktop-5.8.3-1.mga8


How reproducible: always


Steps to Reproduce:
1. set the CPU governor to powersave (cpupower frequency-set -g powersave)
2. launch a program or an activity that uses a lot of CPU resources (tried with the Twitch video player and an OpenGL game)
3. check the CPU frequency while the program is running (cpupower frequency-info): it will always report around 800 MHz; booting with kernel-desktop-5.7.12-1.mga8, it will report higher frequencies (over 1 GHz)
Comment 1 Aurelien Oudelet 2020-08-25 00:18:17 CEST
Hi, thanks reporting this.

I launch as root this:
# watch -n 1  cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Values returned says 800 Mhz at min but also shows update and better frequencies, when doing something within UI. No latency, no lag.

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 94
model name      : Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
stepping        : 3
microcode       : 0xd6
cpu MHz         : 800.000
cache size      : 6144 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds
bogomips        : 6999.82
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

$ cpupower frequency-info
analyse du 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.
  limitation matérielle : 800 MHz - 3.90 GHz
  régulateurs disponibles : performance powersave
  tactique actuelle : la fréquence doit être comprise entre 800 MHz et 3.90 GHz.
                  Le régulateur "powersave" est libre de choisir la vitesse
                  dans cette plage de fréquences.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 800 MHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

I'm able to set governor performance
# cpupower frequency-set --governor performance
# watch -n 1  cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

returns good boost frequencies.

Are you able to change governor and set it to performance?
Comment 2 Dave Hodgins 2020-08-25 02:01:03 CEST
Based on the description, shouldn't the ondemand cpupower setting be used?
I expect the powersave to always keep the cpu at it's lowest setting to minimize
battery usage.

CC: (none) => davidwhodgins

Comment 3 Aurelien Oudelet 2020-08-25 07:27:57 CEST
@Dave, on-demand governor is ni longer provided.

$ cpupower frequency-info
shows that there are only powersave and performance governors available for this processor.
Comment 4 Dave Hodgins 2020-08-25 07:42:27 CEST
(In reply to Aurelien Oudelet from comment #3)
> @Dave, on-demand governor is ni longer provided.
> 
> $ cpupower frequency-info
> shows that there are only powersave and performance governors available for
> this processor.

Ouch. On my system ...
# cpupower frequency-info|grep governors
  available cpufreq governors: conservative userspace powersave ondemand performance schedutil

With the prior kernel, is ondemand available? If it is, then that should help
narrow down where the problem is.
Comment 5 Davide Nifosi 2020-08-25 11:53:06 CEST
Currently on kernel 5.7.12, only performance and powersave are available on my system. With kernel 5.8.3 I could set the governor to performance and get the usual performance, of course with more power usage; I've been on 'powersave' since like Mageia 2 and have never seen this issue before
Comment 6 Davide Nifosi 2020-08-25 14:02:38 CEST
Just rebooted to kernel 5.8.3 and saw that cpupower frequency-info reports a lot more CPU governors available:

conservative
userspace
powersave
ondemand
performance
schedutil

Pretty sure this is the first time this happens; I doubt my old "Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz" supports them, and I've also checked the 5.8 kernelnewbies page to see if support was added, but couldn't find anything about it.

With kernel 5.8.3 and governor 'ondemand', the MHz fluctuate, but stay generally higher than with kernel 5.7.12 + powersave (always above 1 GHZ while doing essentially nothing).

Please let me know if you need any more information
Comment 7 Aurelien Oudelet 2020-08-25 14:31:03 CEST
Assigned to the Kernel and Drivers Team.
(Please set the status to 'assigned' if you are working on it)

Keywords: (none) => Triaged
Assignee: bugsquad => kernel

Comment 8 Pascal Terjan 2020-08-25 14:35:18 CEST
If using intel_pstate (for Sandy Bridge and newer Intel cpus), only performance and powersave are supported, but performace gives frequency scaling.

https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html

Keywords: Triaged => (none)
CC: (none) => pterjan
Assignee: kernel => bugsquad

Comment 9 Pascal Terjan 2020-08-25 14:37:10 CEST
When using powersave, behaviour is described at https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#powersave and depends on a lot of things :(
Comment 10 Pascal Terjan 2020-08-25 14:45:29 CEST
So there were quite a few changes regarding this in 5.8, most importantly https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=33aa46f252c703e42c81a76696cd0c240f2281e4

So the default behaviour changed on CPUs without hardware-managed P-states (HWP) support, and you would need to add intel_pstate=active to restore previous behaviour.
Comment 11 Aurelien Oudelet 2020-08-25 15:00:48 CEST
This is clear.
On my system: journalctl -b --no-pager --no-hostname | grep intel

kernel: intel_pstate: Intel P-state driver initializing
kernel: intel_pstate: HWP enabled

So all functions normally.

What about you @Davide?
Comment 12 Davide Nifosi 2020-08-25 16:07:13 CEST
In my journal I can only see the first line (Intel P-state driver initializing), never the second one, neither with the 5.7.12 kernel nor with the 5.8.3 one, not even after adding intel_pstate=active to the kernel parameters.

However, adding intel_pstate=active seems to work fine for me on powersave: minimums as low as 800 MHz and good performance when needed, like before. As far as I'm concerned, this is solved, but let me know if you need more tests
Comment 13 Aurelien Oudelet 2020-08-25 16:19:25 CEST
No need further tests. This works as expected. Thanks.

I think this should be documented in release notes for Mageia 8
Comment 14 Lewis Smith 2020-08-25 21:49:27 CEST
Thanks to all contributors & investigators, notably Pascal's comments 8-9-10.
> So there were quite a few changes regarding this in 5.8
> the default behaviour changed on CPUs without hardware-managed P-states (HWP)
> support, and you would need to add intel_pstate=active to restore previous
> behaviour
-----------
> adding intel_pstate=active seems to work fine for me on powersave:
> minimums as low as 800 MHz and good performance when needed, like before.
= resolved/fixed

Resolution: (none) => FIXED
Status: NEW => RESOLVED
Whiteboard: (none) => FOR_RELEASE_NOTES
CC: (none) => lewyssmith

Comment 15 Morgan Leijström 2020-08-28 17:29:08 CEST
Not sure it should be closed until it *is* in release notes?

CC: (none) => fri

Comment 17 Aurelien Oudelet 2021-01-20 15:58:32 CET
*** Bug 28173 has been marked as a duplicate of this bug. ***

CC: (none) => mageia


Note You need to log in before you can comment on or make changes to this bug.