AMD CPU frequency scheduler issues since kernel 4.19


(richard.llom) #1

Since 4.19 the schedutil governor is behaving strange on my AMD CPU. Basically it is always clocking around 4 GHz, although my load is only 30%. When I switch to ondemand the frequency goes to reasonable levels, see screenshot below.

However from what I gathered the schedutil governor is actually preferred and prior the update I was also using it with no problems.

Maybe an error with the acpi-cpufreq kernel module?
Can any other AMD user reproduce this issue?
Intel users are probably fine since intel have their own driver (intel_pstate).

$ sudo cpupower info
System does not support Intel's performance bias setting
analyzing CPU 0:

$ sudo 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: 4.0 us
  hardware limits: 1.70 GHz - 4.20 GHz
  available frequency steps:  4.20 GHz, 3.50 GHz, 3.00 GHz, 2.40 GHz, 1.70 GHz
  available cpufreq governors: performance schedutil
  current policy: frequency should be within 1.70 GHz and 4.20 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: 4.20 GHz (asserted by call to hardware)
  boost state support:
    Supported: yes
    Active: no
    Boost States: 3
    Total States: 8
    Pstate-Pb0: 4200MHz (boost state)
    Pstate-Pb1: 4200MHz (boost state)
    Pstate-Pb2: 4200MHz (boost state)
    Pstate-P0:  4200MHz
    Pstate-P1:  3500MHz
    Pstate-P2:  3000MHz
    Pstate-P3:  2400MHz
    Pstate-P4:  1700MHz

$ ls /usr/lib/modules/$(uname -r)/kernel/drivers/cpufreq/ 
acpi-cpufreq.ko.xz  amd_freq_sensitivity.ko.xz  cpufreq_conservative.ko.xz  cpufreq-dt.ko.xz  cpufreq_ondemand.ko.xz  cpufreq_powersave.ko.xz  cpufreq_userspace.ko.xz  p4-clockmod.ko.xz  pcc-cpufreq.ko.xz  powernow-k8.ko.xz  speedstep-lib.ko.xz

Hardware information
System:    Host: cray Kernel: 4.19.12-1-CHAKRA x86_64 bits: 64 Desktop: KDE Plasma 5.14.4 Distro: Chakra 
Machine:   Type: Desktop Mobo: ASUSTeK model: A88XM-PLUS v: Rev X.0x serial: <filter> UEFI: American Megatrends 
           v: 3003 date: 03/04/2017 
CPU:       Topology: Quad Core model: AMD A10-7850K Radeon R7 12 Compute Cores 4C+8G bits: 64 type: MCP 
           L2 cache: 2048 KiB 
           Speed: 2908 MHz min/max: 1700/4200 MHz Core speeds (MHz): 1: 2908 2: 2841 3: 2706 4: 2802 
Graphics:  Card-1: Advanced Micro Devices [AMD/ATI] Fiji [Radeon R9 FURY / NANO Series] driver: amdgpu 
           v: kernel 
           Display: x11 server: X.Org 1.20.3 driver: amdgpu resolution: 2560x1440~144Hz 
           OpenGL: renderer: AMD Radeon R9 Fury Series (FIJI DRM 3.27.0 4.19.12-1-CHAKRA LLVM 6.0.0) 
           v: 4.5 Mesa 18.2.6 
Audio:     Card-1: Advanced Micro Devices [AMD] FCH Azalia driver: snd_hda_intel 
           Card-2: Advanced Micro Devices [AMD/ATI] Fiji HDMI/DP Audio [Radeon R9 Nano / FURY/FURY X] 
           driver: snd_hda_intel 
           Sound Server: ALSA v: k4.19.12-1-CHAKRA 
Network:   Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp4s0 state: up speed: 100 Mbps duplex: full mac: <filter> 
Drives:    HDD Total Size: 1.14 TiB used: 426.30 GiB (36.6%) 
           ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 250GB size: 232.89 GiB 
           ID-2: /dev/sdb vendor: Seagate model: ST1000DX001-1NS162 size: 931.51 GiB 
Sensors:   System Temperatures: cpu: 38.0 C mobo: 36.0 C 
           Fan Speeds (RPM): cpu: 0 
Info:      Processes: 235 Uptime: 7d 2h 52m Memory: 15.61 GiB used: 4.80 GiB (30.7%) Shell: bash inxi: 3.0.10 

(tom) #2

have you checked for a running wild process because it seems a relative high cpu load?


(richard.llom) #4

High CPU load for what?
This issue is about the clocks, not the load and the system isn’t idling (if you meant that).

I encountered this issue now also on another AMD system (AMD Phenom II X4 955).
And the issue is even worse here, since the CPU is constantly clocking at max speed and I can’t even change the governor to ondemand.

$ 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: 4.0 us
  hardware limits: 800 MHz - 3.20 GHz
  available frequency steps:  3.20 GHz, 2.50 GHz, 2.10 GHz, 800 MHz
  available cpufreq governors: performance schedutil
  current policy: frequency should be within 800 MHz and 3.20 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.20 GHz (asserted by call to kernel)
  boost state support:
    Supported: no
    Active: no
$ sudo cpupower frequency-set ondemand
At least one parameter out of -f/--freq, -d/--min, -u/--max, and -g/--governor must be passed
$ ls /usr/lib/modules/$(uname -r)/kernel/drivers/cpufreq/ 
acpi-cpufreq.ko.xz          cpufreq_conservative.ko.xz  cpufreq_ondemand.ko.xz   cpufreq_userspace.ko.xz  pcc-cpufreq.ko.xz  speedstep-lib.ko.xz
amd_freq_sensitivity.ko.xz  cpufreq-dt.ko.xz            cpufreq_powersave.ko.xz  p4-clockmod.ko.xz        powernow-k8.ko.xz

Hardware information
$ inxi -F
System:    Host: kitchen Kernel: 4.19.12-1-CHAKRA x86_64 bits: 64 Desktop: KDE Plasma 5.14.4 Distro: Chakra 
Machine:   Type: Desktop Mobo: Gigabyte model: GA-MA790XT-UD4P v: x.x serial: <root required> BIOS: Award 
           v: F9b date: 08/17/2012 
CPU:       Topology: Quad Core model: AMD Phenom II X4 955 bits: 64 type: MCP L2 cache: 2048 KiB 
           Speed: 3200 MHz min/max: 800/3200 MHz Core speeds (MHz): 1: 3200 2: 3200 3: 3200 4: 3200 
Graphics:  Card-1: Advanced Micro Devices [AMD/ATI] Bonaire XTX [Radeon R7 260X] driver: radeon v: kernel 
           Display: x11 server: X.Org 1.20.3 driver: ati,radeon unloaded: modesetting,vesa 
           resolution: 1920x1080i~50Hz 
           OpenGL: renderer: AMD BONAIRE (DRM 2.50.0 4.19.12-1-CHAKRA LLVM 6.0.0) v: 4.5 Mesa 18.2.6 
Audio:     Card-1: Advanced Micro Devices [AMD/ATI] SBx00 Azalia driver: snd_hda_intel 
           Card-2: Advanced Micro Devices [AMD/ATI] Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM] 
           driver: snd_hda_intel 
           Sound Server: ALSA v: k4.19.12-1-CHAKRA 
Network:   Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: 00:24:1d:7e:63:b9 
Sensors:   System Temperatures: cpu: 34.1 C mobo: 34.0 C gpu: radeon temp: 36 C 
           Fan Speeds (RPM): cpu: 1214 fan-2: 1708 fan-3: 0 fan-5: 0 
Info:      Processes: 167 Uptime: 2h 40m Memory: 7.79 GiB used: 905.7 MiB (11.4%) Shell: bash inxi: 3.0.10 
xi -F
System:    Host: kitchen Kernel: 4.19.12-1-CHAKRA x86_64 bits: 64 Desktop: KDE Plasma 5.14.4 Distro: Chakra 
Machine:   Type: Desktop Mobo: Gigabyte model: GA-MA790XT-UD4P v: x.x serial: <root required> BIOS: Award 
           v: F9b date: 08/17/2012 
CPU:       Topology: Quad Core model: AMD Phenom II X4 955 bits: 64 type: MCP L2 cache: 2048 KiB 
           Speed: 3200 MHz min/max: 800/3200 MHz Core speeds (MHz): 1: 3200 2: 3200 3: 3200 4: 3200 
Graphics:  Card-1: Advanced Micro Devices [AMD/ATI] Bonaire XTX [Radeon R7 260X] driver: radeon v: kernel 
           Display: x11 server: X.Org 1.20.3 driver: ati,radeon unloaded: modesetting,vesa 
           resolution: 1920x1080i~50Hz 
           OpenGL: renderer: AMD BONAIRE (DRM 2.50.0 4.19.12-1-CHAKRA LLVM 6.0.0) v: 4.5 Mesa 18.2.6 
Audio:     Card-1: Advanced Micro Devices [AMD/ATI] SBx00 Azalia driver: snd_hda_intel 
           Card-2: Advanced Micro Devices [AMD/ATI] Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM] 
           driver: snd_hda_intel 
           Sound Server: ALSA v: k4.19.12-1-CHAKRA 
Network:   Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: 00:24:1d:7e:63:b9 
Drives:    HDD Total Size: 465.76 GiB used: 50.38 GiB (10.8%) 
           ID-1: /dev/sda vendor: Western Digital model: WD5000AZRX-00A8LB0 size: 465.76 GiB 
Partition: ID-1: / size: 160.08 GiB used: 33.18 GiB (20.7%) fs: ext4 dev: /dev/sda2 
           ID-2: /home size: 298.12 GiB used: 17.20 GiB (5.8%) fs: ext4 dev: /dev/sda3 
Sensors:   System Temperatures: cpu: 34.1 C mobo: 34.0 C gpu: radeon temp: 36 C 
           Fan Speeds (RPM): cpu: 1214 fan-2: 1708 fan-3: 0 fan-5: 0 
Info:      Processes: 167 Uptime: 2h 40m Memory: 7.79 GiB used: 905.7 MiB (11.4%) Shell: bash inxi: 3.0.10 

(tom) #5

a good question for what but the governor is connected with the cpu load because the governor make the frequency decision by observing the cpu load.


(Luca Giambonini) #6

Starting from kernel 4.19 we introduced the muqss patches. Can be the source of your problems? a different cpu scheduler that keep the frequency high.

Would be nice to further investigate this issue, since now ck patches are applied on our main kernel.


(totte) #7

Hi @facros, we spoke about this on IRC, and I offered to help out - but there may have been a misunderstanding, so I will post here in case others would like to help out.

[2019-02-10 14:42] <totte> I'd like to document how the kernel is built in Chakra, and could do it after Plasma is released.
[2019-02-10 14:42] <totte> Consider posting more information in your topic.
[2019-02-10 14:43] <totte> Also, specific solutions that we could try, such as building a previous kernel, or disable some options.
[2019-02-10 14:50] <fairc> totte: What kind of additional information do you need?
[2019-02-10 14:50] <fairc> (from me)
[2019-02-10 14:51] <totte> I don't know. I've never built a kernel before. Did it work before? What changed? Could we put a bunch of different kernels in a hidden repository to troubleshoot with?
[2019-02-10 14:55] <fairc> the latter sounds like a good idea
[2019-02-10 14:56] <fairc> from what I gathered from AlmAck[m] is that the muqss patchsett is new
[2019-02-10 14:56] <fairc> so that would be my first guess
[2019-02-10 14:58] <totte> If presented with a number of options for what kernel versions to build, and with which options enabled, preferably in a table, this could probably be done.
[2019-02-10 15:06] <totte> I already set up a private repository at <REDACTED>, so we could use that.
[2019-02-10 15:19] <fairc> Ok, let me know in the thread when there are kernels to try. I gotta go soon, will check later today.
[2019-02-10 15:23] <totte> I've no idea what kernels to build, or which options to use, so you could post a table of possible solutions in your topic.
[2019-02-10 15:28] <fairc> I would leave that to AlmAck[m]
[2019-02-10 15:28] <fairc> ping AlmAck[m] ^
[2019-02-10 15:28] <fairc> (since I'm a noob myself)
[2019-02-10 15:30] <totte> Okey, he might be busy, but let me know if you change your mind.

I had a personal code sprint this weekend, and it might make sense to document Linux as a next step. As a part of the process - reading, writing, compiling, packaging - there would be byproducts in the form of Linux packages. If you or someone else were to suggest alterations to the PKGBUILD and related files for Linux in Chakra, I could try applying them, compile Linux, package it, sign it, and upload the package(s) to a private repository for you to try.

I did not mean to give the impression that I would study Linux, the components of it, or your issue in depth - I’m neither affected, nor do I have the same hardware. Not to forget that I know even less about this than you do.


(richard.llom) #8

Hey @AlmAck, are you responsible for building the kernels?
Would it be possible to build some alternative ones (e.g. w/o muqss) and provide them in that directory from totte, so I can try them out and debug this issue?


(Luca Giambonini) #9

yes is possible, I will prepare one

Done, you can try with:
pacman -U https://rsync.chakralinux.org/packages/unstable/x86_64//linux-docs-4.19.12-99-x86_64.pkg.tar.xz https://rsync.chakralinux.org/packages/unstable/x86_64//linux-4.19.12-99-x86_64.pkg.tar.xz https://rsync.chakralinux.org/packages/unstable/x86_64//linux-headers-4.19.12-99-x86_64.pkg.tar.xz


(richard.llom) #10

Thanks, is this all there is to do, i.e. run the command -> restart?
(I never updated the kernel manually)

BTW, the new kernel 4.19.26-1, didn’t change the issue.


(tom) #11

after restart nothing is nothing changed?


(richard.llom) #12

I’m getting this error:

$ LC_ALL=C sudo pacman -U https://rsync.chakralinux.org/packages/unstable/x86_64//linux-docs-4.19.12-99-x86_64.pkg.tar.xz https://rsync.chakralinux.org/packages/unstable/x86_64//linux-4.19.12-99-x86_64.pkg.tar.xz https://rsync.chakralinux.org/packages/unstable/x86_64//linux-headers-4.19.12-99-x86_64.pkg.tar.xz
loading packages...
warning: downgrading package linux (4.19.26-1 => 4.19.12-99)
warning: downgrading package linux-headers (4.19.26-1 => 4.19.12-99)
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing linux (4.19.12-99) breaks dependency 'linux=4.19.26' required by acpi_call
:: installing linux (4.19.12-99) breaks dependency 'linux=4.19.26' required by broadcom-wl
:: installing linux (4.19.12-99) breaks dependency 'linux=4.19.26' required by vhba-module

How can I resolve this?


(tom) #13

i would remove this three packages

Name                     : acpi_call
Version                  : 1.1.0-58
Beschreibung             : A kernel module that enables you to call parameterless ACPI methods by
                           writing the method name to /proc/acpi/call, e.g. to turn off discrete
                           graphics card in a dual graphics environment (like NVIDIA Optimus).
Name                     : broadcom-wl
Version                  : 6.30.223.271-34
Beschreibung             : Broadcom 802.11abgn hybrid Linux networking device driver
Name                     : vhba-module
Version                  : 20170610-22
Beschreibung             : Kernel module that emulates SCSI devices

but vhba-module are not necessary

[tom@donar ~]$ LC_ALL=C pacman -Qi vhba-module
error: package 'vhba-module' was not found

(Luca Giambonini) #14

you are using a testing kernel from [staging]. Disable staging and update again.


(richard.llom) #15

Thanks @brikler and @AlmAck !
I didn’t had [staging] enabled, however removing the three packages let me install the kernel.

And it did solve the clocking issue!

So I would appreciate NO MuQSS in new kernels - until this issue is solved (upstream).


(Luca Giambonini) #16

@facros ok, but at the end which kernel you have installed? 4.19.12-99 ?

that’s really interesting, and what is worse is that affects multiple systems (AMD). I need to discuss with the @team on what to do, revert MuQSS or not.

As a test I can try to build 4.20:


(tom) #17

you are late because the recent kernel version is 5

[tom@donar ~]$ pacman -Qs linux-ck
local/linux-ck-core2 5.0.1-1 (ck-core2)
    The Linux-ck-core2 kernel and modules with the ck1 patchset featuring MuQSS CPU scheduler v0.185
    Intel Core2/Newer Xeon optimized.

(Luca Giambonini) #18

hehe yes if we consider 2 days “late” :grin::
http://ck.kolivas.org/patches/muqss/5.0/5.0/


(richard.llom) #19

FYI:

Check the comment section, thats me and some other AMD user.


(Luca Giambonini) #20

hm… that reply is not so encouraging:

Con Kolivas14 March 2019 at 12:19

It’s likely schedutil broke. No, I don’t have any AMD CPUs. Try another governor like ondemand to see if it’s just schedutil I broke or something else.


(richard.llom) #21

Ok, so whats the status on this topic?

Can we agree to have non-MuQSS kernel for the time being?