Bug 47061

Summary: Server gets stuck in sna_accel_block_handler from time to time
Product: xorg Reporter: Clemens Eisserer <linuxhippy>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Clemens Eisserer 2012-03-07 08:35:33 UTC
On my i945GM based Notebook, I experience hangs every few hours where I am still able to move the mouse-coursor, however the rest of X is completly unresponsive.

Intel: 2.18.0-27-gaaed9e9

pstack-output:
#0  0x005b6831 in _kgem_submit () from /usr/lib/xorg/modules/drivers/intel_drv.so
#1  0x005d8b93 in sna_accel_block_handler () from /usr/lib/xorg/modules/drivers/intel_drv.so
#2  0x005e60ba in sna_block_handler () from /usr/lib/xorg/modules/drivers/intel_drv.so
#3  0x0807a488 in BlockHandler ()
#4  0x080a58f1 in WaitForSomething ()
#5  0x08075eae in ?? ()
#6  0x0806439a in ?? ()
#7  0x41e616b3 in __libc_start_main () from /lib/libc.so.6
#8  0x080646c9 in _start ()


gdb-output at some random time:
0x005b683d in kgem_finish_partials (kgem=0x86f839c) at kgem.c:1425
1425		list_for_each_entry_safe(bo, next, &kgem->active_partials, base.list) {
(gdb) bt
#0  0x005b683d in kgem_finish_partials (kgem=0x86f839c) at kgem.c:1425
#1  _kgem_submit (kgem=0x86f839c) at kgem.c:1681
#2  0x005d8b93 in kgem_bo_submit (bo=0x8729050, kgem=0x86f839c) at kgem.h:253
#3  kgem_bo_flush (bo=0x8729050, kgem=0x86f839c) at kgem.h:259
#4  sna_accel_flush (sna=0x86f8260) at sna_accel.c:11695
#5  sna_accel_block_handler (sna=0x86f8260) at sna_accel.c:11959
#6  0x005e60ba in sna_block_handler (i=0, data=0x86f8260, timeout=0xbfe0e39c, read_mask=0x8235c20) at sna_driver.c:593
#7  0x0807a488 in BlockHandler ()
#8  0x080a58f1 in WaitForSomething ()
#9  0x08075eae in ?? ()
#10 0x0806439a in ?? ()
#11 0x41e616b3 in __libc_start_main () from /lib/libc.so.6
#12 0x080646c9 in _start ()


Xorg.log output:
[ 19613.304] [mi] EQ overflowing. The server is probably stuck in an infinite loop.
[ 19613.304] 
Backtrace:
[ 19613.304] 0: /usr/bin/X (xorg_backtrace+0x3c) [0x80a869c]
[ 19613.304] 1: /usr/bin/X (mieqEnqueue+0x175) [0x81ac2e5]
[ 19613.304] 2: /usr/bin/X (0x8047000+0x43882) [0x808a882]
[ 19613.305] 3: /usr/bin/X (xf86PostMotionEventM+0xf2) [0x80dbbd2]
[ 19613.305] 4: /usr/lib/xorg/modules/input/evdev_drv.so (0x152000+0x343e) [0x15543e]
[ 19613.305] 5: /usr/lib/xorg/modules/input/evdev_drv.so (0x152000+0x492f) [0x15692f]
[ 19613.305] 6: /usr/bin/X (0x8047000+0x7f5f0) [0x80c65f0]
[ 19613.305] 7: /usr/bin/X (0x8047000+0xa60bb) [0x80ed0bb]
[ 19613.305] 8: (vdso) (__kernel_sigreturn+0x0) [0xe29400]
[ 19613.305] 9: /usr/lib/xorg/modules/drivers/intel_drv.so (0x583000+0x337f8) [0x5b67f8]
[ 19613.305] 10: /usr/lib/xorg/modules/drivers/intel_drv.so (0x583000+0x55b93) [0x5d8b93]
[ 19613.305] 11: /usr/lib/xorg/modules/drivers/intel_drv.so (0x583000+0x630ba) [0x5e60ba]
[ 19613.305] 12: /usr/bin/X (BlockHandler+0x58) [0x807a488]
[ 19613.305] 13: /usr/bin/X (WaitForSomething+0x111) [0x80a58f1]
[ 19613.305] 14: /usr/bin/X (0x8047000+0x2eeae) [0x8075eae]
[ 19613.305] 15: /usr/bin/X (0x8047000+0x1d39a) [0x806439a]
[ 19613.305] 16: /lib/libc.so.6 (__libc_start_main+0xf3) [0x41e616b3]
[ 19613.305] 17: /usr/bin/X (0x8047000+0x1d6c9) [0x80646c9]
Comment 1 Chris Wilson 2012-03-07 10:01:39 UTC
And I had just finished debugging this one. If only I had fixed it an hour ago! ;)
Comment 2 Chris Wilson 2012-03-07 10:57:40 UTC
commit 34fe3cbb316c36c7022735cf9b03d8b655e04434
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Mar 7 17:49:01 2012 +0000

    sna: Avoid recursive calls to kgem_retire_partials()
    
    Whilst iterating the partial list and uploading the buffers, we need to
    avoid trigger a recursive call into retire should we attempt to shrink a
    buffer. Such a recursive call will modify the list beneath us so that we
    chase a stale pointer and wreak havoc with memory corruption.
    
    Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47061
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.