On 1/17/25 02:25, Jakub Kicinski wrote:
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
They're gated by checking ifq->netdev in io_uring code, which is
cleared by them under a spin. So either io_uring does
__net_mp_close_rxq() and ->uninstall does nothing, or vise versa.
/* 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);
+}
--
Pavel Begunkov