mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
	ilias.apalodimas@linaro.org, alexanderduyck@fb.com,
	saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com,
	leon@kernel.org, michael.chan@broadcom.com,
	pavan.chebbi@broadcom.com, corbet@lwn.net, shuah@kernel.org,
	bpf@vger.kernel.org, netdev@vger.kernel.org, stuclar@meta.com,
	sdf@fomichev.me, horms@kernel.org, martin.lau@linux.dev,
	almasrymina@google.com, song@kernel.org, yonghong.song@linux.dev,
	jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev,
	rdunlap@infradead.org, kernel-team@meta.com,
	dimitri.daskalakis1@gmail.com, bobbyeshleman@meta.com,
	mohsin.bashr@gmail.com, kees@kernel.org, leitao@debian.org,
	maxime.chevallier@bootlin.com, cuitao@kylinos.cn,
	vadim.fedorenko@linux.dev, mike.marciniszyn@gmail.com,
	kuniyu@google.com, jiayuan.chen@linux.dev, mkarsten@uwaterloo.ca,
	razor@blackwall.org, dw@davidwei.uk, asml.silence@gmail.com,
	linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 03/15] net: Add memory providers that only feed XDP
Date: Wed, 25 Nov 2026 20:43:05 +0100	[thread overview]
Message-ID: <87h5h4ofxy.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <179561568417.3135.7506567631056689365@kernel.org>

netdev-bot+sashiko@kernel.org writes:

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] This patch adds MP_XDP_ONLY providers, which by design sit
>   next to native XDP and AF_XDP.
>
> --
>
> net: Add memory providers that only feed XDP
>
> This patch lets a memory provider mark itself XDP-only with MP_XDP_ONLY.
> Such a provider needs no header split and does not block native XDP. A page
> pool takes it only when the driver sets PP_FLAG_ALLOW_XDP_ONLY_NETMEM. The
> XDP install, XDP propagate and ethtool rings checks move from
> dev_get_min_mp_channel_count() to the new dev_mp_blocks_xdp().
>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 4ca8a9f5a7a5c..8a1d5a284e53c 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>
> [ ... ]
>
>> @@ -11146,6 +11146,23 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
>>  	return err;
>>  }
>>  
>> +/* Native XDP runs next to XDP-only providers only, see %MP_XDP_ONLY */
>> +bool dev_mp_blocks_xdp(const struct net_device *dev)
>> +{
>> +	const struct memory_provider_ops *ops;
>> +	unsigned int i;
>> +
>> +	netdev_assert_locked_ops_compat(dev);
>> +
>> +	for (i = 0; i < dev->real_num_rx_queues; i++) {
>> +		ops = dev->_rx[i].mp_params.mp_ops;
>> +		if (ops && !(ops->flags & MP_XDP_ONLY))
>> +			return true;
>> +	}
>> +
>> +	return false;
>> +}
>> +
>
> [Severity: Medium]
> Should the AF_XDP zero-copy setup paths use this helper too?
>
> Two callers still use dev_get_min_mp_channel_count(). It counts every
> provider by mp_priv, including XDP-only ones:
>
> net/xdp/xsk_buff_pool.c:xp_assign_dev() {
>     ...
> 	if (dev_get_min_mp_channel_count(netdev)) {
> 		err = -EBUSY;
> 		goto err_unreg_pool;
> 	}
>     ...
> err_unreg_pool:
> 	if (!force_zc)
> 		err = 0; /* fallback to copy mode */
>     ...
> }
>
> drivers/net/netkit.c:netkit_xsk() {
>     ...
> 	if (!create || !dev_get_min_mp_channel_count(phys))
> 		ret = phys->netdev_ops->ndo_bpf(phys, &xdp_lower);
>     ...
> }
>
> Later in the series, xsk_sink_bind() installs an MP_XDP_ONLY provider
> (xsk_sink_ops) on q0. After that, a classic AF_XDP socket that binds q1 on
> the same device would see this:
>
>   bind with XDP_ZEROCOPY fails with -EBUSY
>   bind without a mode flag falls back to copy mode and does not report it
>   XSK pool creation through a netkit leased queue returns -EBUSY
>
> The result also seems to depend on bind order. Suppose the classic
> zero-copy socket binds q1 first. The sink can then still be installed on
> q0, because __netif_mp_open_rxq() only checks the pool of its own queue:
>
> net/core/netdev_rx_queue.c:__netif_mp_open_rxq() {
>     ...
> 	if (rxq->pool && !xdp_only) {
>     ...
> }
>
> So the same end state (sink on q0, zero copy on q1) is accepted in one
> order and refused in the other. Is that intended?

No, that's not intended. The device-wide check in
xp_assign_dev()/netkit_xsk() predates this work, and a sink on another
queue does not stop native XDP. I'll switch both to dev_mp_blocks_xdp()
in the next version, so the bind order no longer mattters.


  reply	other threads:[~2026-11-25 19:43 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 11:26 [PATCH net-next 00/15] xsk: Receive in the device's buffer layout Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 01/15] xdp: Let memory providers offer XDP a view of their net_iovs Björn Töpel
2026-11-25 14:07   ` netdev-bot+sashiko
2026-11-25 19:34     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 02/15] xdp: Keep the shared info of a buffer in kernel memory Björn Töpel
2026-11-25 14:07   ` netdev-bot+sashiko
2026-11-25 19:39     ` Björn Töpel
2026-11-25 15:17   ` Maciej Fijalkowski
2026-11-25 19:36     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 03/15] net: Add memory providers that only feed XDP Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 19:43     ` Björn Töpel [this message]
2026-11-24 12:56 ` [PATCH net-next 04/15] page_pool: Let memory providers take back net_iovs Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 19:45     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 05/15] xdp: Run programs on buffers that must not hold kernel structures Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 19:55     ` Björn Töpel
2026-11-25 15:22   ` Maciej Fijalkowski
2026-11-25 15:28     ` Maciej Fijalkowski
2026-11-25 19:50     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 06/15] xsk: Lend UMEM chunks to the page pools of a queue Björn Töpel
2026-11-24 14:34   ` Magnus Karlsson
2026-11-24 15:12     ` Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 20:02     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 07/15] xsk: Deliver to the socket in the device's buffer layout Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 20:11     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 08/15] xsk: Receive " Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 20:16     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 09/15] eth: fbnic: Support XDP redirect Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 10/15] eth: fbnic: Receive into XDP-only memory providers Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 11/15] net: Add netif_rxq_has_xdp_only_mp() Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 12/15] eth: mlx5e: Receive into XDP-only memory providers Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 20:26     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 13/15] eth: bnxt: " Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-25 20:33     ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 14/15] selftests: net: xsk: Test the device's RX buffer layout Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko
2026-11-24 12:56 ` [PATCH net-next 15/15] Documentation: networking: Describe AF_XDP RX in the device's layout Björn Töpel
2026-11-25 14:08   ` netdev-bot+sashiko

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=87h5h4ofxy.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=asml.silence@gmail.com \
    --cc=ast@kernel.org \
    --cc=bobbyeshleman@meta.com \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=cuitao@kylinos.cn \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dimitri.daskalakis1@gmail.com \
    --cc=dw@davidwei.uk \
    --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=ilias.apalodimas@linaro.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kees@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=leitao@debian.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mbloch@nvidia.com \
    --cc=memxor@gmail.com \
    --cc=michael.chan@broadcom.com \
    --cc=mike.marciniszyn@gmail.com \
    --cc=mkarsten@uwaterloo.ca \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=razor@blackwall.org \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=stuclar@meta.com \
    --cc=tariqt@nvidia.com \
    --cc=vadim.fedorenko@linux.dev \
    --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

all inboxes | Powered by JetHome®