* [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used
@ 2025-06-16 13:36 Jedrzej Jagielski
2025-06-16 19:12 ` Simon Horman
2025-06-17 5:39 ` [Intel-wired-lan] " Loktionov, Aleksandr
0 siblings, 2 replies; 3+ messages in thread
From: Jedrzej Jagielski @ 2025-06-16 13:36 UTC (permalink / raw)
To: intel-wired-lan
Cc: anthony.l.nguyen, netdev, Jedrzej Jagielski, Michal Swiatkowski,
Przemek Kitszel
Currently aci.lock is initialized too late. A bunch of ACI callbacks
using the lock are called prior it's initialized.
Commit 337369f8ce9e ("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>
Fixes: 4600cdf9f5ac ("ixgbe: Enable link management in E610 device")
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 03d31e5b131d..18cae81dc794 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6801,6 +6801,13 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
break;
}
+ /* Make sure the SWFW semaphore is in a valid state */
+ if (hw->mac.ops.init_swfw_sync)
+ hw->mac.ops.init_swfw_sync(hw);
+
+ if (hw->mac.type == ixgbe_mac_e610)
+ mutex_init(&hw->aci.lock);
+
#ifdef IXGBE_FCOE
/* FCoE support exists, always init the FCoE lock */
spin_lock_init(&adapter->fcoe.lock);
@@ -11473,10 +11480,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (err)
goto err_sw_init;
- /* Make sure the SWFW semaphore is in a valid state */
- if (hw->mac.ops.init_swfw_sync)
- hw->mac.ops.init_swfw_sync(hw);
-
if (ixgbe_check_fw_error(adapter))
return ixgbe_recovery_probe(adapter);
@@ -11680,8 +11683,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
ixgbe_mac_set_default_filter(adapter);
- if (hw->mac.type == ixgbe_mac_e610)
- mutex_init(&hw->aci.lock);
timer_setup(&adapter->service_timer, ixgbe_service_timer, 0);
if (ixgbe_removed(hw->hw_addr)) {
@@ -11837,9 +11838,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
devl_unlock(adapter->devlink);
ixgbe_release_hw_control(adapter);
ixgbe_clear_interrupt_scheme(adapter);
+err_sw_init:
if (hw->mac.type == ixgbe_mac_e610)
mutex_destroy(&adapter->hw.aci.lock);
-err_sw_init:
ixgbe_disable_sriov(adapter);
adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP;
iounmap(adapter->io_addr);
base-commit: a76bd1156de9fd1d4be4502cbb5160a709ff4cd7
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used
2025-06-16 13:36 [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used Jedrzej Jagielski
@ 2025-06-16 19:12 ` Simon Horman
2025-06-17 5:39 ` [Intel-wired-lan] " Loktionov, Aleksandr
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-06-16 19:12 UTC (permalink / raw)
To: Jedrzej Jagielski
Cc: intel-wired-lan, anthony.l.nguyen, netdev, Michal Swiatkowski,
Przemek Kitszel
On Mon, Jun 16, 2025 at 03:36:36PM +0200, Jedrzej Jagielski wrote:
> Currently aci.lock is initialized too late. A bunch of ACI callbacks
> using the lock are called prior it's initialized.
>
> Commit 337369f8ce9e ("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>
> Fixes: 4600cdf9f5ac ("ixgbe: Enable link management in E610 device")
> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used
2025-06-16 13:36 [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used Jedrzej Jagielski
2025-06-16 19:12 ` Simon Horman
@ 2025-06-17 5:39 ` Loktionov, Aleksandr
1 sibling, 0 replies; 3+ messages in thread
From: Loktionov, Aleksandr @ 2025-06-17 5:39 UTC (permalink / raw)
To: Jagielski, Jedrzej, intel-wired-lan@lists.osuosl.org
Cc: Nguyen, Anthony L, netdev@vger.kernel.org, Jagielski, Jedrzej,
Michal Swiatkowski, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Jedrzej Jagielski
> Sent: Monday, June 16, 2025 3:37 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>;
> netdev@vger.kernel.org; Jagielski, Jedrzej
> <jedrzej.jagielski@intel.com>; Michal Swiatkowski
> <michal.swiatkowski@linux.intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-net v1] 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 337369f8ce9e ("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>
> Fixes: 4600cdf9f5ac ("ixgbe: Enable link management in E610 device")
> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 03d31e5b131d..18cae81dc794 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6801,6 +6801,13 @@ static int ixgbe_sw_init(struct ixgbe_adapter
> *adapter,
> break;
> }
>
> + /* Make sure the SWFW semaphore is in a valid state */
> + if (hw->mac.ops.init_swfw_sync)
> + hw->mac.ops.init_swfw_sync(hw);
> +
> + if (hw->mac.type == ixgbe_mac_e610)
> + mutex_init(&hw->aci.lock);
> +
> #ifdef IXGBE_FCOE
> /* FCoE support exists, always init the FCoE lock */
> spin_lock_init(&adapter->fcoe.lock);
> @@ -11473,10 +11480,6 @@ static int ixgbe_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
> if (err)
> goto err_sw_init;
>
> - /* Make sure the SWFW semaphore is in a valid state */
> - if (hw->mac.ops.init_swfw_sync)
> - hw->mac.ops.init_swfw_sync(hw);
> -
> if (ixgbe_check_fw_error(adapter))
> return ixgbe_recovery_probe(adapter);
>
> @@ -11680,8 +11683,6 @@ static int ixgbe_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
> ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
> ixgbe_mac_set_default_filter(adapter);
>
> - if (hw->mac.type == ixgbe_mac_e610)
> - mutex_init(&hw->aci.lock);
> timer_setup(&adapter->service_timer, ixgbe_service_timer, 0);
>
> if (ixgbe_removed(hw->hw_addr)) {
> @@ -11837,9 +11838,9 @@ static int ixgbe_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
> devl_unlock(adapter->devlink);
> ixgbe_release_hw_control(adapter);
> ixgbe_clear_interrupt_scheme(adapter);
> +err_sw_init:
> if (hw->mac.type == ixgbe_mac_e610)
> mutex_destroy(&adapter->hw.aci.lock);
> -err_sw_init:
> ixgbe_disable_sriov(adapter);
> adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP;
> iounmap(adapter->io_addr);
>
> base-commit: a76bd1156de9fd1d4be4502cbb5160a709ff4cd7
> --
> 2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-17 5:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 13:36 [PATCH iwl-net v1] ixgbe: initialize aci.lock before it's used Jedrzej Jagielski
2025-06-16 19:12 ` Simon Horman
2025-06-17 5:39 ` [Intel-wired-lan] " Loktionov, Aleksandr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).