All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, bpf@vger.kernel.org, hawk@kernel.org,
	toke@redhat.com
Subject: Re: [PATCH net-next] xdp: add multi-buff support for xdp running in generic mode
Date: Tue, 28 Nov 2023 15:10:28 -0800	[thread overview]
Message-ID: <20231128151028.168e7a13@kernel.org> (raw)
In-Reply-To: <ZWZpUaYbgMELGtL8@lore-desk>

On Tue, 28 Nov 2023 23:27:29 +0100 Lorenzo Bianconi wrote:
> > Yes, don't we allow writes to fragments in XDP based on the assumption
> > that it runs on Rx so that paged data must not be zero copy?
> > bpf_xdp_store_bytes() doesn't seem to have any checks which would
> > stop it from writing fragments, as far as I can see.  
> 
> do you mean in the skb use-case we could write to fragments (without copying
> them) if the skb is not cloned and the paged area is not 'zero-copied'?

The zero-copy thing is a red herring. If application uses
sendpage/sendfile/splice the frag may be a page cache page
of a file. Or something completely read only.

IIUC you're trying to avoid the copy if the prog is mbuf capable.
So I was saying that can't work for forms of XDP which actually 
deal with skbs. But that wasn't really your question, sorry :)

> With respect to this patch it would mean we can rely on pskb_expand_head() to
> reallocate the skb and to covert it to a xdp_buff and we do not need to explicitly
> reallocate fragments as we currently do for veth in veth_convert_skb_to_xdp_buff() [0].
> Is my understanding correct or am I missing something?

The difference is that pskb_expand_head() will give you a linear skb,
potentially triggering an order 5 allocation. Expensive and likely to
fail under memory pressure.

veth_convert_skb_to_xdp_buff() tries to allocate pages, and keep
the skb fragmented.

  reply	other threads:[~2023-11-28 23:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 23:38 [PATCH net-next] xdp: add multi-buff support for xdp running in generic mode Lorenzo Bianconi
2023-11-28  9:45 ` Toke Høiland-Jørgensen
2023-11-28 12:02   ` Lorenzo Bianconi
2023-11-28 17:29 ` Lorenzo Bianconi
2023-11-28 18:51   ` Jakub Kicinski
2023-11-28 22:27     ` Lorenzo Bianconi
2023-11-28 23:10       ` Jakub Kicinski [this message]
2023-11-29 16:36         ` Lorenzo Bianconi

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=20231128151028.168e7a13@kernel.org \
    --to=kuba@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.