Netdev List
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Marcin Knap <Marcin.Knap@vecima.com>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: Magnus Karlsson <magnus.karlsson@gmail.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Magnus Karlsson <magnus.karlsson@intel.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Simon Horman <horms@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	"jtollet@cisco.com" <jtollet@cisco.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf] xsk: Do not free ZC Rx buffer when the Rx ring is full
Date: Wed, 21 Oct 2026 14:31:50 +0200	[thread overview]
Message-ID: <87ld7r6xqh.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <DS4PPFFD8A841C22E2663DBBA3A1B4F581E80672@DS4PPFFD8A841C2.namprd18.prod.outlook.com>

Marcin Knap <Marcin.Knap@vecima.com> writes:

> On Tue, Oct 20, 2026 at 07:00:47AM +0000, Maciej Fijalkowski wrote:
>
>> Please don't top-post on MLs and configure your mail client to wrap your
>> lines. Kernel people get triggered by this :P
>
> Sorry for that, I was trying but not good enough... 
> cannot setup this on web outlook and I have blocked every other client.
>
>> ZC drivers are supposed to break processing and yield cpu to
>> application when xsk rxq gets full. We didn't want to expose
>> particular packet multiple times to XDP progs as that might confuse
>> internal logic of progs. Therefore we drop the packet in the core and
>> let driver side know about this via ENOBUFS return value.
>
> Thanks, that explains it and it makes sense to me. 
> I will drop the core change and fix the
> drivers that free the buffer again after -ENOBUFS instead.
>
>> Marcin, could you re-iterate why Jerome's fixes were not enough for
>> you?
>
> This is how I understand this but I don't know this code well and I can be
> wrong.
> Jerome's patches stop mlx5e from releasing the same WQE buffer twice
> when a refill is retried. They don't cover the case where the core
> has already freed the buffer on -ENOBUFS. mlx5e_xdp_handle() treats
> the failed redirect as XDP_DROP, skip-release isn't set, and the
> buffer is released again when its slot is refilled.
>
> xp_free() only catches this if the buffer is still on the free list.
> The free list is LIFO and refill allocates replacement buffers in
> bulk, so the buffer freed by the core is usually handed to another
> WQE before its old slot is refilled. The second free then puts a
> buffer that is still in use back on the free list, and the same UMEM
> frame is later published twice.
>
>> Would also be nice to align mlx-5 to -ENOBUFS case.
>
> Will do, I have potential mlx5 fix (this was my workaround).
>
> I did quick analysis with AI tool and it sounds like all drivers have 
> similar problem and they don't handle -ENOBUFS correctly except 
> Intel drivers needs_wakup path. Given that, would you prefer the driver 
> fixes, or do you have any other ideas?

Marcin, FWIW, we'll discuss this topic on the office hours today [1].
Feel free to join! I added a link with suggested wording for a future
doc [2], and asked an LLM to audit the drivers [3].

Björn

[1] https://lore.kernel.org/netdev/aqPxxX9MeGmAqGy6@boxer/
[2] https://gist.github.com/fb-bjorn/d6835c49650bc3433b427a9c9708fbe2
[3] https://gist.github.com/fb-bjorn/181786547c4dd8182ba09e23cf394dbe

  reply	other threads:[~2026-10-21 12:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  8:22 [PATCH bpf] xsk: Do not free ZC Rx buffer when the Rx ring is full Marcin Knap via B4 Relay
2026-10-19  8:59 ` bot+bpf-ci
2026-10-19 21:10 ` Maciej Fijalkowski
2026-10-20  6:09   ` Magnus Karlsson
2026-10-20  7:00     ` Marcin Knap
2026-10-20 12:23       ` Maciej Fijalkowski
2026-10-20 13:52         ` Marcin Knap
2026-10-21 12:31           ` Björn Töpel [this message]
2026-10-28  8:40             ` Marcin Knap

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=87ld7r6xqh.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=Marcin.Knap@vecima.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john.fastabend@gmail.com \
    --cc=jtollet@cisco.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sdf@fomichev.me \
    /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