Bug 21537

Summary: Many OpenGL applications locks in drm calls using R300 driver (xmoto, bzflag, openarena, kwin, ...)
Product: Mesa Reporter: Pauli <suokkos>
Component: Drivers/DRI/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: medium CC: bugzi11.fdo.tormod, pedretti.fabio
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
URL: https://bugs.launchpad.net/bugs/348450
Whiteboard:
i915 platform: i915 features:
Attachments: xorg.conf
xorg.log
kernel log when I enabled drm debug after freeze

Description Pauli 2009-05-04 01:18:25 UTC
There is ubuntu bug reports about the locking issue.

system:
Turion x2
M-Radeon x1400
Linux 2.6.28
mesa 7.4, git master and radeon-rewrite tested
drm 2.4.5, git master and modesetting-gem tested (modesetting not enabled)
compiz disabled

Steps to reproduce:
1. start xmoto 0.5.0
2. download all additional levels using button in top left corner (appears few seconds after starting xmoto)
3. find level named "Beginners journey part three"
4. just play game about 5 seconds and xmoto will crash (It happens near the 3rd tree visible to player after 2nd steep drop)

state of computer after lock:
- ssh is only way to communicate with computer.
- xmoto is locked in drm call
- Xorg is locked in drm call
- I have seen report that drm heavy lock count is 3 so there is one more unknown application locked too but I couldn't guess which one.
- Backtrace from xmoto and xorg uing stock Ubuntu mesa/drm can be found from Ubuntu bug report. I haven't been able to get backtrace drom newer drivers because gdb hangs when I try to attach with newer drivers.
Comment 1 Alex Deucher 2009-05-04 07:37:45 UTC
This is a GPU hang.  Please attach your xorg log and config.  You might want to try with with the r300 driver from the radeon_rewrite branch of mesa.
Comment 2 Pauli 2009-05-04 12:19:25 UTC
Created attachment 25423 [details]
xorg.conf
Comment 3 Pauli 2009-05-04 12:20:03 UTC
Created attachment 25424 [details]
xorg.log
Comment 4 Pauli 2009-05-04 12:22:08 UTC
Created attachment 25425 [details]
kernel log when I enabled drm debug after freeze

Intresting point is that if I try to reproduce the bug with debug enabled in drm it never locks. So maybe this is some timing problem in driver. (Some locking missing?)

I have tested radeon-rewrite already and same freeze happens there too.
Comment 5 Alex Deucher 2009-05-04 12:26:26 UTC
This looks to be 3D related, but does updating to the latest ddx from git help (git master of xf86-video-ati)?
Comment 6 Pauli 2009-05-04 12:32:28 UTC
I have 5 days old version in /opt/local/lib/xorg/modules :)

It was at commit 7d9f643ae3d07e51e644a5979ca90bc2c102bc89

I can try using updated ddx, radeon-rewrite and modesetting-gem if you think there might be some kind of fix in the last 5 days.
Comment 8 Pauli 2009-05-04 14:23:32 UTC
Now using the latest radeon-rewrite, libdrm  modeseting-gem (including kernel modules but no mode setting because failing to initialise memory manager) and latest ddx everything works.

But when I try to use latest ddx with old mesa it hard locks now already level preview. (Doesn't even respond if trying to probe with nmap scan)
Comment 9 Alex Deucher 2009-05-04 14:31:29 UTC
(In reply to comment #8)
> Now using the latest radeon-rewrite, libdrm  modeseting-gem (including kernel
> modules but no mode setting because failing to initialise memory manager) and
> latest ddx everything works.

Is the DRI enabled properly in that case?  Just want to make sure it's not falling back to software.
Comment 10 Pauli 2009-05-04 14:44:49 UTC
yes. xmoto would run around 0.5 fps if using software mesa. 

btw, I jsut noticed a weird small freeze about a second later that lock used to happen. Now it take about 200-500ms frame hit for no reason that I can see. I can reproduce this every time too. (geometry and texture loads should be far from x1400 card limits unless xmoto is very badly written)
Comment 11 Pauli 2009-05-04 16:56:17 UTC
Some more info:
I found stable combination also for mesa_7_4_branch.
That includes 
- mesa_7_4_branch head
- libdrm master head (also has to install kernel modules)
- xf86-video-ati master head

I tried to bisect for the problem in 7_4 branch and ddx separately but nether turned anything up (only in last 10 days). So here is happening some magic now that I don't understand. Problem might be that I only restarted X and not rebooted between testing ddx versions ...
Then I try to test running with stock drm modules from ubuntu jaunty. Not very promising experience as system paniced quite frequently. (3 times in about 10 minutes)

So I didn't find what was causing the bug in first place but now it seems like fixed.
Comment 12 Pauli 2009-05-05 02:01:47 UTC
Now I just looked more to kern.log and output looks very bad to me. Seems like there is buffer overflow or stack overflow that affects debug output. So is it possible for opengl apps to cause that or maybe some kind of buffer overflow in video memory?

I remember seeing a lot of texture artefacts if running two opengl applications same time. Seems like 2nd one overwrites some of memory reserved by first one. Running 2 instances of warzone shows the problem very clearly. but it is enough for minimal random texture corruption to run xmoto and neverput same time. (I guess kernel memory manager will fix this issue but it could still cause some problems)
Comment 13 Fabio Pedretti 2009-05-22 07:13:40 UTC
I am having a similar lockup problem (see https://bugs.freedesktop.org/show_bug.cgi?id=21849). Can you try reverting to original Ubuntu packages and installing kernel 2.6.29.3 from # KernelMainlineBuilds PPA [0] and see if that fixes your lockup as with me?

I am bisecting between 2.6.29 and 2.6.30-rc1 right now.

[0] https://wiki.ubuntu.com/KernelMainlineBuilds


Comment 14 Fabio Pedretti 2009-11-14 05:19:25 UTC
This was fixed in linux 2.6.30 final, the corresponding Ubuntu bug was also fixed some time ago.

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.