Re: [PATCH v2] [PATCH] drm/amdgpu: Initialise drm_gem_object_funcs for imported BOs

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

 



Hi Andrey,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-exynos/exynos-drm-next]
[also build test WARNING on drm-intel/for-linux-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.10-rc7 next-20201208]
[cannot apply to drm/drm-next]
[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/Andrey-Grodzovsky/drm-amdgpu-Initialise-drm_gem_object_funcs-for-imported-BOs/20201209-041733
base:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
config: xtensa-randconfig-r004-20201208 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/a7b4d98b3660452b6787b39dc59980606b462ff3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andrey-Grodzovsky/drm-amdgpu-Initialise-drm_gem_object_funcs-for-imported-BOs/20201209-041733
        git checkout a7b4d98b3660452b6787b39dc59980606b462ff3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from include/drm/drm_mm.h:49,
                    from include/drm/drm_vma_manager.h:26,
                    from include/drm/drm_gem.h:40,
                    from include/drm/drm_gem_ttm_helper.h:8,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:36:
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c: In function 'amdgpu_gem_create_ioctl':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:288:14: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
     288 |    DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     289 |       size, initial_domain, args->in.alignment, r);
         |       ~~~~    
         |       |
         |       uint64_t {aka long long unsigned int}
   include/drm/drm_print.h:504:25: note: in definition of macro 'DRM_DEBUG'
     504 |  __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
         |                         ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:288:48: note: format string is defined here
     288 |    DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
         |                                              ~~^
         |                                                |
         |                                                long int
         |                                              %lld
   In file included from include/drm/drm_mm.h:49,
                    from include/drm/drm_vma_manager.h:26,
                    from include/drm/drm_gem.h:40,
                    from include/drm/drm_gem_ttm_helper.h:8,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:36:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:288:14: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type '__u64' {aka 'long long unsigned int'} [-Wformat=]
     288 |    DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     289 |       size, initial_domain, args->in.alignment, r);
         |                             ~~~~~~~~~~~~~~~~~~
         |                                     |
         |                                     __u64 {aka long long unsigned int}
   include/drm/drm_print.h:504:25: note: in definition of macro 'DRM_DEBUG'
     504 |  __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
         |                         ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:288:56: note: format string is defined here
     288 |    DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
         |                                                       ~^
         |                                                        |
         |                                                        unsigned int
         |                                                       %llu
   In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:38:
   At top level:
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:198:19: warning: 'no_system_mem_limit' defined but not used [-Wunused-const-variable=]
     198 | static const bool no_system_mem_limit;
         |                   ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:197:19: warning: 'debug_evictions' defined but not used [-Wunused-const-variable=]
     197 | static const bool debug_evictions; /* = false */
         |                   ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:196:18: warning: 'sched_policy' defined but not used [-Wunused-const-variable=]
     196 | static const int sched_policy = KFD_SCHED_POLICY_HWS;
         |                  ^~~~~~~~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:33,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30,
                    from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu.h:67,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:38:
   drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:76:32: warning: 'dc_fixpt_ln2_div_2' defined but not used [-Wunused-const-variable=]
      76 | static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
         |                                ^~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:75:32: warning: 'dc_fixpt_ln2' defined but not used [-Wunused-const-variable=]
      75 | static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
         |                                ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:74:32: warning: 'dc_fixpt_e' defined but not used [-Wunused-const-variable=]
      74 | static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
         |                                ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:73:32: warning: 'dc_fixpt_two_pi' defined but not used [-Wunused-const-variable=]
      73 | static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
         |                                ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:72:32: warning: 'dc_fixpt_pi' defined but not used [-Wunused-const-variable=]
      72 | static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
         |                                ^~~~~~~~~~~

vim +288 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

   213	
   214	/*
   215	 * GEM ioctls.
   216	 */
   217	int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   218				    struct drm_file *filp)
   219	{
   220		struct amdgpu_device *adev = drm_to_adev(dev);
   221		struct amdgpu_fpriv *fpriv = filp->driver_priv;
   222		struct amdgpu_vm *vm = &fpriv->vm;
   223		union drm_amdgpu_gem_create *args = data;
   224		uint64_t flags = args->in.domain_flags;
   225		uint64_t size = args->in.bo_size;
   226		struct dma_resv *resv = NULL;
   227		struct drm_gem_object *gobj;
   228		uint32_t handle, initial_domain;
   229		int r;
   230	
   231		/* reject invalid gem flags */
   232		if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
   233			      AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
   234			      AMDGPU_GEM_CREATE_CPU_GTT_USWC |
   235			      AMDGPU_GEM_CREATE_VRAM_CLEARED |
   236			      AMDGPU_GEM_CREATE_VM_ALWAYS_VALID |
   237			      AMDGPU_GEM_CREATE_EXPLICIT_SYNC |
   238			      AMDGPU_GEM_CREATE_ENCRYPTED))
   239	
   240			return -EINVAL;
   241	
   242		/* reject invalid gem domains */
   243		if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
   244			return -EINVAL;
   245	
   246		if (!amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
   247			DRM_NOTE_ONCE("Cannot allocate secure buffer since TMZ is disabled\n");
   248			return -EINVAL;
   249		}
   250	
   251		/* create a gem object to contain this object in */
   252		if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
   253		    AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
   254			if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
   255				/* if gds bo is created from user space, it must be
   256				 * passed to bo list
   257				 */
   258				DRM_ERROR("GDS bo cannot be per-vm-bo\n");
   259				return -EINVAL;
   260			}
   261			flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
   262		}
   263	
   264		if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
   265			r = amdgpu_bo_reserve(vm->root.base.bo, false);
   266			if (r)
   267				return r;
   268	
   269			resv = vm->root.base.bo->tbo.base.resv;
   270		}
   271	
   272	retry:
   273		initial_domain = (u32)(0xffffffff & args->in.domains);
   274		r = amdgpu_gem_object_create(adev, size, args->in.alignment,
   275					     initial_domain,
   276					     flags, ttm_bo_type_device, resv, &gobj);
   277		if (r) {
   278			if (r != -ERESTARTSYS) {
   279				if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
   280					flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
   281					goto retry;
   282				}
   283	
   284				if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
   285					initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
   286					goto retry;
   287				}
 > 288				DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
   289					  size, initial_domain, args->in.alignment, r);
   290			}
   291			return r;
   292		}
   293	
   294		if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
   295			if (!r) {
   296				struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
   297	
   298				abo->parent = amdgpu_bo_ref(vm->root.base.bo);
   299			}
   300			amdgpu_bo_unreserve(vm->root.base.bo);
   301		}
   302		if (r)
   303			return r;
   304	
   305		r = drm_gem_handle_create(filp, gobj, &handle);
   306		/* drop reference from allocate - handle holds it now */
   307		drm_gem_object_put(gobj);
   308		if (r)
   309			return r;
   310	
   311		memset(args, 0, sizeof(*args));
   312		args->out.handle = handle;
   313		return 0;
   314	}
   315	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux