On 2023/03/31 8:39, Jason Gunthorpe wrote: > Look at siw_netdev_event: > > case NETDEV_UNREGISTER: > ib_unregister_device_queued(&sdev->base_dev); > break; I see. We can observe that net vlan0: siw: event 6 is emitted for every second, but unfortunately ib_unregister_device_queued() is never called because dev_net(netdev) != &init_net is true. Changing like below avoids this problem. I guess that either dev_net(netdev) is not appropriately initialized or dev_net(netdev) != &init_net is too restrictive to call ib_unregister_device_queued(). Where is dev_net(netdev) initialized? ---------------------------------------- diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c index dacc174604bf..6f125e282dfc 100644 --- a/drivers/infiniband/sw/siw/siw_main.c +++ b/drivers/infiniband/sw/siw/siw_main.c @@ -434,13 +434,20 @@ static int siw_netdev_event(struct notifier_block *nb, unsigned long event, struct net_device *netdev = netdev_notifier_info_to_dev(arg); struct ib_device *base_dev; struct siw_device *sdev; + bool flag = false; - dev_dbg(&netdev->dev, "siw: event %lu\n", event); + dev_info(&netdev->dev, "siw: event %lu\n", event); - if (dev_net(netdev) != &init_net) - return NOTIFY_OK; + if (dev_net(netdev) != &init_net) { + pr_info("dev_net(netdev)=%px init_net=%px\n", dev_net(netdev), &init_net); + if (event != NETDEV_UNREGISTER) + return NOTIFY_OK; + flag = true; + } base_dev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_SIW); + if (flag) + pr_info("base_dev=%px for netdev=%px\n", base_dev, netdev); if (!base_dev) return NOTIFY_OK; @@ -471,6 +478,8 @@ static int siw_netdev_event(struct notifier_block *nb, unsigned long event, break; case NETDEV_UNREGISTER: + if (flag) + pr_info("ib_unregister_device_queued(%px)\n", &sdev->base_dev); ib_unregister_device_queued(&sdev->base_dev); break; ---------------------------------------- ---------------------------------------- [ 47.201976] net vlan0: siw: event 6 [ 47.203645] dev_net(netdev)=ffff88800ef58000 init_net=ffffffff86435700 [ 47.206277] base_dev=ffff888100e32000 for netdev=ffff88810389f000 [ 47.208708] ib_unregister_device_queued(ffff888100e32000) ----------------------------------------