Subject: Re: [PATCH net-next] xsk: support use vaddr as ring

From: kernel test robot <[email-masked]>
Date: Thu, 9 Feb 2023 19:06:13 +0800

Hi Xuan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Xuan-Zhuo/xsk-support-use-vaddr-as-ring/20230209-172553
patch link:    https://lore.kernel.org/r/20230209092436.87795-1-xuanzhuo%40linux.alibaba.com
patch subject: [PATCH net-next] xsk: support use vaddr as ring
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230209/[email-masked]/config)
compiler: mips-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/4a7734a008a4c9739f0abcc596455e4b76b601ec
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Xuan-Zhuo/xsk-support-use-vaddr-as-ring/20230209-172553
        git checkout 4a7734a008a4c9739f0abcc596455e4b76b601ec
        # 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=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email-masked]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email-masked]

All warnings (new ones prefixed by >>):

   net/xdp/xsk_queue.c: In function 'xskq_create':
   net/xdp/xsk_queue.c:46:19: error: implicit declaration of function 'vmalloc_user' [-Werror=implicit-function-declaration]
      46 |         q->ring = vmalloc_user(size);
         |                   ^~~~~~~~~~~~
>> net/xdp/xsk_queue.c:46:17: warning: assignment to 'struct xdp_ring *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      46 |         q->ring = vmalloc_user(size);
         |                 ^
   net/xdp/xsk_queue.c: In function 'xskq_destroy':
   net/xdp/xsk_queue.c:60:17: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
      60 |                 vfree(q->ring);
         |                 ^~~~~
         |                 kvfree
   cc1: some warnings being treated as errors

vim +46 net/xdp/xsk_queue.c

    22	
    23	struct xsk_queue *xskq_create(u32 nentries, bool umem_queue)
    24	{
    25		struct xsk_queue *q;
    26		gfp_t gfp_flags;
    27		size_t size;
    28	
    29		q = kzalloc(sizeof(*q), GFP_KERNEL);
    30		if (!q)
    31			return NULL;
    32	
    33		q->nentries = nentries;
    34		q->ring_mask = nentries - 1;
    35	
    36		gfp_flags = GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN |
    37			    __GFP_COMP  | __GFP_NORETRY;
    38		size = xskq_get_ring_size(q, umem_queue);
    39	
    40		q->ring_size = size;
    41		q->ring = (struct xdp_ring *)__get_free_pages(gfp_flags,
    42							      get_order(size));
    43		if (q->ring)
    44			return q;
    45	
  > 46		q->ring = vmalloc_user(size);
    47		if (q->ring)
    48			return q;
    49	
    50		kfree(q);
    51		return NULL;
    52	}
    53	

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