All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jakub Kicinski <kuba@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 23:27:29 +0100	[thread overview]
Message-ID: <ZWZpUaYbgMELGtL8@lore-desk> (raw)
In-Reply-To: <20231128105145.7b39db7d@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]

> On Tue, 28 Nov 2023 18:29:20 +0100 Lorenzo Bianconi wrote:
> > @Jakub: iirc we were discussing something similar for veth [0].
> > Here pskb_expand_head() reallocates skb paged data (skb_shinfo()->frags[])
> > just if the skb is cloned and if it is zero-copied [1] while in skb_cow_data()
> > we always reallocate the paged area if skb_shinfo()->nr_frags is set [2].
> > Since the eBPF program can theoretically modify paged data, I would say we
> > should do the same we did for veth even here, right?
> 
> 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'?
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?

Regards,
Lorenzo

[0] https://elixir.bootlin.com/linux/v6.6.2/source/drivers/net/veth.c#L738

> 
> I don't see how we can ever correctly support this form of mbuf for veth
> or generic XDP :(

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-28 22:27 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 [this message]
2023-11-28 23:10       ` Jakub Kicinski
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=ZWZpUaYbgMELGtL8@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --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.