public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Jon Kohler" <jon@nutanix.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	kvm@vger.kernel.org, virtualization@lists.linux.dev,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	netdev@vger.kernel.org, Jon Kohler <jon@nutanix.com>
Subject: Re: [PATCH net-next] vhost/net: align variable names with XDP terminology
Date: Thu, 8 May 2025 20:00:06 +0800	[thread overview]
Message-ID: <202505081920.FOOj1Z0e-lkp@intel.com> (raw)
In-Reply-To: <20250507160206.3267692-1-jon@nutanix.com>

Hi Jon,

kernel test robot noticed the following build warnings:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Jon-Kohler/vhost-net-align-variable-names-with-XDP-terminology/20250507-233429
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250507160206.3267692-1-jon%40nutanix.com
patch subject: [PATCH net-next] vhost/net: align variable names with XDP terminology
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20250508/202505081920.FOOj1Z0e-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505081920.FOOj1Z0e-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505081920.FOOj1Z0e-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   3 warnings generated.


vim +681 drivers/vhost/net.c

   661	
   662	static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
   663				       struct iov_iter *from)
   664	{
   665		struct vhost_virtqueue *vq = &nvq->vq;
   666		struct vhost_net *net = container_of(vq->dev, struct vhost_net,
   667						     dev);
   668		int copied, headroom, ret, sock_hlen = nvq->sock_hlen;
   669		struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp];
   670		struct socket *sock = vhost_vq_get_backend(vq);
   671		size_t data_len = iov_iter_count(from);
   672		struct virtio_net_hdr *gso;
   673		struct tun_xdp_hdr *hdr;
   674		void *hard_start;
   675		u32 frame_sz;
   676	
   677		if (unlikely(data_len < sock_hlen))
   678			return -EFAULT;
   679	
   680		headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
 > 681					  vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
   682	
   683		frame_sz = SKB_HEAD_ALIGN(headroom + data_len);
   684	
   685		if (frame_sz > PAGE_SIZE)
   686			return -ENOSPC;
   687	
   688		hard_start = page_frag_alloc_align(&net->pf_cache, frame_sz,
   689						   GFP_KERNEL, SMP_CACHE_BYTES);
   690		if (unlikely(!hard_start))
   691			return -ENOMEM;
   692	
   693		copied = copy_from_iter(hard_start + offsetof(struct tun_xdp_hdr, gso),
   694					sock_hlen, from);
   695		if (copied != sock_hlen) {
   696			ret = -EFAULT;
   697			goto err;
   698		}
   699	
   700		hdr = hard_start;
   701		gso = &hdr->gso;
   702	
   703		if (!sock_hlen)
   704			memset(hard_start, 0, headroom);
   705	
   706		if ((gso->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
   707		    vhost16_to_cpu(vq, gso->csum_start) +
   708		    vhost16_to_cpu(vq, gso->csum_offset) + 2 >
   709		    vhost16_to_cpu(vq, gso->hdr_len)) {
   710			gso->hdr_len = cpu_to_vhost16(vq,
   711				       vhost16_to_cpu(vq, gso->csum_start) +
   712				       vhost16_to_cpu(vq, gso->csum_offset) + 2);
   713	
   714			if (vhost16_to_cpu(vq, gso->hdr_len) > data_len) {
   715				ret = -EINVAL;
   716				goto err;
   717			}
   718		}
   719	
   720		data_len -= sock_hlen;
   721		copied = copy_from_iter(hard_start + headroom, data_len, from);
   722		if (copied != data_len) {
   723			ret = -EFAULT;
   724			goto err;
   725		}
   726	
   727		xdp_init_buff(xdp, frame_sz, NULL);
   728		xdp_prepare_buff(xdp, hard_start, headroom, data_len, true);
   729		hdr->buflen = frame_sz;
   730	
   731		++nvq->batched_xdp;
   732	
   733		return 0;
   734	
   735	err:
   736		page_frag_free(hard_start);
   737		return ret;
   738	}
   739	

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

      parent reply	other threads:[~2025-05-08 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 16:02 [PATCH net-next] vhost/net: align variable names with XDP terminology Jon Kohler
2025-05-07 17:23 ` Willem de Bruijn
2025-05-07 17:31   ` Jon Kohler
2025-05-08 13:42     ` Willem de Bruijn
2025-05-08 13:45       ` Jon Kohler
2025-05-08 12:00 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505081920.FOOj1Z0e-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eperezma@redhat.com \
    --cc=hawk@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=jon@nutanix.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox