netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, netdev@vger.kernel.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	virtualization@lists.linux-foundation.org,
	"Corentin Noël" <corentin.noel@collabora.com>
Subject: Re: [PATCH net] virtio-net: fix for skb_over_panic inside big mode
Date: Fri, 4 Jun 2021 10:28:41 +0800	[thread overview]
Message-ID: <231466df-adc1-79a9-6950-77c88e2783c2@redhat.com> (raw)
In-Reply-To: <20210603170901.66504-1-xuanzhuo@linux.alibaba.com>


在 2021/6/4 上午1:09, Xuan Zhuo 写道:
> In virtio-net's large packet mode, there is a hole in the space behind
> buf.


before the buf actually or behind the vnet header?


>
>      hdr_padded_len - hdr_len
>
> We must take this into account when calculating tailroom.
>
> [   44.544385] skb_put.cold (net/core/skbuff.c:5254 (discriminator 1) net/core/skbuff.c:5252 (discriminator 1))
> [   44.544864] page_to_skb (drivers/net/virtio_net.c:485) [   44.545361] receive_buf (drivers/net/virtio_net.c:849 drivers/net/virtio_net.c:1131)
> [   44.545870] ? netif_receive_skb_list_internal (net/core/dev.c:5714)
> [   44.546628] ? dev_gro_receive (net/core/dev.c:6103)
> [   44.547135] ? napi_complete_done (./include/linux/list.h:35 net/core/dev.c:5867 net/core/dev.c:5862 net/core/dev.c:6565)
> [   44.547672] virtnet_poll (drivers/net/virtio_net.c:1427 drivers/net/virtio_net.c:1525)
> [   44.548251] __napi_poll (net/core/dev.c:6985)
> [   44.548744] net_rx_action (net/core/dev.c:7054 net/core/dev.c:7139)
> [   44.549264] __do_softirq (./arch/x86/include/asm/jump_label.h:19 ./include/linux/jump_label.h:200 ./include/trace/events/irq.h:142 kernel/softirq.c:560)
> [   44.549762] irq_exit_rcu (kernel/softirq.c:433 kernel/softirq.c:637 kernel/softirq.c:649)
> [   44.551384] common_interrupt (arch/x86/kernel/irq.c:240 (discriminator 13))
> [   44.551991] ? asm_common_interrupt (./arch/x86/include/asm/idtentry.h:638)
> [   44.552654] asm_common_interrupt (./arch/x86/include/asm/idtentry.h:638)
>
> Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Reported-by: Corentin Noël <corentin.noel@collabora.com>
> Tested-by: Corentin Noël <corentin.noel@collabora.com>
> ---
>   drivers/net/virtio_net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index fa407eb8b457..78a01c71a17c 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -406,7 +406,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
>   	 * add_recvbuf_mergeable() + get_mergeable_buf_len()
>   	 */
>   	truesize = headroom ? PAGE_SIZE : truesize;
> -	tailroom = truesize - len - headroom;
> +	tailroom = truesize - len - headroom - (hdr_padded_len - hdr_len);


The patch looks correct and I saw it has been merged.

But I prefer to do that in receive_big() instead of here.

Thanks



>   	buf = p - headroom;
>   
>   	len -= hdr_len;


  parent reply	other threads:[~2021-06-04  2:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 17:09 [PATCH net] virtio-net: fix for skb_over_panic inside big mode Xuan Zhuo
2021-06-03 22:30 ` patchwork-bot+netdevbpf
2021-06-04  2:28 ` Jason Wang [this message]
     [not found] <1622773823.5042562-1-xuanzhuo@linux.alibaba.com>
2021-06-04  3:00 ` Jason Wang
     [not found] <1622775955.0233824-1-xuanzhuo@linux.alibaba.com>
2021-06-04  6:00 ` Jason Wang
2021-10-09  9:17 Michael S. Tsirkin
2021-10-11  2:04 ` Jason Wang

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=231466df-adc1-79a9-6950-77c88e2783c2@redhat.com \
    --to=jasowang@redhat.com \
    --cc=corentin.noel@collabora.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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).