Skip to content

Commit 37bd9ed

Browse files
jjagielskNipaLocal
authored andcommitted
ixgbe: initialize aci.lock before it's used
Currently aci.lock is initialized too late. A bunch of ACI callbacks using the lock are called prior it's initialized. Commit 337369f ("locking/mutex: Add MUTEX_WARN_ON() into fast path") highlights that issue what results in call trace. [ 4.092899] DEBUG_LOCKS_WARN_ON(lock->magic != lock) [ 4.092910] WARNING: CPU: 0 PID: 578 at kernel/locking/mutex.c:154 mutex_lock+0x6d/0x80 [ 4.098757] Call Trace: [ 4.098847] <TASK> [ 4.098922] ixgbe_aci_send_cmd+0x8c/0x1e0 [ixgbe] [ 4.099108] ? hrtimer_try_to_cancel+0x18/0x110 [ 4.099277] ixgbe_aci_get_fw_ver+0x52/0xa0 [ixgbe] [ 4.099460] ixgbe_check_fw_error+0x1fc/0x2f0 [ixgbe] [ 4.099650] ? usleep_range_state+0x69/0xd0 [ 4.099811] ? usleep_range_state+0x8c/0xd0 [ 4.099964] ixgbe_probe+0x3b0/0x12d0 [ixgbe] [ 4.100132] local_pci_probe+0x43/0xa0 [ 4.100267] work_for_cpu_fn+0x13/0x20 [ 4.101647] </TASK> Move aci.lock mutex initialization to ixgbe_sw_init() before any ACI command is sent. Along with that move also related SWFW semaphore in order to reduce size of ixgbe_probe() and that way all locks are initialized in ixgbe_sw_init(). Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Fixes: 4600cdf ("ixgbe: Enable link management in E610 device") Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: NipaLocal <nipa@local>
1 parent faf6a52 commit 37bd9ed

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6978,6 +6978,13 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
69786978
break;
69796979
}
69806980

6981+
/* Make sure the SWFW semaphore is in a valid state */
6982+
if (hw->mac.ops.init_swfw_sync)
6983+
hw->mac.ops.init_swfw_sync(hw);
6984+
6985+
if (hw->mac.type == ixgbe_mac_e610)
6986+
mutex_init(&hw->aci.lock);
6987+
69816988
#ifdef IXGBE_FCOE
69826989
/* FCoE support exists, always init the FCoE lock */
69836990
spin_lock_init(&adapter->fcoe.lock);
@@ -11648,10 +11655,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1164811655
if (err)
1164911656
goto err_sw_init;
1165011657

11651-
/* Make sure the SWFW semaphore is in a valid state */
11652-
if (hw->mac.ops.init_swfw_sync)
11653-
hw->mac.ops.init_swfw_sync(hw);
11654-
1165511658
if (ixgbe_check_fw_error(adapter))
1165611659
return ixgbe_recovery_probe(adapter);
1165711660

@@ -11855,8 +11858,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1185511858
ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
1185611859
ixgbe_mac_set_default_filter(adapter);
1185711860

11858-
if (hw->mac.type == ixgbe_mac_e610)
11859-
mutex_init(&hw->aci.lock);
1186011861
timer_setup(&adapter->service_timer, ixgbe_service_timer, 0);
1186111862

1186211863
if (ixgbe_removed(hw->hw_addr)) {
@@ -12016,9 +12017,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1201612017
devl_unlock(adapter->devlink);
1201712018
ixgbe_release_hw_control(adapter);
1201812019
ixgbe_clear_interrupt_scheme(adapter);
12020+
err_sw_init:
1201912021
if (hw->mac.type == ixgbe_mac_e610)
1202012022
mutex_destroy(&adapter->hw.aci.lock);
12021-
err_sw_init:
1202212023
ixgbe_disable_sriov(adapter);
1202312024
adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP;
1202412025
iounmap(adapter->io_addr);

0 commit comments

Comments
 (0)