Bug 89681 - X segfaults when switching virtual desktops of KDE
Summary: X segfaults when switching virtual desktops of KDE
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-19 17:34 UTC by Johannes Hirte
Modified: 2015-03-30 02:20 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
xorg.log crash (98.85 KB, text/plain)
2015-03-23 17:52 UTC, Lorenzo Bona
no flags Details
Xorg.0.log (35.99 KB, text/plain)
2015-03-23 18:46 UTC, Johannes Hirte
no flags Details
dmesg output (55.51 KB, text/plain)
2015-03-23 18:46 UTC, Johannes Hirte
no flags Details
Flip error handling fixes (2.65 KB, patch)
2015-03-24 10:09 UTC, Michel Dänzer
no flags Details | Splinter Review
Flip error handling fixes v2 (2.66 KB, text/plain)
2015-03-25 09:14 UTC, Michel Dänzer
no flags Details
xorg.log (2 bytes, text/plain)
2015-03-25 09:49 UTC, Lorenzo Bona
no flags Details

Description Johannes Hirte 2015-03-19 17:34:08 UTC
since commit 6c3a721cde9317233072b573f9502348dcd21b16 of xf86-video-ati X segfaults when switching virtual desktops of KDE. I can reproduce this easily by playing a video on one vt in fullscreen and switching the desktops then back and forth. 

Xorg.log shows the this:

[   258.612] (WW) RADEON(0): flip queue failed: Device or resource busy
[   258.612] (EE)
[   258.612] (EE) Backtrace:
[   258.613] (EE) 0: /usr/bin/X (OsLookupColor+0x149) [0x59c049]
[   258.614] (EE) 1: /lib64/libc.so.6 (killpg+0x50) [0x7f20a4e7607f]
[   258.614] (EE) 2: /usr/lib64/libxcb.so.1 (_init+0x3e73e) [0x7f20a3d5dcfe]
[   258.614] (EE) 3: /usr/lib64/libxcb.so.1 (_init+0x3b5c4) [0x7f20a3d57a04]
[   258.615] (EE) 4: /usr/lib64/libxcb.so.1 (_init+0x42d14) [0x7f20a3d665f4]
[   258.615] (EE) 5: /usr/lib64/libxcb.so.1 (_init+0x3a5ba) [0x7f20a3d556ba]
[   258.615] (EE) 6: /usr/lib64/libxcb.so.1 (_init+0x3b64b) [0x7f20a3d57acb]
[   258.616] (EE) 7: /usr/lib64/libdrm.so.2 (drmHandleEvent+0x76) [0x7f20a6154436]
[   258.616] (EE) 8: /usr/bin/X (WakeupHandler+0x6b) [0x43f1eb]
[   258.617] (EE) 9: /usr/bin/X (WaitForSomething+0x1c3) [0x594d83]
[   258.617] (EE) 10: /usr/bin/X (SendErrorToClient+0x111) [0x43a1f1]
[   258.617] (EE) 11: /usr/bin/X (remove_fs_handlers+0x435) [0x43e675]
[   258.618] (EE) 12: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f20a4e61fd0]
[   258.618] (EE) 13: /usr/bin/X (_start+0x29) [0x42826e]
[   258.619] (EE) 14: ? (?+0x29) [0x29]
[   258.619] (EE)
[   258.619] (EE) Segmentation fault at address 0x0
[   258.619] (EE)
Fatal server error:
[   258.619] (EE) Caught signal 11 (Segmentation fault). Server aborting
[   258.619] (EE)
[   258.619] (EE)

hardware is a Mobility Radeon HD5470
Comment 1 Michel Dänzer 2015-03-20 09:54:32 UTC
I can't seem to reproduce this. Which video player are you using, and how are you switching between the desktops?

Can you get a backtrace of the crash with gdb, and make sure there are debugging symbols for /usr/bin/X(org), /usr/lib64/libdrm.so.2 and radeon_drv.so? If you don't know how to do this, see http://wiki.x.org/wiki/Development/Documentation/ServerDebugging/ .

Please attach the full Xorg.0.log file and output of dmesg.
Comment 2 Lorenzo Bona 2015-03-23 17:51:53 UTC
Same issue here, but with a different cause.

If I run a Steam game, I've tried with CS:GO and Dota2, in full-screen when I ALT+TAB to switch between opened windows Xorg crashes.

I compile ati from git and until this commit (7388d0b6c54b9d536fdb161e3aa61b326627b939) I've never faced this problem.

Here you are my Xorg.0.log.
Comment 3 Lorenzo Bona 2015-03-23 17:52:22 UTC
Created attachment 114555 [details]
xorg.log crash
Comment 4 Johannes Hirte 2015-03-23 18:43:05 UTC
(In reply to Michel Dänzer from comment #1)
> I can't seem to reproduce this. Which video player are you using, and how
> are you switching between the desktops?
> 
> Can you get a backtrace of the crash with gdb, and make sure there are
> debugging symbols for /usr/bin/X(org), /usr/lib64/libdrm.so.2 and
> radeon_drv.so? If you don't know how to do this, see
> http://wiki.x.org/wiki/Development/Documentation/ServerDebugging/ .
> 
> Please attach the full Xorg.0.log file and output of dmesg.

Video player is mpv, desktop environment is KDE5 compiled from git. I've configured 6 different VTs that are switched with F1-F6. 

backtrace from a crash:

Program received signal SIGABRT, Aborted.
0x00007f0433757f97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007f0433757f97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007f04337593bd in __GI_abort () at abort.c:89
#2  0x00007f0433797d20 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7f043388fd80 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007f043379d59d in malloc_printerr (action=3, str=0x7f043388fed8 "double free or corruption (out)", ptr=<optimized out>) at malloc.c:4958
#4  0x00007f043379ddcb in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3829
#5  0x00007f04325fad64 in radeon_drm_abort_one (e=0x2fb6e80, e@entry=0x7f0432fd16b8) at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_drm_queue.c:112
#6  0x00007f04325faee5 in radeon_drm_abort_entry (entry=entry@entry=0x7f0432fd16b8) at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_drm_queue.c:136
#7  0x00007f0432603d34 in radeon_do_pageflip (scrn=0x2feac90, client=<optimized out>, new_front=<optimized out>, id=<optimized out>, data=0x0, ref_crtc_hw_id=0, handler=0x7f04325f7dc0 <radeon_dri2_flip_event_handler>, 
    abort=0x7f04325f7d80 <radeon_dri2_flip_event_abort>) at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/drmmode_display.c:2378
#8  0x00007f04325f9b5a in radeon_dri2_schedule_flip (front=<optimized out>, back=<optimized out>, target_msc=<optimized out>, data=<optimized out>, func=<optimized out>, draw=<optimized out>, client=<optimized out>, 
        scrn=<optimized out>) at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_dri2.c:650
#9  radeon_dri2_frame_event_handler (scrn=0x23f80a0, seq=12941, usec=218698740, event_data=0x2fec6e0) at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_dri2.c:809
#10 0x00007f04325fadeb in radeon_drm_queue_handler (fd=<optimized out>, frame=<optimized out>, sec=<optimized out>, usec=<optimized out>, user_ptr=<optimized out>)
            at /var/tmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_drm_queue.c:67
#11 0x00007f0434a393d6 in drmHandleEvent (fd=18, evctx=0x23f8a68) at /var/tmp/portage/x11-libs/libdrm-9999/work/libdrm-9999/xf86drmMode.c:879
#12 0x000000000043fb0b in WakeupHandler (result=result@entry=1, pReadmask=pReadmask@entry=0x63f080 <LastSelectMask>) at /var/tmp/portage/x11-base/xorg-server-1.17.1-r1/work/xorg-server-1.17.1/dix/dixutils.c:423
#13 0x000000000059aa04 in WaitForSomething (pClientsReady=pClientsReady@entry=0x2651360) at /var/tmp/portage/x11-base/xorg-server-1.17.1-r1/work/xorg-server-1.17.1/os/WaitFor.c:229
#14 0x000000000043a731 in Dispatch () at /var/tmp/portage/x11-base/xorg-server-1.17.1-r1/work/xorg-server-1.17.1/dix/dispatch.c:361
#15 0x000000000043ef15 in dix_main (argc=10, argv=0x7fff5ac2a1e8, envp=<optimized out>) at /var/tmp/portage/x11-base/xorg-server-1.17.1-r1/work/xorg-server-1.17.1/dix/main.c:298
#16 0x00007f0433743fd0 in __libc_start_main (main=0x428240 <main>, argc=10, argv=0x7fff5ac2a1e8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff5ac2a1d8) at libc-start.c:289
#17 0x000000000042826e in _start ()
Comment 5 Johannes Hirte 2015-03-23 18:46:09 UTC
Created attachment 114558 [details]
Xorg.0.log
Comment 6 Johannes Hirte 2015-03-23 18:46:49 UTC
Created attachment 114559 [details]
dmesg output
Comment 7 Lorenzo Bona 2015-03-23 18:51:16 UTC
(In reply to Lorenzo Bona from comment #2)
> Same issue here, but with a different cause.
> 
> If I run a Steam game, I've tried with CS:GO and Dota2, in full-screen when
> I ALT+TAB to switch between opened windows Xorg crashes.
> 
> I compile ati from git and until this commit
> (7388d0b6c54b9d536fdb161e3aa61b326627b939) I've never faced this problem.
> 
> Here you are my Xorg.0.log.

Another hint.
If I execute the same games in a window, not fullscreen, this crash never appen. I can ALT+TAB like crazy.

@Johannes are you using mpv in fullscreen mode?
Otherwise mine could be a different issue.
Comment 8 Johannes Hirte 2015-03-23 19:57:55 UTC
(In reply to Lorenzo Bona from comment #7)
> @Johannes are you using mpv in fullscreen mode?
> Otherwise mine could be a different issue.

Yes, like mentioned in the initial report, I've switched the video to fullscreen for triggering this bug.
Comment 9 Michel Dänzer 2015-03-24 10:09:55 UTC
Created attachment 114577 [details] [review]
Flip error handling fixes

Does this patch fix the problem?

Did you get the "flip queue failed: Device or resource busy" messages before the change which caused the problem as well?
Comment 10 Lorenzo Bona 2015-03-24 18:57:54 UTC
(In reply to Michel Dänzer from comment #9)
> Created attachment 114577 [details] [review] [review]
> Flip error handling fixes
> 
> Does this patch fix the problem?

Nope, X still crashes.

> Did you get the "flip queue failed: Device or resource busy" messages before
> the change which caused the problem as well?

Mmm not completely sure, but I think it's the first time I see this message.
Comment 11 Lorenzo Bona 2015-03-24 18:59:11 UTC
Forgot to mention.

My GPU is a R7-265 - Pitcairn.
Comment 12 Johannes Hirte 2015-03-24 19:32:39 UTC
Same here, the patch doesn't fix the issue and I've not seen the message in the logs before.
Comment 13 Michel Dänzer 2015-03-25 09:14:18 UTC
Created attachment 114612 [details]
Flip error handling fixes v2

How about this patch?

It doesn't address the cause of the flip queue failure though, no idea yet how that could happen.
Comment 14 Lorenzo Bona 2015-03-25 09:49:17 UTC
(In reply to Michel Dänzer from comment #13)
> Created attachment 114612 [details]
> Flip error handling fixes v2
> 
> How about this patch?
> 
> It doesn't address the cause of the flip queue failure though, no idea yet
> how that could happen.

Nice, X doesn't crash now, still complains about page flipping, as you said.
New Xorg.log attached.

I've tested your patch on top of latest changes you've pushed some minutes ago.
Comment 15 Lorenzo Bona 2015-03-25 09:49:57 UTC
Created attachment 114614 [details]
xorg.log
Comment 16 Michel Dänzer 2015-03-26 06:46:30 UTC
Can one of you attach gdb to the Xorg process, set a breakpoint at the drmmode_display.c line printing the "flip queue failed" error message, trigger the breakpoint and get a backtrace?
Comment 17 Michel Dänzer 2015-03-26 07:12:14 UTC
(In reply to Michel Dänzer from comment #16)
> Can one of you attach gdb to the Xorg process, set a breakpoint at the
> drmmode_display.c line printing the "flip queue failed" error message,
> trigger the breakpoint and get a backtrace?

Never mind, it'll be basically the same as in comment 4.
Comment 18 Michel Dänzer 2015-03-30 02:20:16 UTC
The segfault should be fixed. If the flip queue failure causes any other problem, another report should be filed for that.

commit 8fc22360d5520469c82092ccb0fcf2af330c573f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 26 15:58:01 2015 +0900

    Increase robustness against DRM page flip ioctl failures v3
    
    Centralize cleanup, only clean up things that have been allocated for
    the failed ioctl call.
    
    Fixes double-free after a flip ioctl failure.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.