Bug 77283 - [intel+nvidia randr offloading] X segfaults with latest intel drivers
Summary: [intel+nvidia randr offloading] X segfaults with latest intel drivers
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-10 20:16 UTC by Tomas Pruzina
Modified: 2014-04-10 22:18 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
xorg output w/ segfault & backtrace (1.13 KB, text/plain)
2014-04-10 20:16 UTC, Tomas Pruzina
no flags Details
Full Xorg log, previous attachment only contained backtrace (28.17 KB, text/plain)
2014-04-10 20:19 UTC, Tomas Pruzina
no flags Details
recompiled with debug options (133.49 KB, text/plain)
2014-04-10 20:47 UTC, Tomas Pruzina
no flags Details
Only reload HW cursors (3.50 KB, patch)
2014-04-10 21:42 UTC, Chris Wilson
no flags Details | Splinter Review

Description Tomas Pruzina 2014-04-10 20:16:49 UTC
Created attachment 97188 [details]
xorg output w/ segfault & backtrace

Good day,

after updating to latest xf86-video-drivers, X segfaults when attempting to offload Nvidia-blob->Intel via randr 1.4 (PRIME, optimus).

chipset: sandy bridge + nvidia 540M
arch: linux 3.14.0 (also linux-next)
xf86-video-intel: git
xserver 1.15.0
libdrm: 2.4.52
(x)randr: git
distro: gentoo mixed amd64 multilib
machine: Ideapad Z570

my .xinitrc:
xrandr --setprovideroutputsource "Intel" NVIDIA-0
xrandr --auto
exec awesome


After reverting back 'stable' xf86-video-intel, everything works as expected.
X crashes on second command from .xinitrc (^): xrandr --auto.
When I put "xrandr --listproviders > /home/$USER/xout" in between setprovider command and auto, output was as expected (listing both nvidia and intel, with correct capabilities).


If any more information is needed, I'm happy to provide it.
Have a nice day.
Comment 1 Tomas Pruzina 2014-04-10 20:19:04 UTC
Created attachment 97189 [details]
Full Xorg log, previous attachment only contained backtrace
Comment 2 Tomas Pruzina 2014-04-10 20:21:20 UTC
Sry for spam, relevant topic @nvidia dev forums (where I reported the bug first, since I generally only ran into troubles on nvidia side of things).

https://devtalk.nvidia.com/default/topic/726956/linux/-notabug-offloading-no-longer-works-problem-with-latest-intel-drivers-/
Comment 3 Chris Wilson 2014-04-10 20:28:00 UTC
If you can compile xf86-video-intel.git with ./configure --enable-debug=full and send me the Xorg.0.log, that would be most useful.
Comment 4 Chris Wilson 2014-04-10 20:43:32 UTC
Hmm, if you have no display devices connected to nvidia, why use it as the primary? SNB GT2 should be faster for rendering 2D and compositing than a GT540m, and then you can power down the dGPU except for when you need the extra 3D capabilities.
Comment 5 Tomas Pruzina 2014-04-10 20:47:47 UTC
Created attachment 97192 [details]
recompiled with debug options
Comment 6 Tomas Pruzina 2014-04-10 20:53:09 UTC
#4: Mainly due to VDPAU support in adobe flash and also due to the fact that I like trying out new stuff and look forward to see optimus working on Linux laptops.
And yes, I've tried vdpau emulation via libva :-]

PS: log doesn't look particularly useful, at least to me, perhaps I will need to recompile stuff with debug symbols and disable hardening (or I could git bisect the problem if needed).
Comment 7 Chris Wilson 2014-04-10 20:55:44 UTC
That wasn't where I was expecting! Can you please run

addr2line -e /usr/lib64/xorg/modules/drivers/intel_drv.so  -i 0xb88b3 0xb904e 0xba8aa
Comment 8 Chris Wilson 2014-04-10 20:57:03 UTC
(In reply to comment #6)
> #4: Mainly due to VDPAU support in adobe flash and also due to the fact that
> I like trying out new stuff and look forward to see optimus working on Linux
> laptops.
> And yes, I've tried vdpau emulation via libva :-]

Shouldn't vdpau work with DRI offloading though?
Comment 9 Chris Wilson 2014-04-10 20:57:53 UTC
Yeah, you might need the debug symbols, or use the unstripped library in the build tree.
Comment 10 Tomas Pruzina 2014-04-10 21:13:49 UTC
addr2line -e /usr/lib64/xorg/modules/drivers/intel_drv.so  -i 0xb88b3 0xb904e 0xba8aa

Gives me:
??:0
??:0
??:0

So no joy, since i'm lazy to recompile stuff atm, wouldn't magic of /proc/kallsyms suffice here?
edit: erm, no joy, since stuff from kallsyms seems to be randomized (damn hardening).

#8: not quite sure, perhaps via some override it could work in the way you suggest, but vdpauinfo complains and it hasn't worked automagically for me in the past.

I will get vanilla kernel and set it up with more sane options such as frame pointers :-] (might take some while, worst case i'll report tommorow).
Comment 11 Tomas Pruzina 2014-04-10 21:21:22 UTC
#10, just realized its userspace module so kallsyms make no sense.
Interestlingy enough, my toolchain created separated debug symbols... any ideas?
Comment 12 Chris Wilson 2014-04-10 21:25:06 UTC
If you built debug symbols, they were stripped upon installation. If you still have the build tree around you can point addr2line to xf86-video-intel/src/.libs/intel_drv.so instead.
Comment 13 Tomas Pruzina 2014-04-10 21:30:01 UTC
Gotcha.

/var/tmp/tc/xf86-video-intel/src/sna/sna_display.c:3440
/var/tmp/tc/xf86-video-intel/src/sna/sna_display.c:3627
/var/tmp/tc/xf86-video-intel/src/sna/sna_display.c:4081
Comment 14 Tomas Pruzina 2014-04-10 21:35:36 UTC
I've (re) installed from source and then used addr2line on debug symbols, hopefully pointers still remained valid.
Comment 15 Tomas Pruzina 2014-04-10 21:38:20 UTC
If not I can load my debug kernel and provide coredump (perhaps I should have done that in first place).
Comment 16 Chris Wilson 2014-04-10 21:39:08 UTC
I had a funny feeling it was going to be that.
Comment 17 Chris Wilson 2014-04-10 21:42:36 UTC
Created attachment 97195 [details] [review]
Only reload HW cursors

This should prevent the crash. Though I am not sure why PRIME forces software cursors.
Comment 18 Tomas Pruzina 2014-04-10 21:54:09 UTC
works for me, well done sir.
Comment 19 Chris Wilson 2014-04-10 22:00:16 UTC
commit 4950bc4fea80d44dde798f3f8b5a07eee1555a63
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Apr 10 22:26:42 2014 +0100

    sna: Only reload an active HW cursor
    
    Do not attempt to restore the cursor handle if a SW cursor is currently
    active. In particular, this prevents a crash after modesetting if we
    never had a real cursor (for example output offloading).
    
    Reported-by: Tomas Pruzina <pruzinat@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77283
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Now if you can work out the magic to control which GPU vdpau runs on, we will be laughing.
Comment 20 Tomas Pruzina 2014-04-10 22:05:56 UTC
:-]
I think that I'll write on mailing list about that and create separate tracking bug for that.
Comment 21 Chris Wilson 2014-04-10 22:18:10 UTC
Hmm, left a booby trap in there. Silly me for trying to do 2 things at once. :(

Make sure you update again before X crashes.


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.