* [PATCH net-next 1/3] eth: bnxt: switch to netif_close
@ 2025-03-08 1:08 Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 2/3] eth: bnxt: request unconditional ops lock Stanislav Fomichev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2025-03-08 1:08 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, linux-kernel, michael.chan,
pavan.chebbi, andrew+netdev, sdf
All (error) paths that call dev_close are already holding instance lock,
so switch to netif_close to avoid the deadlock.
Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++------
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 1a1e6da77777..e874530f1db2 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -12801,7 +12801,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
if (rc) {
netdev_err(bp->dev, "nic open fail (rc: %x)\n", rc);
- dev_close(bp->dev);
+ netif_close(bp->dev);
}
return rc;
}
@@ -12839,7 +12839,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
half_open_err:
bnxt_free_skbs(bp);
bnxt_free_mem(bp, true);
- dev_close(bp->dev);
+ netif_close(bp->dev);
return rc;
}
@@ -14194,7 +14194,7 @@ void bnxt_fw_reset(struct bnxt *bp)
netdev_err(bp->dev, "Firmware reset aborted, rc = %d\n",
n);
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
- dev_close(bp->dev);
+ netif_close(bp->dev);
goto fw_reset_exit;
} else if (n > 0) {
u16 vf_tmo_dsecs = n * 10;
@@ -14809,7 +14809,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
bnxt_dl_health_fw_status_update(bp, false);
bp->fw_reset_state = 0;
- dev_close(bp->dev);
+ netif_close(bp->dev);
}
static void bnxt_fw_reset_task(struct work_struct *work)
@@ -16275,7 +16275,7 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)
if (netif_running(bp->dev)) {
if (rc)
- dev_close(bp->dev);
+ netif_close(bp->dev);
else
rc = bnxt_open_nic(bp, true, false);
}
@@ -16668,7 +16668,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
goto shutdown_exit;
if (netif_running(dev))
- dev_close(dev);
+ netif_close(dev);
bnxt_ptp_clear(bp);
bnxt_clear_int_mode(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index b06fcddfc81c..b6d6fcd105d7 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -461,7 +461,7 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to deregister");
if (netif_running(bp->dev))
- dev_close(bp->dev);
+ netif_close(bp->dev);
netdev_unlock(bp->dev);
rtnl_unlock();
break;
@@ -576,7 +576,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
*actions_performed |= BIT(action);
} else if (netif_running(bp->dev)) {
netdev_lock(bp->dev);
- dev_close(bp->dev);
+ netif_close(bp->dev);
netdev_unlock(bp->dev);
}
rtnl_unlock();
--
2.48.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH net-next 2/3] eth: bnxt: request unconditional ops lock
2025-03-08 1:08 [PATCH net-next 1/3] eth: bnxt: switch to netif_close Stanislav Fomichev
@ 2025-03-08 1:08 ` Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 3/3] eth: bnxt: add missing netdev lock management to bnxt_dl_reload_up Stanislav Fomichev
2025-03-09 2:50 ` [PATCH net-next 1/3] eth: bnxt: switch to netif_close kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2025-03-08 1:08 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, linux-kernel, michael.chan,
pavan.chebbi, andrew+netdev, sdf
netdev_lock_ops conditionally grabs instance lock when queue_mgmt_ops
is defined. However queue_mgmt_ops support is signaled via FW
so we can sometimes boot without queue_mgmt_ops being set.
This will result in bnxt running without instance lock which
the driver now heavily depends on. Set request_ops_lock to true
unconditionally to always request netdev instance lock.
Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e874530f1db2..225d3e2db541 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -16612,6 +16612,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
bp->rss_cap |= BNXT_RSS_CAP_MULTI_RSS_CTX;
if (BNXT_SUPPORTS_QUEUE_API(bp))
dev->queue_mgmt_ops = &bnxt_queue_mgmt_ops;
+ dev->request_ops_lock = true;
rc = register_netdev(dev);
if (rc)
--
2.48.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH net-next 3/3] eth: bnxt: add missing netdev lock management to bnxt_dl_reload_up
2025-03-08 1:08 [PATCH net-next 1/3] eth: bnxt: switch to netif_close Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 2/3] eth: bnxt: request unconditional ops lock Stanislav Fomichev
@ 2025-03-08 1:08 ` Stanislav Fomichev
2025-03-09 2:50 ` [PATCH net-next 1/3] eth: bnxt: switch to netif_close kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2025-03-08 1:08 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, linux-kernel, michael.chan,
pavan.chebbi, andrew+netdev, sdf
bnxt_dl_reload_up is completely missing instance lock management
which can result in `devlink dev reload` leaving with instance
lock held. Add the missing calls.
Also add netdev_assert_locked to make it clear that the up() method
is running with the instance lock grabbed.
Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index b6d6fcd105d7..ea7f789be760 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -518,6 +518,8 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
struct bnxt *bp = bnxt_get_bp_from_dl(dl);
int rc = 0;
+ netdev_assert_locked(bp->dev);
+
*actions_performed = 0;
switch (action) {
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: {
@@ -542,6 +544,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
if (!netif_running(bp->dev))
NL_SET_ERR_MSG_MOD(extack,
"Device is closed, not waiting for reset notice that will never come");
+ netdev_unlock(bp->dev);
rtnl_unlock();
while (test_bit(BNXT_STATE_FW_ACTIVATE, &bp->state)) {
if (time_after(jiffies, timeout)) {
@@ -557,6 +560,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
msleep(50);
}
rtnl_lock();
+ netdev_lock(bp->dev);
if (!rc)
*actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
clear_bit(BNXT_STATE_FW_ACTIVATE, &bp->state);
@@ -575,10 +579,9 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
}
*actions_performed |= BIT(action);
} else if (netif_running(bp->dev)) {
- netdev_lock(bp->dev);
netif_close(bp->dev);
- netdev_unlock(bp->dev);
}
+ netdev_unlock(bp->dev);
rtnl_unlock();
if (action == DEVLINK_RELOAD_ACTION_DRIVER_REINIT)
bnxt_ulp_start(bp, rc);
--
2.48.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next 1/3] eth: bnxt: switch to netif_close
2025-03-08 1:08 [PATCH net-next 1/3] eth: bnxt: switch to netif_close Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 2/3] eth: bnxt: request unconditional ops lock Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 3/3] eth: bnxt: add missing netdev lock management to bnxt_dl_reload_up Stanislav Fomichev
@ 2025-03-09 2:50 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-03-09 2:50 UTC (permalink / raw)
To: Stanislav Fomichev, netdev
Cc: oe-kbuild-all, davem, edumazet, kuba, pabeni, linux-kernel,
michael.chan, pavan.chebbi, andrew+netdev, sdf
Hi Stanislav,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Stanislav-Fomichev/eth-bnxt-request-unconditional-ops-lock/20250308-091318
base: net-next/main
patch link: https://lore.kernel.org/r/20250308010840.910382-1-sdf%40fomichev.me
patch subject: [PATCH net-next 1/3] eth: bnxt: switch to netif_close
config: arm-randconfig-004-20250309 (https://download.01.org/0day-ci/archive/20250309/202503091014.T0oUWfdo-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250309/202503091014.T0oUWfdo-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503091014.T0oUWfdo-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in arch/arm/probes/kprobes/test-kprobes.o
WARNING: modpost: missing MODULE_DESCRIPTION() in mm/kasan/kasan_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/slub_kunit.o
>> ERROR: modpost: "netif_close" [drivers/net/ethernet/broadcom/bnxt/bnxt_en.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-09 2:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-08 1:08 [PATCH net-next 1/3] eth: bnxt: switch to netif_close Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 2/3] eth: bnxt: request unconditional ops lock Stanislav Fomichev
2025-03-08 1:08 ` [PATCH net-next 3/3] eth: bnxt: add missing netdev lock management to bnxt_dl_reload_up Stanislav Fomichev
2025-03-09 2:50 ` [PATCH net-next 1/3] eth: bnxt: switch to netif_close kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®