Re: [PATCH net-next v3 16/27] virtio_net: xsk: tx: support xmit xsk buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Xuan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mst-vhost/linux-next]
[cannot apply to net-next/main linus/master horms-ipvs/master v6.7-rc7 next-20231222]
[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/Xuan-Zhuo/virtio_net-rename-free_old_xmit_skbs-to-free_old_xmit/20231229-155253
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:    https://lore.kernel.org/r/20231229073108.57778-17-xuanzhuo%40linux.alibaba.com
patch subject: [PATCH net-next v3 16/27] virtio_net: xsk: tx: support xmit xsk buffer
config: x86_64-randconfig-004-20231229 (https://download.01.org/0day-ci/archive/20231230/202312300834.bOCLH0Mi-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231230/202312300834.bOCLH0Mi-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/202312300834.bOCLH0Mi-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In function 'virtnet_xsk_xmit_one',
       inlined from 'virtnet_xsk_xmit_batch' at drivers/net/virtio/xsk.c:58:9,
       inlined from 'virtnet_xsk_xmit' at drivers/net/virtio/xsk.c:80:9:
>> drivers/net/virtio/xsk.c:34:16: warning: 'virtqueue_add_outbuf' accessing 32 bytes in a region of size 8 [-Wstringop-overflow=]
      34 |         return virtqueue_add_outbuf(sq->vq, sq->sg, 2,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      35 |                                     virtnet_xsk_to_ptr(desc->len), GFP_ATOMIC);
         |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/virtio/xsk.c:34:16: note: referencing argument 2 of type 'struct scatterlist[0]'
   In file included from include/linux/virtio_config.h:7,
                    from include/uapi/linux/virtio_net.h:30,
                    from include/linux/virtio_net.h:8,
                    from drivers/net/virtio/virtio_net.h:8,
                    from drivers/net/virtio/xsk.c:6:
   include/linux/virtio.h: In function 'virtnet_xsk_xmit':
   include/linux/virtio.h:42:5: note: in a call to function 'virtqueue_add_outbuf'
      42 | int virtqueue_add_outbuf(struct virtqueue *vq,
         |     ^~~~~~~~~~~~~~~~~~~~


vim +/virtqueue_add_outbuf +34 drivers/net/virtio/xsk.c

    16	
    17	static int virtnet_xsk_xmit_one(struct virtnet_sq *sq,
    18					struct xsk_buff_pool *pool,
    19					struct xdp_desc *desc)
    20	{
    21		struct virtnet_info *vi;
    22		dma_addr_t addr;
    23	
    24		vi = sq->vq->vdev->priv;
    25	
    26		addr = xsk_buff_raw_get_dma(pool, desc->addr);
    27		xsk_buff_raw_dma_sync_for_device(pool, addr, desc->len);
    28	
    29		sg_init_table(sq->sg, 2);
    30	
    31		sg_fill_dma(sq->sg, sq->xsk.hdr_dma_address, vi->hdr_len);
    32		sg_fill_dma(sq->sg + 1, addr, desc->len);
    33	
  > 34		return virtqueue_add_outbuf(sq->vq, sq->sg, 2,
    35					    virtnet_xsk_to_ptr(desc->len), GFP_ATOMIC);
    36	}
    37	
    38	static int virtnet_xsk_xmit_batch(struct virtnet_sq *sq,
    39					  struct xsk_buff_pool *pool,
    40					  unsigned int budget,
    41					  u64 *kicks)
    42	{
    43		struct xdp_desc *descs = pool->tx_descs;
    44		u32 nb_pkts, max_pkts, i;
    45		bool kick = false;
    46		int err;
    47	
    48		/* Every xsk tx packet needs two desc(virtnet header and packet). So we
    49		 * use sq->vq->num_free / 2 as the limitation.
    50		 */
    51		max_pkts = min_t(u32, budget, sq->vq->num_free / 2);
    52	
    53		nb_pkts = xsk_tx_peek_release_desc_batch(pool, max_pkts);
    54		if (!nb_pkts)
    55			return 0;
    56	
    57		for (i = 0; i < nb_pkts; i++) {
  > 58			err = virtnet_xsk_xmit_one(sq, pool, &descs[i]);
    59			if (unlikely(err))
    60				break;
    61	
    62			kick = true;
    63		}
    64	
    65		if (kick && virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq))
    66			(*kicks)++;
    67	
    68		return i;
    69	}
    70	

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




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux