From: Vladimir Oltean <olte...@gmail.com> Date: Tue, 8 Sep 2020 02:48:42 +0300
> Since commit 845e0ebb4408 ("net: change addr_list_lock back to static > key"), cascaded DSA setups (DSA switch port as DSA master for another > DSA switch port) are emitting this lockdep warning: ... > Since DSA never made use of the netdev API for describing links between > upper devices and lower devices, the dev->lower_level value of a DSA > switch interface would be 1, which would warn when it is a DSA master. > > We can use netdev_upper_dev_link() to describe the relationship between > a DSA slave and a DSA master. To be precise, a DSA "slave" (switch port) > is an "upper" to a DSA "master" (host port). The relationship is "many > uppers to one lower", like in the case of VLAN. So, for that reason, we > use the same function as VLAN uses. > > There might be a chance that somebody will try to take hold of this > interface and use it immediately after register_netdev() and before > netdev_upper_dev_link(). To avoid that, we do the registration and > linkage while holding the RTNL, and we use the RTNL-locked cousin of > register_netdev(), which is register_netdevice(). > > Since this warning was not there when lockdep was using dynamic keys for > addr_list_lock, we are blaming the lockdep patch itself. The network > stack _has_ been using static lockdep keys before, and it _is_ likely > that stacked DSA setups have been triggering these lockdep warnings > since forever, however I can't test very old kernels on this particular > stacked DSA setup, to ensure I'm not in fact introducing regressions. > > Fixes: 845e0ebb4408 ("net: change addr_list_lock back to static key") > Suggested-by: Cong Wang <xiyou.wangc...@gmail.com> > Signed-off-by: Vladimir Oltean <olte...@gmail.com> Applied and queued up for v5.8 -stable, thanks.