[Beignet] runtime_alloc_host_ptr_buffer intermittent failure

Guo, Yejun yejun.guo at intel.com
Sat Jan 31 05:40:41 PST 2015


Thanks Palmer for the investigation.

1. yes, the logic is not good to free an incompletely-set-up buffer, need to fix it.

2. I currently have not reproduced the issue, and have no idea on the EINVAL (errno=22).  
Does the system run out of memory at that time? 
Could you please help to add option drm.debug=7 to boot linux kernel, and check 'dmesg' for the failed drmIoctl? Thanks.


-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Rebecca N. Palmer
Sent: Saturday, January 31, 2015 5:51 AM
To: beignet at lists.freedesktop.org
Subject: Re: [Beignet] runtime_alloc_host_ptr_buffer intermittent failure

Further investigation found that ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr) (at libdrm
intel/intel_bufmgr_gem.c:895) was failing with EINVAL, but it's not obvious what's invalid about the parameters.

vload_test_int()    [SUCCESS]
vload_test_float()    [SUCCESS]
runtime_use_host_ptr_buffer()
Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1738000,
     tiling_mode=0, stride=0, size=1642496, flags=0)
     at ../../intel/intel_bufmgr_gem.c:881
881	in ../../intel/intel_bufmgr_gem.c
(gdb) c
Continuing.
     [SUCCESS]
runtime_alloc_host_ptr_buffer()
Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=0, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:881
881	in ../../intel/intel_bufmgr_gem.c
(gdb) print errno
$22 = 2
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
888	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd620)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
warning: Source file is more recent than executable.
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:893
893	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd620)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:891
891	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
892	in ../../intel/intel_bufmgr_gem.c
(gdb) step
893	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
898	in ../../intel/intel_bufmgr_gem.c
(gdb) print errno
$23 = 22
(gdb) print ret
$24 = -1
(gdb) print userptr
$25 = {user_ptr = 24338432, user_size = 1638400, flags = 0, handle = 0}
(gdb) print 0x1736000
$26 = 24338432
(gdb) c
Continuing.

Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=0, stride=0, size=1638400, flags=2147483648)
     at ../../intel/intel_bufmgr_gem.c:881
881	in ../../intel/intel_bufmgr_gem.c
(gdb) print errno
$27 = 22
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
888	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd620)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=2147483648)
     at ../../intel/intel_bufmgr_gem.c:893
893	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd620)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x1736000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=2147483648)
     at ../../intel/intel_bufmgr_gem.c:891
891	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
892	in ../../intel/intel_bufmgr_gem.c
(gdb) step
893	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
898	in ../../intel/intel_bufmgr_gem.c
(gdb) print ret
$28 = -1
(gdb) print errno
$29 = 1
(gdb) print userptr
$30 = {user_ptr = 24338432, user_size = 1638400, flags = 2147483648,
   handle = 0}
(gdb) c
Continuing.
utest_run: 
/home/rnpalmer/Debian/builds/stackbuild/beignet/src/cl_mem.c:1073: 
cl_mem_delete: Assertion `mem->ctx' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff5560107 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) quit
A debugging session is active.

	Inferior 1 [process 3049] will be killed.

Quit anyway? (y or n) y
test1 at rnpalmer-laptop:/home/rnpalmer/Debian/builds/stackbuild/beignet/build/utes
ts$ gdb --args ./utest_run -c runtime_alloc_host_ptr_buffer GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./utest_run...done.
(gdb) break intel_bufmgr_gem.c:881
No source file named intel_bufmgr_gem.c.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (intel_bufmgr_gem.c:881) pending.
(gdb) run
Starting program: 
/home/rnpalmer/Debian/builds/stackbuild/beignet/build/utests/utest_run
-c runtime_alloc_host_ptr_buffer
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
platform number 1
platform_profile "FULL_PROFILE"
platform_name "Intel Gen OCL Driver"
platform_vendor "Intel"
platform_version "OpenCL 1.2 beignet 1.0.1"
platform_extensions "cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_icd"

Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x644c50,
     name=0x7ffff7368a63 "CL memory object", addr=0x655000, tiling_mode=0,
     stride=0, size=4096, flags=0) at ../../intel/intel_bufmgr_gem.c:881
881	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) c
Continuing.
device_profile "FULL_PROFILE"
device_name "Intel(R) HD Graphics IvyBridge M GT2"
device_vendor "Intel"
device_version "OpenCL 1.2 beignet 1.0.1"
device_extensions "cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_icd"
device_opencl_c_version "OpenCL C 1.2 beignet 1.0.1"

Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x644c70,
     name=0x7ffff7368a63 "CL memory object", addr=0x655000, tiling_mode=0,
     stride=0, size=4096, flags=0) at ../../intel/intel_bufmgr_gem.c:881
881	in ../../intel/intel_bufmgr_gem.c
(gdb) c
Continuing.
21 image formats are supported
[CL_R CL_UNORM_INT8]
[CL_R CL_UNORM_INT16]
[CL_R CL_SIGNED_INT8]
[CL_R CL_SIGNED_INT16]
[CL_R CL_SIGNED_INT32]
[CL_R CL_UNSIGNED_INT8]
[CL_R CL_UNSIGNED_INT16]
[CL_R CL_UNSIGNED_INT32]
[CL_R CL_HALF_FLOAT]
[CL_R CL_FLOAT]
[CL_RGBA CL_UNORM_INT8]
[CL_RGBA CL_UNORM_INT16]
[CL_RGBA CL_SIGNED_INT8]
[CL_RGBA CL_SIGNED_INT16]
[CL_RGBA CL_SIGNED_INT32]
[CL_RGBA CL_UNSIGNED_INT8]
[CL_RGBA CL_UNSIGNED_INT16]
[CL_RGBA CL_UNSIGNED_INT32]
[CL_RGBA CL_HALF_FLOAT]
[CL_RGBA CL_FLOAT]
[CL_BGRA CL_UNORM_INT8]
runtime_alloc_host_ptr_buffer()
Breakpoint 1, drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x6e3000,
     tiling_mode=0, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:881
881	in ../../intel/intel_bufmgr_gem.c
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) print errno
$1 = 2
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
884	in ../../intel/intel_bufmgr_gem.c
(gdb) step
885	in ../../intel/intel_bufmgr_gem.c
(gdb) step
888	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd600)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
warning: Source file is more recent than executable.
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x6e3000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:893
893	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
890	in ../../intel/intel_bufmgr_gem.c
(gdb) step
memset (__len=24, __ch=0, __dest=0x7fffffffd600)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:84
84	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) step
drm_intel_gem_bo_alloc_userptr (bufmgr=0x645080,
     name=0x7ffff7368a4a "CL userptr memory object", addr=0x6e3000,
     tiling_mode=<optimized out>, stride=0, size=1638400, flags=0)
     at ../../intel/intel_bufmgr_gem.c:891
891	../../intel/intel_bufmgr_gem.c: No such file or directory.
(gdb) step
892	in ../../intel/intel_bufmgr_gem.c
(gdb) step
893	in ../../intel/intel_bufmgr_gem.c
(gdb) step
895	in ../../intel/intel_bufmgr_gem.c
(gdb) step
898	in ../../intel/intel_bufmgr_gem.c
(gdb) print ret
$2 = 0
(gdb) print errno
$3 = 2
(gdb) print userptr
$4 = {user_ptr = 7221248, user_size = 1638400, flags = 0, handle = 2}
(gdb) print 0x6e3000
$5 = 7221248
(gdb) c
Continuing.
     [SUCCESS]

summary:
----------
   total: 710
   run: 1
   pass: 1
   fail: 0
   pass rate: 1.000000
[Inferior 1 (process 3061) exited normally]
(gdb)

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list