Message ID | alpine.NEB.2.20.17.1611100544220.6177@chris.i8u.org |
---|---|
State | Awaiting Upstream, archived |
Delegated to: | David Miller |
Headers | show |
On Nov 10 05:48, Hisashi T Fujinaka wrote: > On Thu, 10 Nov 2016, Corinna Vinschen wrote: > > On Nov 8 11:33, Alexander Duyck wrote: > ... > > > The question I would have is what is reading the device when it is in > > > this state. The watchdog and any other functions that would read the > > > device should be disabled. > > > > > > One possibility could be a race between a call to igb_close and the > > > igb_suspend function. We have seen some of those pop up recently on > > > ixgbe and it looks like igb has the same bug. We should probably be > > > using the rtnl_lock to guarantee that netif_device_detach and the call > > > to __igb_close are completed before igb_close could possibly be called > > > by the network stack. > > > > Do you have a pointer to the related ixgbe patch, by any chance? > ... > Here's the initial patch for igb I have, but it's on hold awaiting more > changes in ixgbe regarding AER. Thanks a lot! Corinna
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4feca69..ce5add6 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3275,7 +3275,10 @@ static int __igb_close(struct net_device *netdev, bool suspending) int igb_close(struct net_device *netdev) { - return __igb_close(netdev, false); + if (netif_device_present(netdev)) + return __igb_close(netdev, false); + + return 0; } /** @@ -7537,6 +7540,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, int retval = 0; #endif + rtnl_lock(); netif_device_detach(netdev); if (netif_running(netdev)) @@ -7545,6 +7549,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, igb_ptp_suspend(adapter); igb_clear_interrupt_scheme(adapter); + rtnl_unlock(); #ifdef CONFIG_PM retval = pci_save_state(pdev); @@ -7663,16 +7668,17 @@ static int igb_resume(struct device *dev) wr32(E1000_WUS, ~0); - if (netdev->flags & IFF_UP) { - rtnl_lock(); + rtnl_lock(); + + if (!err && netif_running(netdev)) err = __igb_open(netdev, true); - rtnl_unlock(); - if (err) - return err; - } - netif_device_attach(netdev); - return 0; + if (!err) + netif_device_attach(netdev); + + rtnl_unlock(); + + return err; } static int igb_runtime_idle(struct device *dev)