netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	john.fastabend@gmail.com, brouer@redhat.com
Subject: Re: [PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer
Date: Thu, 1 Mar 2018 09:02:06 +0100	[thread overview]
Message-ID: <20180301090206.04e13a71@redhat.com> (raw)
In-Reply-To: <1519874345-10235-3-git-send-email-jasowang@redhat.com>


On Thu,  1 Mar 2018 11:19:05 +0800 Jason Wang <jasowang@redhat.com> wrote:

> We used to do data copy through xdp_linearize_page() for the buffer
> without sufficient headroom, it brings extra complexity without
> helping for the performance. So this patch remove it and switch to use
> generic XDP routine to handle this case.

I don't like where this is going.  I don't like intermixing the native
XDP and generic XDP in this way, for several reasons:

1. XDP generic is not feature complete, e.g. cpumap will drop these
   packets. It might not be possible to implement some features, think
   of (AF_XDP) zero-copy.

2. This can easily cause out-of-order packets.

3. It makes it harder to troubleshoot, when diagnosing issues
   around #1, we have a hard time determining what path an XDP packet
   took (the xdp tracepoints doesn't know).


[...]
> @@ -590,25 +526,14 @@ static struct sk_buff *receive_small(struct net_device *dev,
>  		if (unlikely(hdr->hdr.gso_type))
>  			goto err_xdp;
>  
> +		/* This happnes when headroom is not enough because
> +		 * the buffer was refilled before XDP is set. This
> +		 * only happen for several packets, for simplicity,
> +		 * offload them to generic XDP routine.

In my practical tests, I also saw that sometime my ping packets were
traveling this code-path, even after a long time when XDP were attached.

This worries me a bit, for troubleshooting purposes... as this can give
a strange user experience given point #1.


> +		 */
>  		if (unlikely(xdp_headroom < virtnet_get_headroom(vi))) {
> -			int offset = buf - page_address(page) + header_offset;
> -			unsigned int tlen = len + vi->hdr_len;
> -			u16 num_buf = 1;


-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2018-03-01  8:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  3:19 [PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer Jason Wang
2018-03-01  3:19 ` [PATCH net-next 1/2] " Jason Wang
2018-03-01  8:41   ` Jesper Dangaard Brouer
2018-03-01  9:11     ` Jason Wang
2018-03-01 13:36   ` Michael S. Tsirkin
2018-03-02  4:20     ` Jason Wang
2018-03-01  3:19 ` [PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer Jason Wang
2018-03-01  8:02   ` Jesper Dangaard Brouer [this message]
2018-03-01  8:49     ` Jason Wang
2018-03-01  9:15       ` Jesper Dangaard Brouer
2018-03-01  9:24         ` Jason Wang
2018-03-01  9:10 ` [PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer Jesper Dangaard Brouer
2018-03-01  9:23   ` Jason Wang
2018-03-01 10:35     ` Jesper Dangaard Brouer
2018-03-01 13:15       ` Jason Wang
2018-03-01 14:16         ` Jesper Dangaard Brouer
2018-03-02  4:17           ` Jason Wang
2018-03-01 13:40       ` Michael S. Tsirkin

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=20180301090206.04e13a71@redhat.com \
    --to=brouer@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).