From: kernel test robot <lkp@intel.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, netdev@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
virtualization@lists.linux-foundation.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp()
Date: Thu, 23 Mar 2023 07:43:23 +0800 [thread overview]
Message-ID: <202303230720.XUavHilr-lkp@intel.com> (raw)
In-Reply-To: <20230322030308.16046-8-xuanzhuo@linux.alibaba.com>
Hi Xuan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Xuan-Zhuo/virtio_net-mergeable-xdp-put-old-page-immediately/20230322-110445
patch link: https://lore.kernel.org/r/20230322030308.16046-8-xuanzhuo%40linux.alibaba.com
patch subject: [PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp()
config: i386-randconfig-a002 (https://download.01.org/0day-ci/archive/20230323/202303230720.XUavHilr-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/c00edb888e239eb9eb468c0e93419f373f5e72a7
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Xuan-Zhuo/virtio_net-mergeable-xdp-put-old-page-immediately/20230322-110445
git checkout c00edb888e239eb9eb468c0e93419f373f5e72a7
# 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=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303230720.XUavHilr-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/virtio_net.c:1399:6: warning: variable 'page' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (unlikely(len > truesize - room)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/virtio_net.c:1490:11: note: uninitialized use occurs here
put_page(page);
^~~~
drivers/net/virtio_net.c:1399:2: note: remove the 'if' if its condition is always false
if (unlikely(len > truesize - room)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/virtio_net.c:1392:19: note: initialize the variable 'page' to silence this warning
struct page *page;
^
= NULL
>> drivers/net/virtio_net.c:1399:6: warning: variable 'num_buf' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (unlikely(len > truesize - room)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/virtio_net.c:1491:25: note: uninitialized use occurs here
mergeable_buf_free(rq, num_buf, dev, stats);
^~~~~~~
drivers/net/virtio_net.c:1399:2: note: remove the 'if' if its condition is always false
if (unlikely(len > truesize - room)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/virtio_net.c:1393:13: note: initialize the variable 'num_buf' to silence this warning
int num_buf;
^
= 0
2 warnings generated.
vim +1399 drivers/net/virtio_net.c
1375
1376 static struct sk_buff *receive_mergeable(struct net_device *dev,
1377 struct virtnet_info *vi,
1378 struct receive_queue *rq,
1379 void *buf,
1380 void *ctx,
1381 unsigned int len,
1382 unsigned int *xdp_xmit,
1383 struct virtnet_rq_stats *stats)
1384 {
1385 unsigned int truesize = mergeable_ctx_to_truesize(ctx);
1386 unsigned int headroom = mergeable_ctx_to_headroom(ctx);
1387 unsigned int tailroom = headroom ? sizeof(struct skb_shared_info) : 0;
1388 unsigned int room = SKB_DATA_ALIGN(headroom + tailroom);
1389 struct virtio_net_hdr_mrg_rxbuf *hdr;
1390 struct sk_buff *head_skb, *curr_skb;
1391 struct bpf_prog *xdp_prog;
1392 struct page *page;
1393 int num_buf;
1394 int offset;
1395
1396 head_skb = NULL;
1397 stats->bytes += len - vi->hdr_len;
1398
> 1399 if (unlikely(len > truesize - room)) {
1400 pr_debug("%s: rx error: len %u exceeds truesize %lu\n",
1401 dev->name, len, (unsigned long)(truesize - room));
1402 dev->stats.rx_length_errors++;
1403 goto err_skb;
1404 }
1405
1406 if (likely(vi->xdp_enabled)) {
1407 rcu_read_lock();
1408 xdp_prog = rcu_dereference(rq->xdp_prog);
1409 if (xdp_prog) {
1410 head_skb = receive_mergeable_xdp(dev, vi, rq, xdp_prog,
1411 buf, ctx, len, xdp_xmit,
1412 stats);
1413 rcu_read_unlock();
1414 return head_skb;
1415 }
1416 rcu_read_unlock();
1417 }
1418
1419 hdr = buf;
1420 num_buf = virtio16_to_cpu(vi->vdev, hdr->num_buffers);
1421 page = virt_to_head_page(buf);
1422 offset = buf - page_address(page);
1423
1424 head_skb = page_to_skb(vi, rq, page, offset, len, truesize, headroom);
1425 curr_skb = head_skb;
1426
1427 if (unlikely(!curr_skb))
1428 goto err_skb;
1429 while (--num_buf) {
1430 int num_skb_frags;
1431
1432 buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx);
1433 if (unlikely(!buf)) {
1434 pr_debug("%s: rx error: %d buffers out of %d missing\n",
1435 dev->name, num_buf,
1436 virtio16_to_cpu(vi->vdev,
1437 hdr->num_buffers));
1438 dev->stats.rx_length_errors++;
1439 goto err_buf;
1440 }
1441
1442 stats->bytes += len;
1443 page = virt_to_head_page(buf);
1444
1445 truesize = mergeable_ctx_to_truesize(ctx);
1446 headroom = mergeable_ctx_to_headroom(ctx);
1447 tailroom = headroom ? sizeof(struct skb_shared_info) : 0;
1448 room = SKB_DATA_ALIGN(headroom + tailroom);
1449 if (unlikely(len > truesize - room)) {
1450 pr_debug("%s: rx error: len %u exceeds truesize %lu\n",
1451 dev->name, len, (unsigned long)(truesize - room));
1452 dev->stats.rx_length_errors++;
1453 goto err_skb;
1454 }
1455
1456 num_skb_frags = skb_shinfo(curr_skb)->nr_frags;
1457 if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) {
1458 struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC);
1459
1460 if (unlikely(!nskb))
1461 goto err_skb;
1462 if (curr_skb == head_skb)
1463 skb_shinfo(curr_skb)->frag_list = nskb;
1464 else
1465 curr_skb->next = nskb;
1466 curr_skb = nskb;
1467 head_skb->truesize += nskb->truesize;
1468 num_skb_frags = 0;
1469 }
1470 if (curr_skb != head_skb) {
1471 head_skb->data_len += len;
1472 head_skb->len += len;
1473 head_skb->truesize += truesize;
1474 }
1475 offset = buf - page_address(page);
1476 if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) {
1477 put_page(page);
1478 skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1,
1479 len, truesize);
1480 } else {
1481 skb_add_rx_frag(curr_skb, num_skb_frags, page,
1482 offset, len, truesize);
1483 }
1484 }
1485
1486 ewma_pkt_len_add(&rq->mrg_avg_pkt_len, head_skb->len);
1487 return head_skb;
1488
1489 err_skb:
1490 put_page(page);
1491 mergeable_buf_free(rq, num_buf, dev, stats);
1492
1493 err_buf:
1494 stats->drops++;
1495 dev_kfree_skb(head_skb);
1496 return NULL;
1497 }
1498
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next prev parent reply other threads:[~2023-03-22 23:45 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 3:03 [PATCH net-next 0/8] virtio_net: refactor xdp codes Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 1/8] virtio_net: mergeable xdp: put old page immediately Xuan Zhuo
2023-03-22 8:22 ` Yunsheng Lin
2023-03-23 1:36 ` Xuan Zhuo
2023-03-23 3:38 ` Yunsheng Lin
2023-03-23 3:45 ` Xuan Zhuo
2023-03-23 5:38 ` Jason Wang
2023-03-23 5:58 ` Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 2/8] virtio_net: mergeable xdp: introduce mergeable_xdp_prepare Xuan Zhuo
2023-03-22 11:52 ` Yunsheng Lin
2023-03-23 1:45 ` Xuan Zhuo
2023-03-23 4:45 ` Yunsheng Lin
2023-03-23 4:52 ` Jakub Kicinski
2023-03-23 5:40 ` Jason Wang
2023-03-23 7:24 ` Yunsheng Lin
2023-03-23 11:04 ` Xuan Zhuo
2023-03-23 10:59 ` Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 4/8] virtio_net: separate the logic of freeing xdp shinfo Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 5/8] virtio_net: separate the logic of freeing the rest mergeable buf Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 6/8] virtio_net: auto release xdp shinfo Xuan Zhuo
2023-03-22 3:03 ` [PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp() Xuan Zhuo
2023-03-22 23:43 ` kernel test robot [this message]
2023-03-22 3:03 ` [PATCH net-next 8/8] virtio_net: introduce receive_small_xdp() Xuan Zhuo
2023-03-23 2:06 ` kernel test robot
2023-03-22 3:34 ` [PATCH net-next 0/8] virtio_net: refactor xdp codes Michael S. Tsirkin
2023-03-22 3:40 ` Xuan Zhuo
2023-03-22 3:53 ` Michael S. Tsirkin
2023-03-22 3:56 ` Xuan Zhuo
2023-03-22 3:59 ` Jakub Kicinski
-- strict thread matches above, loose matches on Subject: below --
2023-03-28 12:04 Xuan Zhuo
2023-03-28 12:04 ` [PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp() Xuan Zhuo
2023-03-30 10:18 ` Paolo Abeni
2023-03-31 7:18 ` Xuan Zhuo
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=202303230720.XUavHilr-lkp@intel.com \
--to=lkp@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xuanzhuo@linux.alibaba.com \
/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;
as well as URLs for NNTP newsgroup(s).