Skip to content

Commit 41c6284

Browse files
mdrustadJeff Kirsher
authored andcommitted
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: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 75009b3 commit 41c6284

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎drivers/net/ethernet/intel/ixgbe/ixgbe.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ enum ixgbe_state_t {
808808
__IXGBE_TESTING,
809809
__IXGBE_RESETTING,
810810
__IXGBE_DOWN,
811+
__IXGBE_DISABLED,
811812
__IXGBE_REMOVING,
812813
__IXGBE_SERVICE_SCHED,
813814
__IXGBE_IN_SFP_INIT,

‎drivers/net/ethernet/intel/ixgbe/ixgbe_main.c‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5566,6 +5566,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
55665566
e_dev_err("Cannot enable PCI device from suspend\n");
55675567
return err;
55685568
}
5569+
smp_mb__before_clear_bit();
5570+
clear_bit(__IXGBE_DISABLED, &adapter->state);
55695571
pci_set_master(pdev);
55705572

55715573
pci_wake_from_d3(pdev, false);
@@ -5663,7 +5665,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
56635665

56645666
ixgbe_release_hw_control(adapter);
56655667

5666-
pci_disable_device(pdev);
5668+
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
5669+
pci_disable_device(pdev);
56675670

56685671
return 0;
56695672
}
@@ -8313,7 +8316,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
83138316
pci_select_bars(pdev, IORESOURCE_MEM));
83148317
err_pci_reg:
83158318
err_dma:
8316-
pci_disable_device(pdev);
8319+
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
8320+
pci_disable_device(pdev);
83178321
return err;
83188322
}
83198323

@@ -8382,7 +8386,8 @@ static void ixgbe_remove(struct pci_dev *pdev)
83828386

83838387
pci_disable_pcie_error_reporting(pdev);
83848388

8385-
pci_disable_device(pdev);
8389+
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
8390+
pci_disable_device(pdev);
83868391
}
83878392

83888393
/**
@@ -8489,14 +8494,20 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
84898494

84908495
skip_bad_vf_detection:
84918496
#endif /* CONFIG_PCI_IOV */
8497+
rtnl_lock();
84928498
netif_device_detach(netdev);
84938499

8494-
if (state == pci_channel_io_perm_failure)
8500+
if (state == pci_channel_io_perm_failure) {
8501+
rtnl_unlock();
84958502
return PCI_ERS_RESULT_DISCONNECT;
8503+
}
84968504

84978505
if (netif_running(netdev))
84988506
ixgbe_down(adapter);
8499-
pci_disable_device(pdev);
8507+
8508+
if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
8509+
pci_disable_device(pdev);
8510+
rtnl_unlock();
85008511

85018512
/* Request a slot reset. */
85028513
return PCI_ERS_RESULT_NEED_RESET;
@@ -8518,6 +8529,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
85188529
e_err(probe, "Cannot re-enable PCI device after reset.\n");
85198530
result = PCI_ERS_RESULT_DISCONNECT;
85208531
} else {
8532+
smp_mb__before_clear_bit();
8533+
clear_bit(__IXGBE_DISABLED, &adapter->state);
85218534
adapter->hw.hw_addr = adapter->io_addr;
85228535
pci_set_master(pdev);
85238536
pci_restore_state(pdev);

0 commit comments

Comments
 (0)