From: sashiko-bot@kernel.org
To: "Taehee Yoo" <ap420073@gmail.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org,
bpf@vger.kernel.org
Subject: Re: [RFC PATCH net-next 03/13] net: core: add XDP_MODE_HW offload hook for knod
Date: Tue, 21 Jul 2026 07:17:54 +0000 [thread overview]
Message-ID: <20260721071754.78E471F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260719175857.4071636-4-ap420073@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] The patch introduces an order-dependent state violation where attaching a memory provider and a hardware-offloaded XDP program succeeds or fails depending purely on the order of operations.
Pre-existing issues:
- [High] Blocking XDP uninstalls when a memory provider is active leads to a resource leak of the BPF program and a permanently active 'zombie' XDP program on slave devices.
--
--- Patch [3]: [RFC PATCH net-next 03/13] net: core: add XDP_MODE_HW offload hook for knod ---
commit 2719ee9dd236296c86e09fa87d5113250098ff78
Author: Taehee Yoo <ap420073@gmail.com>
net: core: add XDP_MODE_HW offload hook for knod
Route XDP program install/uninstall to the knod accelerator when a
device is attached, so BPF programs run on the accelerator instead of
the host.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7c21bc0a1e349..5ba1c969029bc 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -10334,7 +10334,7 @@ static int dev_xdp_install(struct net_device *dev, enum bpf_xdp_mode mode,
> return -EBUSY;
> }
>
> - if (dev_get_min_mp_channel_count(dev)) {
> + if (dev_get_min_mp_channel_count(dev) && mode != XDP_MODE_HW) {
[Severity: High]
This is a pre-existing issue, but blocking XDP uninstalls when a memory
provider is active appears to lead to a resource leak and an inconsistent
state on slave devices.
If we attach an XDP program to a bonding device, it propagates to slave
devices without updating their individual dev->xdp_state. If we then bind a
memory provider to the slave device (which succeeds since its local prog count
is 0), what happens when we try to destroy the bond device?
netif_xdp_propagate() will fail because of the memory provider:
net/core/dev.c:netif_xdp_propagate() {
...
if (dev_get_min_mp_channel_count(dev)) {
NL_SET_ERR_MSG(bpf->extack, "unable to propagate XDP...");
return -EBUSY;
}
...
}
In dev_xdp_uninstall(), this failure is ignored:
net/core/dev.c:dev_xdp_uninstall() {
...
WARN_ON(dev_xdp_install(dev, mode, bpf_op, NULL, 0, NULL));
/* auto-detach link from net device */
link = dev_xdp_link(dev, mode);
if (link)
link->dev = NULL;
else
bpf_prog_put(prog);
...
}
Doesn't this result in the bond dropping its reference and clearing its state,
while the slave driver never unloads the program because ndo_bpf is not
called? Will this leave a zombie XDP program permanently executing on the
slave device and leak the BPF program memory?
[Severity: Medium]
Does modifying this check create an order-dependent state regression?
If a memory provider is attached first, this modified check allows an
XDP_MODE_HW program to be installed successfully.
However, if an XDP_MODE_HW program is installed first, a subsequent attempt
to bind a memory provider fails in __netif_mp_open_rxq() because it
unconditionally checks the program count:
net/core/netdev_rx_queue.c:__netif_mp_open_rxq() {
...
if (dev_xdp_prog_count(dev)) {
NL_SET_ERR_MSG(extack, "unable to custom memory provider...");
return -EEXIST;
}
...
}
Should __netif_mp_open_rxq() also check if the existing programs are hardware
offloaded to ensure the API behaves consistently regardless of the operation
order?
> NL_SET_ERR_MSG(extack, "unable to install XDP to device using memory provider");
> return -EBUSY;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260719175857.4071636-1-ap420073@gmail.com?part=3
next prev parent reply other threads:[~2026-07-21 7:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 17:58 [RFC PATCH net-next 00/13] net: knod: in-kernel network offload device Taehee Yoo
2026-07-19 17:58 ` [RFC PATCH net-next 01/13] net: knod: add uapi and core headers Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 02/13] net: devmem: extend memory provider for knod Taehee Yoo
2026-07-20 19:43 ` Mina Almasry
2026-07-21 16:15 ` Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 03/13] net: core: add XDP_MODE_HW offload hook " Taehee Yoo
2026-07-21 7:17 ` sashiko-bot [this message]
2026-07-19 17:58 ` [RFC PATCH net-next 04/13] net: knod: add offload device core and control plane Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 05/13] bpf: offload: allow PERCPU_ARRAY maps for offloaded programs Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 06/13] drm/amdkfd: prepare kfd core for the knod provider Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 07/13] drm/amdkfd: add knod provider core Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 08/13] drm/amdkfd: add GPU instruction emitter and disassembler Taehee Yoo
2026-07-20 20:05 ` Natalie Vock
2026-07-20 20:53 ` Andrew Lunn
2026-07-21 16:36 ` Hoyeon Lee
2026-07-19 17:58 ` [RFC PATCH net-next 09/13] drm/amdkfd: add BPF-to-GPU JIT offload Taehee Yoo
2026-07-19 17:58 ` [RFC PATCH net-next 10/13] net/mlx5e: add knod XDP offload support Taehee Yoo
2026-07-21 7:17 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 11/13] bnxt_en: " Taehee Yoo
2026-07-21 7:18 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 12/13] selftests: drivers/net: add knod tests Taehee Yoo
2026-07-21 7:18 ` sashiko-bot
2026-07-19 17:58 ` [RFC PATCH net-next 13/13] drm/amdkfd: add IPsec full-packet offload Taehee Yoo
2026-07-21 7:18 ` sashiko-bot
2026-07-20 19:18 ` [RFC PATCH net-next 00/13] net: knod: in-kernel network offload device Mina Almasry
2026-07-21 15:17 ` Taehee Yoo
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=20260721071754.78E471F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ap420073@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.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 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.