Bug 73920

Summary: x server crash after radeon_gem_object_create failure
Product: xorg Reporter: Andriy Gapon <avg>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: 7.7 (2012.06)   
Hardware: x86-64 (AMD64)   
OS: FreeBSD   
Whiteboard:
i915 platform: i915 features:

Description Andriy Gapon 2014-01-22 09:40:20 UTC
The following happens after the fix for bug 44099 has been applied.

X server stack trace:
Core was generated by `Xorg'.
Program terminated with signal 11, Segmentation fault.
#0  memcpy () at /usr/src/lib/libc/amd64/string/bcopy.S:65
65              rep
(gdb) bt
#0  memcpy () at /usr/src/lib/libc/amd64/string/bcopy.S:65
#1  0x0000000804edd421 in R600UploadToScreenCS () from /usr/local/lib/xorg/modules/drivers/radeon_drv.so
#2  0x0000000805b4866d in exaDoPutImage (depth=24, src_stride=<optimized out>, bits=0x817400000 <Address 0x817400000 out of bounds>, format=2, h=7811, w=8098, y=0, x=0, pGC=0x8097d6300, pDrawable=0x8101b6840) at exa_accel.c:212
#3  exaPutImage (pDrawable=0x8101b6840, pGC=0x8097d6300, depth=24, x=0, y=0, w=8098, h=7811, leftPad=0, format=2, bits=0x817400000 <Address 0x817400000 out of bounds>) at exa_accel.c:233
#4  0x00000000004f166a in damagePutImage (pDrawable=0x8101b6840, pGC=0x8097d6300, depth=24, x=<optimized out>, y=<optimized out>, w=<optimized out>, h=7811, leftPad=0, format=2, 
    pImage=0x817400000 <Address 0x817400000 out of bounds>) at damage.c:795
#5  0x00000000004c6e19 in ProcShmPutImage (client=0x80978a6c0) at shm.c:583
#6  0x00000000004c7cc5 in ProcShmDispatch (client=0x80978a6c0) at shm.c:1108
#7  0x0000000000433091 in Dispatch () at dispatch.c:428
#8  0x00000000004224da in main (argc=8, argv=0x7fffffffdcd8, envp=<optimized out>) at main.c:288

Unfortunately, radeon_drv.so was compiled without debug symbols.

There are also the following messages in the system log right from the crash time:
kernel: [TTM] Unable to allocate page     
kernel: error: [drm:pid42432:radeon_gem_object_create] *ERROR* Failed to allocate GEM object (254115840, 2, 4096, -12)
kernel: vm_fault: pager read error, pid 42432 (Xorg)
kernel: pid 42432 (Xorg), uid 0: exited on signal 11 (core dumped)
Comment 1 Andriy Gapon 2014-01-22 09:44:19 UTC
Got another crash, this time in R600DownloadFromScreenCS:

(gdb) bt
#0  memcpy () at /usr/src/lib/libc/amd64/string/bcopy.S:65
#1  0x0000000804edce51 in R600DownloadFromScreenCS (pSrc=<optimized out>, x=0, y=0, w=14400, h=<optimized out>, dst=<optimized out>, dst_pitch=14400) at r600_exa.c:1752
#2  0x0000000805b4a960 in exaGetImage (pDrawable=0x81118da40, x=0, y=0, w=3600, h=5364, format=2, planeMask=4294967295, d=0x816a00000 "") at exa_accel.c:1290
#3  0x000000000054be04 in miSpriteGetImage (pDrawable=0x81118da40, sx=0, sy=0, w=3600, h=5364, format=2, planemask=4294967295, pdstLine=0x816a00000 "") at misprite.c:413
#4  0x00000000004b7c7f in compGetImage (pDrawable=0x81118da40, sx=<optimized out>, sy=<optimized out>, w=<optimized out>, h=<optimized out>, format=<optimized out>, planemask=4294967295, pdstLine=0x816a00000 "") at compinit.c:148
#5  0x00000000004c71ab in ProcShmGetImage (client=client@entry=0x809ca6240) at shm.c:679
#6  0x00000000004c7cb5 in ProcShmDispatch (client=0x809ca6240) at shm.c:1114
#7  0x0000000000433091 in Dispatch () at dispatch.c:428
#8  0x00000000004224da in main (argc=8, argv=0x7fffffffdcd8, envp=<optimized out>) at main.c:288

Again, it has been accompanied by the following system log messages:
[TTM] Failed to expire sync object before buffer eviction
[TTM] Unable to allocate page
error: [drm:pid39902:radeon_gem_object_create] *ERROR* Failed to allocate GEM object (78331904, 2, 4096, -12)
vm_fault: pager read error, pid 39902 (Xorg)
pid 39902 (Xorg), uid 0: exited on signal 11 (core dumped)

Also, the following stderr messages have been captured in kdm.log:
Failed to allocate :
   size      : 78329856 bytes
   alignment : 256 bytes
   domains   : 2
Comment 2 Michel Dänzer 2014-02-13 03:02:20 UTC
Does glamor work better? (Make sure you use current glamor Git)
Comment 3 Andriy Gapon 2014-02-15 11:33:18 UTC
I didn't have a chance to try glamor.

But it certainly seems that FreeBSD TTM port is not sufficiently robust with respect to memory allocation.
I am not sure that if the userland bits could be improved to deal better with such memory allocation failures.  I hope that they can be eliminated in the first places by improving the FreeBSD kernel-side radeon driver.
Comment 4 Martin Peres 2019-11-19 07:44:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/93.

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.