Bug 108495

Summary: [patch][crash] Xorg is crashing on startup in xinerama configuration
Product: xorg Reporter: Mariusz Białończyk <manio>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg.log
none
xorg.conf
none
my patch
none
Only generate coldprobe for RR none

Description Mariusz Białończyk 2018-10-19 11:37:07 UTC
Hello
Xorg is crashing with the following backtrace:

[ 17793.950] (EE) Backtrace:
[ 17793.951] (EE) 0: /usr/lib/xorg/Xorg (OsLookupColor+0x139) [0x555656ef5de9]
[ 17793.952] (EE) 1: /lib/x86_64-linux-gnu/libpthread.so.0 (funlockfile+0x50) [0x7f5fbc02d92f]
[ 17793.952] (EE) 2: /lib/x86_64-linux-gnu/libc.so.6 (gsignal+0x10b) [0x7f5fbbe91f3b]
[ 17793.953] (EE) 3: /lib/x86_64-linux-gnu/libc.so.6 (abort+0x151) [0x7f5fbbe932f1]
[ 17793.954] (EE) 4: /lib/x86_64-linux-gnu/libc.so.6 (uselocale+0x33a) [0x7f5fbbe8ac7a]
[ 17793.955] (EE) 5: /lib/x86_64-linux-gnu/libc.so.6 (__assert_fail+0x42) [0x7f5fbbe8ab02]
[ 17793.955] (EE) 6: /usr/lib/xorg/Xorg (RRClientKnowsRates+0x83) [0x555656e55533]
[ 17793.955] (EE) 7: /usr/lib/xorg/Xorg (RRGetInfo+0x47f) [0x555656e55c5f]
[ 17793.956] (EE) 8: /usr/lib/xorg/modules/drivers/intel_drv.so (_init+0x58a82) [0x7f5fba736472]
[ 17793.956] (EE) 9: /usr/lib/xorg/Xorg (TimerSet+0x180) [0x555656eef660]
[ 17793.956] (EE) 10: /usr/lib/xorg/Xorg (TimerSet+0x1f8) [0x555656eef728]
[ 17793.956] (EE) 11: /usr/lib/xorg/Xorg (WaitForSomething+0x277) [0x555656eef807]
[ 17793.956] (EE) 12: /usr/lib/xorg/Xorg (SendErrorToClient+0x10c) [0x555656d9772c]
[ 17793.956] (EE) 13: /usr/lib/xorg/Xorg (InitFonts+0x3b6) [0x555656d9b906]
[ 17793.956] (EE) 14: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xe7) [0x7f5fbbe7eb17]
[ 17793.956] (EE) 15: /usr/lib/xorg/Xorg (_start+0x2a) [0x555656d8567a]

Dual-card configuration (intel + nvidia).
This crash happens on xinerama when both cards are in use.
If only intel or only nvidia are used - no such problem.

I've tested it on modesetting and intel driver.
I've also tested on nouveau and proprietary nvidia driver.
In all above circumstances I have a crash when both cards are enabled.

I've prepared a patch which just disables a RandR calls in one place and it helped! At least I have a working Xorg in awesome wm and did not notice any side effects for several hours of testing.

Please review
Comment 1 Mariusz Białończyk 2018-10-19 11:37:37 UTC
Created attachment 142091 [details]
xorg.log
Comment 2 Mariusz Białończyk 2018-10-19 11:38:04 UTC
Created attachment 142092 [details]
xorg.conf
Comment 3 Mariusz Białończyk 2018-10-19 11:38:28 UTC
Created attachment 142093 [details] [review]
my patch
Comment 4 Chris Wilson 2018-10-19 12:36:28 UTC
Try

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 96e7b1bc..76e1e75b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -7743,7 +7743,10 @@ bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna)
                }
        }
        sort_config_outputs(sna);
-       TimerSet(NULL, 0, COLDPLUG_DELAY_MS, sna_mode_coldplug, sna);
+
+       /* Simulate a hotplug event on wakeup to force a RR probe */
+       if (rrGetScrPriv(screen))
+               TimerSet(NULL, 0, COLDPLUG_DELAY_MS, sna_mode_coldplug, sna);
 
        sna_setup_provider(scrn);
        return scrn->modes != NULL;
Comment 5 Chris Wilson 2018-10-19 12:37:06 UTC
Would help if I didn't move the code before pasting.
Comment 6 Chris Wilson 2018-10-19 12:46:36 UTC
Created attachment 142094 [details] [review]
Only generate coldprobe for RR
Comment 7 Mariusz Białończyk 2018-10-22 04:33:01 UTC
Chris,
I am confirming that with your patch applied, it is working properly :)

Thank you!
Comment 8 Chris Wilson 2018-10-22 07:53:30 UTC
commit f146dc06ce32df9c2f9b46691e968c7e1bcaeb52 (HEAD -> master, upstream/master)
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Oct 19 13:44:43 2018 +0100

    sna: Only generate a coldprobe RR probe when RandR is enabled
    
    If Xinerama is enabled, RandR is disabled and calling into RR functions
    merely explode, so don't.
    
    Reported-by: Mariusz Białończyk <manio@skyboo.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108495
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.