High single CPU core usage on Wayland when using external display

I’m experiencing high single CPU core usage on Wayland. My setup is:

  • Lenovo Legion 7 Pro
  • external 4k display connected to HDMI

When laptop is booted and I log into Manjaro, CPU usage is fine. At some random point, one CPU core jumps up and stays permanently between 60% and 90%, spinning up fans.

High CPU usage remain the same even when I close all applications, including those in my sys tray, leaving desktop empty.

However, when I disconnect external 4k display, CPU usage drops to normal. Reconnecting it back causes CPU to jump back up.

Logging out of Wayland session and logging back in fixes the problem for next few minutes.

Any help to drill down the problem is appreciated.

Thanks.

Here’s my inxi:

eden@kurbla:[~]: inxi -Fazy                                                                                                                               
System:
  Kernel: 6.9.0-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: hpet avail: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.9-x86_64
    root=UUID=cd3ab193-9b18-400a-a3a4-c4003dcf1a15 rw quiet
    cryptdevice=UUID=2b2ec8fa-503a-4d8e-ab24-1eee26daadb5:luks-2b2ec8fa-503a-4d8e-ab24-1eee26daadb5
    root=/dev/mapper/luks-2b2ec8fa-503a-4d8e-ab24-1eee26daadb5 splash
    resume=/dev/mapper/luks-28093df8-5714-4942-9e2b-abdec63b82cd
    udev.log_priority=3
  Desktop: KDE Plasma v: 6.0.4 tk: Qt v: N/A info: frameworks v: 6.1.0
    wm: kwin_wayland vt: 1 dm: SDDM Distro: Manjaro base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 82WS v: Legion Pro 7 16ARX8H
    serial: <superuser required> Chassis: type: 10 v: Legion Pro 7 16ARX8H
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: NO DPK serial: <superuser required>
    part-nu: LENOVO_MT_82WS_BU_idea_FM_Legion Pro 7 16ARX8H
    uuid: <superuser required> UEFI: LENOVO v: LPCN49WW date: 01/10/2024
Battery:
  ID-1: BAT0 charge: 98.8 Wh (100.0%) condition: 98.8/99.9 Wh (98.9%)
    volts: 17.6 min: 15.5 model: SMP L22M4PC1 type: Li-poly serial: <filter>
    status: full cycles: 19
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse MX Master 3
    serial: <filter> charge: 50% (should be ignored) rechargeable: yes
    status: discharging
CPU:
  Info: model: AMD Ryzen 9 7945HX with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 4 gen: 5 level: v4 note: check built: 2022+ process: TSMC n5 (5nm)
    family: 0x19 (25) model-id: 0x61 (97) stepping: 2 microcode: 0xA601206
  Topology: cpus: 1x cores: 16 tpc: 2 threads: 32 smt: enabled cache:
    L1: 1024 KiB desc: d-16x32 KiB; i-16x32 KiB L2: 16 MiB desc: 16x1024 KiB
    L3: 64 MiB desc: 2x32 MiB
  Speed (MHz): avg: 1371 high: 5165 min/max: 400/5461 scaling:
    driver: amd-pstate-epp governor: powersave cores: 1: 5099 2: 4867 3: 400
    4: 400 5: 4259 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400 13: 4672
    14: 400 15: 400 16: 400 17: 400 18: 5163 19: 4658 20: 400 21: 400 22: 400
    23: 400 24: 400 25: 400 26: 400 27: 400 28: 400 29: 400 30: 400 31: 400
    32: 5165 bogomips: 159761
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  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: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow mitigation: Safe RET
  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: Enhanced / Automatic IBRS; IBPB: conditional;
    STIBP: always-on; RSB filling; PBRSB-eIBRS: Not affected; BHI: Not
    affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA AD104M [GeForce RTX 4080 Max-Q / Mobile] vendor: Lenovo
    driver: nvidia v: 550.78 alternate: nouveau,nvidia_drm non-free: 550.xx+
    status: current (as of 2024-04) arch: Lovelace code: AD1xx
    process: TSMC n4 (5nm) built: 2022+ pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s ports: active: none off: HDMI-A-1
    empty: DP-1, DP-2, DP-3, eDP-2 bus-ID: 01:00.0 chip-ID: 10de:27e0
    class-ID: 0300
  Device-2: AMD Raphael vendor: Lenovo driver: amdgpu v: kernel arch: RDNA-2
    code: Navi-2x process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4
    speed: 16 GT/s lanes: 16 ports: active: eDP-1 empty: Writeback-1
    bus-ID: 05:00.0 chip-ID: 1002:164e class-ID: 0300 temp: 65.0 C
  Device-3: Luxvisions Innotech Integrated Camera driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-2.4:4
    chip-ID: 30c9:00ac class-ID: fe01 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 23.2.6
    compositor: kwin_wayland driver: X: loaded: amdgpu,nvidia dri: radeonsi
    gpu: nvidia,amdgpu d-rect: 5539x3244 display-ID: 0
  Monitor-1: HDMI-A-1 pos: primary,top-left res: 3491x1964 size: N/A
    modes: N/A
  Monitor-2: eDP-1 pos: bottom-r res: 2048x1280 size: N/A modes: N/A
  API: EGL v: 1.5 hw: drv: nvidia drv: amd radeonsi platforms: device: 0
    drv: nvidia device: 1 drv: radeonsi device: 3 drv: swrast surfaceless:
    drv: nvidia wayland: drv: radeonsi x11: drv: radeonsi
    inactive: gbm,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 24.0.6-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon Graphics (radeonsi
    raphael_mendocino LLVM 17.0.6 DRM 3.57 6.9.0-1-MANJARO)
    device-ID: 1002:164e memory: 1.95 GiB unified: no display-ID: :1.0
  API: Vulkan v: 1.3.279 layers: 4 device: 0 type: discrete-gpu name: NVIDIA
    GeForce RTX 4080 Laptop GPU driver: nvidia v: 550.78 device-ID: 10de:27e0
    surfaces: xcb,xlib,wayland device: 1 type: integrated-gpu name: AMD Radeon
    Graphics (RADV RAPHAEL_MENDOCINO) driver: mesa radv v: 24.0.6-manjaro1.1
    device-ID: 1002:164e surfaces: xcb,xlib,wayland
Audio:
  Device-1: NVIDIA driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s
    lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:22bc class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Lenovo
    driver: snd_rpl_pci_acp6x v: kernel alternate: snd_pci_acp3x,
    snd_rn_pci_acp3x, snd_pci_acp5x, snd_pci_acp6x, snd_acp_pci, snd_pci_ps,
    snd_sof_amd_renoir, snd_sof_amd_rembrandt, snd_sof_amd_vangogh,
    snd_sof_amd_acp63 pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 05:00.5
    chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 05:00.6
    chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.9.0-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: JACK v: 1.9.22 status: off tools: N/A
  Server-3: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    vendor: Lenovo driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
    bus-ID: 03:00.0 chip-ID: 14c3:0616 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8168 v: 8.053.00-NAPI modules: r8169 pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: 2000 bus-ID: 04:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp4s0 state: down mac: <filter>
  IF-ID-1: docker0 state: up speed: 10000 Mbps duplex: unknown mac: <filter>
  IF-ID-2: tun0 state: unknown speed: 10000 Mbps duplex: full mac: N/A
  IF-ID-3: veth7340ec3 state: up speed: 10000 Mbps duplex: full mac: <filter>
  IF-ID-4: veth7ae35fb state: up speed: 10000 Mbps duplex: full mac: <filter>
  IF-ID-5: veth85251c2 state: up speed: 10000 Mbps duplex: full mac: <filter>
  Info: services: NetworkManager, sshd, wpa_supplicant
Bluetooth:
  Device-1: Foxconn / Hon Hai Bluetooth Adapter driver: btusb v: 0.8 type: USB
    rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 5-1.1:3
    chip-ID: 0489:e0d8 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 2 state: up address: see --recommends
Drives:
  Local Storage: total: 953.87 GiB used: 307.31 GiB (32.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVL21T0HCLR-00BL2
    size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: EL1QGXA7 temp: 44.9 C
    scheme: GPT
Partition:
  ID-1: / raw-size: 919.98 GiB size: 904.46 GiB (98.31%)
    used: 307.12 GiB (34.0%) fs: ext4 dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-2b2ec8fa-503a-4d8e-ab24-1eee26daadb5
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 32.4 MiB (10.8%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: partition size: 33.59 GiB used: 169.8 MiB (0.5%)
    priority: -2 dev: /dev/dm-1 maj-min: 254:1
    mapped: luks-28093df8-5714-4942-9e2b-abdec63b82cd
Sensors:
  System Temperatures: cpu: 74.2 C mobo: 50.0 C gpu: amdgpu temp: 66.0 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 32 GiB note: est. available: 29.06 GiB used: 16.81 GiB (57.9%)
  Processes: 585 Power: uptime: 2h 34m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 11.58 GiB services: org_kde_powerdevil,upowerd
    Init: systemd v: 255 default: graphical tool: systemctl
  Packages: 1655 pm: pacman pkgs: 1643 libs: 398 tools: octopi,pamac,yay
    pm: flatpak pkgs: 12 Compilers: clang: 17.0.6 gcc: 13.2.1 Shell: Zsh v: 5.9
    running-in: konsole inxi: 3.3.34

Now I’m sure that’s nvidia driver responsible for this, but still trying to find the solution:

$ perf top -K -p {kwin_pid}