Commit bc0c7151 authored by Mark Rustad's avatar Mark Rustad Committed by Jeff Kirsher

ixgbevf: 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 41c62843
...@@ -419,6 +419,7 @@ enum ixbgevf_state_t { ...@@ -419,6 +419,7 @@ enum ixbgevf_state_t {
__IXGBEVF_TESTING, __IXGBEVF_TESTING,
__IXGBEVF_RESETTING, __IXGBEVF_RESETTING,
__IXGBEVF_DOWN, __IXGBEVF_DOWN,
__IXGBEVF_DISABLED,
__IXGBEVF_REMOVING, __IXGBEVF_REMOVING,
}; };
......
...@@ -3329,6 +3329,7 @@ static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -3329,6 +3329,7 @@ static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
return retval; return retval;
#endif #endif
if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
return 0; return 0;
...@@ -3353,6 +3354,8 @@ static int ixgbevf_resume(struct pci_dev *pdev) ...@@ -3353,6 +3354,8 @@ static int ixgbevf_resume(struct pci_dev *pdev)
dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n");
return err; return err;
} }
smp_mb__before_clear_bit();
clear_bit(__IXGBEVF_DISABLED, &adapter->state);
pci_set_master(pdev); pci_set_master(pdev);
ixgbevf_reset(adapter); ixgbevf_reset(adapter);
...@@ -3607,6 +3610,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3607,6 +3610,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_release_regions(pdev); pci_release_regions(pdev);
err_pci_reg: err_pci_reg:
err_dma: err_dma:
if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
return err; return err;
} }
...@@ -3645,6 +3649,7 @@ static void ixgbevf_remove(struct pci_dev *pdev) ...@@ -3645,6 +3649,7 @@ static void ixgbevf_remove(struct pci_dev *pdev)
free_netdev(netdev); free_netdev(netdev);
if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
} }
...@@ -3662,15 +3667,20 @@ static pci_ers_result_t ixgbevf_io_error_detected(struct pci_dev *pdev, ...@@ -3662,15 +3667,20 @@ static pci_ers_result_t ixgbevf_io_error_detected(struct pci_dev *pdev,
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct ixgbevf_adapter *adapter = netdev_priv(netdev); struct ixgbevf_adapter *adapter = netdev_priv(netdev);
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))
ixgbevf_down(adapter); ixgbevf_down(adapter);
if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
rtnl_unlock();
/* Request a slot slot reset. */ /* Request a slot slot reset. */
return PCI_ERS_RESULT_NEED_RESET; return PCI_ERS_RESULT_NEED_RESET;
...@@ -3694,6 +3704,8 @@ static pci_ers_result_t ixgbevf_io_slot_reset(struct pci_dev *pdev) ...@@ -3694,6 +3704,8 @@ static pci_ers_result_t ixgbevf_io_slot_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
smp_mb__before_clear_bit();
clear_bit(__IXGBEVF_DISABLED, &adapter->state);
pci_set_master(pdev); pci_set_master(pdev);
ixgbevf_reset(adapter); ixgbevf_reset(adapter);
......
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