Bug 498544

Summary: Maximizing a window by dragging it to the top of the screen can cause a full system freeze
Product: [Plasma] kwin Reporter: kostadinshishmanov
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: fanzhuyifan
Priority: NOR    
Version First Reported In: git-stable-Plasma/6.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=481610
https://bugs.kde.org/show_bug.cgi?id=489797
https://bugs.kde.org/show_bug.cgi?id=488518
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description kostadinshishmanov 2025-01-12 00:58:55 UTC
SUMMARY

Sometimes, when I drag a window to the top to maximize it, the whole system freezes, requiring a full reboot. 
It's not 100% reproducible, so you might need to drag the window down to minimize it, and then back to the top of the screen to maximize it again in order to cause the freeze.

Can't reproduce with 6.2.5, will try to bisect if I have the time.

STEPS TO REPRODUCE
1. Open a random window
2. Drag it to the top of the screen to maximize it
3. Whole system freeze

OBSERVED RESULT

Whole system freezes

EXPECTED RESULT

The window gets maximized without causing a system freeze

SOFTWARE/OS VERSIONS
Operating System: Gentoo 2.17
KDE Plasma Version: 6.2.90
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.12.9-gentoo-dist (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 30.9 GiB of RAM
Graphics Processor: AMD Radeon RX 6800

ADDITIONAL INFORMATION:
`kwin_wayland_wrapper[106933]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug` gets spammed in journalctl
Comment 1 fanzhuyifan 2025-01-12 16:46:34 UTC
When your system freezes, could you try pressing alt+sysrq (or alt+printscreen), and then ctrl+alt+f4 to switch to a virtual terminal?

If you can do that, could you first run htop to check the CPU usage of kwin?
Then, could you run attach gdb to the running kwin process (gdb kwin_wayland -p (pid of kwin_wayland process)), hit ctrl-c, and provide the output of bt? (debug symbols needed, https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces)

I was able to reproduce by moving a window along top edge back and forth, and saw kwin stuck in updateInteractiveMoveResize in window.cpp. So this very likely has same underlying cause as BUG 481610
Comment 3 Zamundaaa 2025-01-16 17:03:14 UTC
Git commit dcaa11bced46539b87ab36189c538f6b70f8eac2 by Xaver Hugl.
Committed on 16/01/2025 at 16:32.
Pushed by zamundaaa into branch 'master'.

backends/drm: remove the chance for false positives in pageflip timeout detection

The previous code also detected the main thread hanging as a pageflip timeout. Instead of
just detecting the pageflip timing out, call back to the main thread and handle it hanging

M  +31   -4    src/backends/drm/drm_commit_thread.cpp
M  +4    -0    src/backends/drm/drm_commit_thread.h
M  +6    -0    src/backends/drm/drm_gpu.cpp
M  +3    -1    src/backends/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/-/commit/dcaa11bced46539b87ab36189c538f6b70f8eac2
Comment 4 Bug Janitor Service 2025-01-16 17:04:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7025
Comment 5 fanzhuyifan 2025-01-16 17:09:28 UTC
Just discovered 493797, which is more detailed and earlier.

*** This bug has been marked as a duplicate of bug 493797 ***
Comment 6 Zamundaaa 2025-01-16 19:21:04 UTC
Git commit 275b4ac9829720291cfae67d0ae37165b6140ce4 by Xaver Hugl.
Committed on 16/01/2025 at 17:04.
Pushed by zamundaaa into branch 'Plasma/6.3'.

backends/drm: remove the chance for false positives in pageflip timeout detection

The previous code also detected the main thread hanging as a pageflip timeout. Instead of
just detecting the pageflip timing out, call back to the main thread and handle it hanging
(cherry picked from commit dcaa11bced46539b87ab36189c538f6b70f8eac2)

M  +31   -4    src/backends/drm/drm_commit_thread.cpp
M  +4    -0    src/backends/drm/drm_commit_thread.h
M  +6    -0    src/backends/drm/drm_gpu.cpp
M  +3    -1    src/backends/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/-/commit/275b4ac9829720291cfae67d0ae37165b6140ce4