[linux-next:master 13686/13827] drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:24: error: assignment to 'struct svm_range *' from 'int' makes pointer from integer without a cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   864b1099d16fc7e332c3ad7823058c65f890486c
commit: b049504e211e8f4dbcd40434f2dcab2215ea1039 [13686/13827] drm/amdkfd: Validate user queue svm memory residency
config: powerpc64-randconfig-003-20240725 (https://download.01.org/0day-ci/archive/20240725/202407252127.zvnxaKRA-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240725/202407252127.zvnxaKRA-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407252127.zvnxaKRA-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c: In function 'kfd_queue_buffer_svm_get':
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:26: error: implicit declaration of function 'svm_range_from_addr' [-Wimplicit-function-declaration]
     107 |                 prange = svm_range_from_addr(&p->svms, addr, NULL);
         |                          ^~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:24: error: assignment to 'struct svm_range *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     107 |                 prange = svm_range_from_addr(&p->svms, addr, NULL);
         |                        ^
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:111:28: error: invalid use of undefined type 'struct svm_range'
     111 |                 if (!prange->mapped_to_gpu)
         |                            ^~
   In file included from include/linux/kernel.h:23,
                    from arch/powerpc/include/asm/page.h:11,
                    from arch/powerpc/include/asm/mmu.h:144,
                    from arch/powerpc/include/asm/paca.h:18,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/thread_info.h:23,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/powerpc/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:25:
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:45: error: invalid use of undefined type 'struct svm_range'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                                             ^~
   include/linux/bitops.h:45:44: note: in definition of macro 'bitop'
      45 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:22: note: in expansion of macro 'test_bit'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:45: error: invalid use of undefined type 'struct svm_range'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                                             ^~
   include/linux/bitops.h:46:23: note: in definition of macro 'bitop'
      46 |           (uintptr_t)(addr) != (uintptr_t)NULL &&                       \
         |                       ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:22: note: in expansion of macro 'test_bit'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:45: error: invalid use of undefined type 'struct svm_range'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                                             ^~
   include/linux/bitops.h:47:57: note: in definition of macro 'bitop'
      47 |           __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         |                                                         ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:22: note: in expansion of macro 'test_bit'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:45: error: invalid use of undefined type 'struct svm_range'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                                             ^~
   include/linux/bitops.h:48:24: note: in definition of macro 'bitop'
      48 |          const##op(nr, addr) : op(nr, addr))
         |                        ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:22: note: in expansion of macro 'test_bit'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:45: error: invalid use of undefined type 'struct svm_range'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                                             ^~
   include/linux/bitops.h:48:39: note: in definition of macro 'bitop'
      48 |          const##op(nr, addr) : op(nr, addr))
         |                                       ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:117:22: note: in expansion of macro 'test_bit'
     117 |                 if (!test_bit(gpuidx, prange->bitmap_access) &&
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:45: error: invalid use of undefined type 'struct svm_range'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                                             ^~
   include/linux/bitops.h:45:44: note: in definition of macro 'bitop'
      45 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:22: note: in expansion of macro 'test_bit'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:45: error: invalid use of undefined type 'struct svm_range'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                                             ^~
   include/linux/bitops.h:46:23: note: in definition of macro 'bitop'
      46 |           (uintptr_t)(addr) != (uintptr_t)NULL &&                       \
         |                       ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:22: note: in expansion of macro 'test_bit'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:45: error: invalid use of undefined type 'struct svm_range'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                                             ^~
   include/linux/bitops.h:47:57: note: in definition of macro 'bitop'
      47 |           __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         |                                                         ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:22: note: in expansion of macro 'test_bit'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                      ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:45: error: invalid use of undefined type 'struct svm_range'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                                             ^~
   include/linux/bitops.h:48:24: note: in definition of macro 'bitop'
      48 |          const##op(nr, addr) : op(nr, addr))
         |                        ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:118:22: note: in expansion of macro 'test_bit'
     118 |                     !test_bit(gpuidx, prange->bitmap_aip))
         |                      ^~~~~~~~


vim +107 drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c

    86	
    87	static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
    88	{
    89		struct kfd_process *p = pdd->process;
    90		struct list_head update_list;
    91		struct svm_range *prange;
    92		int ret = -EINVAL;
    93	
    94		INIT_LIST_HEAD(&update_list);
    95		addr >>= PAGE_SHIFT;
    96		size >>= PAGE_SHIFT;
    97	
    98		mutex_lock(&p->svms.lock);
    99	
   100		/*
   101		 * range may split to multiple svm pranges aligned to granularity boundaery.
   102		 */
   103		while (size) {
   104			uint32_t gpuid, gpuidx;
   105			int r;
   106	
 > 107			prange = svm_range_from_addr(&p->svms, addr, NULL);
   108			if (!prange)
   109				break;
   110	
   111			if (!prange->mapped_to_gpu)
   112				break;
   113	
   114			r = kfd_process_gpuid_from_node(p, pdd->dev, &gpuid, &gpuidx);
   115			if (r < 0)
   116				break;
   117			if (!test_bit(gpuidx, prange->bitmap_access) &&
   118			    !test_bit(gpuidx, prange->bitmap_aip))
   119				break;
   120	
   121			if (!(prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED))
   122				break;
   123	
   124			list_add(&prange->update_list, &update_list);
   125	
   126			if (prange->last - prange->start + 1 >= size) {
   127				size = 0;
   128				break;
   129			}
   130	
   131			size -= prange->last - prange->start + 1;
   132			addr += prange->last - prange->start + 1;
   133		}
   134		if (size) {
   135			pr_debug("[0x%llx 0x%llx] not registered\n", addr, addr + size - 1);
   136			goto out_unlock;
   137		}
   138	
   139		list_for_each_entry(prange, &update_list, update_list)
   140			atomic_inc(&prange->queue_refcount);
   141		ret = 0;
   142	
   143	out_unlock:
   144		mutex_unlock(&p->svms.lock);
   145		return ret;
   146	}
   147	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux