All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<hawk@kernel.org>, <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 v5 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff()
Date: Fri, 31 Oct 2025 12:37:37 +0100	[thread overview]
Message-ID: <aQSfgQ9+Jc8dkdhg@boxer> (raw)
In-Reply-To: <20251030190511.62575480@kernel.org>

On Thu, Oct 30, 2025 at 07:05:11PM -0700, Jakub Kicinski wrote:
> On Thu, 30 Oct 2025 21:22:34 +0100 Maciej Fijalkowski wrote:
> > > > Why do you say so?
> > > > 
> > > > netif_receive_generic_xdp()
> > > > 	netif_skb_check_for_xdp()
> > > > 	skb_cow_data_for_xdp() failed
> > > > 		go through skb linearize path
> > > > 			returned skb data is backed by kmalloc, not page_pool,
> > > > 			means mem type for this particular xdp_buff has to be
> > > > 			MEM_TYPE_PAGE_SHARED
> > > > 
> > > > Are we on the same page now?  
> > > 
> > > No, I think I already covered this, maybe you disagreed and I missed it.
> > > 
> > > The mem_type set here is expected to be used only for freeing pages. 
> > > XDP can only free fagments (when pkt is trimmed), it cannot free the
> > > head from under the skb. So only fragments matter here, we can ignore
> > > the head.  
> > 
> > ...and given that linearize path would make skb a frag-less one...okay -
> > I'm buying this! :D I have some other thoughts, but I would like to
> > finally close this pandora's box, you probably have similar feelings.
> > 
> > So plain assignment like:
> > xdp->rxq->mem.type = MEM_TYPE_PAGE_POOL;
> 
> Yes, LGTM.
> 
> > would be fine for you? Plus AI reviewer has kicked me in the nuts on veth
> > patch so have to send v6 anyways.
> 
> The veth side unfortunately needs more work than Mr Robot points out.
> For some reason veth tries to turn skb into an xdp_frame..

That is beyond the scope of the fix that I started doing as you're
undermining overall XDP support in veth, IMHO.

I can follow up on this on some undefined future but right now I will
have to switch to some other work.

If you disagree and insist on addressing skb->xdp_frame in veth within
this patchset then I'm sorry but I will have to postpone my activities
here.

> 
> Either we have to make it not do that - we could probably call
> xdp_do_generic_redirect() and for Tx .. figure out the right incantation 
> to give the frame back to the peer veth.
> 
> Or, if we didn't hit CoW, you need to actually add the incantation we
> removed here, there:
> 
> 	xdp->rxq->mem.type = skb->pp_recycle && page_pool_page_is_pp(..) ?
> 		MEM_TYPE_PAGE_POOL : MEM_TYPE_PAGE_SHARED;
> 
> Or CoW the head retroactively if we hit the Tx/Redir path.
> 
> My intuition is that first option (making the handling as similar to
> XDP generic as possible) is going to be least buggy long term.

  reply	other threads:[~2025-10-31 11:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 22:13 [PATCH v5 bpf 0/2] xdp: fix page_pool leaks Maciej Fijalkowski
2025-10-29 22:13 ` [PATCH v5 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff() Maciej Fijalkowski
2025-10-29 23:50   ` Jakub Kicinski
2025-10-30 12:14     ` Maciej Fijalkowski
2025-10-30 15:25       ` Jakub Kicinski
2025-10-30 20:22         ` Maciej Fijalkowski
2025-10-31  2:05           ` Jakub Kicinski
2025-10-31 11:37             ` Maciej Fijalkowski [this message]
2025-10-31 18:49               ` Jakub Kicinski
2025-11-03 12:16                 ` Maciej Fijalkowski
2025-11-05 18:39                   ` Jesper Dangaard Brouer
2025-10-29 22:13 ` [PATCH v5 bpf 2/2] veth: update mem type in xdp_buff Maciej Fijalkowski
2025-10-29 22:59   ` bot+bpf-ci
2025-10-31 12:46     ` Maciej Fijalkowski
2025-10-31 13:45       ` Chris Mason

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=aQSfgQ9+Jc8dkdhg@boxer \
    --to=maciej.fijalkowski@intel.com \
    --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=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --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 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.