[PATCH v11 05/10] drm/shmem-helper: Add memory shrinker

kernel test robot lkp at intel.com
Mon Feb 27 08:56:09 UTC 2023


Hi Dmitry,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[cannot apply to drm/drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.2 next-20230227]
[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/Dmitry-Osipenko/drm-shmem-helper-Factor-out-pages-alloc-release-from-drm_gem_shmem_get-put_pages/20230227-140619
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230227060219.904986-6-dmitry.osipenko%40collabora.com
patch subject: [PATCH v11 05/10] drm/shmem-helper: Add memory shrinker
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20230227/202302271639.sq28B3aR-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/c4d106484ddbebccf4219dacbc2a9975909f4c2a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Dmitry-Osipenko/drm-shmem-helper-Factor-out-pages-alloc-release-from-drm_gem_shmem_get-put_pages/20230227-140619
        git checkout c4d106484ddbebccf4219dacbc2a9975909f4c2a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302271639.sq28B3aR-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_gem_shmem_helper.c:832:18: warning: no previous prototype for 'drm_gem_shmem_get_pages_sgt_locked' [-Wmissing-prototypes]
     832 | struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem)
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_gem_shmem_helper.c: In function 'drm_gem_shmem_shrinker_scan_objects':
   drivers/gpu/drm/drm_gem_shmem_helper.c:1015:47: error: passing argument 3 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1015 |                                   nr_to_scan, &remaining,
         |                                               ^~~~~~~~~~
         |                                               |
         |                                               long unsigned int *
   In file included from include/drm/drm_gem_shmem_helper.h:12,
                    from drivers/gpu/drm/drm_gem_shmem_helper.c:22:
   include/drm/drm_gem.h:490:39: note: expected 'bool (*)(struct drm_gem_object *)' {aka '_Bool (*)(struct drm_gem_object *)'} but argument is of type 'long unsigned int *'
     490 |                                bool (*shrink)(struct drm_gem_object *obj));
         |                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_gem_shmem_helper.c:1014:18: error: too many arguments to function 'drm_gem_lru_scan'
    1014 |         freed += drm_gem_lru_scan(&shmem_shrinker->lru_evictable,
         |                  ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:489:15: note: declared here
     489 | unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru, unsigned nr_to_scan,
         |               ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_gem_shmem_helper.c:1021:63: error: passing argument 3 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1021 |                                           nr_to_scan - freed, &remaining,
         |                                                               ^~~~~~~~~~
         |                                                               |
         |                                                               long unsigned int *
   include/drm/drm_gem.h:490:39: note: expected 'bool (*)(struct drm_gem_object *)' {aka '_Bool (*)(struct drm_gem_object *)'} but argument is of type 'long unsigned int *'
     490 |                                bool (*shrink)(struct drm_gem_object *obj));
         |                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_gem_shmem_helper.c:1020:26: error: too many arguments to function 'drm_gem_lru_scan'
    1020 |                 freed += drm_gem_lru_scan(&shmem_shrinker->lru_evictable,
         |                          ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:489:15: note: declared here
     489 | unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru, unsigned nr_to_scan,
         |               ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/drm_gem_shmem_get_pages_sgt_locked +832 drivers/gpu/drm/drm_gem_shmem_helper.c

   831	
 > 832	struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_object *shmem)
   833	{
   834		struct drm_gem_object *obj = &shmem->base;
   835		int ret;
   836		struct sg_table *sgt;
   837	
   838		if (shmem->sgt)
   839			return shmem->sgt;
   840	
   841		drm_WARN_ON(obj->dev, obj->import_attach);
   842	
   843		ret = drm_gem_shmem_get_pages(shmem);
   844		if (ret)
   845			return ERR_PTR(ret);
   846	
   847		sgt = drm_gem_shmem_get_sg_table(shmem);
   848		if (IS_ERR(sgt)) {
   849			ret = PTR_ERR(sgt);
   850			goto err_put_pages;
   851		}
   852		/* Map the pages for use by the h/w. */
   853		ret = dma_map_sgtable(obj->dev->dev, sgt, DMA_BIDIRECTIONAL, 0);
   854		if (ret)
   855			goto err_free_sgt;
   856	
   857		shmem->sgt = sgt;
   858	
   859		drm_gem_shmem_update_pages_state(shmem);
   860	
   861		return sgt;
   862	
   863	err_free_sgt:
   864		sg_free_table(sgt);
   865		kfree(sgt);
   866	err_put_pages:
   867		drm_gem_shmem_put_pages(shmem);
   868		return ERR_PTR(ret);
   869	}
   870	

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


More information about the dri-devel mailing list