Commit b212d815 authored by Mauro S M Rodrigues's avatar Mauro S M Rodrigues Committed by Jeff Kirsher

ixgbe/ixgbevf: Free IRQ when PCI error recovery removes the device

Since commit f7f37e7f ("ixgbe: handle close/suspend race with
netif_device_detach/present") ixgbe_close_suspend is called, from
ixgbe_close, only if the device is present, i.e. if it isn't detached.
That exposed a situation where IRQs weren't freed if a PCI error
recovery system opts to remove the device. For such case the pci channel
state is set to pci_channel_io_perm_failure and ixgbe_io_error_detected
was returning PCI_ERS_RESULT_DISCONNECT before calling
ixgbe_close_suspend consequentially not freeing IRQ and crashing when
the remove handler calls pci_disable_device, hitting a BUG_ON at
free_msi_irqs, which asserts that there is no non-free IRQ associated
with the device to be removed:

BUG_ON(irq_has_action(entry->irq + i));

The issue is fixed by calling the ixgbe_close_suspend before evaluate
the pci channel state.
Reported-by: default avatarNaresh Bannoth <nbannoth@in.ibm.com>
Reported-by: default avatarAbdul Haleem <abdhalee@in.ibm.com>
Signed-off-by: default avatarMauro S M Rodrigues <maurosr@linux.vnet.ibm.com>
Reviewed-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 9cfbfa70
...@@ -10935,14 +10935,14 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, ...@@ -10935,14 +10935,14 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
rtnl_lock(); rtnl_lock();
netif_device_detach(netdev); netif_device_detach(netdev);
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
if (state == pci_channel_io_perm_failure) { if (state == pci_channel_io_perm_failure) {
rtnl_unlock(); rtnl_unlock();
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
rtnl_unlock(); rtnl_unlock();
......
...@@ -4747,14 +4747,14 @@ static pci_ers_result_t ixgbevf_io_error_detected(struct pci_dev *pdev, ...@@ -4747,14 +4747,14 @@ static pci_ers_result_t ixgbevf_io_error_detected(struct pci_dev *pdev,
rtnl_lock(); rtnl_lock();
netif_device_detach(netdev); netif_device_detach(netdev);
if (netif_running(netdev))
ixgbevf_close_suspend(adapter);
if (state == pci_channel_io_perm_failure) { if (state == pci_channel_io_perm_failure) {
rtnl_unlock(); rtnl_unlock();
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
if (netif_running(netdev))
ixgbevf_close_suspend(adapter);
if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state)) if (!test_and_set_bit(__IXGBEVF_DISABLED, &adapter->state))
pci_disable_device(pdev); pci_disable_device(pdev);
rtnl_unlock(); rtnl_unlock();
......
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