[PATCH 2/4] dma-buf: add dma_resv_get_singleton_rcu (v4)

kernel test robot lkp at intel.com
Sat May 22 18:59:00 UTC 2021


Hi Jason,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tegra-drm/drm/tegra/for-next]
[also build test WARNING on linus/master v5.13-rc2 next-20210521]
[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/Jason-Ekstrand/dma-buf-Add-an-API-for-exporting-sync-files-v8/20210522-201251
base:   git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
config: x86_64-randconfig-a013-20210522 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e84a9b9bb3051c35dea993cdad7b3d2575638f85)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/925221f402201e7b1f665619dda2c5ee6d6324f1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jason-Ekstrand/dma-buf-Add-an-API-for-exporting-sync-files-v8/20210522-201251
        git checkout 925221f402201e7b1f665619dda2c5ee6d6324f1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-resv.c:550: warning: expecting prototype for dma_resv_get_singleton(). Prototype was for dma_resv_get_singleton_rcu() instead


vim +550 drivers/dma-buf/dma-resv.c

   534	
   535	/**
   536	 * dma_resv_get_singleton - get a single fence for the dma_resv object
   537	 * @obj: the reservation object
   538	 * @extra: extra fence to add to the resulting array
   539	 * @result: resulting dma_fence
   540	 *
   541	 * Get a single fence representing all unsignaled fences in the dma_resv object
   542	 * plus the given extra fence. If we got only one fence return a new
   543	 * reference to that, otherwise return a dma_fence_array object.
   544	 *
   545	 * RETURNS
   546	 * Returns -NOMEM if allocations fail, zero otherwise.
   547	 */
   548	int dma_resv_get_singleton_rcu(struct dma_resv *obj, struct dma_fence *extra,
   549				       struct dma_fence **result)
 > 550	{
   551		struct dma_fence **resv_fences, *fence, *chain, **fences;
   552		struct dma_fence_array *array;
   553		unsigned int num_resv_fences, num_fences;
   554		unsigned int ret, i, j;
   555	
   556		ret = dma_resv_get_fences_rcu(obj, NULL, &num_resv_fences, &resv_fences);
   557		if (ret)
   558			return ret;
   559	
   560		num_fences = 0;
   561		*result = NULL;
   562	
   563		if (num_resv_fences == 0 && !extra)
   564			return 0;
   565	
   566		for (i = 0; i < num_resv_fences; ++i) {
   567			dma_fence_deep_dive_for_each(fence, chain, j, resv_fences[i]) {
   568				if (dma_fence_is_signaled(fence))
   569					continue;
   570	
   571				*result = fence;
   572				++num_fences;
   573			}
   574		}
   575	
   576		if (extra) {
   577			dma_fence_deep_dive_for_each(fence, chain, j, extra) {
   578				if (dma_fence_is_signaled(fence))
   579					continue;
   580	
   581				*result = fence;
   582				++num_fences;
   583			}
   584		}
   585	
   586		if (num_fences <= 1) {
   587			*result = dma_fence_get(*result);
   588			goto put_resv_fences;
   589		}
   590	
   591		fences = kmalloc_array(num_fences, sizeof(struct dma_fence*),
   592				       GFP_KERNEL);
   593		if (!fences) {
   594			*result = NULL;
   595			ret = -ENOMEM;
   596			goto put_resv_fences;
   597		}
   598	
   599		num_fences = 0;
   600		for (i = 0; i < num_resv_fences; ++i) {
   601			dma_fence_deep_dive_for_each(fence, chain, j, resv_fences[i]) {
   602				if (!dma_fence_is_signaled(fence))
   603					fences[num_fences++] = dma_fence_get(fence);
   604			}
   605		}
   606	
   607		if (extra) {
   608			dma_fence_deep_dive_for_each(fence, chain, j, extra) {
   609				if (dma_fence_is_signaled(fence))
   610					fences[num_fences++] = dma_fence_get(fence);
   611			}
   612		}
   613	
   614		if (num_fences <= 1) {
   615			*result = num_fences ? fences[0] : NULL;
   616			kfree(fences);
   617			goto put_resv_fences;
   618		}
   619	
   620		array = dma_fence_array_create(num_fences, fences,
   621					       dma_fence_context_alloc(1),
   622					       1, false);
   623		if (array) {
   624			*result = &array->base;
   625		} else {
   626			*result = NULL;
   627			while (num_fences--)
   628				dma_fence_put(fences[num_fences]);
   629			kfree(fences);
   630			ret = -ENOMEM;
   631		}
   632	
   633	put_resv_fences:
   634		while (num_resv_fences--)
   635			dma_fence_put(resv_fences[num_resv_fences]);
   636		kfree(resv_fences);
   637	
   638		return ret;
   639	}
   640	EXPORT_SYMBOL_GPL(dma_resv_get_singleton_rcu);
   641	

---
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: 40297 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210523/44e52f7f/attachment-0001.gz>


More information about the dri-devel mailing list