mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Nov 07 2023 - 16:49:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: be3ca57cfb777ad820c6659d52e60bbdd36bf5ff
commit: 7a025e91abd23effe869a05d037b26770ffa0309 mm/vmstat: Use preempt_[dis|en]able_nested()
date: 1 year, 2 months ago
config: loongarch-randconfig-r123-20231107 (https://download.01.org/0day-ci/archive/20231108/202311080409.LlOfTR3m-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231108/202311080409.LlOfTR3m-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/202311080409.LlOfTR3m-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got unsigned int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got unsigned int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got unsigned int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got unsigned int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got int [noderef] __percpu *
>> mm/vmstat.c:358:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:358:9: sparse: expected void *ptr
mm/vmstat.c:358:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:394:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:394:9: sparse: expected void *ptr
mm/vmstat.c:394:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:440:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:440:9: sparse: expected void *ptr
mm/vmstat.c:440:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:463:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:463:9: sparse: expected void *ptr
mm/vmstat.c:463:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got unsigned int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:496:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/vmstat.c:496:9: sparse: expected void *ptr
mm/vmstat.c:496:9: sparse: got int [noderef] __percpu *
mm/vmstat.c:519:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/vmstat.c:519:9: sparse: expected void *ptr

vim +358 mm/vmstat.c

337
338 /*
339 * For use when we know that interrupts are disabled,
340 * or when we know that preemption is disabled and that
341 * particular counter cannot be updated from interrupt context.
342 */
343 void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
344 long delta)
345 {
346 struct per_cpu_zonestat __percpu *pcp = zone->per_cpu_zonestats;
347 s8 __percpu *p = pcp->vm_stat_diff + item;
348 long x;
349 long t;
350
351 /*
352 * Accurate vmstat updates require a RMW. On !PREEMPT_RT kernels,
353 * atomicity is provided by IRQs being disabled -- either explicitly
354 * or via local_lock_irq. On PREEMPT_RT, local_lock_irq only disables
355 * CPU migrations and preemption potentially corrupts a counter so
356 * disable preemption.
357 */
> 358 preempt_disable_nested();
359
360 x = delta + __this_cpu_read(*p);
361
362 t = __this_cpu_read(pcp->stat_threshold);
363
364 if (unlikely(abs(x) > t)) {
365 zone_page_state_add(x, zone, item);
366 x = 0;
367 }
368 __this_cpu_write(*p, x);
369
370 preempt_enable_nested();
371 }
372 EXPORT_SYMBOL(__mod_zone_page_state);
373

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