Hi Liviu,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.12-rc6 next-20241106]
[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#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/Liviu-Dudau/drm-panthor-Lock-XArray-when-getting-entries-for-heap-and-VM/20241106-200841
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    
https://lore.kernel.org/r/20241106120748.290697-1-liviu.dudau%40arm.com
patch subject: [PATCH] drm/panthor: Lock XArray when getting entries for heap 
and VM
config: arc-allyesconfig 
(https://download.01.org/0day-ci/archive/20241107/202411070140.l4jawkvx-...@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20241107/202411070140.l4jawkvx-...@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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202411070140.l4jawkvx-...@intel.com/

All error/warnings (new ones prefixed by >>):

>> drivers/gpu/drm/panthor/panthor_heap.c:354:57: warning: 'struct 
>> pathor_heap_pool' declared inside parameter list will not be visible outside 
>> of this definition or declaration
     354 | static struct panthor_heap *panthor_heap_from_id(struct 
pathor_heap_pool *pool, u32 id)
         |                                                         
^~~~~~~~~~~~~~~~
   In file included from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/huge_mm.h:8,
                    from include/linux/mm.h:1120,
                    from include/linux/scatterlist.h:8,
                    from include/linux/iommu.h:10,
                    from include/linux/io-pgtable.h:6,
                    from drivers/gpu/drm/panthor/panthor_device.h:10,
                    from drivers/gpu/drm/panthor/panthor_heap.c:9:
   drivers/gpu/drm/panthor/panthor_heap.c: In function 'panthor_heap_from_id':
>> drivers/gpu/drm/panthor/panthor_heap.c:358:22: error: invalid use of 
>> undefined type 'struct pathor_heap_pool'
     358 |         xa_lock(&pool->xa);
         |                      ^~
   include/linux/xarray.h:536:45: note: in definition of macro 'xa_lock'
     536 | #define xa_lock(xa)             spin_lock(&(xa)->xa_lock)
         |                                             ^~
   drivers/gpu/drm/panthor/panthor_heap.c:359:29: error: invalid use of 
undefined type 'struct pathor_heap_pool'
     359 |         heap = xa_load(&pool->xa, id);
         |                             ^~
   drivers/gpu/drm/panthor/panthor_heap.c:360:24: error: invalid use of 
undefined type 'struct pathor_heap_pool'
     360 |         xa_unlock(&pool->va);
         |                        ^~
   include/linux/xarray.h:537:47: note: in definition of macro 'xa_unlock'
     537 | #define xa_unlock(xa)           spin_unlock(&(xa)->xa_lock)
         |                                               ^~
   drivers/gpu/drm/panthor/panthor_heap.c: In function 
'panthor_heap_return_chunk':
>> drivers/gpu/drm/panthor/panthor_heap.c:389:37: error: passing argument 1 of 
>> 'panthor_heap_from_id' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
     389 |         heap = panthor_heap_from_id(pool, heap_id);
         |                                     ^~~~
         |                                     |
         |                                     struct panthor_heap_pool *
   drivers/gpu/drm/panthor/panthor_heap.c:354:75: note: expected 'struct 
pathor_heap_pool *' but argument is of type 'struct panthor_heap_pool *'
     354 | static struct panthor_heap *panthor_heap_from_id(struct 
pathor_heap_pool *pool, u32 id)
         |                                                  
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/gpu/drm/panthor/panthor_heap.c: In function 'panthor_heap_grow':
   drivers/gpu/drm/panthor/panthor_heap.c:452:37: error: passing argument 1 of 
'panthor_heap_from_id' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
     452 |         heap = panthor_heap_from_id(pool, heap_id);
         |                                     ^~~~
         |                                     |
         |                                     struct panthor_heap_pool *
   drivers/gpu/drm/panthor/panthor_heap.c:354:75: note: expected 'struct 
pathor_heap_pool *' but argument is of type 'struct panthor_heap_pool *'
     354 | static struct panthor_heap *panthor_heap_from_id(struct 
pathor_heap_pool *pool, u32 id)
         |                                                  
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/seq_file.h:11,
                    from include/drm/drm_debugfs.h:36,
                    from drivers/gpu/drm/panthor/panthor_mmu.c:5:
   drivers/gpu/drm/panthor/panthor_mmu.c: In function 'panthor_vm_pool_get_vm':
>> drivers/gpu/drm/panthor/panthor_mmu.c:1585:26: error: 'struct 
>> panthor_vm_pool' has no member named 'va'; did you mean 'xa'?
    1585 |         xa_unlock(&pool->va);
         |                          ^~
   include/linux/xarray.h:537:47: note: in definition of macro 'xa_unlock'
     537 | #define xa_unlock(xa)           spin_unlock(&(xa)->xa_lock)
         |                                               ^~


vim +358 drivers/gpu/drm/panthor/panthor_heap.c

   353  
 > 354  static struct panthor_heap *panthor_heap_from_id(struct 
 > pathor_heap_pool *pool, u32 id)
   355  {
   356          struct panthor_heap *heap;
   357  
 > 358          xa_lock(&pool->xa);
   359          heap = xa_load(&pool->xa, id);
   360          xa_unlock(&pool->va);
   361  
   362          return heap;
   363  }
   364  
   365  /**
   366   * panthor_heap_return_chunk() - Return an unused heap chunk
   367   * @pool: The pool this heap belongs to.
   368   * @heap_gpu_va: The GPU address of the heap context.
   369   * @chunk_gpu_va: The chunk VA to return.
   370   *
   371   * This function is used when a chunk allocated with panthor_heap_grow()
   372   * couldn't be linked to the heap context through the FW interface 
because
   373   * the group requesting the allocation was scheduled out in the 
meantime.
   374   */
   375  int panthor_heap_return_chunk(struct panthor_heap_pool *pool,
   376                                u64 heap_gpu_va,
   377                                u64 chunk_gpu_va)
   378  {
   379          u64 offset = heap_gpu_va - 
panthor_kernel_bo_gpuva(pool->gpu_contexts);
   380          u32 heap_id = (u32)offset / 
panthor_heap_ctx_stride(pool->ptdev);
   381          struct panthor_heap_chunk *chunk, *tmp, *removed = NULL;
   382          struct panthor_heap *heap;
   383          int ret;
   384  
   385          if (offset > U32_MAX || heap_id >= MAX_HEAPS_PER_POOL)
   386                  return -EINVAL;
   387  
   388          down_read(&pool->lock);
 > 389          heap = panthor_heap_from_id(pool, heap_id);
   390          if (!heap) {
   391                  ret = -EINVAL;
   392                  goto out_unlock;
   393          }
   394  
   395          chunk_gpu_va &= GENMASK_ULL(63, 12);
   396  
   397          mutex_lock(&heap->lock);
   398          list_for_each_entry_safe(chunk, tmp, &heap->chunks, node) {
   399                  if (panthor_kernel_bo_gpuva(chunk->bo) == chunk_gpu_va) 
{
   400                          removed = chunk;
   401                          list_del(&chunk->node);
   402                          heap->chunk_count--;
   403                          break;
   404                  }
   405          }
   406          mutex_unlock(&heap->lock);
   407  
   408          if (removed) {
   409                  panthor_kernel_bo_destroy(chunk->bo);
   410                  kfree(chunk);
   411                  ret = 0;
   412          } else {
   413                  ret = -EINVAL;
   414          }
   415  
   416  out_unlock:
   417          up_read(&pool->lock);
   418          return ret;
   419  }
   420  

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

Reply via email to