diff mbox series

[net,v2,05/11] net/mlx5e: use netdev_lockdep_set_classes

Message ID 20250327135659.2057487-6-sdf@fomichev.me (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: hold instance lock during NETDEV_UP/REGISTER/UNREGISTER | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 518 this patch: 518
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: saeedm@nvidia.com linux-rdma@vger.kernel.org tariqt@nvidia.com leon@kernel.org andrew+netdev@lunn.ch
netdev/build_clang success Errors and warnings before: 966 this patch: 966
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 15128 this patch: 15128
netdev/checkpatch warning WARNING: Unknown link reference '0:', use 'Link:' or 'Closes:' instead
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Stanislav Fomichev March 27, 2025, 1:56 p.m. UTC
Cosmin reports a potential recursive lock warning in [0]. mlx5 is
using register_netdevice_notifier_dev_net which might result in
iteration over entire netns which triggers lock ordering issues.
We know that lower devices are independent, so it's save to
suppress the lockdep.

0: https://lore.kernel.org/netdev/672305efd02d3d29520f49a1c18e2f4da6e90902.camel@nvidia.com/

Reported-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jakub Kicinski March 27, 2025, 7:08 p.m. UTC | #1
On Thu, 27 Mar 2025 06:56:53 -0700 Stanislav Fomichev wrote:
> Cosmin reports a potential recursive lock warning in [0]. mlx5 is
> using register_netdevice_notifier_dev_net which might result in
> iteration over entire netns which triggers lock ordering issues.
> We know that lower devices are independent, so it's save to
> suppress the lockdep.

But mlx5 does not use instance locking, yet, so lets defer this one?
Stanislav Fomichev March 27, 2025, 9:05 p.m. UTC | #2
On 03/27, Jakub Kicinski wrote:
> On Thu, 27 Mar 2025 06:56:53 -0700 Stanislav Fomichev wrote:
> > Cosmin reports a potential recursive lock warning in [0]. mlx5 is
> > using register_netdevice_notifier_dev_net which might result in
> > iteration over entire netns which triggers lock ordering issues.
> > We know that lower devices are independent, so it's save to
> > suppress the lockdep.
> 
> But mlx5 does not use instance locking, yet, so lets defer this one?

SG! Maybe the mlx folks can have it as part of their queue mgmt work?
Cosmin are you ok with adding this to your patch series?
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3506024c2453..e3d8d6c9bf03 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -40,6 +40,7 @@ 
 #include <linux/if_bridge.h>
 #include <linux/filter.h>
 #include <net/netdev_queues.h>
+#include <net/netdev_lock.h>
 #include <net/page_pool/types.h>
 #include <net/pkt_sched.h>
 #include <net/xdp_sock_drv.h>
@@ -5454,6 +5455,7 @@  static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	netdev->netdev_ops = &mlx5e_netdev_ops;
 	netdev->xdp_metadata_ops = &mlx5e_xdp_metadata_ops;
 	netdev->xsk_tx_metadata_ops = &mlx5e_xsk_tx_metadata_ops;
+	netdev_lockdep_set_classes(netdev);
 
 	mlx5e_dcbnl_build_netdev(netdev);