Bug 132308

Summary: X server crashes
Product: [openSUSE] SUSE Linux 10.1 Reporter: Andreas Schwab <schwab>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: Stefan Dirsch <sndirsch>
Severity: Major    
Priority: P5 - None CC: eich, ekunze, mort, rw, susedev
Version: Alpha 2plus   
Target Milestone: ---   
Hardware: IA64   
OS: Other   
Whiteboard: ia64-graphics
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: xorg.conf
Patch to fix PCI domain support for Altix
New patch lightly tested on Altix
Alternative patch
Tested patch
better domain support detection
Final patch
Incremental patch to fix Bug #142039

Description Andreas Schwab 2005-11-04 13:34:42 UTC
# gdb --args Xorg -config xorg.conf 
GNU gdb 6.3.50.20051003-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "ia64-suse-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /usr/X11R6/bin/Xorg -config xorg.conf

This is a pre-release version of the The X.Org Foundation X11.
It is not supported in any way.
Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.
Select the "xorg" product for bugs you find in this release.
Before reporting bugs in pre-release versions please check the
latest version in the The X.Org Foundation "monolithic tree" CVS
repository hosted at http://www.freedesktop.org/Software/xorg/
X Window System Version 6.8.99.901 (6.9.0 RC 1)
Release Date: 18 October 2005 + cvs
X Protocol Version 11, Revision 0, Release 6.8.99.901
Build Operating System: SuSE Linux [ELF] SuSE
Current Operating System: Linux brouwer 2.6.14-15.2-default #1 SMP Thu Nov 3 13:20:43 UTC 2005 ia64
Build Date: 04 November 2005
        Before reporting problems, check http://wiki.X.Org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Nov  4 14:29:07 2005
(++) Using config file: "xorg.conf"

Program received signal SIGSEGV, Segmentation fault.
0x40000000000cad51 in xf86PostScanAltix () at altixPCI.c:98
98              prevBusNum = curBusNum = pdev[0]->busnum;
(gdb) p pdev
$1 = (pciConfigPtr *) 0x60000000000478d8
(gdb) p pdev[0]
$2 = (pciConfigPtr) 0x0
(gdb) bt
#0  0x40000000000cad51 in xf86PostScanAltix () at altixPCI.c:98
#1  0x40000000000babd0 in ia64ScanPCIWrapper (flags=SCANPCI_TERM)
    at ia64Pci.c:238
#2  0x40000000000cac90 in xf86scanpci (flags=-1) at Pci.c:892
#3  0x4000000000060b70 in FindPCIVideoInfo () at xf86pciBus.c:201
#4  0x40000000000557f0 in xf86BusProbe () at xf86Bus.c:116
#5  0x4000000000040920 in InitOutput (pScreenInfo=0x6000000000054778, argc=3, 
    argv=0x60000fffff91b058) at xf86Init.c:391
#6  0x400000000014b960 in main (argc=3, argv=0x60000fffff91b058, 
    envp=0x60000fffff91b078) at main.c:372
Comment 1 Andreas Schwab 2005-11-04 13:36:00 UTC
Created attachment 56480 [details]
xorg.conf
Comment 2 Stefan Dirsch 2005-11-04 13:55:12 UTC
Ok. Nullpointer reference.

altixPCI.c:xf86PostScanAltix()

        [...]
        pdev = xf86scanpci(0);
        prevBusNum = curBusNum = pdev[0]->busnum;
                                 ^^^^^^^

Pretty new this stuff. See also Bug X.Org #2373

  https://bugs.freedesktop.org/show_bug.cgi?id=2373

Assigning to Egbert, since he already looked at this before.
Comment 3 Gerald Pfeifer 2005-11-08 19:17:40 UTC
SGI, would you mind also looking into this?  Graphics enablement...
Comment 4 Greg Edwards 2005-11-09 23:13:06 UTC
Forthcoming patch will be attached to:

Bug 5000: Domain support does not work for SGI Altix machines
https://bugs.freedesktop.org/show_bug.cgi?id=5000
Comment 5 Stefan Dirsch 2005-11-09 23:21:57 UTC
Thanks. I've added myself to Cc now.
Comment 6 Stefan Dirsch 2005-11-10 10:10:54 UTC
Created attachment 56955 [details]
Patch to fix PCI domain support for Altix

Patch from X.Org Bugzilla (#5000).

"This patch works on Altix, and should fall back correctly on other platforms."
Comment 7 Stefan Dirsch 2005-11-10 10:57:51 UTC
*** Bug 133236 has been marked as a duplicate of this bug. ***
Comment 11 Egbert Eich 2005-11-23 17:34:59 UTC
From looking at this patch I cannot find anything that appears to be questionable. The patch attempts to be less intrusive than would normally be.
Please test it on one or two non-Altix to verify this in reality. Then I don't have any problems with this patch going in.

I will revisit the PCI domain issue later.
Comment 12 Andreas Schwab 2005-11-25 15:21:58 UTC
The patch does the wrong thing for non-SGI systems.  It causes all pci devices to be enumerated multiple time (once for each possible domain).
Comment 13 Andreas Schwab 2005-11-25 15:59:46 UTC
The change in linuxOpenLegacy also does not make any sense.  Rather xf86GetPciDomain should be changed.
Comment 14 Egbert Eich 2005-11-25 16:32:31 UTC
But this is not the cause of the problem. The problem comes from linuxPciOpenFile(). I'm looking for the best fix.
Comment 15 Andreas Schwab 2005-11-25 16:36:56 UTC
Created attachment 58767 [details]
New patch lightly tested on Altix
Comment 16 Egbert Eich 2005-11-25 17:15:47 UTC
Created attachment 58769 [details]
Alternative patch

This one's much faster at startup.
I readded the '- 1' in openLegacy. without it the fallback code is called all the time.
Comment 17 Andreas Schwab 2005-11-25 17:41:06 UTC
IMHO the change in xf86GetPciDomain is still needed, but I haven't tested it yet.
Comment 18 Egbert Eich 2005-11-25 18:13:30 UTC
Domain 0 is treated special. I don't know why. The author of domain support has added some incredible complexity. This will go once I revisit this code. As long as this isn't changed we may have to start numbering with 1.
I know - this is ugly.
Comment 19 Andreas Schwab 2005-11-25 22:15:26 UTC
The last patch does not work.  Just because a specific pci bus does not exist does not mean that domains are not supported at all.
Comment 20 Andreas Schwab 2005-11-25 22:43:48 UTC
Created attachment 58776 [details]
Tested patch

This patch is tested and works, both on Altix and other systems.
Comment 21 Egbert Eich 2005-11-28 12:57:39 UTC
Created attachment 58825 [details]
better domain support detection

This patch should fix the problem with the domain detection and speeds up startup considerably. I have only test on zx2000 at the moment, though.
Comment 22 Andreas Schwab 2005-11-28 18:38:10 UTC
When bus >= 256 you should use %04x for printing (twice).

-sprintf(file, "/proc/bus/pci/%04x:%02x", domain, bus);
+sprintf(file, "/proc/bus/pci/%04x:%04x", domain, bus);

-sprintf(file, "/proc/bus/pci/%04x:%02x/%02x.%1x",
+sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
Comment 23 Andreas Schwab 2005-11-28 20:20:37 UTC
The patch only builds if INCLUDE_XF86_NO_DOMAIN is not defined.
Comment 24 Andreas Schwab 2005-11-29 10:32:13 UTC
Created attachment 58912 [details]
Final patch
Comment 25 Stefan Dirsch 2005-11-29 10:53:40 UTC
> Final patch

Egbert, can you confirm this?
Comment 26 Egbert Eich 2005-11-29 11:29:35 UTC
Yes. 
I forgot to add the:
+ #ifndef INCLUDE_XF86_NO_DOMAIN
        domain_support = linuxDomainSupport();
+ #endif
and of course the sprintf changes are correct.
Comment 27 Stefan Dirsch 2005-11-29 11:34:53 UTC
Thanks. I'll take care of this now.
Comment 28 Stefan Dirsch 2005-11-29 22:45:16 UTC
xorg-x11 package submitted for STABLE (fixed for Alpha4).
Comment 29 Stefan Dirsch 2006-01-12 05:29:38 UTC
Created attachment 63024 [details]
Incremental patch to fix Bug #142039

Andreas Schwab made a patch, which fixes Bug #142039.