[PATCH 3/4] dma-buf: begin/end_cpu might lock the dma_resv lock

kernel test robot lkp at intel.com
Fri Dec 11 22:31:11 UTC 2020


Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20201211]
[also build test ERROR on v5.10-rc7]
[cannot apply to tegra-drm/drm/tegra/for-next linus/master v5.10-rc7 v5.10-rc6 v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/dma-buf-Remove-kmap-kerneldoc-vestiges/20201212-000040
base:    3cc2bd440f2171f093b3a8480a4b54d8c270ed38
config: powerpc64-randconfig-r035-20201210 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5ff35356f1af2bb92785b38c657463924d9ec386)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/0day-ci/linux/commit/24d4fcf0e09c80974556c7639cb630f86a544378
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-Vetter/dma-buf-Remove-kmap-kerneldoc-vestiges/20201212-000040
        git checkout 24d4fcf0e09c80974556c7639cb630f86a544378
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

>> drivers/dma-buf/dma-buf.c:1121:14: error: use of undeclared identifier 'dma_buf'
           might_lock(&dma_buf->resv.lock);
                       ^
>> drivers/dma-buf/dma-buf.c:1121:14: error: use of undeclared identifier 'dma_buf'
>> drivers/dma-buf/dma-buf.c:1121:14: error: use of undeclared identifier 'dma_buf'
   drivers/dma-buf/dma-buf.c:1156:14: error: use of undeclared identifier 'dma_buf'
           might_lock(&dma_buf->resv.lock);
                       ^
   drivers/dma-buf/dma-buf.c:1156:14: error: use of undeclared identifier 'dma_buf'
   drivers/dma-buf/dma-buf.c:1156:14: error: use of undeclared identifier 'dma_buf'
   6 errors generated.

vim +/dma_buf +1121 drivers/dma-buf/dma-buf.c

  1093	
  1094	/**
  1095	 * dma_buf_begin_cpu_access - Must be called before accessing a dma_buf from the
  1096	 * cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific
  1097	 * preparations. Coherency is only guaranteed in the specified range for the
  1098	 * specified access direction.
  1099	 * @dmabuf:	[in]	buffer to prepare cpu access for.
  1100	 * @direction:	[in]	length of range for cpu access.
  1101	 *
  1102	 * After the cpu access is complete the caller should call
  1103	 * dma_buf_end_cpu_access(). Only when cpu access is braketed by both calls is
  1104	 * it guaranteed to be coherent with other DMA access.
  1105	 *
  1106	 * This function will also wait for any DMA transactions tracked through
  1107	 * implicit synchronization in &dma_buf.resv. For DMA transactions with explicit
  1108	 * synchronization this function will only ensure cache coherency, callers must
  1109	 * ensure synchronization with such DMA transactions on their own.
  1110	 *
  1111	 * Can return negative error values, returns 0 on success.
  1112	 */
  1113	int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
  1114				     enum dma_data_direction direction)
  1115	{
  1116		int ret = 0;
  1117	
  1118		if (WARN_ON(!dmabuf))
  1119			return -EINVAL;
  1120	
> 1121		might_lock(&dma_buf->resv.lock);
  1122	
  1123		if (dmabuf->ops->begin_cpu_access)
  1124			ret = dmabuf->ops->begin_cpu_access(dmabuf, direction);
  1125	
  1126		/* Ensure that all fences are waited upon - but we first allow
  1127		 * the native handler the chance to do so more efficiently if it
  1128		 * chooses. A double invocation here will be reasonably cheap no-op.
  1129		 */
  1130		if (ret == 0)
  1131			ret = __dma_buf_begin_cpu_access(dmabuf, direction);
  1132	
  1133		return ret;
  1134	}
  1135	EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access);
  1136	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 44099 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20201212/1f31c37a/attachment-0001.gz>


More information about the dri-devel mailing list