All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Philip Yang <Philip.Yang@amd.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Felix Kuehling <felix.kuehling@amd.com>
Subject: [linux-next:master 837/1677] drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:10: warning: assignment makes pointer from integer without a cast
Date: Wed, 31 Jul 2024 17:34:21 +0800	[thread overview]
Message-ID: <202407311751.DspbODml-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   cd19ac2f903276b820f5d0d89de0c896c27036ed
commit: b049504e211e8f4dbcd40434f2dcab2215ea1039 [837/1677] drm/amdkfd: Validate user queue svm memory residency
config: x86_64-randconfig-013-20240731 (https://download.01.org/0day-ci/archive/20240731/202407311751.DspbODml-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240731/202407311751.DspbODml-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407311751.DspbODml-lkp@intel.com/

All warnings (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:12: error: implicit declaration of function 'svm_range_from_addr'; did you mean 'svm_range_get_info'? [-Werror=implicit-function-declaration]
      prange = svm_range_from_addr(&p->svms, addr, NULL);
               ^~~~~~~~~~~~~~~~~~~
               svm_range_get_info
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      prange = svm_range_from_addr(&p->svms, addr, NULL);
             ^
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:111:14: error: dereferencing pointer to incomplete type 'struct svm_range'
      if (!prange->mapped_to_gpu)
                 ^~
   In file included from include/linux/bits.h:22:0,
                    from include/linux/gfp_types.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:16,
                    from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:25:
   include/linux/compiler_types.h:451:27: error: expression in static assertion is not an integer
    #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
                              ^
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
    #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                           ^~~~
   include/linux/container_of.h:20:2: note: in expansion of macro 'static_assert'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
     ^~~~~~~~~~~~~
   include/linux/container_of.h:20:16: note: in expansion of macro '__same_type'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
                   ^~~~~~~~~~~
   include/linux/list.h:601:2: note: in expansion of macro 'container_of'
     container_of(ptr, type, member)
     ^~~~~~~~~~~~
   include/linux/list.h:612:2: note: in expansion of macro 'list_entry'
     list_entry((ptr)->next, type, member)
     ^~~~~~~~~~
   include/linux/list.h:778:13: note: in expansion of macro 'list_first_entry'
     for (pos = list_first_entry(head, typeof(*pos), member); \
                ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:139:2: note: in expansion of macro 'list_for_each_entry'
     list_for_each_entry(prange, &update_list, update_list)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:451:27: error: expression in static assertion is not an integer
    #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
                              ^
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
    #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                           ^~~~
   include/linux/container_of.h:20:2: note: in expansion of macro 'static_assert'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
     ^~~~~~~~~~~~~
   include/linux/container_of.h:20:16: note: in expansion of macro '__same_type'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
                   ^~~~~~~~~~~
   include/linux/list.h:601:2: note: in expansion of macro 'container_of'
     container_of(ptr, type, member)
     ^~~~~~~~~~~~
   include/linux/list.h:645:2: note: in expansion of macro 'list_entry'
     list_entry((pos)->member.next, typeof(*(pos)), member)
     ^~~~~~~~~~
   include/linux/list.h:780:13: note: in expansion of macro 'list_next_entry'
          pos = list_next_entry(pos, member))
                ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:139:2: note: in expansion of macro 'list_for_each_entry'
     list_for_each_entry(prange, &update_list, update_list)
     ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c: In function 'kfd_queue_buffer_svm_put':
   include/linux/container_of.h:20:47: error: dereferencing pointer to incomplete type 'struct svm_range'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
                                                  ^
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
    #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                           ^~~~
   include/linux/container_of.h:20:2: note: in expansion of macro 'static_assert'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
     ^~~~~~~~~~~~~
   include/linux/container_of.h:20:16: note: in expansion of macro '__same_type'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
                   ^~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:165:12: note: in expansion of macro 'container_of'
      prange = container_of(node, struct svm_range, it_node);
               ^~~~~~~~~~~~
   include/linux/compiler_types.h:451:27: error: expression in static assertion is not an integer
    #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
                              ^
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
    #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                           ^~~~
   include/linux/container_of.h:20:2: note: in expansion of macro 'static_assert'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
     ^~~~~~~~~~~~~
   include/linux/container_of.h:20:16: note: in expansion of macro '__same_type'
     static_assert(__same_type(*(ptr), ((type *)0)->member) || \
                   ^~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:165:12: note: in expansion of macro 'container_of'
      prange = container_of(node, struct svm_range, it_node);
               ^~~~~~~~~~~~
   In file included from include/uapi/linux/posix_types.h:5:0,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/uapi/linux/sysinfo.h:5,
                    from include/uapi/linux/kernel.h:5,
                    from include/linux/cache.h:5,
                    from include/linux/slab.h:15,
                    from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:25:
   include/linux/stddef.h:16:32: error: invalid use of undefined type 'struct svm_range'
    #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
                                   ^


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

                 reply	other threads:[~2024-07-31  9:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202407311751.DspbODml-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Philip.Yang@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=felix.kuehling@amd.com \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.