[PATCH v2] dma-buf: allow nested dma_resv_reserve_fences

kernel test robot lkp at intel.com
Fri Jun 23 21:20:48 UTC 2023


Hi Yunxiang,

kernel test robot noticed the following build errors:



url:    https://github.com/intel-lab-lkp/linux/commits/UPDATE-20230624-040209/Yunxiang-Li/drm-amdgpu-fix-missing-fence-reserve-in-amdgpu_vm_sdma_commit/20230622-002915
base:   the 2th patch of https://lore.kernel.org/r/20230621162652.10875-3-Yunxiang.Li%40amd.com
patch link:    https://lore.kernel.org/r/20230623200113.62051-1-Yunxiang.Li%40amd.com
patch subject: [PATCH v2] dma-buf: allow nested dma_resv_reserve_fences
config: m68k-randconfig-r002-20230622 (https://download.01.org/0day-ci/archive/20230624/202306240538.Mz3kjtT7-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230624/202306240538.Mz3kjtT7-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306240538.Mz3kjtT7-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/dma-buf/dma-resv.c: In function 'dma_resv_add_fence':
>> drivers/dma-buf/dma-resv.c:326: error: unterminated #else
     326 | #ifdef CONFIG_DEBUG_MUTEXES
         | 
   drivers/dma-buf/dma-resv.c:327:9: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
     327 |         else
         |         ^~~~
   drivers/dma-buf/dma-resv.c:327:9: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
>> drivers/dma-buf/dma-resv.c:328:17: error: expected declaration or statement at end of input
     328 |                 WARN_ON(1); // missing fence slot allocation
         |                 ^~~~~~~


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

   274	
   275	/**
   276	 * dma_resv_add_fence - Add a fence to the dma_resv obj
   277	 * @obj: the reservation object
   278	 * @fence: the fence to add
   279	 * @usage: how the fence is used, see enum dma_resv_usage
   280	 *
   281	 * Add a fence to a slot, @obj must be locked with dma_resv_lock(), and
   282	 * dma_resv_reserve_fences() has been called.
   283	 *
   284	 * See also &dma_resv.fence for a discussion of the semantics.
   285	 */
   286	void dma_resv_add_fence(struct dma_resv *obj, struct dma_fence *fence,
   287				enum dma_resv_usage usage)
   288	{
   289		struct dma_resv_list *fobj;
   290		struct dma_fence *old;
   291		unsigned int i, count;
   292	
   293		dma_fence_get(fence);
   294	
   295		dma_resv_assert_held(obj);
   296	
   297		/* Drivers should not add containers here, instead add each fence
   298		 * individually.
   299		 */
   300		WARN_ON(dma_fence_is_container(fence));
   301	
   302	retry:
   303		fobj = dma_resv_fences_list(obj);
   304		count = fobj->num_fences;
   305	
   306		for (i = 0; i < count; ++i) {
   307			enum dma_resv_usage old_usage;
   308	
   309			dma_resv_list_entry(fobj, i, obj, &old, &old_usage);
   310			if ((old->context == fence->context && old_usage >= usage &&
   311			     dma_fence_is_later(fence, old)) ||
   312			    dma_fence_is_signaled(old)) {
   313				dma_resv_list_set(fobj, i, fence, usage);
   314				dma_fence_put(old);
   315				return;
   316			}
   317		}
   318	
   319		if (WARN_ON(fobj->num_fences == fobj->max_fences)) {
   320			// try our best to avoid memory corruption
   321			dma_resv_reserve_fences(obj, 1);
   322			goto retry;
   323		}
   324		if (fobj->reserved_fences)
   325			fobj->reserved_fences -= 1;
 > 326	#ifdef CONFIG_DEBUG_MUTEXES
   327		else
 > 328			WARN_ON(1); // missing fence slot allocation
   329	#else
   330		count++;
   331	
   332		dma_resv_list_set(fobj, i, fence, usage);
   333		/* pointer update must be visible before we extend the num_fences */
   334		smp_store_mb(fobj->num_fences, count);
   335	}
   336	EXPORT_SYMBOL(dma_resv_add_fence);
   337	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


More information about the dri-devel mailing list