Commit e93c937
devlink: change per-devlink netdev notifier to static one
The commit 565b482 ("devlink: change port event netdev notifier
from per-net to global") changed original per-net notifier to be
per-devlink instance. That fixed the issue of non-receiving events
of netdev uninit if that moved to a different namespace.
That worked fine in -net tree.
However, later on when commit ee75f1f ("net/mlx5e: Create
separate devlink instance for ethernet auxiliary device") and
commit 72ed5d5 ("net/mlx5: Suspend auxiliary devices only in
case of PCI device suspend") were merged, a deadlock was introduced
when removing a namespace with devlink instance with another nested
instance.
Here there is the bad flow example resulting in deadlock with mlx5:
net_cleanup_work -> cleanup_net (takes down_read(&pernet_ops_rwsem) ->
devlink_pernet_pre_exit() -> devlink_reload() ->
mlx5_devlink_reload_down() -> mlx5_unload_one_devl_locked() ->
mlx5_detach_device() -> del_adev() -> mlx5e_remove() ->
mlx5e_destroy_devlink() -> devlink_free() ->
unregister_netdevice_notifier() (takes down_write(&pernet_ops_rwsem)
Steps to reproduce:
$ modprobe mlx5_core
$ ip netns add ns1
$ devlink dev reload pci/0000:08:00.0 netns ns1
$ ip netns del ns1
Resolve this by converting the notifier from per-devlink instance to
a static one registered during init phase and leaving it registered
forever. Use this notifier for all devlink port instances created
later on.
Note what a tree needs this fix only in case all of the cited fixes
commits are present.
Reported-by: Moshe Shemesh <[email protected]>
Fixes: 565b482 ("devlink: change port event netdev notifier from per-net to global")
Fixes: ee75f1f ("net/mlx5e: Create separate devlink instance for ethernet auxiliary device")
Fixes: 72ed5d5 ("net/mlx5: Suspend auxiliary devices only in case of PCI device suspend")
Signed-off-by: Jiri Pirko <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent 7ce93d6 commit e93c937
3 files changed
+9
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | 207 | | |
213 | 208 | | |
214 | 209 | | |
| |||
233 | 228 | | |
234 | 229 | | |
235 | 230 | | |
236 | | - | |
237 | | - | |
238 | 231 | | |
239 | 232 | | |
240 | 233 | | |
| |||
266 | 259 | | |
267 | 260 | | |
268 | 261 | | |
269 | | - | |
270 | | - | |
271 | 262 | | |
272 | 263 | | |
273 | 264 | | |
| |||
303 | 294 | | |
304 | 295 | | |
305 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
306 | 301 | | |
307 | 302 | | |
308 | 303 | | |
| |||
311 | 306 | | |
312 | 307 | | |
313 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
314 | 312 | | |
315 | 313 | | |
316 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7073 | 7073 | | |
7074 | 7074 | | |
7075 | 7075 | | |
7076 | | - | |
7077 | | - | |
7078 | | - | |
| 7076 | + | |
7079 | 7077 | | |
| 7078 | + | |
7080 | 7079 | | |
7081 | 7080 | | |
7082 | 7081 | | |
| |||
0 commit comments