AMD Ryzen 7 high CPU usage, application freezes

Hello,
I have really high CPU usage, some freezes, application like Android Studio likes from time to time freeze so I need to use -killall -9 java to end these processes.
Recently, I have been using wayland now I’ve changed it for X11 to test this approach.
Thanks for any advices.

Screen from htop:
https://paste.pics/23eb835835fcf0e655aaa57a849cafea

inxi --full --admin --filter --width

System:
  Kernel: 6.1.38-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64
    root=UUID=758df14c-2163-4fe3-a0db-2a38fe4278d3 rw quiet splash apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: GNOME v: 44.3 tk: GTK v: 3.24.38 wm: gnome-shell dm: GDM v: 44.1
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: HP product: HP Pavilion 15 Laptop PC v: N/A
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: HP model: 88D0 v: 78.31 serial: <superuser required> UEFI: AMI
    v: F.23 date: 10/05/2022
Battery:
  ID-1: BAT0 charge: 39.9 Wh (98.0%) condition: 40.7/40.7 Wh (100.0%)
    volts: 12.9 min: 11.3 model: HP Primary type: Li-ion serial: <filter>
    status: charging cycles: 36
  Device-1: hidpp_battery_0 model: Logitech Wireless Keyboard ERGO K860
    serial: <filter> charge: 100% (should be ignored) rechargeable: yes
    status: discharging
CPU:
  Info: model: AMD Ryzen 7 5700U with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 2 gen: 3 level: v3 note: check built: 2020-22
    process: TSMC n7 (7nm) family: 0x17 (23) model-id: 0x68 (104) stepping: 1
    microcode: 0x8608104
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 8 MiB
    desc: 2x4 MiB
  Speed (MHz): avg: 1699 high: 1800 min/max: 1400/4370 boost: enabled
    scaling: driver: acpi-cpufreq governor: performance cores: 1: 1397 2: 1800
    3: 1397 4: 1800 5: 1800 6: 1800 7: 1397 8: 1397 9: 1800 10: 1800 11: 1800
    12: 1800 13: 1800 14: 1800 15: 1800 16: 1800 bogomips: 57505
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT enabled with STIBP
    protection
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Lucienne vendor: Hewlett-Packard driver: amdgpu v: kernel
    arch: GCN-5 code: Vega process: GF 14nm built: 2017-20 pcie: gen: 3
    speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports:
    active: HDMI-A-1,eDP-1 empty: DP-1 bus-ID: 04:00.0 chip-ID: 1002:164c
    class-ID: 0300 temp: 42.0 C
  Device-2: Luxvisions Innotech HP Wide Vision HD Camera driver: uvcvideo
    type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:2
    chip-ID: 30c9:000e class-ID: 0e02
  Display: x11 server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.2
    compositor: gnome-shell driver: X: loaded: amdgpu
    unloaded: modesetting,radeon alternate: fbdev,vesa dri: radeonsi
    gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3840x1080 s-size: <missing: xdpyinfo>
  Monitor-1: HDMI-A-1 mapped: HDMI-A-0 pos: right model: MSI MAG272C
    serial: <filter> built: 2020 res: 1920x1080 hz: 60 dpi: 82 gamma: 1.2
    size: 598x336mm (23.54x13.23") diag: 686mm (27") ratio: 16:9 modes:
    max: 1920x1080 min: 720x400
  Monitor-2: eDP-1 mapped: eDP pos: primary,left model: BOE Display 0x0a17
    built: 2021 res: 1920x1080 hz: 60 dpi: 142 gamma: 1.2
    size: 344x194mm (13.54x7.64") diag: 395mm (15.5") ratio: 16:9
    modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 23.0.4 renderer: AMD Radeon Graphics (renoir LLVM
    15.0.7 DRM 3.49 6.1.38-1-MANJARO) direct-render: Yes
Audio:
  Device-1: AMD Renoir Radeon High Definition Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 04:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Hewlett-Packard
    driver: snd_rn_pci_acp3x v: kernel alternate: snd_pci_acp3x, snd_pci_acp5x,
    snd_pci_acp6x, snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps,
    snd_sof_amd_renoir, snd_sof_amd_rembrandt pcie: gen: 3 speed: 8 GT/s
    lanes: 16 link-max: gen: 4 speed: 16 GT/s bus-ID: 04:00.5
    chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 04:00.6 chip-ID: 1022:15e3
    class-ID: 0403
  API: ALSA v: k6.1.38-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.74 status: off with: pipewire-media-session
    status: active tools: pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter
    vendor: Hewlett-Packard driver: rtw89_8852ae v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: f000 bus-ID: 02:00.0 chip-ID: 10ec:8852
    class-ID: 0280
  IF: wlo1 state: up mac: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio driver: btusb v: 0.8 type: USB rev: 1.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-4:3 chip-ID: 0bda:2852
    class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 476.94 GiB used: 169.14 GiB (35.5%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix
    model: BC711 HFM512GD3JX013N size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: HPS1 temp: 29.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 476.64 GiB size: 468.09 GiB (98.21%)
    used: 169.14 GiB (36.1%) fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 312 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
  Kernel: swappiness: 5 (default 60) cache-pressure: 50 (default 100)
  ID-1: swap-1 type: file size: 20 GiB used: 0 KiB (0.0%) priority: -2
    file: /swapfile
Sensors:
  System Temperatures: cpu: 48.8 C mobo: N/A gpu: amdgpu temp: 41.0 C
  Fan Speeds (RPM): fan-1: 0 fan-2: 0
Info:
  Processes: 446 Uptime: 23m wakeups: 21 Memory: total: 32 GiB note: est.
  available: 30.68 GiB used: 9.81 GiB (32.0%) Init: systemd v: 253
  default: graphical tool: systemctl Compilers: gcc: 13.1.1 clang: 15.0.7
  Packages: 1632 pm: pacman pkgs: 1627 libs: 469 tools: gnome-software,pamac
  pm: flatpak pkgs: 5 Shell: Zsh v: 5.9 running-in: gnome-terminal inxi: 3.3.28

cpupower frequency-info

analyzing CPU 12:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 12
  CPUs which need to have their frequency coordinated by software: 12
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 1.40 GHz - 4.37 GHz
  available frequency steps:  1.80 GHz, 1.70 GHz, 1.40 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 1.40 GHz and 1.80 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.53 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no

cpupower frequency-info -g

analyzing CPU 12:
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil

This what I’ve tried.

sudo cpupower frequency-set -g performance                                         ✔ 
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
Setting cpu: 8
Setting cpu: 9
Setting cpu: 10
Setting cpu: 11
Setting cpu: 12
Setting cpu: 13
Setting cpu: 14
Setting cpu: 15

mhwd-kernel -li

Currently running: 6.1.38-1-MANJARO (linux61)
The following kernels are installed in your system:
   * linux419
   * linux61

inxi -G

Graphics:
  Device-1: AMD Lucienne driver: amdgpu v: kernel
  Device-2: Luxvisions Innotech HP Wide Vision HD Camera driver: uvcvideo
    type: USB
  Display: x11 server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.2 driver: X:
    loaded: amdgpu unloaded: modesetting,radeon dri: radeonsi gpu: amdgpu
    resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz
  API: OpenGL v: 4.6 Mesa 23.0.4 renderer: AMD Radeon Graphics (renoir LLVM
    15.0.7 DRM 3.49 6.1.38-1-MANJARO)

inxi

CPU: 8-core AMD Ryzen 7 5700U with Radeon Graphics (-MT MCP-)
speed/min/max: 1682/1400/4370 MHz Kernel: 6.1.38-1-MANJARO x86_64 Up: 19m
Mem: 9.48/30.68 GiB (30.9%) Storage: 476.94 GiB (35.5% used) Procs: 446
Shell: Zsh inxi: 3.3.28

lspci | grep VGA

04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Lucienne (rev c1)

mhwd -li

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI


Warning: No installed USB configs!

Also additional information to solution. As far as I have searched the internet there is not information that you need to add it to GRUB_CMDLINE_LINUX, they say GRUB_CMDLINE_LINUX_DEFAULT or GRUB_CMDLINE_LINUX, that isn’t true in my case.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash initcall_blacklist=acpi_cpufreq_init amd_pstate.enable=1 amd_pstate=force amd_pstate=active amd_pstate.shared_mem=1 apparmor=1 security=apparmo>[...]
GRUB_CMDLINE_LINUX="amd_pstate.enable=1 amd_pstate=force amd_pstate=active amd_pstate.shared_mem=1"

that’s mine

i see that you are running the latest LTS kernel. but considering your recent hardware you might want to check with the latest kernel 6.4.x to see how it goes. if i’m not mistaken there were number of AMD specific fixed that went in to recent kernels

1 Like

OK it is done, as far as I see CPU usage is still very high

Maybe also check if there is any new bios update for your card.

1 Like

not entirely sure how these things work on AMD, hoped the AMD experts would have chimed in by now. anyway first run

$ sudo cpupower frequency-info

and get the output. ideally you should have driver: amd-pstate

in case you dont, you can modprobe to load kernel module by (assuming manjaro kernel have this enabled/included);

$ sudo modprobe amd-pstate

to make it permanent add amd_pstate=force to the kernel parameters. and see how it goes. refer;
https://kernel.org/doc/html/next/admin-guide/pm/amd-pstate.html

EDIT:

you have legacy driver; acpi-cpufreq enabled ATM

1 Like

Android Studio is a known cpu hog, you can try some of the suggestions here;

https://stackoverflow.com/questions/19986498/android-studio-using-100-cpu-at-all-times-no-background-processes-appear-to

1 Like

I think the kernel parameter should be corrected as;
amd_pstate=active
OR
amd_pstate=passive

refer;

https://kernel.org/doc/html/next/admin-guide/pm/amd-pstate.html

1 Like

I think it works a little bit better, no rockets but satisfactory.
Ok for now I have added amd-pstate it was quite hard, but it is.
I don’t have CPPC option in my BIOS.

cpupower frequency-info

analyzing CPU 8:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 8
  CPUs which need to have their frequency coordinated by software: 8
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.37 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.37 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.40 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no

But still

modprobe amd_pstate

modprobe: FATAL: Module amd_pstate not found in directory /lib/modules/6.4.6-1-MANJARO

and now that line you mentioned

  Speed (MHz): avg: 776 high: 2598 min/max: 400/4372 scaling:
    driver: amd-pstate-epp governor: powersave cores: 1: 1371 2: 400 3: 400
    4: 2598 5: 1336 6: 400 7: 1305 8: 400 9: 400 10: 400 11: 400 12: 400
    13: 400 14: 400 15: 1417 16: 400 bogomips: 57518
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.