Bug 80001

Summary: regression: X segfaults with xf86-video-intel-2.99.912 and DRI_PRIME (with radeon)
Product: xorg Reporter: Jan Buecken <jb.faq>
Component: Server/Ext/DRIAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: cmalvesgomesreg, pokepal101, shawn.starr, thad.fisch
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg log after segfault
none
command run with gdb
none
bt full of X after segfault
none
git biesect log
none
Xorg.0.log with intel debug full compiled
none
Use the right DRI2ScreenPtr for calling reuse_notifier
none
Xorg.0.log after crash on normal system none

Description Jan Buecken 2014-06-13 19:53:07 UTC
Created attachment 101006 [details]
xorg log after segfault

Hello,
after update from 
xf86-video-intel-2.21.15
to
xf86-video-intel-2.99.912
(with xorg-server-1.15.0)
the X server segfaults if I try to use dri_prime.

I run

DRI_PRIME=1 glxgears

and X restarts. Everything is working fine with xf86-video-intel-2.21.15

Setup:
xf86-video-intel-2.99.912
xorg-server-1.15.0
xf86-video-ati-7.3.0


A xorg log that shows a backtrace is attached.
Comment 1 Jan Buecken 2014-06-13 19:56:55 UTC
Created attachment 101010 [details]
command run with gdb

I don't use gdb very often. But the output may help
I created it by running
DRI_PRIME=1 gdb glxgears > dri_prime_true_gdb_glxgears
and typed "run" blindly from an xterm.
X crashes afterwards...
Comment 2 Chris Wilson 2014-06-13 19:59:04 UTC
Can you grab a bt full?

Ah, you need to run gdb on X, which requires a ssh connection.
Comment 3 Jan Buecken 2014-06-13 20:18:45 UTC
I'm not sure how to get the bt full (is it possible via a tty...) or do I really need a second client, and use X forwarding?

ssh -X myserver "DRI_PRIME=1 gdb glxgears"

Or what are your intentions?


May be interesting:
It is working with
xf86-video-intel-2.99.911-r1 
(I'm on gentoo, r1 has small backports compared to plain 2.99.911)

So the regression is between xf86-video-intel-2.99.911 and xf86-video-intel-2.99.912.
Comment 4 Chris Wilson 2014-06-13 20:30:24 UTC
From your second machine, ssh into your main machine and attach to a running X server, e.g. gdb --pid `pidof X`. Then trigger the crash on the first machine. Go back to your second machine, see that gdb has the segfault and type bt full.
Comment 5 Jan Buecken 2014-06-13 21:00:27 UTC
Interesting. gdb on the X pid freezes the display output and I cannot make any input via mouse and keyboard.



By the way:

Just tried to use git version, but compile failed

(another bug, but may be connected to your recent changes?)

[...]
/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999/tools/virtual.c: In function ‘display_cleanup’:
/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999/tools/virtual.c:3067:2: error: ‘res’ undeclared (first use in this function)
/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999/tools/virtual.c:3067:2: note: each undeclared identifier is reported only once for each function it appears in
/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999/tools/virtual.c: In function ‘context_cleanup’:
/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999/tools/virtual.c:3085:23: error: request for member ‘display’ in something not a structure or union
make[2]: *** [intel_virtual_output-virtual.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999_build/tools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/x11-drivers/xf86-video-intel-9999/work/xf86-video-intel-9999_build'
make: *** [all] Error 2
Comment 6 Jan Buecken 2014-06-13 21:20:30 UTC
Created attachment 101014 [details]
bt full of X after segfault

Got it. Forgot the "continue" (as I mentioned, I use gdb rarely...)

bt full attached
Comment 7 Jan Buecken 2014-06-13 21:25:49 UTC
Ok, saw your commit in git. Build works again.

Problem still exists in git (last commit 15485602d8451bcf6c2e979ccbd9cdc11111bcce).
Comment 8 Chris Wilson 2014-06-13 21:59:15 UTC
Sigh. No symbols for X or xf86-video-intel. Tested DRI_PRIME=1 locally with nouveau and nothing untoward happened.
Comment 9 Jan Buecken 2014-06-14 14:26:30 UTC
Created attachment 101051 [details]
git biesect log

8369166349c92a20d9a2e7d0256e63f66fe2682b is the first bad commit
commit 8369166349c92a20d9a2e7d0256e63f66fe2682b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 4 08:29:51 2014 +0100

    sna/dri2: Enable immediate buffer exchanges
    
    The primary benefit of this is avoid the extra blit when using a
    compositor and instead propagate the compositor flip on the frontbuffer
    to the scanout, or equivalently allows a fullscreen game to flip onto
    the scanout without intervention by TearFree.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

:040000 040000 dfbc6f4995687fd29ebe5072c432fc951449c977 22f8ea8ed349d4ce0e37115a5aa24856321857e0 M      src
Comment 10 Chris Wilson 2014-06-14 17:04:55 UTC
That's one of the big scary changes that should not have affected you outside of TearFree. Is it possible for you to compile xf86-video-intel with --enable-debug=full and attach the (compressed) Xorg.0.log?
Comment 11 Jan Buecken 2014-06-17 22:03:55 UTC
Created attachment 101273 [details]
Xorg.0.log with intel debug full compiled

The Xorg.0.log after compiling xf86-video-intel (git today) with --enable-debug=full and the crash reproduced via 
   DRI_PRIME=1 glxgears
.
Comment 12 Chris Wilson 2014-06-17 22:30:45 UTC
That was a distinct sanity check failure. Please update to

commit 77f1a16f1145e69d69a76f2db4b1c60d9a7a4d53
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jun 17 23:27:16 2014 +0100

    sna: Set the correct mapping type after calling mmap__async
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=80001
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

and recapture the debug log. Thanks.
Comment 13 Chris Wilson 2014-06-18 05:52:39 UTC
*** Bug 80172 has been marked as a duplicate of this bug. ***
Comment 14 Chris Wilson 2014-06-18 10:11:23 UTC
Created attachment 101292 [details] [review]
Use the right DRI2ScreenPtr for calling reuse_notifier
Comment 15 Yingtong Li 2014-06-19 07:08:16 UTC
Created attachment 101332 [details]
Xorg.0.log after crash on normal system

Attached my own log file on the off chance that it might prove useful.
Comment 16 Jan Buecken 2014-06-21 12:59:08 UTC
Hello Chris,
I applied the patch from Comment 14 to xorg-server-1.15.0 and the segfault went away. --> Works for me.

Thanks very much.
Comment 17 GitLab Migration User 2018-12-13 18:32:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/210.

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.