netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>, <bpf@vger.kernel.org>,
	<ast@kernel.org>, <daniel@iogearbox.net>,
	<netdev@vger.kernel.org>, <magnus.karlsson@intel.com>,
	<aleksander.lobakin@intel.com>, <ilias.apalodimas@linaro.org>,
	<toke@redhat.com>, <lorenzo@kernel.org>,
	<syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Octavian Purdila <tavip@google.com>
Subject: Re: [PATCH v4 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff()
Date: Wed, 29 Oct 2025 16:12:18 -0700	[thread overview]
Message-ID: <20251029161218.15aef43e@kernel.org> (raw)
In-Reply-To: <aQH5+ojHJ1V9jfk8@boxer>

On Wed, 29 Oct 2025 12:26:50 +0100 Maciej Fijalkowski wrote:
> > I still think _all_ frags which may end up here are from the per CPU PP
> > since we CoW the skbs. So:  
> 
> Agree!
> 
> > 
> > 	DEBUG_NET_WARN_ON_ONCE(!skb->pp_recycle);
> > 	xdp->rxq->mem.type = MEM_TYPE_PAGE_POOL;  
> 
> This has to be conditional as it is fine to use this helper for
> MEM_TYPE_PAGE_SHARED, plus the mem type has to be updated per packet.
> 
> > ? It is legal to have pp and non-pp frags in a single skb AFAIK.  
> 
> Ok, but not in this case where data origins from CoW path.

Right.

I guess what I'm saying is that right now we have 4 callers:
 - XDP generic
 - veth
 - devmap 
 - cpumap
these all go thru skb_pp_cow_data() if skb has frags.

You're right that in theory someone can call this function
on a private skb they just constructed (IOW they know they 
don't need to CoW). But IIUC (1) such caller doesn't exist
today; (2) why wouldn't that caller run XDP before allocating
the skb..

So my thinking was to keep this simple for now, used fixed
MEM_TYPE_PAGE_POOL. Add that DEBUG_WARN() and in the kdoc
say that we expect the skbs to have gone thru skb_pp_cow_data().

Worry about conditionals when the odd new user appears.

  reply	other threads:[~2025-10-29 23:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 12:13 [PATCH v4 bpf 0/2] xdp: fix page_pool leaks Maciej Fijalkowski
2025-10-27 12:13 ` [PATCH v4 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff() Maciej Fijalkowski
2025-10-27 14:31   ` Toke Høiland-Jørgensen
2025-10-28  8:08   ` Jesper Dangaard Brouer
2025-10-29  1:53     ` Jakub Kicinski
2025-10-29 11:26       ` Maciej Fijalkowski
2025-10-29 23:12         ` Jakub Kicinski [this message]
2025-10-27 12:13 ` [PATCH v4 bpf 2/2] veth: update mem type in xdp_buff Maciej Fijalkowski
2025-10-27 14:31   ` Toke Høiland-Jørgensen

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=20251029161218.15aef43e@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hawk@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lorenzo@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com \
    --cc=tavip@google.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 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).