* [PATCH net 0/3] net: core: fix a lockdep splat in the dev_addr_list.
@ 2020-09-25 18:12 Taehee Yoo
2020-09-28 22:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Taehee Yoo @ 2020-09-25 18:12 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ap420073, xiyou.wangcong
This patchset is to avoid lockdep splat.
When a stacked interface graph is changed, netif_addr_lock() is called
recursively and it internally calls spin_lock_nested().
The parameter of spin_lock_nested() is 'dev->lower_level',
this is called subclass.
The problem of 'dev->lower_level' is that while 'dev->lower_level' is
being used as a subclass of spin_lock_nested(), its value can be changed.
So, spin_lock_nested() would be called recursively with the same
subclass value, the lockdep understands a deadlock.
In order to avoid this, a new variable is needed and it is going to be
used as a parameter of spin_lock_nested().
The first and second patch is a preparation patch for the third patch.
In the third patch, the problem will be fixed.
The first patch is to add __netdev_upper_dev_unlink().
An existed netdev_upper_dev_unlink() is renamed to
__netdev_upper_dev_unlink(). and netdev_upper_dev_unlink()
is added as an wrapper of this function.
The second patch is to add the netdev_nested_priv structure.
netdev_walk_all_{ upper | lower }_dev() pass both private functions
and "data" pointer to handle their own things.
At this point, the data pointer type is void *.
In order to make it easier to expand common variables and functions,
this new netdev_nested_priv structure is added.
The third patch is to add a new variable 'nested_level'
into the net_device structure.
This variable will be used as a parameter of spin_lock_nested() of
dev->addr_list_lock.
Due to this variable, it can avoid lockdep splat.
Taehee Yoo (3):
net: core: add __netdev_upper_dev_unlink()
net: core: introduce struct netdev_nested_priv for nested interface
infrastructure
net: core: add nested_level variable in net_device
drivers/infiniband/core/cache.c | 10 +-
drivers/infiniband/core/cma.c | 9 +-
drivers/infiniband/core/roce_gid_mgmt.c | 9 +-
drivers/infiniband/ulp/ipoib/ipoib_main.c | 9 +-
drivers/net/bonding/bond_alb.c | 9 +-
drivers/net/bonding/bond_main.c | 10 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 37 ++--
.../net/ethernet/mellanox/mlxsw/spectrum.c | 24 +--
.../ethernet/mellanox/mlxsw/spectrum_router.c | 11 +-
.../mellanox/mlxsw/spectrum_switchdev.c | 10 +-
drivers/net/ethernet/rocker/rocker_main.c | 9 +-
drivers/net/wireless/quantenna/qtnfmac/core.c | 10 +-
include/linux/netdevice.h | 68 ++++++--
net/bridge/br_arp_nd_proxy.c | 26 ++-
net/bridge/br_vlan.c | 20 ++-
net/core/dev.c | 164 +++++++++++++-----
net/core/dev_addr_lists.c | 12 +-
17 files changed, 318 insertions(+), 129 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net 0/3] net: core: fix a lockdep splat in the dev_addr_list.
2020-09-25 18:12 [PATCH net 0/3] net: core: fix a lockdep splat in the dev_addr_list Taehee Yoo
@ 2020-09-28 22:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-28 22:14 UTC (permalink / raw)
To: ap420073; +Cc: kuba, netdev, xiyou.wangcong
From: Taehee Yoo <ap420073@gmail.com>
Date: Fri, 25 Sep 2020 18:12:46 +0000
> This patchset is to avoid lockdep splat.
>
> When a stacked interface graph is changed, netif_addr_lock() is called
> recursively and it internally calls spin_lock_nested().
> The parameter of spin_lock_nested() is 'dev->lower_level',
> this is called subclass.
> The problem of 'dev->lower_level' is that while 'dev->lower_level' is
> being used as a subclass of spin_lock_nested(), its value can be changed.
> So, spin_lock_nested() would be called recursively with the same
> subclass value, the lockdep understands a deadlock.
> In order to avoid this, a new variable is needed and it is going to be
> used as a parameter of spin_lock_nested().
> The first and second patch is a preparation patch for the third patch.
> In the third patch, the problem will be fixed.
>
> The first patch is to add __netdev_upper_dev_unlink().
> An existed netdev_upper_dev_unlink() is renamed to
> __netdev_upper_dev_unlink(). and netdev_upper_dev_unlink()
> is added as an wrapper of this function.
>
> The second patch is to add the netdev_nested_priv structure.
> netdev_walk_all_{ upper | lower }_dev() pass both private functions
> and "data" pointer to handle their own things.
> At this point, the data pointer type is void *.
> In order to make it easier to expand common variables and functions,
> this new netdev_nested_priv structure is added.
>
> The third patch is to add a new variable 'nested_level'
> into the net_device structure.
> This variable will be used as a parameter of spin_lock_nested() of
> dev->addr_list_lock.
> Due to this variable, it can avoid lockdep splat.
Series applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-28 23:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 18:12 [PATCH net 0/3] net: core: fix a lockdep splat in the dev_addr_list Taehee Yoo
2020-09-28 22:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).