Multithreaded tls_model("global-dynamic") glXMakeContextCurrent ___tls_get_addr () freeze/deadlock
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linux Mint |
New
|
Undecided
|
Unassigned | ||
mesa (Debian) |
Invalid
|
Undecided
|
Unassigned | ||
mesa (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Ubuntu mesa contains the patch 113_fix_tls.diff that triggers a freezing impact:
+++
extern __thread void *u_current_user
- __attribute_
+ __attribute_
+++
JogAmp JOGL have triaged that this bug are introduced by this ubuntu local patch:
https:/
I am able to reproduce this bug using Ubuntu 11.10 + mesa 7.11
GL_VENDOR: X.Org
GL_RENDERER: Gallium 0.4 on AMD RV770
GL_VERSION: 2.1 Mesa 7.11
Testcase (large ~150mb)
wget http://
tar zxvf processing-
cd processing-2.0a5
./processing
#open File->Examples... Pick Topics->Geometry-> double click on RGBCube
#run the sketch ctrl-r
#output below:
xranby@hp ~/processing-2.0a5 $ ./processing
Info: XInitThreads() called for concurrent Thread support
<window opens>
<freeze>
Backtrace of the stalled window thread.
(gdb) bt
#0 0x00118e3f in pthread_mutex_lock ()
from /lib/i386-
#1 0x0058701b in ?? () from /lib/ld-linux.so.2
#2 0x0059781d in ___tls_get_addr () from /lib/ld-linux.so.2
#3 0x0305e558 in ?? () from /usr/lib/
#4 0x0218e3be in dri_make_current ()
from /usr/lib/
#5 0x0216b1bf in ?? () from /usr/lib/
#6 0x074e4b8d in ?? () from /usr/lib/
#7 0x074bcb97 in glXMakeCurrentR
from /usr/lib/
#8 0x082f329a in Java_jogamp_
from /tmp/jogamp.
Related branches
tags: | added: oneiric precise |
Changed in mesa (Debian): | |
importance: | Undecided → Unknown |
status: | New → Unknown |
Changed in mesa (Debian): | |
status: | Unknown → New |
Allow me to copy my analysis of this bug here /jogamp. org/bugzilla/ show_bug. cgi?id= 566#c13
from https:/
This bug affects all Mesa8 w/ the tls_model( "global- dynamic" ) patch enabled!
+++
Analysis of patch 113_fix_tls.diff and it's freezing impact:
+++ _((tls_ model(" initial- exec")) ); _((tls_ model(" global- dynamic" )));
extern __thread void *u_current_user
- __attribute_
+ __attribute_
+++
the above changes the TLS behavior of libGL.
Note: u_current_user reflects the current context urrent( ..).
changed by glXMakeContextC
Phenomenon of AWT-EDT glXMakeContextC urrent( ) freeze:
[0] Java launches
[0.1] starts new AWT-EDT thread
[0.2] starts main thread and hands over execution of main
[1] JOGL loads and initializes the libGL via 1st call of GLProfile. initSingleton( )
incl. lib loading via dlopen() and symbol lookup etc.
[2] Step [1] kicks of the shared resource runner, which creates the very 1st
JOGL GL context while probing all profiles.
[3] At some point, AWT-EDT runs a JOGL Runnable:
[3.1] ctx = createContext()
[3.2] makeCurrent(dpy, read, write, ctx);
[3.3] makeCurrent(dpy, 0, 0, 0); -> release context *** Freeze ***
glx/glxcurrent. c/MakeContextCu rrent() :...... ......_ _glXSetCurrentC ontextNull( ) c/__glXSetCurre ntContextNull( ): ....... ..._glapi_ set_context( NULL); mapi/mapi_ glapi.c/ _glapi_ set_context( NULL):. ....... u_current_ set_user( NULL); mapi/u_ current. c/u_current_ set_user( NULL):. ....... .....u_ current_ init(); mapi/u_ current. c/u_current_ set_user( NULL): ....... ......u_ current_ user =(void *) ptr; ***** FREEZE ***
glx/glxcurrent.
./mapi/
./mapi/
./mapi/
Mesa8 release-context implementation attempts to access the TLS u_current_user 'field'.
For some reason, an already existing thread like AWT-EDT [0.1] cannot use libGL's global TLS [3]
when the latter was initialized by a later running thread [0.2] + [1].
Prove that this is the root cause can be made by it's remedies:
R1: Set java system property 'sun.java2d.opengl' to 'true', which loads and
uses libGL from the start.
R2: Load the libraries [1] from the AWT-EDT
+++
R2 is our workaround in JOGL and works fine w/ Ubuntu 12.04 & Mesa8
+++
Nevertheless, it is unclear whether the above behavior is intrinsic to "global- dynamic" ) and hence a restriction or other special
tls_model(
circumstances
lead to an erroneous behavior.
Note:tls_ model(" initial- exec") works fine, i.e. w/o patch 113_fix_tls.diff