net: core: add generic lockdep keys
Some interface types could be nested. (VLAN, BONDING, TEAM, MACSEC, MACVLAN, IPVLAN, VIRT_WIFI, VXLAN, etc..) These interface types should set lockdep class because, without lockdep class key, lockdep always warn about unexisting circular locking. In the current code, these interfaces have their own lockdep class keys and these manage itself. So that there are so many duplicate code around the /driver/net and /net/. This patch adds new generic lockdep keys and some helper functions for it. This patch does below changes. a) Add lockdep class keys in struct net_device - qdisc_running, xmit, addr_list, qdisc_busylock - these keys are used as dynamic lockdep key. b) When net_device is being allocated, lockdep keys are registered. - alloc_netdev_mqs() c) When net_device is being free'd llockdep keys are unregistered. - free_netdev() d) Add generic lockdep key helper function - netdev_register_lockdep_key() - netdev_unregister_lockdep_key() - netdev_update_lockdep_key() e) Remove unnecessary generic lockdep macro and functions f) Remove unnecessary lockdep code of each interfaces. After this patch, each interface modules don't need to maintain their lockdep keys. Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
				
					committed by
					
						 David S. Miller
						David S. Miller
					
				
			
			
				
	
			
			
			
						parent
						
							5343da4c17
						
					
				
				
					commit
					ab92d68fc2
				
			| @@ -24,8 +24,6 @@ | ||||
| const struct nf_br_ops __rcu *nf_br_ops __read_mostly; | ||||
| EXPORT_SYMBOL_GPL(nf_br_ops); | ||||
| 
 | ||||
| static struct lock_class_key bridge_netdev_addr_lock_key; | ||||
| 
 | ||||
| /* net device transmit always called with BH disabled */ | ||||
| netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | ||||
| { | ||||
| @@ -108,11 +106,6 @@ out: | ||||
| 	return NETDEV_TX_OK; | ||||
| } | ||||
| 
 | ||||
| static void br_set_lockdep_class(struct net_device *dev) | ||||
| { | ||||
| 	lockdep_set_class(&dev->addr_list_lock, &bridge_netdev_addr_lock_key); | ||||
| } | ||||
| 
 | ||||
| static int br_dev_init(struct net_device *dev) | ||||
| { | ||||
| 	struct net_bridge *br = netdev_priv(dev); | ||||
| @@ -150,7 +143,6 @@ static int br_dev_init(struct net_device *dev) | ||||
| 		br_mdb_hash_fini(br); | ||||
| 		br_fdb_hash_fini(br); | ||||
| 	} | ||||
| 	br_set_lockdep_class(dev); | ||||
| 
 | ||||
| 	return err; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user