Bug 12907

Summary: radeonhd: X crash (cursor related)
Product: xorg Reporter: Roman I Khimov <roman>
Component: Driver/radeonhdAssignee: Matthias Hopf <mat>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: eich, lverhaegen, mat
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg.conf
none
Xorg.log
none
New Xorg.log
none
X crash log
none
xorg.conf that belongs to attachment 12738
none
stacktrace creator
none
gdb log for rhd_cursor
none
gdb output of stacktrace creator
none
corefile from the gdb session above
none
gdb log for rhd_cursor 2 none

Description Roman I Khimov 2007-10-24 00:49:57 UTC
X crashes often with this backtrace:

Backtrace:
0: /usr/bin/X(xf86SigHandler+0x6a) [0x482daa]
1: /lib/libc.so.6 [0x2b1513ac2710]
2: /usr/bin/X(ChangeWindowAttributes+0x73e) [0x43d4de]
3: /usr/bin/X(CreateWindow+0x63b) [0x43e6bb]
4: /usr/bin/X(ProcCreateWindow+0x130) [0x44ded0]
5: /usr/bin/X(Dispatch+0x2e0) [0x44e210]
6: /usr/bin/X(main+0x47c) [0x436a1c]
7: /lib/libc.so.6(__libc_start_main+0xf4) [0x2b1513aaeb44]
8: /usr/bin/X(FontFileCompleteXLFD+0x259) [0x435d59]

Usually it happens when X is just about to draw a new window (popup,
application window, etc).

I wasn't able to reproduce it with vesa driver (it's quite easy to trigger with radeonhd - run KDE, run several apps, click here and there, run some dialogs like "Search" or "Run application" and boom).

I'll attach xorg.conf and Xorg.log.
Comment 1 Roman I Khimov 2007-10-24 00:50:56 UTC
Created attachment 12169 [details]
xorg.conf
Comment 2 Roman I Khimov 2007-10-24 00:51:52 UTC
Created attachment 12170 [details]
Xorg.log
Comment 3 Luc Verhaegen 2007-10-24 03:34:01 UTC
Roman: 1920x1200 with a dvi-i connector. Sweet :)
Egbert/Matthias: We've seen other people report crashes like this, and these crashes only turned up after libpciaccess support was added. The X version here seems quite recent too. This points clearly to something that was changed in X that our driver setup triggers, while vesa doesn't.
Comment 4 Egbert Eich 2007-10-24 12:52:21 UTC
The location where this happens is strange. I would have to investigate this myself to get a more detailed backtrace.
Comment 5 Egbert Eich 2007-10-24 12:57:22 UTC
Since I did libpciaccess i should take this one.
Comment 6 Roman I Khimov 2007-10-24 13:07:21 UTC
> I would have to investigate this myself to get a more detailed backtrace.
X server is current Debian sid. If there is anything I can do to help, feel free to ask.
Comment 7 Egbert Eich 2007-10-25 09:38:03 UTC
Assinging this to myself.
Comment 8 Luc Verhaegen 2007-11-19 10:42:04 UTC
Any advance?
Comment 9 Roman I Khimov 2007-11-26 11:06:19 UTC
Created attachment 12726 [details]
New Xorg.log

I've just updated X server and installed packaged radeonhd driver (0.0.4~git20071124). X crashed. But for another reason now, which is interesting.
Comment 10 Matthias Hopf 2007-11-27 03:18:24 UTC
Uff.

That should *never* *ever* happen. Seems like someone is happily overwriting memory...
Comment 11 Børre Gaup 2007-11-27 07:03:23 UTC
Created attachment 12738 [details]
X crash log

For me X crashes immediately. This is using git master from today, Kubuntu Gutsy.
Comment 12 Børre Gaup 2007-11-27 07:05:27 UTC
Created attachment 12739 [details]
xorg.conf that belongs to attachment 12738 [details]
Comment 13 Matthias Hopf 2007-11-27 07:26:59 UTC
Can you create a more meaningful stack trace?

Compile the driver with 'make CFLAGS="-O0 -g3"', install the xserver -debuginfo package (depending on the distribution you are using), and use the script I'll attach shortly for starting the server.
Comment 14 Matthias Hopf 2007-11-27 07:29:32 UTC
Created attachment 12740 [details]
stacktrace creator

Call this script for running Xorg. You might need to change the path to Xorg (/usr/bin/Xorg in the script).
Comment 15 Roman I Khimov 2007-11-27 23:09:36 UTC
Created attachment 12761 [details]
gdb log for rhd_cursor

Well, nothing new from me, unfortunately. No core, no backtrace.
Comment 16 Børre Gaup 2007-11-28 01:09:27 UTC
Created attachment 12766 [details]
gdb output of stacktrace creator
Comment 17 Børre Gaup 2007-11-28 01:12:22 UTC
Created attachment 12767 [details]
corefile from the gdb session above
Comment 18 Børre Gaup 2007-11-28 01:22:24 UTC
Another effect of the X crash is that the monitor becomes black.
I can switch virtual terminals and type commands (ie. reboot the machine), but I am not able to see what I type.
Comment 19 Matthias Hopf 2007-11-28 03:57:08 UTC
> Another effect of the X crash is that the monitor becomes black.

Right. Just noticed that there is a bug in our xf86debug script. Add a new line containing "cont" just before the "quit" line, and your screen will (hopefully) be restored.


@B�rre:

Your issue is a completely unrelated one, and a severe one as well. Could you please open a different bug report for that? Assign it right to me.


@Roman:

Didn't notice that the crash was from a different user. For the ASSERT() xf86debug doesn't help. Still continue to use it, so if you get the crash of the initial bug report again, attach the gdb output file (core file not needed ATM).

I have yet to test radeonhd with a git Xserver.
Comment 20 Egbert Eich 2007-11-28 04:37:29 UTC
Matthias, the original bug reported by Roman I Khimov refers to nother crash. It predates RandR support in the driver even.
Please open another ticket to track the other crash.
Comment 21 Børre Gaup 2007-11-28 05:28:11 UTC
The second crash is now reported separately in https://bugs.freedesktop.org/show_bug.cgi?id=13420
Comment 22 Matthias Hopf 2007-11-28 10:59:01 UTC
Roman: Please clone
  git://anongit.freedesktop.org/~mhopf/radeonhd

and check whether the issue is gone. Last commit: 99feb9897
Comment 23 Roman I Khimov 2007-11-28 23:20:30 UTC
Done that, still the same, unfortunately. Just line number changed:

../../src/rhd_cursor.c:110: setCursorImage: Assertion '(Cursor->Height > 0) && (Cursor->Height <= MAX_CURSOR_HEIGHT)' failed.

Need full log?
Comment 24 Matthias Hopf 2007-11-29 03:35:21 UTC
Nope, thanks.

I just pushed some tests there, could you please git-pull and try it again? It will fail, but it will print out additional information, and give you a stack trace in Xorg.log. I would need both.
Comment 25 Roman I Khimov 2007-11-29 09:21:05 UTC
Got it.

============================================================
../../src/rhd_cursor.c:111: setCursorImage: Assertion '(Cursor->Width > 0) && (Cursor->Width <= MAX_CURSOR_WIDTH)' failed.
  Width=70, Height=26, Base=(nil)

Backtrace:
0: /usr/bin/X(xf86SigHandler+0x6a) [0x47554a]
1: /lib/libc.so.6 [0x3f1a632040]
2: /lib/libc.so.6(kill+0x7) [0x3f1a632467]
3: /usr/lib/xorg/modules/drivers//radeonhd_drv.so(RhdAssertFailedFormat+0xb2) [0x2b947cd855e2]
4: /usr/lib/xorg/modules/drivers//radeonhd_drv.so [0x2b947cd80d58]
5: /usr/bin/X(xf86SetCursor+0xc3) [0x4b5803]
6: /usr/bin/X [0x4b5019]
7: /usr/bin/X(miPointerUpdateSprite+0x167) [0x4e0727]
8: /usr/bin/X [0x4e0812]
9: /usr/bin/X [0x4f5a05]
10: /usr/bin/X [0x5171c4]
11: /usr/bin/X [0x4559ac]
12: /usr/bin/X [0x458bd1]
13: /usr/bin/X(CoreProcessPointerEvent+0x37f) [0x45972f]
14: /usr/bin/X(ProcessPointerEvent+0xb2) [0x5420e2]
15: /usr/bin/X(mieqProcessInputEvents+0x109) [0x4d7b19]
16: /usr/bin/X(ProcessInputEvents+0x1c) [0x475cec]
17: /usr/bin/X(Dispatch+0x7d) [0x44e16d]
18: /usr/bin/X(main+0x47c) [0x436bcc]
19: /lib/libc.so.6(__libc_start_main+0xf4) [0x3f1a61e1c4]
20: /usr/bin/X(FontFileCompleteXLFD+0x261) [0x435f09]

Fatal server error:
Caught signal 11.  Server aborting
============================================================

And it looks like now I can reproduce it with 100% guarantee. It crashes when horizontal move cursor appears (or how to say it better? the one which appears on the right or left side of the window). I'm using "Chameleon-Pearl-Large" cursor theme from 'chameleon-cursor-theme' Debian package.
Comment 26 Matthias Hopf 2007-11-30 06:38:30 UTC
Hm, several symbols from the stack trace are missing, so I don't really know whether xf86CursorSetCursor() from the mi layer is called before xf86SetCursor().

xf86CursorSetCursor() is doing the size test.
Maybe Egbert has more old-school knowledge here.


Also, I just found this in your xorg.conf:
Section "ServerFlags"
	Option		"Xinerama"	"true"
EndSection

Xinerama doesn't work well together with RandR yet, and yes you have RandR disabled - but I haven't done much testing with Xinerama. Can you try and disable Xinerama for a test, please?
Comment 27 Matthias Hopf 2007-11-30 06:47:36 UTC
I also updated my test git repro, could you please git-pull and run the Xserver afterwards with the stacktrace creator (comment #14 and comment #19)?
Comment 28 Roman I Khimov 2007-11-30 09:07:49 UTC
> Also, I just found this in your xorg.conf:
> Section "ServerFlags"
>         Option          "Xinerama"      "true"
> EndSection
Nope, you have found it in B�rre's xorg.conf. :) Mine doesn't have Xinerama enabled.

 
> I also updated my test git repro, could you please git-pull and run the Xserver
> afterwards with the stacktrace creator (comment #14 and comment #19)?
I'll try. Although last time I tried the system freezed hard and I couldn't switch to console to see what's up. :)
Comment 29 Matthias Hopf 2007-11-30 09:12:41 UTC
(In reply to comment #28)
> > Also, I just found this in your xorg.conf:
> Nope, you have found it in B�rre's xorg.conf. :) Mine doesn't have Xinerama
> enabled.

Eek. :) Sorry.

> > I also updated my test git repro, could you please git-pull and run the Xserver
> > afterwards with the stacktrace creator (comment #14 and comment #19)?
> I'll try. Although last time I tried the system freezed hard and I couldn't
> switch to console to see what's up. :)

I guess you know that you can still use our driver (in between tests ;) with the Option "SWcursor"?
In the stacktrace creator you have to patch a line according to #19 to get the console lit up again.
Comment 30 Roman I Khimov 2007-11-30 09:32:11 UTC
> I guess you know that you can still use our driver (in between tests ;)
> with the Option "SWcursor"?
Hmm. Not thought of that. Thanks, I'll try. Maybe I'll be able to reproduce the crash that I've reported first.

> In the stacktrace creator you have to patch a line according to #19 to
> get the console lit up again.
OK.
Comment 31 Roman I Khimov 2007-11-30 09:55:20 UTC
Created attachment 12879 [details]
gdb log for rhd_cursor 2

This is the log for cursor crash, reproduced easily again as I've said above.

Regarding SWCursor - writing this from Konqueror under X with radeonhd driver and SWCursor enabled. So far so good. Yeah, 1920x1200, missed that with vesa. :)
Comment 32 Roman I Khimov 2007-11-30 09:56:34 UTC
BTW, I have core file if you need that (285 Mb :)).
Comment 33 Roman I Khimov 2007-11-30 09:58:00 UTC
> core file if you need that (285 Mb :)).
Or just one meg compressed.
Comment 34 Roman I Khimov 2007-12-03 22:39:21 UTC
BTW, I'm still running SWCursor session from November 30 here (almost 4 days), no problems.
Comment 35 Matthias Hopf 2007-12-11 07:59:17 UTC
Good to know.

I added some further tests in my own git repro. Can you please git-pull it once more and test it (w/o SWCursor)? I'd need both a gdb backtrace (from the stacktrace creator) and a full Xorg.0.log if it still fails.
Comment 36 Roman I Khimov 2007-12-12 01:26:45 UTC
> if it still fails.
Well, it doesn't. Running for two hours now, displayed all (or almost all) cursors from my theme, no crash.
Comment 37 Matthias Hopf 2007-12-12 04:00:07 UTC
So it seems we have found the issue:

Undocumented behavior of UseHWCursorARGB(). It has to verify the cursor size restrictions itself, while for UseHWCursor() this is not the case. Ugh.

Thanks for helping here.
Comment 38 Matthias Hopf 2007-12-12 04:06:56 UTC
Fixed in git affbdf54d68d8a36372a79ac2e631dfcbaf3897c

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.