Plasmashell CPU spikes when playing audio, system-wide freeze

when any application which can play audio is running, and I start a new application which plays audio, there’s a CPU-usage spike in plasmashell of about 5% per app started. This freezes everything for up to a second.

my complaint is not so much the cpu usage itself, but the prioritisation of plasmashell over everything else.

this happens often because I have hotkeys for useful functions which also play sound effects for clarity. I can turn off the sound effects, but that just hides the problem, and I shouldn’t have to anyway.

If I run OBS with priority FIFO 90 (almost the highest possible), and run plasmashell with Batch 19 (the lowest possible), plasmashell still gets all the time it wants to do whatever it’s doing before obs gets any time at all.
I even tried running plasmashell in the app.slice cgroup where OBS also runs, but plasmashell still gets absolute priority over all apps.
Is there some other prioritisation mechanism I’m not aware of?

when plasamashell is stopped, the problem stops too.

I am using pipewire.

I have also tried disabling everything in the system tray relating to audio, as was recommended by one post I found. No difference.

problem exists in both plasmashell 5.22.4 and 5.22.5 (latest)

Results of
sudo inxi --admin --verbosity=7 --filter --no-host --width

System:
  Kernel: 5.4.144-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.4-x86_64 
  root=UUID=16c002c6-52f8-47e4-a124-6a0942150ed4 rw quiet udev.log_priority=3 
  Console: tty pts/3 wm: kwin_x11 DM: SDDM Distro: Manjaro Linux 
  base: Arch Linux 
Machine:
  Type: Desktop System: Micro-Star product: MS-7B86 v: 4.0 serial: N/A 
  Mobo: Micro-Star model: B450-A PRO MAX (MS-7B86) v: 4.0 serial: <filter> 
  UEFI: American Megatrends LLC. v: M.D0 date: 05/17/2021 
Battery:
  Device-1: hidpp_battery_3 
  model: Logitech G305 Lightspeed Wireless Gaming Mouse serial: <filter> 
  charge: 100% (should be ignored) rechargeable: yes status: Discharging 
Memory:
  RAM: total: 31.35 GiB used: 10.49 GiB (33.5%) 
  Array-1: capacity: 128 GiB slots: 4 EC: None max-module-size: 32 GiB 
  note: est. 
  Device-1: DIMM 0 size: 8 GiB speed: 3800 MT/s type: DDR4 
  detail: synchronous unbuffered (unregistered) bus-width: 64 bits 
  total: 64 bits manufacturer: Crucial part-no: BL8G36C16U4B.M8FE1 
  serial: <filter> 
  Device-2: DIMM 1 size: 8 GiB speed: 3800 MT/s type: DDR4 
  detail: synchronous unbuffered (unregistered) bus-width: 64 bits 
  total: 64 bits manufacturer: Crucial part-no: BL8G36C16U4W.M8FE1 
  serial: <filter> 
  Device-3: DIMM 0 size: 8 GiB speed: 3800 MT/s type: DDR4 
  detail: synchronous unbuffered (unregistered) bus-width: 64 bits 
  total: 64 bits manufacturer: Crucial part-no: BL8G36C16U4B.M8FE1 
  serial: <filter> 
  Device-4: DIMM 1 size: 8 GiB speed: 3800 MT/s type: DDR4 
  detail: synchronous unbuffered (unregistered) bus-width: 64 bits 
  total: 64 bits manufacturer: Crucial part-no: BL8G36C16U4W.M8FE1 
  serial: <filter> 
CPU:
  Info: 8-Core model: AMD Ryzen 7 3700X socket: AM4 bits: 64 type: MT MCP 
  arch: Zen 2 family: 17 (23) model-id: 71 (113) stepping: 0 
  microcode: 8701021 cache: L1: 512 KiB L2: 4 MiB L3: 32 MiB bogomips: 115250 
  Speed: 3764 MHz min/max: 2200/3600 MHz base/boost: 3600/4400 boost: enabled 
  volts: 1.1 V ext-clock: 100 MHz Core speeds (MHz): 1: 3764 2: 3950 3: 3889 
  4: 3755 5: 3641 6: 3751 7: 3876 8: 3821 9: 3820 10: 3687 11: 3889 12: 3707 
  13: 3824 14: 3861 15: 3867 16: 3895 
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1 
  bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy 
  constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc 
  cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid 
  fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibs irperf lahf_lm lbrv lm 
  mba mca mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc 
  nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter pclmulqdq 
  pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pni popcnt pse 
  pse36 rdpid rdrand rdseed rdt_a rdtscp rep_good sep sev sha_ni skinit smap 
  smca sme smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor svm 
  svm_lock syscall tce topoext tsc tsc_scale umip v_vmsave_vmload vgif 
  vmcb_clean vme vmmcall wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt 
  xsaves 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP: 
  conditional, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA GM204 [GeForce GTX 970] vendor: eVga.com. driver: nvidia 
  v: 470.63.01 alternate: nouveau,nvidia_drm bus-ID: 25:00.0 
  chip-ID: 10de:13c2 class-ID: 0300 
  Device-2: AMD Fiji [Radeon R9 FURY / NANO Series] driver: amdgpu v: kernel 
  bus-ID: 26:00.0 chip-ID: 1002:7300 class-ID: 0300 
  Device-3: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo bus-ID: 1-8:2 chip-ID: 046d:082d 
  class-ID: 0102 serial: <filter> 
  Display: server: X.Org 1.20.13 compositor: kwin_x11 driver: 
  loaded: amdgpu,ati,nvidia unloaded: modesetting,nouveau 
  alternate: fbdev,nv,vesa display-ID: :0 screens: 1 
  Screen-1: 0 s-res: 3440x1440 s-dpi: 96 s-size: 910x381mm (35.8x15.0") 
  s-diag: 987mm (38.8") 
  Monitor-1: DisplayPort-0 res: 3440x1440 dpi: 110 
  size: 797x334mm (31.4x13.1") diag: 864mm (34") 
  OpenGL: renderer: AMD Radeon R9 Fury Series (FIJI DRM 3.35.0 
  5.4.144-1-MANJARO LLVM 12.0.1) 
  v: 4.6 Mesa 21.2.1 direct render: Yes 
Audio:
  Device-1: AMD Fiji HDMI/DP Audio [Radeon R9 Nano / FURY/FURY X] 
  driver: snd_hda_intel v: kernel bus-ID: 26:00.1 chip-ID: 1002:aae8 
  class-ID: 0403 
  Device-2: AMD Starship/Matisse HD Audio vendor: Micro-Star MSI 
  driver: snd_hda_intel v: kernel bus-ID: 28:00.4 chip-ID: 1022:1487 
  class-ID: 0403 
  Device-3: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo bus-ID: 1-8:2 chip-ID: 046d:082d 
  class-ID: 0102 serial: <filter> 
  Device-4: Texas Instruments PCM2902 Audio Codec type: USB 
  driver: hid-generic,snd-usb-audio,usbhid bus-ID: 3-1:2 chip-ID: 08bb:2902 
  class-ID: 0300 
  Sound Server-1: ALSA v: k5.4.144-1-MANJARO running: yes 
  Sound Server-2: sndio v: N/A running: no 
  Sound Server-3: JACK v: 1.9.19 running: no 
  Sound Server-4: PulseAudio v: 15.0 running: no 
  Sound Server-5: PipeWire v: 0.3.35 running: yes 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Micro-Star MSI driver: r8169 v: kernel port: e000 bus-ID: 22:00.0 
  chip-ID: 10ec:8168 class-ID: 0200 
  IF: enp34s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  IP v4: <filter> type: dynamic noprefixroute scope: global 
  broadcast: <filter> 
  IP v6: <filter> type: noprefixroute scope: link 
  WAN IP: <filter> 
Bluetooth:
  Message: No bluetooth data found. 
Logical:
  Message: No logical block device data found. 
RAID:
  Device-1: cache type: zfs status: - level: linear zfs-fs: size: 3.29 TiB 
  free: raw: size: N/A free: N/A 
  Components: Online: 
  1: 
  Device-2: colossus type: zfs status: ONLINE level: linear raw: size: 3.4 TiB 
  free: 174 GiB allocated: 3.23 TiB zfs-fs: size: 3.29 TiB free: 65.59 GiB 
  Components: Online: 
  1: sdb maj-min: 8:16 size: 2.73 TiB 
  2: sdc maj-min: 8:32 size: 698.64 GiB 
  Device-3: logs type: zfs status: - level: linear zfs-fs: size: 3.29 TiB 
  free: raw: size: N/A free: N/A 
  Components: Online: 
  1: 
Drives:
  Local Storage: total: raw: 3.75 TiB usable: 7.08 TiB used: 3.52 TiB (49.7%) 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung 
  model: SSD 970 EVO Plus 250GB size: 232.89 GiB block-size: physical: 512 B 
  logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> 
  rev: 2B2QEXM7 temp: 45 Celsius C scheme: GPT 
  SMART: yes health: PASSED on: 49d 23h cycles: 717 
  read-units: 5,721,356 [2.92 TB] written-units: 85,281,339 [43.6 TB] 
  ID-2: /dev/sda maj-min: 8:0 vendor: SanDisk model: SDSSDHII120G 
  family: Marvell based SSDs size: 111.79 GiB block-size: physical: 512 B 
  logical: 512 B sata: 3.2 speed: 6.0 Gb/s type: SSD serial: <filter> 
  rev: 00RL temp: 35 C scheme: MBR 
  SMART: yes state: enabled health: PASSED on: 3y 90d 14h cycles: 3055 
  ID-3: /dev/sdb maj-min: 8:16 vendor: Toshiba model: HDWD130 family: P300 
  size: 2.73 TiB block-size: physical: 4096 B logical: 512 B sata: 3.0 
  speed: 6.0 Gb/s type: HDD rpm: 7200 serial: <filter> rev: ACF0 temp: 42 C 
  scheme: GPT 
  SMART: yes state: enabled health: PASSED on: 2y 144d 17h cycles: 2118 
  ID-4: /dev/sdc maj-min: 8:32 vendor: Seagate model: ST3750528AS 
  family: Barracuda 7200.12 size: 698.64 GiB block-size: physical: 512 B 
  logical: 512 B sata: 2.6 speed: 3.0 Gb/s type: HDD rpm: 7200 
  serial: <filter> rev: CC44 temp: 40 C scheme: GPT 
  SMART: yes state: enabled health: PASSED on: 6y 112d 1h cycles: 5934 
  read: 91.3 GiB written: 482.48 GiB Pre-Fail: attribute: Spin_Retry_Count 
  value: 100 worst: 100 threshold: 97 
  Message: No optical or floppy data found. 
Partition:
  ID-1: / raw-size: 48.34 GiB size: 47.28 GiB (97.81%) used: 43.32 GiB (91.6%) 
  fs: ext4 block-size: 4096 B dev: /dev/nvme0n1p4 maj-min: 259:4 label: N/A 
  uuid: 16c002c6-52f8-47e4-a124-6a0942150ed4 
  ID-2: /boot/efi raw-size: 500 MiB size: 499.7 MiB (99.95%) 
  used: 6.8 MiB (1.4%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p2 
  maj-min: 259:2 label: N/A uuid: 7B48-5FB6 
  ID-3: /mnt/120 raw-size: 111.79 GiB size: 109.92 GiB (98.32%) 
  used: 94.2 GiB (85.7%) fs: ext4 block-size: 4096 B dev: /dev/sda1 
  maj-min: 8:1 label: N/A uuid: edb6bdf6-9793-49b7-b2ca-fd90f4971d5f 
  ID-4: /mnt/colossus raw-size: N/A size: 3.29 TiB used: 3.23 TiB (98.1%) 
  fs: zfs logical: colossus 
  ID-5: /mnt/mainpart raw-size: 183.76 GiB size: 179.88 GiB (97.89%) 
  used: 159.76 GiB (88.8%) fs: ext4 block-size: 4096 B dev: /dev/nvme0n1p3 
  maj-min: 259:3 label: N/A uuid: 36312b62-36ba-4ae7-9c17-9a96dabdcfa7 
Swap:
  Alert: No swap data was found. 
Unmounted:
  Message: No unmounted partitions found. 
USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 10 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 1-8:2 info: Logitech HD Pro Webcam C920 type: Video,Audio 
  driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s 
  power: 500mA chip-ID: 046d:082d class-ID: 0102 serial: <filter> 
  Device-2: 1-9:7 info: Samsung Galaxy A5 (MTP) type: <vendor specific> 
  driver: usbfs interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 96mA 
  chip-ID: 04e8:6860 class-ID: 0000 serial: <filter> 
  Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 3-1:2 info: Texas Instruments PCM2902 Audio Codec type: Audio,HID 
  driver: hid-generic,snd-usb-audio,usbhid interfaces: 4 rev: 1.1 
  speed: 12 Mb/s power: 100mA chip-ID: 08bb:2902 class-ID: 0300 
  Hub-4: 3-2:3 info: Realtek RTS5411 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 0bda:5411 class-ID: 0900 
  Hub-5: 3-2.1:4 info: Realtek RTS5411 Hub ports: 4 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 0bda:5411 class-ID: 0900 
  Device-1: 3-2.3:14 info: Logitech USB Receiver type: Keyboard,Mouse,HID 
  driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s 
  power: 98mA chip-ID: 046d:c53f class-ID: 0300 
  Device-2: 3-2.4:7 info: Holtek USB Gaming Keyboard type: Keyboard,HID 
  driver: hid-generic,usbhid interfaces: 3 rev: 1.1 speed: 12 Mb/s 
  power: 100mA chip-ID: 04d9:a0f8 class-ID: 0300 
  Hub-6: 4-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-7: 4-2:2 info: Realtek Hub ports: 4 rev: 3.2 speed: 5 Gb/s 
  chip-ID: 0bda:0411 class-ID: 0900 
  Hub-8: 4-2.1:3 info: Realtek Hub ports: 4 rev: 3.2 speed: 5 Gb/s 
  chip-ID: 0bda:0411 class-ID: 0900 
Sensors:
  System Temperatures: cpu: 51.0 C mobo: N/A gpu: amdgpu temp: 51.0 C 
  Fan Speeds (RPM): N/A gpu: amdgpu fan: 1513 
Info:
  Processes: 496 Uptime: 1d 4h 17m wakeups: 18 Init: systemd v: 249 
  tool: systemctl Compilers: gcc: 11.1.0 clang: 12.0.1 Packages: pacman: 1391 
  lib: 412 Shell: Zsh (sudo) v: 5.8 default: Bash v: 5.1.8 running-in: konsole 
  inxi: 3.3.06 

:+1: Welcome to Manjaro! :+1:

  1. Please read this:
    [HowTo] Provide System Information
    and press the three dots below your post and press the :pencil2: to give us more information so we can see what’s really going on.
    Now we know the symptom of the disease, but we need some more probing to know where the origin lies… :grin:

  2. An inxi --admin --verbosity=7 --filter --no-host --width would be the minimum required information for us to be able to help you. (Personally Identifiable Information like serial numbers and MAC addresses will be filtered out by the above command)
    Also, please copy-paste that output in-between 3 backticks ``` at the beginning and end of the code/text.

  3. Have you already tried disabling that and trying again? (and if PulseAudio was disabled, enable that again)

    systemctl --user disable --now pipewire.socket && systemctl --user disable --now pipewire.service && systemctl --user mask pipewire.socket
    

:+1:

P.S. If you want to notify me that you did provide this information, please :heart: this message and I’ll come back and have another look.
P.P.S. If you enter a bit more details in your profile, we can also see which Desktop Environment you’re using, which exact CPU/GPU or Kernel, … you have without typing it every time

thanks for the advice. I have updated my first post with the command output.

I can try just disabling pipewire, but since that’s my only audio handler I’ll probably just get an error when I try to play anything.
I can try testing without pipewire, but that means uninstalling pipewire and reinstalling pulseaudio, which is an awkward procedure. If all else fails though, I might try this.

The reason I didn’t include inxi is that I hoped that it was a known problem, or someone might have a suggestion I could try even before investigating the cause.

I was also hoping someone would be able to tell me why plasmashell automatically gets higher CPU priority than everything else, no matter what process priority or cgroups I configure. I don’t suppose you know?

1 Like
  1. Please limit the number of questions to one question per… well… question! :grin: Because the more questions you ask per question, the less likely you’ll find an expert that knows about all of them, so they just move on to the next question where they can help.
    We promise we won’t charge you more :money_with_wings: :money_with_wings: :money_with_wings: if you create more than one topic! :wink:
  2. On such a new machine, why are you running kernel 5.4 LTS instead of 5.10 LTS? If there is no compelling reason not to be running 5.10, install that first and see if the issue goes away before moving to the next point.
  3. PipeWire is new and and shiny an IMHO not ready for primetime, and as you do already have PulseAudio installed, but not running, that should indeed be our first port of call:
    • Disable PipeWire:

      systemctl --user disable --now pipewire.socket && systemctl --user disable --now pipewire.service && systemctl --user mask pipewire.socket
      
    • Enable Pulseaudio

      systemctl --user enable --now pulseaudio.socket && systemctl --user enable --now pulseaudio.service
      

:crossed_fingers:

questions relevant to the thread topic are common in forums. Are you withholding the answer because I didn’t ask in the right format? Should I start a new thread for this question too?

I’m running 5.4 because any newer kernel causes audio issues. I’m not the only person to have experienced this; I think there was a post on these forums about it.
regardless, I’ll try booting with a newer one, to see if the audio issues remain and whether it fixes this problem.

I am not using pipewire by accident, it is intentional and for a good reason. Allow me to relieve you of the notion that I have no idea what I’m doing.
I will be using pipewire even if it is the cause of this problem, which it doesn’t seem to be.

if you don’t have any ideas which could clarify this problem beyond boilerplate ones, perhaps someone else does.

1 Like

:bowing_man: :crossed_fingers:

Audio data in inxi is showing PulseAudio server is present but not running
so the replacement emulation package may not be installed

the pulseaudio package is not installed. The pipewire-pulse layer is definitely running and apps do use it.
What displays in the inxi output is probably just what displays when pipewire is installed normally (but if it’s not, maybe there is a problem with my setup).

Previous forum posts do not show PulseAudio sound server in inxi if it has been removed and replaced

Recent updates might possibly have changed ìnxi response to show a false positive result
I hope this is not the case and inxi is working as intended
But if inxi is showing PulseAudio emulation, it may not be running

Please post response to these commands show status of all available services

systemctl --user list-unit-files | grep -E 'pulseaudio.|pipewire' | awk '{print $1,"- " $2}'

and available ALSA plugins

aplay -L | grep -E -A1 'pulse|pipewire'