Bug 17781 - [i965 gem-classic] glthreads will abort soon after it runs
[i965 gem-classic] glthreads will abort soon after it runs
Status: VERIFIED FIXED
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965
git
All Linux (All)
: medium normal
Assigned To: Eric Anholt
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-25 19:11 UTC by zhao jian
Modified: 2009-08-24 12:30 UTC (History)
0 users

See Also:


Attachments
xorg.conf (3.67 KB, text/plain)
2008-09-25 19:11 UTC, zhao jian
Details
Xorg.0.log (48.93 KB, text/plain)
2008-09-25 19:13 UTC, zhao jian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zhao jian 2008-09-25 19:11:13 UTC
Created attachment 19220 [details]
xorg.conf

System Environment:
--------------------------
--Platform: gm45
--Architecture(32-bit,64-bit,compatiblity): x86_64
--2D driver: xf86-video-intel-2.5-branch
                 8408995ffbf705aa0bc09ab72c58c2e31a4b70c3
--3D driver: intel-2008-q3 branch e636f5b76bbcfef95092d21646c844c0dfe770e0
--DRM:shipped with kernel 2.6.27-rc6
--libdrm: master 2db8e0c8ef8c7a66460fceda129533b364f6418c
--Xserver: 1.5.1
--Kernel: 2.6.27-rc6

Bug detailed description:
start X, and start gnome, then run 'glthread -n 10' with CLASSIC, it can start
successfully, but it will terminated automatically soon with the following information: 
rd0
7f1e2cdc3000-7f1e2d099000 rw-p 7f1e2cdc3000 00:00 0
7f1e2d099000-7f1e2d6d9000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e2d6d9000-7f1e2dd19000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e2dd19000-7f1e2e359000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e2e359000-7f1e2e62f000 rw-p 7f1e2e359000 00:00 0
7f1e2e62f000-7f1e2ec6f000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e2ec6f000-7f1e2f2af000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e2f2af000-7f1e2f8ef000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e2f8ef000-7f1e2fbc5000 rw-p 7f1e2f8ef000 00:00 0
7f1e2fbc5000-7f1e30205000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e30205000-7f1e30845000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e30845000-7f1e30e85000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e30e85000-7f1e3115b000 rw-p 7f1e30e85000 00:00 0
7f1e3115b000-7f1e3179b000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e3179b000-7f1e31ddb000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e31ddb000-7f1e3241b000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e3241b000-7f1e326f1000 rw-p 7f1e3241b000 00:00 0
7f1e326f1000-7f1e32d31000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e32d31000-7f1e33371000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e33371000-7f1e339b1000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e339b1000-7f1e33c87000 rw-p 7f1e339b1000 00:00 0
7f1e33c87000-7f1e342c7000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e342c7000-7f1e34907000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e34907000-7f1e34f47000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e34f47000-7f1e3521d000 rw-p 7f1e34f47000 00:00 0
7f1e3521d000-7f1e3585d000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e3585d000-7f1e35e9d000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e35e9d000-7f1e364dd000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e364dd000-7f1e367b3000 rw-p 7f1e364dd000 00:00 0
7f1e367b3000-7f1e36df3000 rw-s 85301000 00:0f 9420                       /dev/dri/card0
7f1e36df3000-7f1e37433000 rw-s 84301000 00:0f 9420                       /dev/dri/card0
7f1e37433000-7f1e37a73000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e37a73000-7f1e37d49000 rw-p 7f1e37a73000 00:00 0
7f1e37d49000-7f1e39d49000 rw-s 86301000 00:0f 9420                       /dev/dri/card0
7f1e39d49000-7f1e3a389000 rw-s 2fffb000 00:0f 9420                       /dev/dri/card0
7f1e3a389000-7f1e3a390000 r-xp 00000000 08:01 210152                     /opt/X11R7.unstable/lib/libdrm_intel.so.1.0.0
7f1e3a390000-7f1e3a58f000 ---p 00007000 08:01 210152                     /opt/X11R7.unstable/lib/libdrm_intel.so.1.0.0
7f1e3a58f000-7f1e3a590000 rw-p 00006000 08:01 210152                     /opt/X11R7.unstable/lib/libdrm_intel.so.1.0.0
7f1e3a5a2000-7f1e3a806000 r-xp 00000000 08:01 205165                     /opt/X11R7.unstable/lib/dri/i965_dri.so
7f1e3a806000-7f1e3aa05000 ---p 00264000 08:01 205165                     /opt/X11R7.unstable/lib/dri/i965_dri.so
7f1e3aa05000-7f1e3aa1f000 rw-p 00263000 08:01 205165                     /opt/X11R7.unstable/lib/dri/i965_dri.so
7f1e3aa1f000-7f1e3aa2c000 rw-p 7f1e3aa1f000 00:00 0
7f1e3aa2c000-7f1e3aa31000 r-xp 00000000 08:01 205211                     /opt/X11R7.unstable/lib/libXdmcp.so.6.0.0
7f1e3aa31000-7f1e3ab30000 ---p 00005000 08:01 205211                     /opt/X11R7.unstable/lib/libXdmcp.so.6.0.0
7f1e3ab30000-7f1e3ab31000 rw-p 00004000 08:01 205211                     /opt/X11R7.unstable/lib/libXdmcp.so.6.0.0
7f1e3ab31000-7f1e3ab33000 r-xp 00000000 08:01 205190                     /opt/X11R7.unstable/lib/libXau.so.6.0.0
7f1e3ab33000-7f1e3ac32000 ---p 00002000 08:01 205190                     /opt/X11R7.unstable/lib/libXau.so.6.0.0
7f1e3ac32000-7f1e3ac33000 rw-p 00001000 08:01 205190                     /opt/X11R7.unstable/lib/libXau.so.6.0.0
7f1e3ac33000-7f1e3ac34000 rw-p 7f1e3ac33000 00:00 0
7f1e3ac34000-7f1e3ac3b000 r-xp 00000000 08:01 205171                     /opt/X11R7.unstable/lib/libdrm.so.2.3.0
7f1e3ac3b000-7f1e3ae3b000 ---p 00007000 08:01 205171                     /opt/X11R7.unstable/lib/libdrm.so.2.3.0
7f1e3ae3b000-7f1e3ae3c000 rw-p 00007000 08:01 205171                     /opt/X11R7.unstable/lib/libdrm.so.2.3.0
7f1e3ae3c000-7f1e3ae41000 r-xp 00000000 08:01 205220                     /opt/X11R7.unstable/lib/libXfixes.so.3.1.0
7f1e3ae41000-7f1e3af40000 ---p 00005000 08:01 205220                     /opt/X11R7.unstable/lib/libXfixes.so.3.1.0
7f1e3af40000-7f1e3af41000 rw-p 00004000 08:01 205220                     /opt/X11R7.unstable/lib/libXfixes.so.3.1.0
7f1e3af41000-7f1e3af43000 r-xp 00000000 08:01 205208                     /opt/X11R7.unstable/lib/libXdamage.so.1.1.0
7f1e3af43000-7f1e3b042000 ---p 00002000 08:01 205208                     /opt/X11R7.unstable/lib/libXdamage.so.1.1.0
7f1e3b042000-7f1e3b043000 rw-p 00001000 08:01 205208                     /opt/X11R7.unstable/lib/libXdamage.so.1.1.0
7f1e3b043000-7f1e3b044000 rw-p 7f1e3b043000 00:00 0
7f1e3b044000-7f1e3b049000 r-xp 00000000 08:01 205286                     /opt/X11R7.unstable/lib/libXxf86vm.so.1.0.0
7f1e3b049000-7f1e3b148000 ---p 00005000 08:01 205286                     /opt/X11R7.unstable/lib/libXxf86vm.so.1.0.0
7f1e3b148000-7f1e3b149000 rw-p 00004000 08:01 205286                     /opt/X11R7.unstable/lib/libXxf86vm.so.1.0.0
7f1e3b149000-7f1e3b159000 r-xp 00000000 08:01 205217                     /opt/X11R7.unstable/lib/libXext.so.6.4.0
7f1e3b159000-7f1e3b259000 ---p 00010000 08:01 205217                     /opt/X11R7.unstable/lib/libXext.so.6.4.0
7f1e3b259000-7f1e3b25a000 rw-p 00010000 08:01 205217                     /opt/X11R7.unstable/lib/libXext.so.6.4.0
7f1e3b25a000-7f1e3b25b000 rw-p 7f1e3b25a000 00:00 0
7f1e3b25b000-7f1e3b35d000 r-xp 00000000 08:01 205181                     /opt/X11R7.unstable/lib/libX11.so.6.2.0
7f1e3b35d000-7f1e3b45c000 ---p 00102000 08:01 205181                     /opt/X11R7.unstable/lib/libX11.so.6.2.0
7f1e3b45c000-7f1e3b462000 rw-p 00101000 08:01 205181                     /opt/X11R7.unstable/lib/libX11.so.6.2.0
7f1e3b462000-7f1e3b464000 rw-p 7f1e3b462000 00:00 0
7f1e3b473000-7f1e3b475000 rw-s 2effe000 00:0f 9420                       /dev/dri/card0
7f1e3b475000-7f1e3b476000 rw-p 7f1e3b475000 00:00 0
7f1e3b476000-7f1e3b4e9000 r-xp 00000000 08:01 205151                     /opt/X11R7.unstable/lib/libGL.so.1.2
7f1e3b4e9000-7f1e3b6e9000 ---p 00073000 08:01 205151                     /opt/X11R7.unstable/lib/libGL.so.1.2
7f1e3b6e9000-7f1e3b6f3000 rw-p 00073000 08:01 205151                     /opt/X11R7.unstable/lib/libGL.so.1.2
7f1e3b6f3000-7f1e3b6f8000 rw-p 7f1e3b6f3000 00:00 0
7fff436e3000-7fff436f8000 rw-p 7ffffffea000 00:00 0                      [stack]
7fff437ff000-7fff43800000 r-xp 7fff437ff000 00:00 0                      [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted 

Reproduce steps:
1. xinit&
2. gnome-session
3. ./glthread -n 10
Comment 1 zhao jian 2008-09-25 19:13:52 UTC
Created attachment 19221 [details]
Xorg.0.log
Comment 2 Eric Anholt 2008-09-26 16:01:25 UTC
You've cut off the important part of the error message.  If an app's output is too long (but not more than a megabyte) just attach it rather than putting it inline in the report.  Including the relevant error messages (most importantly, assertion failure messages) inline is convenient.

I see several failure cases with glthreads on my system:
1) Deadlock on app startup.

This looks like there must be lock order reversal going on somewhere, as everyone's blocked on a condvar or waiting for information from the X Server.  Adding a sleep(1) in the thread spawner works around this.

2) glthreads: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed.

This looks like an issue in xcb's locking for Xlib.

3) 
X Error of failed request:  BadIDChoice (invalid resource ID chosen for this connection)
  Major opcode of failed request:  146 (XFIXES)
  Minor opcode of failed request:  5 (XFixesCreateRegion)
  Resource id in failed request:  0x0
  Serial number of failed request:  5580
  Current serial number in output stream:  8252

This also sounds to me like a locking failure in Xlib/XCB.

None of these 3 issues appear to be related to our driver.
Comment 3 zhao jian 2008-09-26 19:58:13 UTC
I have met another glthreads problem(maybe mentioned as deadlock in Eric's comments). When I run "./glthreads -n 10", there will be 10 windows displaying in the desktop, all with blank screen. It can be terminated. The whole information displayed during its running as following:

glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
libGL: XF86DRIGetClientDriverName: 1.9.0 i965 (screen 0)
libGL: OpenDriver: trying /opt/X11R7/lib/dri/i965_dri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: Searching for BusID pci:0000:00:02.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: drmOpenMinor returns 4
drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
Failed to initialize TTM buffer manager.  Falling back to classic.
glthreads: creating threads
glthreads: Created thread 0x40c72950
glthreads: Created thread 0x41473950
glthreads: Created thread 0x41c74950
glthreads: Created thread 0x42475950
glthreads: Created thread 0x42c76950
glthreads: Created thread 0x43477950
glthreads: Created thread 0x43c78950
glthreads: Created thread 0x44479950
glthreads: Created thread 0x44c7a950
glthreads: Created thread 0x4547b950
Comment 4 zhao jian 2008-09-26 20:11:34 UTC
I foget to say that the deadlock(maybe) I mentioned in Comment#3,is met in the image built with mesa7_2 branch(35fe0e56e6f6b45ceea0c3d43be7596c1ea44e00). 
Comment 5 zhao jian 2008-09-26 23:20:16 UTC
The platform GM45 which I find such error first time has been borrowed by other developers, so I just redo this test on two other platforms: G45 and GM45(it is another one, a little older than the one I tested with on 2008-09-25). Run "./glthreads -n 10" and both of them will  have 10 windows displaying in the desktop, all with blank screen. It can be terminated. The whole information displayed during its running as following:

glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
libGL: XF86DRIGetClientDriverName: 1.9.0 i965 (screen 0)
libGL: OpenDriver: trying /opt/X11R7/lib/dri/i965_dri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: Searching for BusID pci:0000:00:02.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: drmOpenMinor returns 4
drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
Failed to initialize GEM.  Falling back to classic.
glthreads: creating threads
glthreads: Created thread 0x40859950
glthreads: Created thread 0x4105a950
glthreads: Created thread 0x4185b950
glthreads: Created thread 0x4205c950
glthreads: Created thread 0x4285d950
glthreads: 1: GL_RENDERER = Mesa DRI Mobile Intel® GM45 Express Chipset 20080716
glthreads: Created thread 0x4305e950
glthreads: Created thread 0x4385f950
glthreads: Created thread 0x44060950
glthreads: Created thread 0x44861950
glthreads: Created thread 0x45062950
Comment 6 zhao jian 2008-10-05 22:16:40 UTC
It also exists on G45 with the latest gem-class branch.
Comment 7 Eric Anholt 2008-10-06 13:06:05 UTC
There is no chipset dependency in this bug.
Comment 8 Eric Anholt 2008-10-09 13:02:13 UTC
commit 3169d9639bd002b43e4064cea32e0d262076c1e0
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jun 12 23:22:26 2008 -0700

    intel: Protect bufmgr objects with a pthread mutex.
    
    We want to be able to use the bufmgr from multiple threads for GL, and thus
    we need to protect the internal structures.
    
    The pthread-stubs package is used so that programs not linked against
    pthreads get weak symbols to stubs and don't eat most of the cost.
Comment 9 zhao jian 2008-10-19 20:31:48 UTC
I verified on gm45 with kernel2.6.27,32 bit.
Comment 10 ajax at nwnk dot net 2009-08-24 12:30:55 UTC
Mass version move, cvs -> git