Bug 27340 - mesa deadlocks with latest HoN game
Summary: mesa deadlocks with latest HoN game
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-27 03:28 UTC by Török Edwin
Modified: 2011-03-02 06:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
tentative patch (1.53 KB, patch)
2010-03-27 03:40 UTC, Török Edwin
Details | Splinter Review

Description Török Edwin 2010-03-27 03:28:58 UTC
Heroes of Newerth just autoupdated to a new version, and mesa deadlocks after logging in to the new version.

Here is a backtrace of the graphics thread (the other 3 threads are polling in libasound):

Thread 1 (Thread 0x7f4e07a466f0 (LWP 15203)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
#1  0x0000003b3b008e79 in _L_lock_949 () from /lib/libpthread.so.0
#2  0x0000003b3b008c9b in __pthread_mutex_lock (mutex=<value optimized out>) at pthread_mutex_lock.c:61
#3  0x00007f4df9bbe4a5 in _mesa_HashLookup (table=0x22775d0, key=128) at main/hash.c:140
#4  0x00007f4df9bbe5ab in _mesa_HashFindFreeKeyBlock (table=0x22775d0, numKeys=1) at main/hash.c:450
#5  0x00007f4df9bf6385 in _mesa_GenTextures (n=1, textures=0x7fff240a2a24) at main/texobj.c:803
#6  0x00007f4dfb12d568 in ?? () from /home/edwin/hon2/vid_gl2-x86_64.so
#7  0x00007f4dfb12e6a8 in ?? () from /home/edwin/hon2/vid_gl2-x86_64.so
#8  0x00007f4dfb0e017f in ?? () from /home/edwin/hon2/vid_gl2-x86_64.so
#9  0x00007f4dfb0e24f7 in ?? () from /home/edwin/hon2/vid_gl2-x86_64.so
#10 0x00007f4e091c5e4d in ?? () from /home/edwin/hon2/libk2-x86_64.so
#11 0x00007f4e091acd19 in ?? () from /home/edwin/hon2/libk2-x86_64.so
Comment 1 Török Edwin 2010-03-27 03:32:55 UTC
Looks like it is trying to lock a mutex that is already locked:
_mesa_HashFindFreeKeyBlock(
line 438:   _glthread_LOCK_MUTEX(table->Mutex);
line 450:	 if (_mesa_HashLookup(table, key)) {

_mesa_HashLookup( 
line 140:  _glthread_LOCK_MUTEX(table->Mutex);
Comment 2 Török Edwin 2010-03-27 03:35:15 UTC
Looks like this is caused by this commit:
commit 107a2ec9eef53dee038c1bcc0d956c5667e0b68f
Author: Brian Paul <brianp@vmware.com>
Date:   Tue Feb 16 08:21:38 2010 -0700
Comment 3 Török Edwin 2010-03-27 03:40:45 UTC
Created attachment 34502 [details] [review]
tentative patch
Comment 4 Török Edwin 2010-03-27 03:42:00 UTC
The patch I just attached fixes the deadlock, please apply.
Comment 5 Török Edwin 2010-03-27 03:42:36 UTC
Patch to src/mesa/main/hash.c:
https://bugs.freedesktop.org/attachment.cgi?id=34502
Comment 6 Brian Paul 2010-03-27 08:00:29 UTC
The patch looks good (except for "inline" should be "INLINE").  I verified the patch here by forcing the code path in question with a couple Mesa demos.  I'll commit shortly.

Either the game uses a _lot_ of textures or it uses its own (very large) texture IDs at some point.  Evidently, the slow path in _mesa_HashFindFreeKeyBlock() hasn't been hit before!

Please retest with latest Mesa sources from git and then close the bug.  Thanks.
Comment 7 Török Edwin 2010-03-27 09:44:53 UTC
(In reply to comment #6)
> The patch looks good (except for "inline" should be "INLINE").  I verified the
> patch here by forcing the code path in question with a couple Mesa demos.  I'll
> commit shortly.
> 
> Either the game uses a _lot_ of textures or it uses its own (very large)
> texture IDs at some point.  Evidently, the slow path in
> _mesa_HashFindFreeKeyBlock() hasn't been hit before!
> 
> Please retest with latest Mesa sources from git and then close the bug. 
> Thanks.
> 

Thanks. 
I see you merged my commit to the 7.8 branch, but not to master (I use master).
Comment 8 ryan 2010-04-01 17:17:18 UTC
i've been working on this all day; im unfamiliar with linux and it took me awhile too google up how to patch and everything; so i could've done something wrong. but i followed the directions here > https://wiki.ubuntu.com/XorgOnTheEdge for building your own drivers. downloaded the mesa 7.9 git karmic; applied patch, installed mesa-utils and mesa-common, rebooted; game still froze on me.
Comment 9 ryan 2010-04-01 17:19:29 UTC
(In reply to comment #8)
> i've been working on this all day; im unfamiliar with linux and it took me
> awhile too google up how to patch and everything; so i could've done something
> wrong. but i followed the directions here >
> https://wiki.ubuntu.com/XorgOnTheEdge for building your own drivers. downloaded
> the mesa 7.9 git karmic; applied patch, installed mesa-utils and mesa-common,
> rebooted; game still froze on me.
> 

like i said, im a big newbie. i thought those were the only 2 debs, now looking in the directory; well, lets just say ill tell you if it works or not in 20-30 minutes. :D
Comment 10 Marek Olšák 2011-03-02 06:12:49 UTC
HoN works according to a lot of feedback from users lately. The patch was pushed per Brian's comment, and the fixes from 7.8 have been merged to master. Closing.

Feel free to reopen if you still encounter any issues.


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.