Bug 489878

Summary: 100% CPU for kwin_wayland and system hang on login with Lightdm
Product: [Plasma] kwin Reporter: ase1590
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: major CC: ase1590, kdedev, postix, xaver.hugl
Priority: NOR    
Version: 6.1.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=493277
https://bugs.kde.org/show_bug.cgi?id=492506
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description ase1590 2024-07-07 14:42:21 UTC
SOFTWARE/OS VERSIONS
OS: Arch Linux
Kernel: 6.6.37
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
GPU: AMD Radeon RX 7900 XTX

SUMMARY:
On login, kwin_wayland will max out the system's CPU by having multiple instances running, all at 100%, causing the system's desktop to entirely freeze up. 
This began occuring on mesa 1.24.1.2-1 on arch, however mesa 1.24.1.1-1 was working fine and not triggering this issue. 

I will have multiple instances of the following process, all using 100% CPU:

`/usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-@ --xwayland-fd 8 --xwayland-fd 9 --xwayland-display :1 --xwayland-xauthority /run/user/10@@/xauth_pzjRIB --xwayland` 

If I ssh in and kill *one* of the kwin_wayland processes, it will cause it to kill the others and restart kwin normally, making the system usable again. 

logs from `journalctl --user -u plasma-kwin_wayland.service -b`:

```
Jul 07 08:55:45 thegatekeeper systemd[1349]: Starting KDE Window Manager...
Jul 07 08:55:45 thegatekeeper systemd[1349]: Started KDE Window Manager.
Jul 07 08:55:45 thegatekeeper kwin_wayland[1401]: No backend specified, automatically choosing drm
Jul 07 08:55:45 thegatekeeper kwin_wayland_wrapper[1401]: _amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
Jul 07 08:55:45 thegatekeeper kwin_wayland_wrapper[1401]: amdgpu: amdgpu_device_initialize failed.
Jul 07 08:55:58 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: The XKEYBOARD keymap compiler (xkbcomp) reports:
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: > Warning:          Unsupported maximum keycode 708, clipping.
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: >                   X11 cannot support keycodes above 255.
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: > Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: > Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou
Jul 07 08:55:59 thegatekeeper kwin_wayland_wrapper[1651]: Errors from xkbcomp are not fatal to the X server
Jul 07 08:56:09 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:56:10 thegatekeeper kcminit[1632]: Initializing  "/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fonts.so"
Jul 07 08:56:10 thegatekeeper kcminit[1632]: Initializing  "/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_style.so"
Jul 07 08:56:52 thegatekeeper kwin_wayland_wrapper[1557]: [dix] couldn't enable device 10
Jul 07 08:56:52 thegatekeeper kwin_wayland_wrapper[1557]: [dix] couldn't enable device 11
Jul 07 08:56:52 thegatekeeper kwin_wayland_wrapper[1557]: [dix] couldn't enable device 12
Jul 07 08:57:06 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:57:31 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:57:40 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:57:48 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:57:57 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:05 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:14 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:22 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:31 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:39 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:48 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:58:56 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:59:05 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:59:13 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:59:21 thegatekeeper kwin_wayland[1401]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Jul 07 08:59:25 thegatekeeper kwin_wayland[2399]: No backend specified, automatically choosing drm
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: The XKEYBOARD keymap compiler (xkbcomp) reports:
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: > Warning:          Unsupported maximum keycode 708, clipping.
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: >                   X11 cannot support keycodes above 255.
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: > Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: > Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou
Jul 07 08:59:25 thegatekeeper kwin_wayland_wrapper[2574]: Errors from xkbcomp are not fatal to the X server
Jul 07 08:59:25 thegatekeeper kcminit[2589]: Initializing  "/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fonts.so"
Jul 07 08:59:25 thegatekeeper kcminit[2589]: Initializing  "/usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_style.so"
Jul 07 09:00:31 thegatekeeper kwin_wayland[2399]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Jul 07 09:00:31 thegatekeeper kwin_wayland[2399]: kwin_scene_opengl: 0x2: GL_INVALID_VALUE in glTexStorage2D(width, height or depth < 1)
Jul 07 09:00:31 thegatekeeper kwin_wayland[2399]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Jul 07 09:00:31 thegatekeeper kwin_wayland[2399]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glBindFramebuffer(non-gen name)
Jul 07 09:00:31 thegatekeeper kwin_wayland[2399]: kwin_scene_opengl: 0x2: GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
```
Comment 1 ase1590 2024-07-08 13:51:05 UTC
Curiously if I skip using LightDM and just directly do
```
export QT_LOGGING_RULES="kwin_*.debug=true"
startplasma-wayland > ~/startplasma-wayland.log 2>&1
```

the KDE session comes up just fine with no errors. 
Which makes me wonder if this is somehow related to whatever Lightdm is doing to start up the session.
Comment 2 ase1590 2024-07-08 14:26:06 UTC
Yeah. Switching over to SDDM instead of Lightdm makes this issue not able to be reproduced, so I'm thinking this may have been a bug with Lightdm. 

This ticket can either be held open to investigate the interaction with lightdm and kwin
or the ticket can possibly be closed as not a KDE issue. 

I'm fine with either decision.
Comment 3 postix 2024-10-17 12:30:06 UTC
About the plageflips, see also bug #493754