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); > +}