117 lines
3.7 KiB
Diff
117 lines
3.7 KiB
Diff
From 1c5f23db129a2e1115918a8cf4b6cf5062350f2e Mon Sep 17 00:00:00 2001
|
|
From: Kamal Heib <kheib@redhat.com>
|
|
Date: Mon, 20 Apr 2026 14:59:30 -0400
|
|
Subject: [PATCH] net/mlx5: Initialize events outside devlink lock
|
|
|
|
JIRA: https://redhat.atlassian.net/browse/RHEL-169055
|
|
|
|
commit b6b03097f9826db72aeb3f751774c5e9edd9a5b3
|
|
Author: Cosmin Ratiu <cratiu@nvidia.com>
|
|
Date: Sun Nov 16 22:45:35 2025 +0200
|
|
|
|
net/mlx5: Initialize events outside devlink lock
|
|
|
|
Move event init/cleanup outside of mlx5_init_one() / mlx5_uninit_one()
|
|
and into the mlx5_mdev_init() / mlx5_mdev_uninit() functions.
|
|
|
|
By doing this, we avoid the events being reinitialized on devlink reload
|
|
and, more importantly, the events->sw_nh notifier chain becomes
|
|
available earlier in the init procedure, which will be used in
|
|
subsequent patches. This makes sense because the events struct is pure
|
|
software, independent of any HW details.
|
|
|
|
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
|
|
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
|
|
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
|
|
Link: https://patch.msgid.link/1763325940-1231508-2-git-send-email-tariqt@nvidia.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
|
|
Signed-off-by: Kamal Heib <kheib@redhat.com>
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
|
|
index b0d8d9888629..f73e1b5e13e3 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
|
|
@@ -1010,16 +1010,10 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
|
|
goto err_irq_cleanup;
|
|
}
|
|
|
|
- err = mlx5_events_init(dev);
|
|
- if (err) {
|
|
- mlx5_core_err(dev, "failed to initialize events\n");
|
|
- goto err_eq_cleanup;
|
|
- }
|
|
-
|
|
err = mlx5_fw_reset_init(dev);
|
|
if (err) {
|
|
mlx5_core_err(dev, "failed to initialize fw reset events\n");
|
|
- goto err_events_cleanup;
|
|
+ goto err_eq_cleanup;
|
|
}
|
|
|
|
mlx5_cq_debugfs_init(dev);
|
|
@@ -1121,8 +1115,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
|
|
mlx5_cleanup_reserved_gids(dev);
|
|
mlx5_cq_debugfs_cleanup(dev);
|
|
mlx5_fw_reset_cleanup(dev);
|
|
-err_events_cleanup:
|
|
- mlx5_events_cleanup(dev);
|
|
err_eq_cleanup:
|
|
mlx5_eq_table_cleanup(dev);
|
|
err_irq_cleanup:
|
|
@@ -1155,7 +1147,6 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
|
|
mlx5_cleanup_reserved_gids(dev);
|
|
mlx5_cq_debugfs_cleanup(dev);
|
|
mlx5_fw_reset_cleanup(dev);
|
|
- mlx5_events_cleanup(dev);
|
|
mlx5_eq_table_cleanup(dev);
|
|
mlx5_irq_table_cleanup(dev);
|
|
mlx5_devcom_unregister_device(dev->priv.devc);
|
|
@@ -1833,6 +1824,24 @@ static int vhca_id_show(struct seq_file *file, void *priv)
|
|
|
|
DEFINE_SHOW_ATTRIBUTE(vhca_id);
|
|
|
|
+static int mlx5_notifiers_init(struct mlx5_core_dev *dev)
|
|
+{
|
|
+ int err;
|
|
+
|
|
+ err = mlx5_events_init(dev);
|
|
+ if (err) {
|
|
+ mlx5_core_err(dev, "failed to initialize events\n");
|
|
+ return err;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void mlx5_notifiers_cleanup(struct mlx5_core_dev *dev)
|
|
+{
|
|
+ mlx5_events_cleanup(dev);
|
|
+}
|
|
+
|
|
int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
|
|
{
|
|
struct mlx5_priv *priv = &dev->priv;
|
|
@@ -1888,6 +1897,10 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
|
|
if (err)
|
|
goto err_hca_caps;
|
|
|
|
+ err = mlx5_notifiers_init(dev);
|
|
+ if (err)
|
|
+ goto err_hca_caps;
|
|
+
|
|
/* The conjunction of sw_vhca_id with sw_owner_id will be a global
|
|
* unique id per function which uses mlx5_core.
|
|
* Those values are supplied to FW as part of the init HCA command to
|
|
@@ -1930,6 +1943,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
|
|
if (priv->sw_vhca_id > 0)
|
|
ida_free(&sw_vhca_ida, dev->priv.sw_vhca_id);
|
|
|
|
+ mlx5_notifiers_cleanup(dev);
|
|
mlx5_hca_caps_free(dev);
|
|
mlx5_adev_cleanup(dev);
|
|
mlx5_pagealloc_cleanup(dev);
|
|
--
|
|
2.50.1 (Apple Git-155)
|
|
|