From: "Björn Töpel" <bjorn@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
aleksander.lobakin@intel.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, willemb@google.com, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, shuah@kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org, horms@kernel.org,
sdf@fomichev.me, martin.lau@linux.dev, song@kernel.org,
yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com,
ihor.solodrai@linux.dev, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, larysa.zaremba@intel.com,
tushar.vyavahare@intel.com, kerneljasonxing@gmail.com,
bastien.curutchet@bootlin.com, colin.i.king@gmail.com,
intel-wired-lan@lists.osuosl.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory
Date: Mon, 30 Nov 2026 13:04:30 +0100 [thread overview]
Message-ID: <874icy1q5t.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <179587889144.3135.7516970201926139253@kernel.org>
netdev-bot+sashiko@kernel.org writes:
> [Severity: Low]
> This isn't a bug, but bpf_xdp_adjust_tail() in net/core/filter.c still has
> this comment above its linear grow check:
[...]
> Should that comment be updated as well?
Yes, will fix.
> [Severity: Critical]
> Can this overflow the skb_shared_info of the skb built by
> xdp_build_skb_from_zc() in net/core/xdp.c?
[...]
> Should truesize be sized from (data_end - data_hard_start) +
> SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), or should the copy be
> bounded some other way?
You're right. It already happens for single-buffer pools, which give the
device the whole chunk (Clément reported that case earlier [1]), and
this patch extends it to multi-buffer pools and to tail growth. I'll add
the apatch in front that sizes the skb head from the data, as you
suggest, and gives a head that does not fit a page its own allocation.
[1] https://lore.kernel.org/bpf/20260629072300.1664622-1-clecigne@google.com/
> [Severity: High]
> A related question: can the LARGEST_ALIGN(len) copy in
> xdp_build_skb_from_zc() now read past the end of the UMEM chunk?
Ya. The same new patch copies the exact length, for the head and the
fragments. The new patch fixes those.
> [Severity: Low]
> This isn't a bug, but struct xsk_buff_pool documents this section as
> "Members only used in the control path first.". The data path members
> start at the cacheline aligned fq.
[...]
> Would it fit better with the data path members?
I'd keep it next to xskb_list, which tracks the same packet and is also
used on the data path.
> [Severity: Medium]
> Does the shared info flag really stay for virtio_net in zero-copy
> mode?
[...]
> Should xp_alloc() and xsk_buff_set_size() set XDP_FLAGS_SINFO_EXT
> instead of only keeping it? xp_alloc_batch() would need the same
> treatment, since virtio_net allocates through it. Alternatively,
> should buf_to_xdp() clear only XDP_FLAGS_HAS_FRAGS?
Good point. In the next version every buffer gets the flag when the pool
is created, and set again.
> [Severity: Medium]
> Is there a window here where a head already has XDP_FLAGS_SINFO_EXT and
> the new rxq, but rxq->ext_sinfo is still NULL?
[...]
> Would storing rxq->ext_sinfo before publishing rxq on the heads, with
> release/acquire or WRITE_ONCE() ordering, close this window? Requiring a
> quiesced datapath here would also work.
Yup. As the flag is set at creation, xp_set_rxq_info() no longer touches
the flags. I'll fence the stores rxq->ext_sinfo in the next version.
Switching the queue under a running NAPI is older than this series.
pw-bot: cr
Björn
next prev parent reply other threads:[~2026-11-30 12:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 14:21 [PATCH net 0/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-11-27 14:21 ` [PATCH net 1/3] libeth: xsk: Count each XDP_TX buffer on its own Björn Töpel
2026-11-28 15:14 ` netdev-bot+sashiko
2026-11-30 11:58 ` Björn Töpel
2026-11-27 14:21 ` [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-11-27 19:26 ` Maciej Fijalkowski
2026-11-30 12:05 ` Björn Töpel
2026-11-28 15:14 ` netdev-bot+sashiko
2026-11-30 12:04 ` Björn Töpel [this message]
2026-11-27 14:21 ` [PATCH net 3/3] selftests/bpf: Drop the zero-copy tailroom from the xsk tests Björn Töpel
2026-11-27 15:49 ` Maciej Fijalkowski
2026-11-27 16:56 ` Björn Töpel
2026-11-27 14:24 ` [PATCH net 0/3] xsk: Keep the shared info of zero-copy buffers in kernel memory netdev-bot+sinfo
2026-11-30 11:53 ` Björn Töpel
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=874icy1q5t.fsf@all.your.base.are.belong.to.us \
--to=bjorn@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=andrii@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=colin.i.king@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@kernel.org \
--cc=emil@etsalapatis.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tushar.vyavahare@intel.com \
--cc=willemb@google.com \
--cc=yonghong.song@linux.dev \
/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