Bug 72902 - [IVB/HSW/BDW] DOTA2 segfaults unless Mesa is configured with (non-default) --enable-glx-tls
Summary: [IVB/HSW/BDW] DOTA2 segfaults unless Mesa is configured with (non-default) --...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: All Linux (All)
: low minor
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 77449
  Show dependency treegraph
 
Reported: 2013-12-20 08:46 UTC by zhoujian
Modified: 2016-12-12 14:04 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
dmesg.log (94 bytes, text/plain)
2013-12-20 08:47 UTC, zhoujian
Details
dota2.log (5.14 KB, text/plain)
2013-12-20 08:48 UTC, zhoujian
Details
Xorg.0.log (21.94 KB, text/plain)
2013-12-20 08:49 UTC, zhoujian
Details
Use drm_intel_bufmgr_gem_set_vma_cache_size() after initializing intel buffer manager (419 bytes, patch)
2014-03-21 08:17 UTC, Iago Toral
Details | Splinter Review

Description zhoujian 2013-12-20 08:46:30 UTC
Platform: IVB/HSW
Libdrm:(master)libdrm-2.4.50-3-g068ea68b3f7ebd5efcfcc2f6ae
Mesa:(master)149140e922a9fbf892c60a755788fb88d9757749
Xf86_video_intel:(master)2.99.906-98-g9289e2c56b7f0cc78c5123691Cairo: (master)8e11a42e3e9b679dce97ac45cd8b47322536a253
Libva: (staging)feb43645518a9c9c17c39a19c0b1998e99d2e156
Libva_intel_driver: (staging)48ad48ecc1716cfc598cbc5
Kernel:(drm-intel-nightly)git-e9c4f4

Bug detailed description:
----------------------------------------------
Steam Dota2 crashes on IVB/HSW. It’s not a regression. Dota 2 is new case and good commit can’t be found.
Please see dmesg.log, Xorg.o.log and dota2 output log.

Reproduce steps:
---------------------------------------------
1, xinit
2, start steam
3. run dota2 in steam
4, Click “PLAY”->”DAVION,THE DRAGON KNIGHT”
Comment 1 zhoujian 2013-12-20 08:47:30 UTC
Created attachment 91021 [details]
dmesg.log
Comment 2 zhoujian 2013-12-20 08:48:01 UTC
Created attachment 91022 [details]
dota2.log
Comment 3 zhoujian 2013-12-20 08:49:08 UTC
Created attachment 91023 [details]
Xorg.0.log
Comment 4 Eero Tamminen 2013-12-27 09:58:01 UTC
(In reply to comment #2)
> Created attachment 91022 [details]
> dota2.log

---------------
[S_API FAIL] SteamAPI_Init() failed; no appID found.
Either launch the game from Steam, or put the file steam_appid.txt containing the correct appID in your game folder.
---------------


> 3. run dota2 in steam

Did you run it *from* Steam?
Comment 5 zhoujian 2013-12-30 02:42:13 UTC
(In reply to comment #4)
> (In reply to comment #2)
> Created attachment 91022 [details]
> dota2.log
> ---------------
[S_API FAIL] SteamAPI_Init() failed; no appID found.
Either
> launch the game from Steam, or put the file steam_appid.txt containing the
> correct appID in your game folder.
---------------


> 3. run dota2 in steam
> Did you run it *from* Steam?
Yes,run Steam,then launch the game.
Comment 6 Tapani Pälli 2014-01-02 08:14:11 UTC
with debug build of Mesa I can see:
GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?)

these come from some togl call in libtogl.so.
Comment 7 Tapani Pälli 2014-01-02 08:15:06 UTC
(forgot to add that the errors might be unrelated to the crash though)
Comment 8 Eero Tamminen 2014-01-02 15:10:35 UTC
DOTA2 seems to crash if "low" textures option is used.  If the issue is that, you need to remove saved DOTA2 config file, to restore defaults.
Comment 9 zhoujian 2014-01-03 06:41:15 UTC
(In reply to comment #8)
> DOTA2 seems to crash if "low" textures option is used.  If the issue is
> that, you need to remove saved DOTA2 config file, to restore defaults.

Removed the saved DOTA2 config file,then the problem still existence.
(dota2 cfg:/root/.steam/steam/SteamApps/common/dota\ 2\ beta/dota/cfg/config.cfg)
Comment 10 Eero Tamminen 2014-01-07 15:19:06 UTC
(In reply to comment #5)
> > 3. run dota2 in steam
> > Did you run it *from* Steam?
> Yes,run Steam,then launch the game.

I didn't mean whether Steam was running before launching the game, but did you launch the game from the Steam UI, or e.g. from command line?
Comment 11 zhoujian 2014-01-08 03:00:57 UTC
(In reply to comment #10)
> (In reply to comment #5)
> > 3. run dota2 in steam
> > Did you run it *from*
> Steam?
> Yes,run Steam,then launch the game.

I didn't mean whether Steam
> was running before launching the game, but did you launch the game from the
> Steam UI, or e.g. from command line?

Yes,launch the game from the Steam UI and command line,Have tried,but the problem still existencet.
Comment 12 Tapani Pälli 2014-01-08 06:35:44 UTC
Keeps consistently crashing for me as well. The backtrace I'm getting is from the game binaries (no symbols).
Comment 13 Eero Tamminen 2014-01-09 09:51:25 UTC
On which HW and OS this happens?

Tapani's crash is with Fedora on IVB, but DOTA2 runs for me fine on Ubuntu 13.10 on HSW (GT3e).


In Tapani's case DOTA2 doesn't crash immediately after clicking ”DAVION,THE DRAGON KNIGHT”, it takes quite a long loading things and increasing its memory usage until its virtual memory usage reaches ~2.5 GB (according to top), at which point it crashes.  Zhou, does the same happen in your case?

DOTA2 is 32-bit application.  On my case DOTA2 uses 2.9 GB of RAM, after loading the tutorial has finished.  No problems.

32-bit applications should be able to map 3GB of virtual memory (or 4GB depending on kernel config).  However, this can be limited with "ulimit".

In my case, I get:
$ ulimit -a|grep memory
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
virtual memory          (kbytes, -v) unlimited

What about your setups?
Comment 14 zhoujian 2014-01-14 09:39:05 UTC
(In reply to comment #13)
> On which HW and OS this happens?
DOTA2 crashes with Fedora/Ubuntu on IVB/HSW.

My steps:
1.xinit& 
2.gnome-session
3. lanuch steam->run dota2 in steam->Click “PLAY”->Click ”DAVION,THE DRAGON KNIGHT”->crashes.
        
>In Tapani's case
> DOTA2 doesn't crash immediately after clicking ”DAVION,THE DRAGON KNIGHT”,
> it takes quite a long loading things and increasing its memory usage until
> its virtual memory usage reaches ~2.5 GB (according to top), at which point
> it crashes.  Zhou, does the same happen in your case?
Yes,it's the same as my side.
Comment 15 zhoujian 2014-01-23 06:25:51 UTC
Dota2 on Steam can works in Win8 on IVB,BTW,Win8 driver:9.18.10.3272
Comment 16 Eric Anholt 2014-02-14 22:51:17 UTC
Someone interested in looking into this should probably check out trying variations on drm_intel_bufmgr_gem_set_vma_cache_size(intel->bufmgr, 512); immediately after setting up the bufmgr.  (on i386-only; amd64 doesn't have this address space problem of course)
Comment 17 zhoujian 2014-02-28 08:04:49 UTC
(In reply to comment #16)
Hi, do you mean set "drm_intel_bufmgr_gem_set_vma_cache_size" in mesa? Could you give us a patch for that?
Comment 18 Iago Toral 2014-03-21 08:17:03 UTC
Created attachment 96144 [details] [review]
Use drm_intel_bufmgr_gem_set_vma_cache_size() after initializing intel buffer manager

zhoujian: you can try Eric's suggestion with this patch
Comment 19 meng 2014-03-24 05:38:48 UTC
The problem also exists on 2014Q1 release testing.
Comment 20 zhoujian 2014-03-25 01:34:06 UTC
(In reply to comment #18)
> Created attachment 96144 [details] [review] [review]
> Use drm_intel_bufmgr_gem_set_vma_cache_size() after initializing intel
> buffer manager
> 
> zhoujian: you can try Eric's suggestion with this patch
With above the patch, the problem also exist.
Comment 21 jinliangx.wang 2014-05-16 01:45:52 UTC
On Mesa-10.2-rc2 testing, follow zhoujian's test steps, Dota 2 still crashes on HSW, and the issue also appear on BDW. 
Test both on Fedora & Ubuntu.
Comment 22 Kaveh 2014-06-10 20:50:25 UTC
Does it still crash on 10.2.1?
Comment 23 zhoujian 2014-06-11 08:59:22 UTC
(In reply to comment #22)
Yes,the problem still exists on 10.2.1.
Comment 24 meng 2014-06-27 09:09:07 UTC
The issue also exists on mesa-10.2.2.
Comment 25 Eero Tamminen 2014-08-18 12:12:54 UTC
With latest Mesa, DOTA2 is crashing also for me on HSW (GT3e) after starting DOTA2 Tutorial.

Toggling overlay off doesn't help, nor does changing graphics options from maximum to minimum.

While this could be related to bug 82759, DOTA2 works for Tapani with latest Mesa so I think it unlikely.  With  Mesa v10.1 in Ubuntu 14.04, DOTA2 works fine (both from Steam & and command line), so my DOTA2 install itself is in working condition.

Gdb doesn't show anything useful.  Program counter points to zeroed memory (clearly invalid for code), and addresses in backtrace aren't addressible i.e. program seems to have jumped to invalid/wrong address and either that had corrupted the stack (as return address there is invalid), or stack corruption caused jump to wrong place.

DOTA2 takes too much memory that I could run any of the memory debuggers (valgrind, duma).
Comment 26 Eero Tamminen 2014-08-18 14:49:17 UTC
Building Mesa with GCC -fstack-protector-all option didn't help to catch the corruption earlier, DOTA2 still crashes in same place.

After wasting few hours trying to find good commit for bisecting, testing Ubuntu package's patches on top of 10.1.3 tag and finally configure options, I found what allows DOTA2 to run without crashes.  It's the "--enable-glx-tls" configure option (which is disabled by default in Mesa).

Mengmeng and Zhoujian, does adding that option to Mesa build get rid of also your DOTA2 crashes?
Comment 27 Tapani Pälli 2014-08-19 03:50:18 UTC
(In reply to comment #26)
> Building Mesa with GCC -fstack-protector-all option didn't help to catch the
> corruption earlier, DOTA2 still crashes in same place.
> 
> After wasting few hours trying to find good commit for bisecting, testing
> Ubuntu package's patches on top of 10.1.3 tag and finally configure options,
> I found what allows DOTA2 to run without crashes.  It's the
> "--enable-glx-tls" configure option (which is disabled by default in Mesa).
> 
> Mengmeng and Zhoujian, does adding that option to Mesa build get rid of also
> your DOTA2 crashes?

I am using '--enable-glx-tls' when I configure Mesa, otherwise there are missing symbols when running apps.
Comment 28 zhoujian 2014-08-19 06:09:54 UTC
(In reply to comment #26)
> Building Mesa with GCC -fstack-protector-all option didn't help to catch the
> corruption earlier, DOTA2 still crashes in same place.
> 
> After wasting few hours trying to find good commit for bisecting, testing
> Ubuntu package's patches on top of 10.1.3 tag and finally configure options,
> I found what allows DOTA2 to run without crashes.  It's the
> "--enable-glx-tls" configure option (which is disabled by default in Mesa).
> 
> Mengmeng and Zhoujian, does adding that option to Mesa build get rid of also
> your DOTA2 crashes?

DOTA2 will not crash after adding the option"--enable-glx-tls", but if I missed the precise click against the steam menus, I will never be able to click the steam menus again, which means I only can operate the steam menus via first menu precise click.
Comment 29 Eero Tamminen 2014-08-19 07:09:15 UTC
> I am using '--enable-glx-tls' when I configure Mesa, otherwise there are
> missing symbols when running apps.

Tapani, with what applications you get problems and with what symbols?
(I haven't seen this problem)

I'm also using --enable-shared-glapi, in case that matters.
Zhoujian, what about you?

When looking at the Mesa code, '--enable-glx-tls' affects to where GLX pointer is stored, and to generation of GL function asm entry points.
Comment 30 zhoujian 2014-08-19 07:24:03 UTC
(In reply to comment #29)
> 
> I'm also using --enable-shared-glapi, in case that matters.
> Zhoujian, what about you?
Yes,I'm also using the option "--enable-shared-glapi".
Comment 31 Tapani Pälli 2014-08-19 07:55:43 UTC
(In reply to comment #29)
> > I am using '--enable-glx-tls' when I configure Mesa, otherwise there are
> > missing symbols when running apps.
> 
> Tapani, with what applications you get problems and with what symbols?
> (I haven't seen this problem)

I'm missing the dispatch for GL funcs, nowadays only `_glapi_tls_Dispatch' (IIRC used to be a few more funcs some months ago), a lot of apps affected including my own test cases (I guess anything with threads?).

> I'm also using --enable-shared-glapi, in case that matters.

I'm not using that one.
Comment 32 Tapani Pälli 2014-08-19 08:38:10 UTC
I'm not convinced there is a bug, Mesa used here was just misconfigured.

There is documentation about how the dispatch works here (which touches the tls topic): http://www.mesa3d.org/dispatch.html
Comment 33 Eero Tamminen 2014-08-19 14:41:38 UTC
(In reply to comment #32)
> I'm not convinced there is a bug, Mesa used here was just misconfigured.
> 
> There is documentation about how the dispatch works here (which touches the
> tls topic): http://www.mesa3d.org/dispatch.html

E.g. pixman configure.ac seems to automatically detect & enable TLS when compiler supports it.  Is there some reason why Mesa couldn't or shouldn't do the same?
Comment 34 Eero Tamminen 2014-12-29 15:47:52 UTC
(In reply to Eero Tamminen from comment #33)
> (In reply to comment #32)
> > I'm not convinced there is a bug, Mesa used here was just misconfigured.
> > 
> > There is documentation about how the dispatch works here (which touches the
> > tls topic): http://www.mesa3d.org/dispatch.html
> 
> E.g. pixman configure.ac seems to automatically detect & enable TLS when
> compiler supports it.  Is there some reason why Mesa couldn't or shouldn't
> do the same?

Ian?
Comment 35 Eero Tamminen 2016-12-12 14:04:41 UTC
DOTA2 is nowadays 64-bit and "--enable-glx-tls" is enabled by default by commit b83153e77b08ac82160f6281424878abacd97e31, so issue shouldn't anymore happen (Vulkan & GL versions of DOTA2 work fine for me).

I'm not sure what resolution is appropriate, so I just set this as FIXED.


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.