From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Dan Carpenter <dan.carpenter@linaro.org>, <bpf@vger.kernel.org>,
<ast@kernel.org>, <andrii@kernel.org>, <netdev@vger.kernel.org>,
<magnus.karlsson@intel.com>, <stfomichev@gmail.com>,
<aleksander.lobakin@intel.com>,
Eryk Kubanski <e.kubanski@partner.samsung.com>
Subject: Re: [PATCH v6 bpf] xsk: fix immature cq descriptor production
Date: Fri, 29 Aug 2025 18:14:26 +0200 [thread overview]
Message-ID: <aLHR4qMphDdG43l2@boxer> (raw)
In-Reply-To: <089fa206-1511-4fd9-bc12-f73ab8a08bb6@iogearbox.net>
On Tue, Aug 26, 2025 at 02:23:34PM +0200, Daniel Borkmann wrote:
> On 8/26/25 10:14 AM, Dan Carpenter wrote:
> > On Wed, Aug 20, 2025 at 05:44:16PM +0200, Maciej Fijalkowski wrote:
> > > return ERR_PTR(err);
> > > skb_reserve(skb, hr);
> > > +
> > > + addrs = kmem_cache_zalloc(xsk_tx_generic_cache, GFP_KERNEL);
> > > + if (!addrs) {
> > > + kfree(skb);
> >
> > This needs to be kfree_skb(skb);
>
> Oh well, good catch! Maciej, given this commit did not land yet in Linus' tree,
> I can toss the commit from bpf tree assuming you send a v7?
>
> Also, looking at xsk_build_skb(), do we similarly need to free that allocated
> skb when we hit the ERR_PTR(-EOVERFLOW) ? Mentioned function has the following
> in the free_err path:
>
> if (first_frag && skb)
> kfree_skb(skb);
>
> Pls double check.
for EOVERFLOW we drop skb and then we continue with consuming next
descriptors from XSK Tx queue. Every other errno causes this loop
processing to stop and give the control back to application side. skb
pointer is kept within xdp_sock and on next syscall we will retry with
sending it.
if (err == -EOVERFLOW) {
xsk_drop_skb(xs->skb);
-> xsk_consume_skb(skb);
-> consume_skb(skb);
since it's a drop, i wonder if we should have a kfree_skb() with proper
drop reason for XSK subsystem, but that's for a different discussion.
I will now send a v7 which is supposed to address the reported perf impact
by Jason...keep your fingers crossed for me not messing anything again
around this code base:D
>
> > regards,
> > dan carpenter
> >
> > > + return ERR_PTR(-ENOMEM);
> > > + }
> > > +
> > > + xsk_set_destructor_arg(skb, addrs);
> > > }
> > > addr = desc->addr;
> >
>
next prev parent reply other threads:[~2025-08-29 16:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 15:44 [PATCH v6 bpf] xsk: fix immature cq descriptor production Maciej Fijalkowski
2025-08-20 17:06 ` Stanislav Fomichev
2025-08-22 16:20 ` patchwork-bot+netdevbpf
2025-08-26 8:14 ` Dan Carpenter
2025-08-26 12:23 ` Daniel Borkmann
2025-08-26 13:40 ` Jason Xing
2025-08-29 16:14 ` Maciej Fijalkowski [this message]
2025-08-30 10:32 ` Jason Xing
2025-08-26 16:00 ` Jason Xing
2025-08-26 18:23 ` Magnus Karlsson
2025-08-26 19:03 ` Maciej Fijalkowski
2025-08-26 19:13 ` Maciej Fijalkowski
2025-08-27 0:25 ` Jason Xing
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=aLHR4qMphDdG43l2@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=daniel@iogearbox.net \
--cc=e.kubanski@partner.samsung.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=stfomichev@gmail.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).