net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Wed Nov 15 2023 - 14:13:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
commit: ff4e538c8c3e675a15e1e49509c55951832e0451 page_pool: add a lockdep check for recycling in hardirq
date: 3 months ago
config: loongarch-randconfig-r133-20231107 (https://download.01.org/0day-ci/archive/20231116/202311160339.DbhaH8LX-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231116/202311160339.DbhaH8LX-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/202311160339.DbhaH8LX-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got unsigned int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *
>> net/core/page_pool.c:590:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
net/core/page_pool.c:590:9: sparse: expected void *ptr
net/core/page_pool.c:590:9: sparse: got int [noderef] __percpu *

vim +590 net/core/page_pool.c

579
580 /* If the page refcnt == 1, this will try to recycle the page.
581 * if PP_FLAG_DMA_SYNC_DEV is set, we'll try to sync the DMA area for
582 * the configured size min(dma_sync_size, pool->max_len).
583 * If the page refcnt != 1, then the page will be returned to memory
584 * subsystem.
585 */
586 static __always_inline struct page *
587 __page_pool_put_page(struct page_pool *pool, struct page *page,
588 unsigned int dma_sync_size, bool allow_direct)
589 {
> 590 lockdep_assert_no_hardirq();
591
592 /* This allocator is optimized for the XDP mode that uses
593 * one-frame-per-page, but have fallbacks that act like the
594 * regular page allocator APIs.
595 *
596 * refcnt == 1 means page_pool owns page, and can recycle it.
597 *
598 * page is NOT reusable when allocated when system is under
599 * some pressure. (page_is_pfmemalloc)
600 */
601 if (likely(page_ref_count(page) == 1 && !page_is_pfmemalloc(page))) {
602 /* Read barrier done in page_ref_count / READ_ONCE */
603
604 if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
605 page_pool_dma_sync_for_device(pool, page,
606 dma_sync_size);
607
608 if (allow_direct && in_softirq() &&
609 page_pool_recycle_in_cache(page, pool))
610 return NULL;
611
612 /* Page found as candidate for recycling */
613 return page;
614 }
615 /* Fallback/non-XDP mode: API user have elevated refcnt.
616 *
617 * Many drivers split up the page into fragments, and some
618 * want to keep doing this to save memory and do refcnt based
619 * recycling. Support this use case too, to ease drivers
620 * switching between XDP/non-XDP.
621 *
622 * In-case page_pool maintains the DMA mapping, API user must
623 * call page_pool_put_page once. In this elevated refcnt
624 * case, the DMA is unmapped/released, as driver is likely
625 * doing refcnt based recycle tricks, meaning another process
626 * will be invoking put_page.
627 */
628 recycle_stat_inc(pool, released_refcnt);
629 page_pool_return_page(pool, page);
630
631 return NULL;
632 }
633

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