SUMMARY When moving the mouse, the CPU usage of the window under the cursor, as well as kwin_wayland is very high. STEPS TO REPRODUCE 1. move cursor over a window or over the desktop OBSERVED RESULT The CPU usage shoots up (over 30% for kwin_wayland, and another over 25% for the window under the cursor) on my machine, i.e. more than 50% cpu. Interestingly, when there's another process which uses 100% cpu, when moving the cursor kwin_wayland "only" uses 17%, and the window under the cursor "only" uses 7%. EXPECTED RESULT There should be a negligible cpu usage from just moving the mouse cursor around SOFTWARE/OS VERSIONS Linux/KDE Plasma: (available in About System) KDE Plasma Version: 6.0.80 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.1 ADDITIONAL INFORMATION System: Kernel: 6.5.0-15-generic x86_64 bits: 64 compiler: N/A Desktop: KDE Plasma 6.0.80 Distro: KDE neon 22.04 Unstable Edition base: Ubuntu 22.04 LTS Jammy Machine: Type: Desktop System: Dell product: Precision 3630 Tower v: N/A serial: <superuser required> Mobo: Dell model: 0NNNCT v: A01 serial: <superuser required> UEFI: Dell v: 2.25.0 date: 11/09/2023 CPU: Info: 6-core model: Intel Core i7-8700 bits: 64 type: MT MCP arch: Coffee Lake rev: A cache: L1: 384 KiB L2: 1.5 MiB L3: 12 MiB Speed (MHz): avg: 800 high: 804 min/max: 800/4600 cores: 1: 804 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 bogomips: 76799 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Graphics: Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Dell CometLake-S driver: i915 v: kernel bus-ID: 00:02.0 Device-2: NVIDIA GP104 [GeForce GTX 1080] vendor: Dell driver: nouveau v: kernel bus-ID: 01:00.0 Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 23.2.3 compositor: kwin_wayland driver: X: loaded: modesetting unloaded: fbdev,vesa gpu: i915,nouveau resolution: 1920x1080 OpenGL: renderer: NV134 v: 4.3 Mesa 23.0.4-0ubuntu1~22.04.1 direct render: Yes Audio: Device-1: Intel Cannon Lake PCH cAVS vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 Device-2: NVIDIA GP104 High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 01:00.1 Sound Server-1: ALSA v: k6.5.0-15-generic running: yes Sound Server-2: PulseAudio v: 15.99.1 running: yes Sound Server-3: PipeWire v: 0.3.48 running: yes Network: Device-1: Intel Ethernet I219-LM vendor: Dell driver: e1000e v: kernel port: N/A bus-ID: 00:1f.6 IF: eno1 state: up speed: 100 Mbps duplex: full mac: <filter> RAID: Hardware-1: Intel SATA Controller [RAID mode] driver: ahci v: 3.0 bus-ID: 00:17.0 Drives: Local Storage: total: 476.94 GiB used: 0 KiB (0.0%) ID-1: /dev/sda vendor: Micron model: 1100 SATA 512GB size: 476.94 GiB Partition: ID-1: / size: 15.58 GiB used: 338.7 MiB (2.1%) fs: overlay source: ERR-102 Swap: Alert: No swap data was found. Sensors: System Temperatures: cpu: 29.0 C pch: 43.0 C mobo: 29.0 C gpu: nouveau temp: 39.0 C Fan Speeds (RPM): cpu: 1561 fan-2: 852 gpu: nouveau fan: 1008 Info: Processes: 276 Uptime: 2h 38m Memory: 31.17 GiB used: 3.96 GiB (12.7%) Init: systemd runlevel: 5 Compilers: gcc: 11.4.0 Packages: 2184 Shell: Bash v: 5.1.16 inxi: 3.3.13
Does the issue go away if you use the proprietary drivers, rather than Nouveau?
(In reply to Nate Graham from comment #1) > Does the issue go away if you use the proprietary drivers, rather than > Nouveau? No. I've installed the nvidia drivers using ubuntu-drivers, it's still using up about the same amount of CPU. The only difference is that now even on idle kwin_wayland uses 20% CPU, and nv_queue uses 15% CPU. When moving the mouse kwin_wayland now uses almost 50% CPU, the window under the cursor still uses around 20%, and nv_queue uses about 10% CPU. Here's the updated system details: System: Kernel: 6.5.0-15-generic x86_64 bits: 64 compiler: N/A Desktop: KDE Plasma 6.0.80 Distro: KDE neon 22.04 Unstable Edition base: Ubuntu 22.04 LTS Jammy Machine: Type: Desktop System: Dell product: Precision 3630 Tower v: N/A serial: <superuser required> Mobo: Dell model: 0NNNCT v: A01 serial: <superuser required> UEFI: Dell v: 2.26.0 date: 12/08/2023 CPU: Info: 6-core model: Intel Core i7-8700 bits: 64 type: MT MCP arch: Coffee Lake rev: A cache: L1: 384 KiB L2: 1.5 MiB L3: 12 MiB Speed (MHz): avg: 1170 high: 4354 min/max: 800/4600 cores: 1: 900 2: 900 3: 851 4: 900 5: 800 6: 800 7: 1039 8: 900 9: 832 10: 4354 11: 966 12: 800 bogomips: 76799 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Graphics: Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Dell CometLake-S driver: i915 v: kernel bus-ID: 00:02.0 Device-2: NVIDIA GP104 [GeForce GTX 1080] vendor: Dell driver: nvidia v: 535.154.05 bus-ID: 01:00.0 Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 23.2.3 compositor: kwin_wayland driver: X: loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa gpu: i915,nvidia resolution: 1920x1080 OpenGL: renderer: NVIDIA GeForce GTX 1080/PCIe/SSE2 v: 4.6.0 NVIDIA 535.154.05 direct render: Yes Audio: Device-1: Intel Cannon Lake PCH cAVS vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 Device-2: NVIDIA GP104 High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 01:00.1 Sound Server-1: ALSA v: k6.5.0-15-generic running: yes Sound Server-2: PulseAudio v: 15.99.1 running: yes Sound Server-3: PipeWire v: 0.3.48 running: yes Network: Device-1: Intel Ethernet I219-LM vendor: Dell driver: e1000e v: kernel port: N/A bus-ID: 00:1f.6 IF: eno1 state: up speed: 100 Mbps duplex: full mac: <filter> RAID: Hardware-1: Intel SATA Controller [RAID mode] driver: ahci v: 3.0 bus-ID: 00:17.0 Drives: Local Storage: total: 476.94 GiB used: 9.68 GiB (2.0%) ID-1: /dev/sda vendor: Micron model: 1100 SATA 512GB size: 476.94 GiB Partition: ID-1: / size: 19.12 GiB used: 9.59 GiB (50.2%) fs: ext4 dev: /dev/sda6 ID-2: /boot/efi size: 646 MiB used: 90.2 MiB (14.0%) fs: vfat dev: /dev/sda1 Swap: Alert: No swap data was found. Sensors: System Temperatures: cpu: 39.0 C pch: 47.0 C mobo: 39.0 C Fan Speeds (RPM): cpu: 1569 fan-2: 859 Info: Processes: 279 Uptime: 2m Memory: 31.17 GiB used: 2.42 GiB (7.8%) Init: systemd runlevel: 5 Compilers: gcc: 11.4.0 Packages: 2181 Shell: Bash v: 5.1.16 inxi: 3.3.13
With regards to the increased kwin_wayland cpu usage on my latest reply (as compared to my first one): it stemmed from the fps desktop effect - when I turned it off, the figures returned to the ones I have reported initially, that is to say, the nvidia driver didn't make it worse (nor better).
Thanks.
Can't reproduce; I get around 5% combined CPU usage kwin_wayland + plasmashell when moving the cursor over the desktop with a 12k DPI mouse. If you can consistently see this high CPU usage, you could try finding out what's causing it in kwin with hotspot (https://github.com/KDAB/hotspot). Just record a trace of the kwin_wayland process, and check if any single function call looks conspicuous in the flame graph.
Created attachment 166085 [details] Screenshot of hotspot I don't really know how to make sense of this, especially with the missing debug symbols... But here's the flame graph.
Yeah, we definitely need a flamegraph with debug symbols for plasmashell and Qt at least, this unfortunately doesn't look useful
What do I need to do to have these debug symbols? I'm using Neon
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
Can you help me setting KDE Neon to have the debug symbols needed to profile this?
Hi, I'd really like to help figure out why I'm seeing this increased CPU usage, but I couldn't figure out how to make perf show the relevant binary name and function name... Even when adding the debug info server, I wasn't able to see it in hotspot. I would appreciate it if anyone could help me setup my machine to be able to debug this properly.
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!
Sorry, I don't know how to do it on Neon either; it "just works" on Fedora and Arch
I believe I am also seeing a similar issue where moving the cursor or really any kind of movement seems to cause spikes in cpu usage for the kwin_wayland process. I especially notice this during video playback during firefox. I have downloaded the appimage for hotspot and I'm not sure if I did everything correctly, but I will try to save and submit the file it produced when I attached to the kwin_wayland process. During the test I mostly triggered the overview, moved the mouse, and scrolled through the desktops. I'll do another test with video playback in firefox and then submit that later. System Info: Operating System: EndeavourOS KDE Plasma Version: 6.0.90 KDE Frameworks Version: 6.3.0 Qt Version: 6.7.1 Kernel Version: 6.9.3-zen1-1-zen (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor Memory: 62.7 GiB of RAM Graphics Processor: NVIDIA GeForce RTX 3080/PCIe/SSE2 Manufacturer: Micro-Star International Co., Ltd. Product Name: MS-7C95 System Version: 1.0
Created attachment 170413 [details] hotspot flamegraph screenshot
Well it looks like the file generated by hotspot is too big, so for now I'll just post screenshots of the flamegraph. If there is another way to send you the perf.data.perfparser files then let me know and if there are any other logs you need. Let me know too.
Created attachment 170415 [details] hotspot flamegraph firefox playback
Created attachment 170512 [details] Screen Recording of htop as I move the mosue around. kwin seems to use less cpu when another cpu intensive process is running, but this screen recording should still show the spike that is happening. In general, I notice kwin using more resources cpu and gpu when moving the mouse, windows, or watching videos that say gnome or xfce. This lead me to believe that there may be some kind of performance issue lurking about. On the aforementioned desktops. There respective compositors' do not use enough resources to make it to the top of various resource monitoring utilities such as htop or intel_gpu_top in most cases. For this reason, I am extremely interested in debugging this issue further.
Created attachment 170524 [details] Video of htop taken on my phone. Here is one more video, but taken on my phone. As mentioned before, when other cpu intensive tasks are running. The kwin_wayland process doesn't use as much cpu. In this video, you will see the kwin-wayland process using more cpu than the main firefox process while I am trying to watch a video. That is despite hardware acceleration being in use.
I can confirm the experience (Arch Linux, having latest KDE 6.1 update of this moment). I am using the proprietary NVIDIA driver. Hardware: Lenovo Legion 5-Pro laptop with NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 I am running in dedicated graphics mode (I often run in dynamic graphics mode, so then I use the builtin GPU of my AMD CPU is used primarilly and I haven't tested with that now). It's _not_ that the graphics are laggy. These are still extremely smooth. For me it started with that I noticed my laptop getting warmer than expected. Then I also did the same test with HTOP open. What I am seeing: Low CPU (< 5%) remains when: - Moving mouse on top of the Alacrity terminal. - Moving mause on top of the Konsole terminal. High CPU (somewhere between 20% and 35%) occurs when: - Moving mouse on top of Firefox. - Moving mouse over the taskbar panel, especially the icons. Even higher CPU (somewhere between 40% and 55%) can be seen when: - Repeatedly opening the Launcher by repeatedly pressing the Super key. My CPU has 16 threads. The percentages here are a total over all threads.
Okay, I have now tested in dynamic graphics mode, effectively that means the Plasma uses the AMD CPU's GPU graphics. Now the CPU usage of kwin_wayland remains lower than other processes, when doing the same tests.
(In reply to Dashon from comment #18) > Well it looks like the file generated by hotspot is too big, so for now I'll > just post screenshots of the flamegraph. If there is another way to send you > the perf.data.perfparser files then let me know and if there are any other > logs you need. Let me know too. The perf file is only useful with the exact same binary and debug info for it on my side, the flame graph is easier to work with. It looks as though you're missing debug information for kwin though; could you make sure you have debuginfod installed? Afaik hotspot can use it to download the required information automatically. (In reply to Eduard from comment #23) > Okay, I have now tested in dynamic graphics mode, effectively that means the > Plasma uses the AMD CPU's GPU graphics. Now the CPU usage of kwin_wayland > remains lower than other processes, when doing the same tests. That'll be from copying the screen contents from the dedicated to the integrated GPU; that's known to be very inefficient in the NVidia driver right now.
(In reply to Zamundaaa from comment #24) > (In reply to Dashon from comment #18) > > Well it looks like the file generated by hotspot is too big, so for now I'll > > just post screenshots of the flamegraph. If there is another way to send you > > the perf.data.perfparser files then let me know and if there are any other > > logs you need. Let me know too. > The perf file is only useful with the exact same binary and debug info for > it on my side, the flame graph is easier to work with. It looks as though > you're missing debug information for kwin though; could you make sure you > have debuginfod installed? Afaik hotspot can use it to download the required > information automatically. > > (In reply to Eduard from comment #23) > > Okay, I have now tested in dynamic graphics mode, effectively that means the > > Plasma uses the AMD CPU's GPU graphics. Now the CPU usage of kwin_wayland > > remains lower than other processes, when doing the same tests. > That'll be from copying the screen contents from the dedicated to the > integrated GPU; that's known to be very inefficient in the NVidia driver > right now. I'm certain I have debuginfod installed. It just sometimes fails to download certain debuginfo for whatever reason. I will try again though. One thing that I wanted to add if I hadn't mentioned before is that kwin_wayland will use a lot of cpu on some webpages in firefox even if nothing is happening in them while on others. It uses nothing at all.
One such website that seems to cause kwin_wayland to use a lot more cpu than normal is the endeavourOS forums.
Created attachment 171909 [details] Debug Symbols Failed to Load Apparently.
Created attachment 171914 [details] Flamegraph with hopefully more debug symbols.
Zamundaaa from comment #24) > (In reply to Dashon from comment #18) > > Well it looks like the file generated by hotspot is too big, so for now I'll > > just post screenshots of the flamegraph. If there is another way to send you > > the perf.data.perfparser files then let me know and if there are any other > > logs you need. Let me know too. > The perf file is only useful with the exact same binary and debug info for > it on my side, the flame graph is easier to work with. It looks as though > you're missing debug information for kwin though; could you make sure you > have debuginfod installed? Afaik hotspot can use it to download the required > information automatically. > > (In reply to Eduard from comment #23) > > Okay, I have now tested in dynamic graphics mode, effectively that means the > > Plasma uses the AMD CPU's GPU graphics. Now the CPU usage of kwin_wayland > > remains lower than other processes, when doing the same tests. > That'll be from copying the screen contents from the dedicated to the > integrated GPU; that's known to be very inefficient in the NVidia driver > right now. I have added one more screen shot of a flamegraph that hopefully includes more debug symbols that previously. I'm unsure if hotspot is actually calling debuginfod. It works with gdb though.
(In reply to Zamundaaa from comment #24) > (In reply to Dashon from comment #18) > > Well it looks like the file generated by hotspot is too big, so for now I'll > > just post screenshots of the flamegraph. If there is another way to send you > > the perf.data.perfparser files then let me know and if there are any other > > logs you need. Let me know too. > The perf file is only useful with the exact same binary and debug info for > it on my side, the flame graph is easier to work with. It looks as though > you're missing debug information for kwin though; could you make sure you > have debuginfod installed? Afaik hotspot can use it to download the required > information automatically. > > (In reply to Eduard from comment #23) > > Okay, I have now tested in dynamic graphics mode, effectively that means the > > Plasma uses the AMD CPU's GPU graphics. Now the CPU usage of kwin_wayland > > remains lower than other processes, when doing the same tests. > That'll be from copying the screen contents from the dedicated to the > integrated GPU; that's known to be very inefficient in the NVidia driver > right now. Would it help to simply upload a copy of my perf.data file, so that you could look at on your machine rather than the bits and pieces captured in screenshots?
Maybe that would be better, but unfortunately perf data isn't really portable. If you record one on an up to date Neon, I should be able to replicate the same environment and take a look though
(In reply to Zamundaaa from comment #31) > Maybe that would be better, but unfortunately perf data isn't really > portable. If you record one on an up to date Neon, I should be able to > replicate the same environment and take a look though Alright, I'll try and reproduce the issue on neon.
Oh, I just looked at the bug report's platform field. EndeavourOS is fine too, we just need to look at it with the same software versions
OK, then I'll upload the one I recorded on Endeavour as soon as I make it home. -------- Original Message -------- On 8/5/24 2:16 PM, Zamundaaa <bugzilla_noreply@kde.org> wrote: > https://bugs.kde.org/show_bug.cgi?id=480885 > > --- Comment #33 from Zamundaaa <xaver.hugl@gmail.com> --- > Oh, I just looked at the bug report's platform field. EndeavourOS is fine too, > we just need to look at it with the same software versions > > -- > You are receiving this mail because: > You are on the CC list for the bug.
(In reply to Zamundaaa from comment #33) > Oh, I just looked at the bug report's platform field. EndeavourOS is fine > too, we just need to look at it with the same software versions Sorry, I forgot to do this when I got home. It should be uploaded with this comment.
File was too large. Here is a dropbox link https://www.dropbox.com/scl/fi/b83p456yo2lx8ccyyso3v/perf.data?rlkey=oo9q4vnmyehrm7xem4egbxeqf&st=jnvop26j&dl=0
Okay, that worked. About 5% of the CPU usage is in drmModeAddFB2WithModifiers, which is not great, but more importantly 77% is in a drmIoctl in the framebuffer destructor, which will be either https://invent.kde.org/plasma/kwin/-/blob/bbfffec6d6efcb6ab81fc57a08430892b0b50e52/src/backends/drm/drm_buffer.cpp#L69 or https://invent.kde.org/plasma/kwin/-/blob/bbfffec6d6efcb6ab81fc57a08430892b0b50e52/src/backends/drm/drm_buffer.cpp#L70 They get called when apps update the cursor image or their window, which causes KWin to update the cursor or screen with a different buffer, which explains why you see different behavior with different apps. I don't know what the kernel driver is doing in the drm ioctl - hotspot just shows ??? - but it's supposed to be pretty much free, so this is almost certainly a driver bug. Please report it at https://forums.developer.nvidia.com/c/gpu-graphics/linux/148
(In reply to Zamundaaa from comment #37) > Okay, that worked. > About 5% of the CPU usage is in drmModeAddFB2WithModifiers, which is not > great, but more importantly 77% is in a drmIoctl in the framebuffer > destructor, which will be either > https://invent.kde.org/plasma/kwin/-/blob/ > bbfffec6d6efcb6ab81fc57a08430892b0b50e52/src/backends/drm/drm_buffer.cpp#L69 > or > https://invent.kde.org/plasma/kwin/-/blob/ > bbfffec6d6efcb6ab81fc57a08430892b0b50e52/src/backends/drm/drm_buffer.cpp#L70 > They get called when apps update the cursor image or their window, which > causes KWin to update the cursor or screen with a different buffer, which > explains why you see different behavior with different apps. > > I don't know what the kernel driver is doing in the drm ioctl - hotspot just > shows ??? - but it's supposed to be pretty much free, so this is almost > certainly a driver bug. Please report it at > https://forums.developer.nvidia.com/c/gpu-graphics/linux/148 Thanks for your time. I'll make sure to report it. I somehow knew it would end up back in Nvidia's hands.