Skip to contentSkip to conversation

ixgbe: Fix free irq process when removing device due to PCI Errors

PATCH New Mauro S. M. Rodrigues 1 participant 1 message Apr 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: Fix free irq process when removing device due to PCI Errors

When a PCI error is detected ixgbe's pci error handler ixgbe_io_error_detected detaches the network device. In general the PCI error recovery mechanism may try to recover the device from the error or eventually remove it completely from the system.

Since commit f7f37e7ff2b9 ("ixgbe: handle close/suspend race with netif_device_detach/present")
we only follow to ixgbe_close_suspend if
the device is preset, i.e. if it wasn't detached, and then the irqs are freed. That prevents to free irqs when the PCI error recovery system decides to remove the device and hitting a BUG_ON free_msi_irqs when it search for non freed irqs associated with the device being removed:

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

This is fixed allowing the ixgbe_close_suspend, and thus ixgbe_free_irq, to be called also when the PCI error recovery mechanism sets the device channel to permanent failure state.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
index afadba9..d170de8 100644
@@ -6679,7 +6679,8 @@ int ixgbe_close(struct net_device *netdev)
 
 	ixgbe_ptp_stop(adapter);
 
-	if (netif_device_present(netdev))
+	if (netif_device_present(netdev) ||
+	    adapter->pdev->error_state == pci_channel_io_perm_failure)
 		ixgbe_close_suspend(adapter);
 
 	ixgbe_fdir_filter_exit(adapter);
Signature · 1 line
2.7.4