Commit 41c62843 authored by Mark Rustad's avatar Mark Rustad Committed by Jeff Kirsher

ixgbe: Fix rcu warnings induced by LER

Resolve some rcu warnings produced when LER actions take place.
This appears to be due to not holding the rtnl lock when calling
ixgbe_down, so hold the lock. Also avoid disabling the device
when it is already disabled. This check is necessary because the
callback can be called more than once in some cases.
Signed-off-by: default avatarMark Rustad <mark.d.rustad@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 75009b3a
...@@ -808,6 +808,7 @@ enum ixgbe_state_t { ...@@ -808,6 +808,7 @@ enum ixgbe_state_t {
__IXGBE_TESTING, __IXGBE_TESTING,
__IXGBE_RESETTING, __IXGBE_RESETTING,
__IXGBE_DOWN, __IXGBE_DOWN,
__IXGBE_DISABLED,
__IXGBE_REMOVING, __IXGBE_REMOVING,
__IXGBE_SERVICE_SCHED, __IXGBE_SERVICE_SCHED,
__IXGBE_IN_SFP_INIT, __IXGBE_IN_SFP_INIT,
......
...@@ -5566,6 +5566,8 @@ static int ixgbe_resume(struct pci_dev *pdev) ...@@ -5566,6 +5566,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
e_dev_err("Cannot enable PCI device from suspend\n"); e_dev_err("Cannot enable PCI device from suspend\n");
return err; return err;
} }
smp_mb__before_clear_bit();
clear_bit(__IXGBE_DISABLED, &adapter->state);
pci_set_master(pdev); pci_set_master(pdev);
pci_wake_from_d3(pdev, false); pci_wake_from_d3(pdev, false);
...@@ -5663,6 +5665,7 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5663,6 +5665,7 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
ixgbe_release_hw_control(adapter); ixgbe_release_hw_control(adapter);
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
return 0; return 0;
...@@ -8313,6 +8316,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8313,6 +8316,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_select_bars(pdev, IORESOURCE_MEM)); pci_select_bars(pdev, IORESOURCE_MEM));
err_pci_reg: err_pci_reg:
err_dma: err_dma:
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
return err; return err;
} }
...@@ -8382,6 +8386,7 @@ static void ixgbe_remove(struct pci_dev *pdev) ...@@ -8382,6 +8386,7 @@ static void ixgbe_remove(struct pci_dev *pdev)
pci_disable_pcie_error_reporting(pdev); pci_disable_pcie_error_reporting(pdev);
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
} }
...@@ -8489,14 +8494,20 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, ...@@ -8489,14 +8494,20 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
skip_bad_vf_detection: skip_bad_vf_detection:
#endif /* CONFIG_PCI_IOV */ #endif /* CONFIG_PCI_IOV */
rtnl_lock();
netif_device_detach(netdev); netif_device_detach(netdev);
if (state == pci_channel_io_perm_failure) if (state == pci_channel_io_perm_failure) {
rtnl_unlock();
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
}
if (netif_running(netdev)) if (netif_running(netdev))
ixgbe_down(adapter); ixgbe_down(adapter);
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
rtnl_unlock();
/* Request a slot reset. */ /* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET; return PCI_ERS_RESULT_NEED_RESET;
...@@ -8518,6 +8529,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) ...@@ -8518,6 +8529,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
e_err(probe, "Cannot re-enable PCI device after reset.\n"); e_err(probe, "Cannot re-enable PCI device after reset.\n");
result = PCI_ERS_RESULT_DISCONNECT; result = PCI_ERS_RESULT_DISCONNECT;
} else { } else {
smp_mb__before_clear_bit();
clear_bit(__IXGBE_DISABLED, &adapter->state);
adapter->hw.hw_addr = adapter->io_addr; adapter->hw.hw_addr = adapter->io_addr;
pci_set_master(pdev); pci_set_master(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment