[agd5f:amd-staging-drm-next 1160/1989] drivers/gpu/drm/panthor/panthor_gem.c:1499:50: warning: passing argument 2 of 'drm_gem_lru_scan' makes pointer from integer without a cast

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   04764d6c56dbf1efec626716b7b36ac121f014e0
commit: 03ad9467e6567c258264a72fd5ef4694e7995149 [1160/1989] Merge tag 'v7.1-rc6' into amd-staging-drm-next
config: s390-randconfig-001-20260718 (https://download.01.org/0day-ci/archive/20260718/[email protected]/config)
compiler: s390-linux-gcc (GCC) 13.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/panthor/panthor_gem.c: In function 'panthor_gem_shrinker_scan':
   drivers/gpu/drm/panthor/panthor_gem.c:1498:35: error: passing argument 1 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1498 |         freed += drm_gem_lru_scan(&ptdev->reclaim.unused,
         |                                   ^~~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct drm_gem_lru *
   In file included from include/drm/drm_gpuvm.h:35,
                    from include/drm/drm_debugfs.h:38,
                    from drivers/gpu/drm/panthor/panthor_gem.c:15:
   include/drm/drm_gem.h:615:37: note: expected 'struct drm_device *' but argument is of type 'struct drm_gem_lru *'
     615 | drm_gem_lru_scan(struct drm_device *dev,
         |                  ~~~~~~~~~~~~~~~~~~~^~~
>> drivers/gpu/drm/panthor/panthor_gem.c:1499:50: warning: passing argument 2 of 'drm_gem_lru_scan' makes pointer from integer without a cast [-Wint-conversion]
    1499 |                                   sc->nr_to_scan - freed, &remaining,
         |                                   ~~~~~~~~~~~~~~~^~~~~~~
         |                                                  |
         |                                                  long unsigned int
   include/drm/drm_gem.h:616:38: note: expected 'struct drm_gem_lru *' but argument is of type 'long unsigned int'
     616 |                  struct drm_gem_lru *lru,
         |                  ~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/gpu/drm/panthor/panthor_gem.c:1499:59: warning: passing argument 3 of 'drm_gem_lru_scan' makes integer from pointer without a cast [-Wint-conversion]
    1499 |                                   sc->nr_to_scan - freed, &remaining,
         |                                                           ^~~~~~~~~~
         |                                                           |
         |                                                           long unsigned int *
   include/drm/drm_gem.h:617:31: note: expected 'unsigned int' but argument is of type 'long unsigned int *'
     617 |                  unsigned int nr_to_scan,
         |                  ~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1500:35: error: passing argument 4 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1500 |                                   panthor_gem_try_evict_no_resv_wait, NULL);
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *) {aka _Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)}
   include/drm/drm_gem.h:618:33: note: expected 'long unsigned int *' but argument is of type 'bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)' {aka '_Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)'}
     618 |                  unsigned long *remaining,
         |                  ~~~~~~~~~~~~~~~^~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1498:18: error: too few arguments to function 'drm_gem_lru_scan'
    1498 |         freed += drm_gem_lru_scan(&ptdev->reclaim.unused,
         |                  ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:615:1: note: declared here
     615 | drm_gem_lru_scan(struct drm_device *dev,
         | ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1504:35: error: passing argument 1 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1504 |         freed += drm_gem_lru_scan(&ptdev->reclaim.mmapped,
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct drm_gem_lru *
   include/drm/drm_gem.h:615:37: note: expected 'struct drm_device *' but argument is of type 'struct drm_gem_lru *'
     615 | drm_gem_lru_scan(struct drm_device *dev,
         |                  ~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/panthor/panthor_gem.c:1505:50: warning: passing argument 2 of 'drm_gem_lru_scan' makes pointer from integer without a cast [-Wint-conversion]
    1505 |                                   sc->nr_to_scan - freed, &remaining,
         |                                   ~~~~~~~~~~~~~~~^~~~~~~
         |                                                  |
         |                                                  long unsigned int
   include/drm/drm_gem.h:616:38: note: expected 'struct drm_gem_lru *' but argument is of type 'long unsigned int'
     616 |                  struct drm_gem_lru *lru,
         |                  ~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/panthor/panthor_gem.c:1505:59: warning: passing argument 3 of 'drm_gem_lru_scan' makes integer from pointer without a cast [-Wint-conversion]
    1505 |                                   sc->nr_to_scan - freed, &remaining,
         |                                                           ^~~~~~~~~~
         |                                                           |
         |                                                           long unsigned int *
   include/drm/drm_gem.h:617:31: note: expected 'unsigned int' but argument is of type 'long unsigned int *'
     617 |                  unsigned int nr_to_scan,
         |                  ~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1506:35: error: passing argument 4 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1506 |                                   panthor_gem_try_evict_no_resv_wait, NULL);
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *) {aka _Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)}
   include/drm/drm_gem.h:618:33: note: expected 'long unsigned int *' but argument is of type 'bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)' {aka '_Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)'}
     618 |                  unsigned long *remaining,
         |                  ~~~~~~~~~~~~~~~^~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1504:18: error: too few arguments to function 'drm_gem_lru_scan'
    1504 |         freed += drm_gem_lru_scan(&ptdev->reclaim.mmapped,
         |                  ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:615:1: note: declared here
     615 | drm_gem_lru_scan(struct drm_device *dev,
         | ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1518:35: error: passing argument 1 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1518 |         freed += drm_gem_lru_scan(&ptdev->reclaim.gpu_mapped_shared,
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct drm_gem_lru *
   include/drm/drm_gem.h:615:37: note: expected 'struct drm_device *' but argument is of type 'struct drm_gem_lru *'
     615 | drm_gem_lru_scan(struct drm_device *dev,
         |                  ~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/panthor/panthor_gem.c:1519:50: warning: passing argument 2 of 'drm_gem_lru_scan' makes pointer from integer without a cast [-Wint-conversion]
    1519 |                                   sc->nr_to_scan - freed, &remaining,
         |                                   ~~~~~~~~~~~~~~~^~~~~~~
         |                                                  |
         |                                                  long unsigned int
   include/drm/drm_gem.h:616:38: note: expected 'struct drm_gem_lru *' but argument is of type 'long unsigned int'
     616 |                  struct drm_gem_lru *lru,
         |                  ~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/panthor/panthor_gem.c:1519:59: warning: passing argument 3 of 'drm_gem_lru_scan' makes integer from pointer without a cast [-Wint-conversion]
    1519 |                                   sc->nr_to_scan - freed, &remaining,
         |                                                           ^~~~~~~~~~
         |                                                           |
         |                                                           long unsigned int *
   include/drm/drm_gem.h:617:31: note: expected 'unsigned int' but argument is of type 'long unsigned int *'
     617 |                  unsigned int nr_to_scan,
         |                  ~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1520:35: error: passing argument 4 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1520 |                                   panthor_gem_try_evict, NULL);
         |                                   ^~~~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *) {aka _Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)}
   include/drm/drm_gem.h:618:33: note: expected 'long unsigned int *' but argument is of type 'bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)' {aka '_Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)'}
     618 |                  unsigned long *remaining,
         |                  ~~~~~~~~~~~~~~~^~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c:1518:18: error: too few arguments to function 'drm_gem_lru_scan'
    1518 |         freed += drm_gem_lru_scan(&ptdev->reclaim.gpu_mapped_shared,
         |                  ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:615:1: note: declared here
     615 | drm_gem_lru_scan(struct drm_device *dev,
         | ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_gem.c: In function 'panthor_gem_shrinker_init':
   drivers/gpu/drm/panthor/panthor_gem.c:1554:9: error: too many arguments to function 'drm_gem_lru_init'
    1554 |         drm_gem_lru_init(&ptdev->reclaim.unused, &ptdev->reclaim.lock);
--
   drivers/gpu/drm/panthor/panthor_mmu.c: In function 'panthor_vm_create':
   drivers/gpu/drm/panthor/panthor_mmu.c:2777:9: error: too many arguments to function 'drm_gem_lru_init'
    2777 |         drm_gem_lru_init(&vm->reclaim.lru, &ptdev->reclaim.lock);
         |         ^~~~~~~~~~~~~~~~
   In file included from include/drm/drm_gpuvm.h:35,
                    from include/drm/drm_debugfs.h:38,
                    from drivers/gpu/drm/panthor/panthor_mmu.c:6:
   include/drm/drm_gem.h:610:6: note: declared here
     610 | void drm_gem_lru_init(struct drm_gem_lru *lru);
         |      ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_mmu.c: In function 'panthor_mmu_reclaim_priv_bos':
   drivers/gpu/drm/panthor/panthor_mmu.c:3161:43: error: passing argument 1 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3161 |                 freed += drm_gem_lru_scan(&vm->reclaim.lru, nr_to_scan - freed,
         |                                           ^~~~~~~~~~~~~~~~
         |                                           |
         |                                           struct drm_gem_lru *
   include/drm/drm_gem.h:615:37: note: expected 'struct drm_device *' but argument is of type 'struct drm_gem_lru *'
     615 | drm_gem_lru_scan(struct drm_device *dev,
         |                  ~~~~~~~~~~~~~~~~~~~^~~
>> drivers/gpu/drm/panthor/panthor_mmu.c:3161:72: warning: passing argument 2 of 'drm_gem_lru_scan' makes pointer from integer without a cast [-Wint-conversion]
    3161 |                 freed += drm_gem_lru_scan(&vm->reclaim.lru, nr_to_scan - freed,
         |                                                             ~~~~~~~~~~~^~~~~~~
         |                                                                        |
         |                                                                        long unsigned int
   include/drm/drm_gem.h:616:38: note: expected 'struct drm_gem_lru *' but argument is of type 'long unsigned int'
     616 |                  struct drm_gem_lru *lru,
         |                  ~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/gpu/drm/panthor/panthor_mmu.c:3162:43: warning: passing argument 3 of 'drm_gem_lru_scan' makes integer from pointer without a cast [-Wint-conversion]
    3162 |                                           remaining, shrink, NULL);
         |                                           ^~~~~~~~~
         |                                           |
         |                                           long unsigned int *
   include/drm/drm_gem.h:617:31: note: expected 'unsigned int' but argument is of type 'long unsigned int *'
     617 |                  unsigned int nr_to_scan,
         |                  ~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/panthor/panthor_mmu.c:3162:54: error: passing argument 4 of 'drm_gem_lru_scan' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3162 |                                           remaining, shrink, NULL);
         |                                                      ^~~~~~
         |                                                      |
         |                                                      bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *) {aka _Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)}
   include/drm/drm_gem.h:618:33: note: expected 'long unsigned int *' but argument is of type 'bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)' {aka '_Bool (*)(struct drm_gem_object *, struct ww_acquire_ctx *)'}
     618 |                  unsigned long *remaining,
         |                  ~~~~~~~~~~~~~~~^~~~~~~~~
   drivers/gpu/drm/panthor/panthor_mmu.c:3161:26: error: too few arguments to function 'drm_gem_lru_scan'
    3161 |                 freed += drm_gem_lru_scan(&vm->reclaim.lru, nr_to_scan - freed,
         |                          ^~~~~~~~~~~~~~~~
   include/drm/drm_gem.h:615:1: note: declared here
     615 | drm_gem_lru_scan(struct drm_device *dev,
         | ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/drm_gem_lru_scan +1499 drivers/gpu/drm/panthor/panthor_gem.c

e06177ec7a3639 Boris Brezillon 2025-12-08  1487  
fb42964e2a76f6 Akash Goel      2026-04-01  1488  static unsigned long
fb42964e2a76f6 Akash Goel      2026-04-01  1489  panthor_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
fb42964e2a76f6 Akash Goel      2026-04-01  1490  {
fb42964e2a76f6 Akash Goel      2026-04-01  1491  	struct panthor_device *ptdev = shrinker->private_data;
fb42964e2a76f6 Akash Goel      2026-04-01  1492  	unsigned long remaining = 0;
fb42964e2a76f6 Akash Goel      2026-04-01  1493  	unsigned long freed = 0;
fb42964e2a76f6 Akash Goel      2026-04-01  1494  
fb42964e2a76f6 Akash Goel      2026-04-01  1495  	if (!can_swap())
fb42964e2a76f6 Akash Goel      2026-04-01  1496  		goto out;
fb42964e2a76f6 Akash Goel      2026-04-01  1497  
fb42964e2a76f6 Akash Goel      2026-04-01  1498  	freed += drm_gem_lru_scan(&ptdev->reclaim.unused,
fb42964e2a76f6 Akash Goel      2026-04-01 @1499  				  sc->nr_to_scan - freed, &remaining,
fb42964e2a76f6 Akash Goel      2026-04-01  1500  				  panthor_gem_try_evict_no_resv_wait, NULL);
fb42964e2a76f6 Akash Goel      2026-04-01  1501  	if (freed >= sc->nr_to_scan)
fb42964e2a76f6 Akash Goel      2026-04-01  1502  		goto out;
fb42964e2a76f6 Akash Goel      2026-04-01  1503  
fb42964e2a76f6 Akash Goel      2026-04-01  1504  	freed += drm_gem_lru_scan(&ptdev->reclaim.mmapped,
fb42964e2a76f6 Akash Goel      2026-04-01  1505  				  sc->nr_to_scan - freed, &remaining,
fb42964e2a76f6 Akash Goel      2026-04-01  1506  				  panthor_gem_try_evict_no_resv_wait, NULL);
fb42964e2a76f6 Akash Goel      2026-04-01  1507  	if (freed >= sc->nr_to_scan)
fb42964e2a76f6 Akash Goel      2026-04-01  1508  		goto out;
fb42964e2a76f6 Akash Goel      2026-04-01  1509  
fb42964e2a76f6 Akash Goel      2026-04-01  1510  	if (!can_block(sc))
fb42964e2a76f6 Akash Goel      2026-04-01  1511  		goto out;
fb42964e2a76f6 Akash Goel      2026-04-01  1512  
fb42964e2a76f6 Akash Goel      2026-04-01  1513  	freed += panthor_mmu_reclaim_priv_bos(ptdev, sc->nr_to_scan - freed,
fb42964e2a76f6 Akash Goel      2026-04-01  1514  					      &remaining, panthor_gem_try_evict);
fb42964e2a76f6 Akash Goel      2026-04-01  1515  	if (freed >= sc->nr_to_scan)
fb42964e2a76f6 Akash Goel      2026-04-01  1516  		goto out;
fb42964e2a76f6 Akash Goel      2026-04-01  1517  
fb42964e2a76f6 Akash Goel      2026-04-01  1518  	freed += drm_gem_lru_scan(&ptdev->reclaim.gpu_mapped_shared,
fb42964e2a76f6 Akash Goel      2026-04-01  1519  				  sc->nr_to_scan - freed, &remaining,
fb42964e2a76f6 Akash Goel      2026-04-01  1520  				  panthor_gem_try_evict, NULL);
fb42964e2a76f6 Akash Goel      2026-04-01  1521  
fb42964e2a76f6 Akash Goel      2026-04-01  1522  out:
fb42964e2a76f6 Akash Goel      2026-04-01  1523  #ifdef CONFIG_DEBUG_FS
fb42964e2a76f6 Akash Goel      2026-04-01  1524  	/* This is racy, but that's okay, because this is just debugfs
fb42964e2a76f6 Akash Goel      2026-04-01  1525  	 * reporting and doesn't need to be accurate.
fb42964e2a76f6 Akash Goel      2026-04-01  1526  	 */
fb42964e2a76f6 Akash Goel      2026-04-01  1527  	ptdev->reclaim.nr_pages_reclaimed_on_last_scan = freed;
fb42964e2a76f6 Akash Goel      2026-04-01  1528  #endif
fb42964e2a76f6 Akash Goel      2026-04-01  1529  
fb42964e2a76f6 Akash Goel      2026-04-01  1530  	/* If there are things to reclaim, try a couple times before giving up. */
fb42964e2a76f6 Akash Goel      2026-04-01  1531  	if (!freed && remaining > 0 &&
fb42964e2a76f6 Akash Goel      2026-04-01  1532  	    atomic_inc_return(&ptdev->reclaim.retry_count) < 2)
fb42964e2a76f6 Akash Goel      2026-04-01  1533  		return 0;
fb42964e2a76f6 Akash Goel      2026-04-01  1534  
fb42964e2a76f6 Akash Goel      2026-04-01  1535  	atomic_set(&ptdev->reclaim.retry_count, 0);
fb42964e2a76f6 Akash Goel      2026-04-01  1536  
fb42964e2a76f6 Akash Goel      2026-04-01  1537  	if (freed)
fb42964e2a76f6 Akash Goel      2026-04-01  1538  		return freed;
fb42964e2a76f6 Akash Goel      2026-04-01  1539  
fb42964e2a76f6 Akash Goel      2026-04-01  1540  	/* There's nothing left to reclaim, or the resources are contended. Give up now. */
fb42964e2a76f6 Akash Goel      2026-04-01  1541  	return SHRINK_STOP;
fb42964e2a76f6 Akash Goel      2026-04-01  1542  }
fb42964e2a76f6 Akash Goel      2026-04-01  1543  

:::::: The code at line 1499 was first introduced by commit
:::::: fb42964e2a76f68a5fb581d382b5d2be2d5bda9b drm/panthor: Add a GEM shrinker

:::::: TO: Akash Goel <[email protected]>
:::::: CC: Boris Brezillon <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.