[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250116182558.4c7b66f6@kernel.org>
Date: Thu, 16 Jan 2025 18:25:58 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: io-uring@...r.kernel.org, netdev@...r.kernel.org, Jens Axboe
<axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>, Paolo Abeni
<pabeni@...hat.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jesper Dangaard Brouer <hawk@...nel.org>, David
Ahern <dsahern@...nel.org>, Mina Almasry <almasrymina@...gle.com>,
Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v11 10/21] net: add helpers for setting a
memory provider on an rx queue
On Thu, 16 Jan 2025 15:16:52 -0800 David Wei wrote:
> +static void __net_mp_close_rxq(struct net_device *dev, unsigned ifq_idx,
> + struct pp_memory_provider_params *old_p)
> +{
> + struct netdev_rx_queue *rxq;
> + int ret;
> +
> + if (WARN_ON_ONCE(ifq_idx >= dev->real_num_rx_queues))
> + return;
> +
> + rxq = __netif_get_rx_queue(dev, ifq_idx);
I think there's a small race between io_uring closing and the netdev
unregister. We can try to uninstall twice, let's put
/* Callers holding a netdev ref may get here after we already
* went thru shutdown via dev_memory_provider_uninstall().
*/
if (dev->reg_state > NETREG_REGISTERED &&
!rxq->mp_params.mp_ops)
return;
here, and in dev_memory_provider_uninstall() clear the pointers?
> + if (WARN_ON_ONCE(rxq->mp_params.mp_ops != old_p->mp_ops ||
> + rxq->mp_params.mp_priv != old_p->mp_priv))
> + return;
> +
> + rxq->mp_params.mp_ops = NULL;
> + rxq->mp_params.mp_priv = NULL;
> + ret = netdev_rx_queue_restart(dev, ifq_idx);
> + if (ret)
> + pr_devel("Could not restart queue %u after removing memory provider.\n",
> + ifq_idx);
> +}
Powered by blists - more mailing lists