Skip to content

Commit

Permalink
net: get rid of lockdep_set_class_and_subclass()
Browse files Browse the repository at this point in the history
lockdep_set_class_and_subclass() is meant to reduce
the _nested() annotations by assigning a default subclass.
For addr_list_lock, we have to compute the subclass at
run-time as the netdevice topology changes after creation.

So, we should just get rid of these
lockdep_set_class_and_subclass() and stick with our _nested()
annotations.

Fixes: 845e0eb ("net: change addr_list_lock back to static key")
Suggested-by: Taehee Yoo <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
congwang authored and davem330 committed Jun 29, 2020
1 parent 7dea927 commit be74294
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions drivers/net/macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -4052,9 +4052,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
return err;

netdev_lockdep_set_classes(dev);
lockdep_set_class_and_subclass(&dev->addr_list_lock,
&macsec_netdev_addr_lock_key,
dev->lower_level);
lockdep_set_class(&dev->addr_list_lock,
&macsec_netdev_addr_lock_key);

err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0)
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,8 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
static void macvlan_set_lockdep_class(struct net_device *dev)
{
netdev_lockdep_set_classes(dev);
lockdep_set_class_and_subclass(&dev->addr_list_lock,
&macvlan_netdev_addr_lock_key,
dev->lower_level);
lockdep_set_class(&dev->addr_list_lock,
&macvlan_netdev_addr_lock_key);
}

static int macvlan_init(struct net_device *dev)
Expand Down
9 changes: 4 additions & 5 deletions net/8021q/vlan_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,10 @@ static void vlan_dev_set_lockdep_one(struct net_device *dev,
lockdep_set_class(&txq->_xmit_lock, &vlan_netdev_xmit_lock_key);
}

static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass)
static void vlan_dev_set_lockdep_class(struct net_device *dev)
{
lockdep_set_class_and_subclass(&dev->addr_list_lock,
&vlan_netdev_addr_lock_key,
subclass);
lockdep_set_class(&dev->addr_list_lock,
&vlan_netdev_addr_lock_key);
netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, NULL);
}

Expand Down Expand Up @@ -601,7 +600,7 @@ static int vlan_dev_init(struct net_device *dev)

SET_NETDEV_DEVTYPE(dev, &vlan_type);

vlan_dev_set_lockdep_class(dev, dev->lower_level);
vlan_dev_set_lockdep_class(dev);

vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
if (!vlan->vlan_pcpu_stats)
Expand Down

0 comments on commit be74294

Please sign in to comment.