[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNF632NGqn893xlJ@mini-arch>
Date: Mon, 22 Sep 2025 09:35:43 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, kuba@...nel.org,
davem@...emloft.net, razor@...ckwall.org, pabeni@...hat.com,
willemb@...gle.com, sdf@...ichev.me, john.fastabend@...il.com,
martin.lau@...nel.org, jordan@...fe.io,
maciej.fijalkowski@...el.com, magnus.karlsson@...el.com,
David Wei <dw@...idwei.uk>
Subject: Re: [PATCH net-next 08/20] net: Proxy net_mp_{open,close}_rxq for
mapped queues
On 09/19, Daniel Borkmann wrote:
> From: David Wei <dw@...idwei.uk>
>
> When a process in a container wants to setup a memory provider, it will
> use the virtual netdev and a mapped rxq, and call net_mp_{open,close}_rxq
> to try and restart the queue. At this point, proxy the queue restart on
> the real rxq in the physical netdev.
>
> For memory providers (io_uring zero-copy rx and devmem), it causes the
> real rxq in the physical netdev to be filled from a memory provider that
> has DMA mapped memory from a process within a container.
>
> Signed-off-by: David Wei <dw@...idwei.uk>
> Co-developed-by: Daniel Borkmann <daniel@...earbox.net>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> ---
> net/core/netdev_rx_queue.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
> index c7d9341b7630..238d3cd9677e 100644
> --- a/net/core/netdev_rx_queue.c
> +++ b/net/core/netdev_rx_queue.c
> @@ -105,13 +105,21 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx,
>
> if (!netdev_need_ops_lock(dev))
> return -EOPNOTSUPP;
> -
> if (rxq_idx >= dev->real_num_rx_queues) {
> NL_SET_ERR_MSG(extack, "rx queue index out of range");
> return -ERANGE;
> }
> +
> rxq_idx = array_index_nospec(rxq_idx, dev->real_num_rx_queues);
> + rxq = __netif_get_rx_queue_peer(&dev, &rxq_idx);
>
> + /* Check again since dev might have changed */
> + if (!netdev_need_ops_lock(dev))
> + return -EOPNOTSUPP;
But if old dev != new dev, the new dev is not gonna be locked, right?
Are you not triggering netdev_assert_locked from
netdev_rx_queue_restart?
You might need to resolve the new dev+queue in the callers in order
to do proper locking.
Powered by blists - more mailing lists