Subject: Re: [PATCH v2 05/24] page_pool: Start using netmem in allocation path.

From: kernel test robot <[email-masked]>
Date: Fri, 6 Jan 2023 10:34:37 +0800

Hi Matthew,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master net/master net-next/master linus/master v6.2-rc2 next-20230105]
[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/Matthew-Wilcox-Oracle/netmem-Create-new-type/20230106-054852
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20230105214631.3939268-6-willy%40infradead.org
patch subject: [PATCH v2 05/24] page_pool: Start using netmem in allocation path.
config: arm64-randconfig-r033-20230105
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/37522b9f56a9bac5d16428140c925698c26b07d1
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Matthew-Wilcox-Oracle/netmem-Create-new-type/20230106-054852
        git checkout 37522b9f56a9bac5d16428140c925698c26b07d1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   In file included from net/core/page_pool.c:13:
   include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return page_to_pfn(netmem_page(nmem));
                              ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return page_to_nid(netmem_page(nmem));
                              ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return page_to_virt(netmem_page(nmem));
                               ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return page_address(netmem_page(nmem));
                               ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return page_ref_count(netmem_page(nmem));
                                 ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
>> net/core/page_pool.c:309:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           struct page *page = netmem_page(nmem);
                               ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   net/core/page_pool.c:337:25: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
                   pool->p.init_callback(netmem_page(nmem), pool->p.init_arg);
                                         ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   net/core/page_pool.c:368:9: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
           return netmem_page(nmem);
                  ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   net/core/page_pool.c:410:44: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc]
                   pool->alloc.cache[pool->alloc.count++] = netmem_page(nmem);
                                                            ^
   include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page'
           const struct netmem:    (const struct page *)nmem,              \
                 ^
   10 warnings generated.

vim +309 net/core/page_pool.c

   306	
   307	static bool page_pool_dma_map(struct page_pool *pool, struct netmem *nmem)
   308	{
 > 309		struct page *page = netmem_page(nmem);
   310		dma_addr_t dma;
   311	
   312		/* Setup DMA mapping: use 'struct page' area for storing DMA-addr
   313		 * since dma_addr_t can be either 32 or 64 bits and does not always fit
   314		 * into page private data (i.e 32bit cpu with 64bit DMA caps)
   315		 * This mapping is kept for lifetime of page, until leaving pool.
   316		 */
   317		dma = dma_map_page_attrs(pool->p.dev, page, 0,
   318					 (PAGE_SIZE << pool->p.order),
   319					 pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
   320		if (dma_mapping_error(pool->p.dev, dma))
   321			return false;
   322	
   323		page_pool_set_dma_addr(page, dma);
   324	
   325		if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
   326			page_pool_dma_sync_for_device(pool, page, pool->p.max_len);
   327	
   328		return true;
   329	}
   330	

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