Bug 109680

Summary: Multiple cards with modesetting results in Segmentation Fault
Product: xorg Reporter: ToBeReplaced
Component: Driver/AMDgpuAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED NOTOURBUG QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description ToBeReplaced 2019-02-19 22:05:15 UTC
I am attempting to use modesetting with the following two devices, one AGPU, one Graphics Card. Both cards are working fine if the configuration is modified to omit the other.

10:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos PRO [Radeon HD 7450] (prog-if 00 [VGA controller])
        Subsystem: Micro-Star International Co., Ltd. [MSI] Device 212f
        Flags: bus master, fast devsel, latency 0, IRQ 320
        Memory at e0000000 (64-bit, prefetchable) [size=256M]
        Memory at fe920000 (64-bit, non-prefetchable) [size=128K]
        I/O ports at f000 [size=256]
        Expansion ROM at fe900000 [disabled] [size=128K]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150] Advanced Error Reporting
        Kernel driver in use: radeon
        Kernel modules: radeon


38:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] (rev c8) (prog-if 00 [VGA controller])
        Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series]
        Flags: bus master, fast devsel, latency 0, IRQ 57
        Memory at c0000000 (64-bit, prefetchable) [size=256M]
        Memory at d0000000 (64-bit, prefetchable) [size=2M]
        I/O ports at d000 [size=256]
        Memory at fe400000 (32-bit, non-prefetchable) [size=512K]
        Expansion ROM at <unassigned> [disabled]
        Capabilities: [48] Vendor Specific Information: Len=08 <?>
        Capabilities: [50] Power Management version 3
        Capabilities: [64] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable+ Count=1/4 Maskable- 64bit+
        Capabilities: [c0] MSI-X: Enable- Count=3 Masked-
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [200] #15
        Capabilities: [270] #19
        Capabilities: [2a0] Access Control Services
        Capabilities: [2b0] Address Translation Service (ATS)
        Capabilities: [2c0] Page Request Interface (PRI)
        Capabilities: [2d0] Process Address Space ID (PASID)
        Capabilities: [320] Latency Tolerance Reporting
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu

Configuration:

Section "ServerLayout" 
    Identifier "Example" 
    Screen 0 "A" 
    Screen 1 "B" 
EndSection 

Section "Device" 
    Identifier "A Card" 
    Driver "modesetting" 
    Screen 0 
    BusID "PCI:16@0:0:0" 
    Option "kmsdev" "/dev/dri/card1" 
    Option "Monitor-DVI-D-1" 
EndSection 

Section "Monitor" 
    Identifier "A Monitor" 
EndSection 

Section "Screen" 
    Identifier "A" 
    Device "A Card" 
    Monitor "A Monitor" 
EndSection 

Section "Device" 
    Identifier "B Card" 
    Driver "modesetting" 
    Screen 1 
    BusID "PCI:56@0:0:0" 
    Option "kmsdev" "/dev/dri/card0" 
    Option "Monitor-HDMI-1" 
EndSection 

Section "Monitor" 
    Identifier "B Monitor" 
EndSection 

Section "Screen" 
    Identifier "B" 
    Device "B Card" 
    Monitor "B Monitor" 
EndSection 

Xorg.log.0:

X.Org X Server 1.20.1
X Protocol Version 11, Revision 0
[430291.775] Build Operating System:  3.10.0-693.17.1.el7.x86_64 
[430291.775] Current Operating System: Linux localhost.localdomain 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64
[430291.775] Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-957.5.1.el7.x86_64 root=/dev/mapper/centos_localhost-root ro crashkernel=auto rd.lvm.lv=centos_localhost/root rd.lvm.lv=centos_localhost/swap rhgb qui
et
[430291.776] Build Date: 29 January 2019  06:03:26PM
[430291.776] Build ID: xorg-x11-server 1.20.1-5.2.el7_6 
[430291.776] Current version of pixman: 0.34.0
[430291.776]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[430291.776] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[430291.776] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Feb 19 15:00:00 2019
[430291.776] (++) Using config directory: "/usr/local/lib/x11test/xorg.conf.d"
[430291.776] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[430291.776] (==) ServerLayout "Example"
[430291.776] (**) |-->Screen "A" (0)
[430291.776] (**) |   |-->Monitor "A Monitor"
[430291.777] (**) |   |-->Device "A Card"
[430291.777] (**) |-->Screen "B" (1)
[430291.777] (**) |   |-->Monitor "B Monitor"
[430291.777] (**) |   |-->Device "B Card"
[430291.777] (==) Automatically adding devices
[430291.777] (==) Automatically enabling devices
[430291.777] (==) Automatically adding GPU devices
[430291.777] (==) Automatically binding GPU devices
[430291.777] (==) Max clients allowed: 256, resource mask: 0x1fffff
[430291.777] (==) FontPath set to:
        catalogue:/etc/X11/fontpath.d,
        built-ins
[430291.777] (==) ModulePath set to "/usr/lib64/xorg/modules"
[430291.777] (II) The server relies on udev to provide the list of input devices.
        If no devices become available, reconfigure udev or disable AutoAddDevices.
[430291.777] (II) Loader magic: 0x55c6783ce020
[430291.777] (II) Module ABI versions:
[430291.777]    X.Org ANSI C Emulation: 0.4
[430291.777]    X.Org Video Driver: 24.0
[430291.777]    X.Org XInput driver : 24.1
[430291.777]    X.Org Server Extension : 10.0
[430291.778] (II) xfree86: Adding drm device (/dev/dri/card1)
[430291.778] (II) Platform probe for /sys/devices/pci0000:00/0000:00:01.1/0000:10:00.0/drm/card1
[430291.778] (II) Platform PCI device at pci:0000:00:01.1
[430291.778] (II) xfree86: Adding drm device (/dev/dri/card0)
[430291.778] (II) Platform probe for /sys/devices/pci0000:00/0000:00:08.1/0000:38:00.0/drm/card0
[430291.778] (II) Platform PCI device at pci:0000:00:08.1
[430291.786] (--) PCI: (16@0:0:0) 1002:677b:1462:212f rev 0, Mem @ 0xe0000000/268435456, 0xfe920000/131072, I/O @ 0x0000f000/256, BIOS @ 0x????????/131072
[430291.786] (--) PCI:*(56@0:0:0) 1002:15dd:1002:15dd rev 200, Mem @ 0xc0000000/268435456, 0xd0000000/2097152, 0xfe400000/524288, I/O @ 0x0000d000/256, BIOS @ 0x????????/131072
[430291.786] (II) LoadModule: "glx"
[430291.786] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so
[430291.788] (II) Module glx: vendor="X.Org Foundation"
[430291.788]    compiled for 1.20.1, module version = 1.0.0
[430291.788]    ABI class: X.Org Server Extension, version 10.0
[430291.788] (II) LoadModule: "modesetting"
[430291.788] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so
[430291.788] (II) Module modesetting: vendor="X.Org Foundation"
[430291.788]    compiled for 1.20.1, module version = 1.20.1
[430291.788]    Module class: X.Org Video Driver
[430291.788]    ABI class: X.Org Video Driver, version 24.0
[430291.788] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[430291.788] (--) using VT number 1

[430291.788] (WW) xf86OpenConsole: setpgid failed: Operation not permitted
[430291.788] (WW) xf86OpenConsole: setsid failed: Operation not permitted
[430291.788] (**) modeset(0): claimed PCI slot 16@0:0:0
[430291.788] (II) modeset(0): using /dev/dri/card1
[430291.788] (EE) 
[430291.788] (EE) Backtrace:
[430291.788] (EE) 0: /usr/bin/X (xorg_backtrace+0x55) [0x55c678140185]
[430291.788] (EE) 1: /usr/bin/X (0x55c677f8f000+0x1b4e09) [0x55c678143e09]
[430291.788] (EE) 2: /lib64/libpthread.so.0 (0x7ff8de11e000+0xf5d0) [0x7ff8de12d5d0]
[430291.788] (EE) 3: /usr/lib64/xorg/modules/drivers/modesetting_drv.so (0x7ff8da31d000+0xa144) [0x7ff8da327144]
[430291.788] (EE) 4: /usr/bin/X (0x55c677f8f000+0xb0049) [0x55c67803f049]
[430291.788] (EE) 5: /usr/bin/X (xf86CallDriverProbe+0x4b) [0x55c67801e00b]
[430291.788] (EE) 6: /usr/bin/X (xf86BusConfig+0x46) [0x55c67801e966]
[430291.788] (EE) 7: /usr/bin/X (InitOutput+0x8ac) [0x55c67802bf0c]
[430291.789] (EE) 8: /usr/bin/X (0x55c677f8f000+0x601b0) [0x55c677fef1b0]
[430291.789] (EE) 9: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7ff8ddd733d5]
[430291.789] (EE) 10: /usr/bin/X (0x55c677f8f000+0x4a4ce) [0x55c677fd94ce]
[430291.789] (EE) 
[430291.789] (EE) Segmentation fault at address 0x2ba
[430291.789] (EE) 
Fatal server error:
[430291.789] (EE) Caught signal 11 (Segmentation fault). Server aborting
[430291.789] (EE) 
[430291.789] (EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
[430291.789] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[430291.789] (EE) 
[430291.789] (EE) Server terminated with error (1). Closing log file.
Comment 1 ToBeReplaced 2019-02-19 22:07:17 UTC
Whoops, forgot to add that I attempted to receive support through #xorg on freenode (no responses), then later at https://superuser.com/questions/1406211/xorg-multi-card-modesetting-configuration-segmentation-fault (no answers). If this is not the appropriate channel for escalation please let me know where would be more appropriate.
Comment 2 Michel Dänzer 2019-02-20 08:44:05 UTC
modesetting driver issues need to be reported at https://gitlab.freedesktop.org/xorg/xserver/issues/new .

That said, does removing the Screen stanzas from Section "Device" help? That is for a so-called "Zaphod" configuration with multiple "Device" and "Screen" sections for the same GPU.
Comment 3 ToBeReplaced 2019-02-20 14:57:55 UTC
Thank you for the quick reply. I'll post an issue there, then close this one.

Removing the Screen sections does not help, unfortunately. I'll post another log in a bit. The end goal is to use it with ZaphodHeads actually, so when moving the issue I'll include the ZaphodHeads lines and a log with those included.
Comment 4 Michel Dänzer 2019-02-20 15:29:48 UTC
(In reply to ToBeReplaced from comment #3)
> Thank you for the quick reply. I'll post an issue there, then close this one.

This one's already resolved, no need to close it.


> Removing the Screen sections does not help, unfortunately.

That's not what I mean. I mean the

 Screen 0/1

stanzas in Section "Device".


> The end goal is to use it with ZaphodHeads actually, so when moving the issue
> I'll include the ZaphodHeads lines and a log with those included.

Like the Screen stanza, Option "ZaphodHeads" is (as the name suggests) only relevant with a Zaphod configuration, not with a single screen per GPU as in your case.
Comment 5 ToBeReplaced 2019-02-20 16:32:59 UTC
Thank you for all of the help. I have come to a resolution based on your hunch about removing Screen lines in the device sections.

The segmentation fault appears to occur if there is no "Screen 0" for a given BusID. The core misunderstanding was that the screen number in the ServerLayout section is *not* related to the screen number in the Device section.

My comment about ZaphodHeads was because I originally had a third screen based off of the second bus id, but I removed it from the configuration since it was not required to cause a Segmentation Fault. My end goal was display :0.0 on one card, :0.1 on another card, and :0.2 on that second card.

A working configuration, with comments for the "surprises" I had is below, in case it is useful for anyone in the future or for improving existing documentaiton.

Section "ServerLayout" 
    Identifier "Example" 
    Screen 0 "A" 
    Screen 1 "B" 
    Screen 2 "C" 
EndSection 

Section "Device" 
    Identifier "A Card" 
    Driver "modesetting" 
    Screen 0 
    BusID "PCI:16@0:0:0" 
    Option "kmsdev" "/dev/dri/card1"
    Option "Monitor-DVI-D-1" 
EndSection 

Section "Monitor" 
    Identifier "A Monitor" 
EndSection 

Section "Screen" 
    Identifier "A" 
    Device "A Card" 
    Monitor "A Monitor" 
EndSection 

Section "Device" 
    Identifier "B Card" 
    Driver "modesetting" 
    Screen 0 # 1st screen for bus, 2nd screen in layout
    BusID "PCI:56@0:0:0" 
    Option "kmsdev" "/dev/dri/card0"
    Option "Monitor-HDMI-1" 
EndSection 

Section "Monitor" 
    Identifier "B Monitor" 
EndSection 

Section "Screen" 
    Identifier "B" 
    Device "B Card" 
    Monitor "B Monitor" 
EndSection 

Section "Device"
    Identifier "C Card"
    Driver "modesetting"
    Screen 1 # 2nd screen for bus, 3rd screen in layout
    BusID "PCI:56@0:0:0"
    Option "kmsdev" "/dev/dri/card0"
    Option "Monitor-HDMI-2"
    Option "ZaphodHeads" "HDMI-2"
EndSection

Section "Monitor"
    Identifier "C Monitor"
EndSection

Section "Screen"
    Identifier "C"
    Device "C Card"
    Monitor "C Monitor"
EndSection

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.