Roi Dayan
880b517691
net/mlx5: Bridge, Fix devlink deadlock on net namespace deletion
When changing mode to switchdev, rep bridge init registered to netdevice
notifier holds the devlink lock and then takes pernet_ops_rwsem.
At that time deleting a netns holds pernet_ops_rwsem and then takes
the devlink lock.
Example sequence is:
$ ip netns add foo
$ devlink dev eswitch set pci/0000:00:08.0 mode switchdev &
$ ip netns del foo
deleting netns trace:
[ 1185.365555] ? devlink_pernet_pre_exit+0x74/0x1c0
[ 1185.368331] ? mutex_lock_io_nested+0x13f0/0x13f0
[ 1185.370984] ? xt_find_table+0x40/0x100
[ 1185.373244] ? __mutex_lock+0x24a/0x15a0
[ 1185.375494] ? net_generic+0xa0/0x1c0
[ 1185.376844] ? wait_for_completion_io+0x280/0x280
[ 1185.377767] ? devlink_pernet_pre_exit+0x74/0x1c0
[ 1185.378686] devlink_pernet_pre_exit+0x74/0x1c0
[ 1185.379579] ? devlink_nl_cmd_get_dumpit+0x3a0/0x3a0
[ 1185.380557] ? xt_find_table+0xda/0x100
[ 1185.381367] cleanup_net+0x372/0x8e0
changing mode to switchdev trace:
[ 1185.411267] down_write+0x13a/0x150
[ 1185.412029] ? down_write_killable+0x180/0x180
[ 1185.413005] register_netdevice_notifier+0x1e/0x210
[ 1185.414000] mlx5e_rep_bridge_init+0x181/0x360 [mlx5_core]
[ 1185.415243] mlx5e_uplink_rep_enable+0x269/0x480 [mlx5_core]
[ 1185.416464] ? mlx5e_uplink_rep_disable+0x210/0x210 [mlx5_core]
[ 1185.417749] mlx5e_attach_netdev+0x232/0x400 [mlx5_core]
[ 1185.418906] mlx5e_netdev_attach_profile+0x15b/0x1e0 [mlx5_core]
[ 1185.420172] mlx5e_netdev_change_profile+0x15a/0x1d0 [mlx5_core]
[ 1185.421459] mlx5e_vport_rep_load+0x557/0x780 [mlx5_core]
[ 1185.422624] ? mlx5e_stats_grp_vport_rep_num_stats+0x10/0x10 [mlx5_core]
[ 1185.424006] mlx5_esw_offloads_rep_load+0xdb/0x190 [mlx5_core]
[ 1185.425277] esw_offloads_enable+0xd74/0x14a0 [mlx5_core]
Fix this by registering rep bridges for per net netdev notifier
instead of global one, which operats on the net namespace without holding
the pernet_ops_rwsem.
Fixes: 19e9bfa044 ("net/mlx5: Bridge, add offload infrastructure")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2022-02-01 20:59:40 -08:00
..
2022-01-14 16:02:28 +01:00
2022-01-22 11:28:23 +02:00
2022-01-03 13:44:38 +01:00
2022-01-21 18:39:16 +09:00
2022-01-13 12:50:48 +00:00
2022-01-22 08:33:35 +02:00
2022-01-23 06:20:44 +02:00
2022-01-18 10:05:48 +02:00
2022-01-16 08:08:11 +02:00
2022-01-22 08:33:35 +02:00
2022-01-22 08:33:35 +02:00
2022-01-21 09:16:11 +02:00
2022-01-10 13:53:16 +01:00
2022-01-26 18:57:09 -08:00
2022-01-06 15:51:13 +01:00
2022-01-06 18:31:33 +01:00
2022-01-05 18:31:17 +01:00
2022-01-18 10:05:48 +02:00
2022-01-04 17:29:31 -08:00
2022-01-15 20:37:06 +02:00
2022-01-18 14:03:34 +02:00
2022-01-16 06:52:38 +02:00
2022-01-10 11:45:23 -08:00
2021-12-24 15:27:52 +09:00
2022-01-19 19:37:44 -08:00
2021-12-22 15:38:12 +01:00
2022-01-20 17:38:23 +02:00
2022-01-27 17:55:20 +02:00
2021-12-21 10:13:26 +01:00
2022-01-21 15:10:02 +01:00
2022-01-16 15:53:00 +02:00
2022-01-23 06:20:44 +02:00
2022-01-18 10:05:48 +02:00
2022-01-13 02:05:50 +01:00
2022-01-23 06:20:44 +02:00
2022-01-23 06:20:44 +02:00
2022-01-17 08:27:55 +02:00
2022-01-18 10:05:48 +02:00
2022-01-13 09:05:29 -08:00
2021-12-30 12:12:12 -08:00
2022-01-12 16:59:22 -08:00
2022-01-22 08:33:35 +02:00
2022-01-13 11:19:07 -08:00
2022-01-12 15:46:11 -08:00
2022-01-23 06:20:44 +02:00
2022-01-11 11:35:28 -08:00
2022-01-10 10:33:52 -05:00
2022-01-12 11:11:34 -08:00
2022-01-16 08:08:11 +02:00
2022-01-23 06:20:44 +02:00
2022-01-14 15:08:36 +01:00
2022-02-01 20:59:40 -08:00
2022-01-12 14:17:45 +00:00
2022-01-17 08:14:18 +02:00
2022-01-22 08:33:37 +02:00
2022-01-18 10:05:48 +02:00
2022-01-12 10:35:23 -08:00
2021-12-21 10:26:50 +01:00
2022-01-22 09:52:17 +02:00
2022-01-22 11:28:23 +02:00
2022-01-23 17:45:00 +02:00
2022-01-16 08:08:11 +02:00
2022-01-13 09:05:29 -08:00
2022-01-14 16:02:28 +01:00
2022-01-12 10:56:08 -08:00
2022-01-22 08:33:37 +02:00
2022-01-22 08:33:37 +02:00
2022-01-11 11:26:57 -08:00
2021-12-27 16:51:12 +01:00
2022-01-06 12:18:08 +00:00
2022-01-20 13:25:01 +02:00
2021-12-21 10:22:19 +01:00
2022-01-07 13:36:35 +00:00
2022-01-17 16:44:26 -06:00
2022-01-10 08:32:37 -08:00
2022-01-27 11:23:26 +02:00
2022-01-16 23:50:34 +01:00
2022-01-12 15:46:11 -08:00
2022-01-23 06:20:44 +02:00
2022-01-23 06:20:44 +02:00
2022-01-14 16:02:28 +01:00
2022-01-14 14:55:38 +01:00
2022-01-17 05:49:30 +02:00
2022-01-10 08:13:52 -08:00
2022-01-17 19:48:07 +01:00
2021-12-28 10:43:56 +03:00
2022-01-23 06:20:44 +02:00
2021-12-29 10:54:50 +01:00
2022-01-22 08:33:37 +02:00
2022-01-18 10:05:48 +02:00
2022-01-20 13:31:46 +02:00
2022-01-14 18:50:54 -05:00
2022-01-16 06:52:38 +02:00
2022-01-23 06:20:44 +02:00
2022-01-14 18:50:53 -05:00
2021-12-21 10:38:13 +01:00
2022-01-17 08:07:57 +02:00
2022-01-06 09:53:41 +01:00
2022-01-22 08:33:37 +02:00