diff options
| author | David S. Miller <davem@davemloft.net> | 2016-06-09 23:28:38 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-06-09 23:28:38 +0300 |
| commit | cf515802043cccecfe9ab75065f8fc71e6ec9bab (patch) | |
| tree | e2596fb5628d463cc4acb13f282a612496174aae /include | |
| parent | 5362855aba7159aab8f7c6573eb675d9da317914 (diff) | |
| parent | 0d7dd798fd89d986a6c59030b704827a4e6a13b4 (diff) | |
| download | linux-cf515802043cccecfe9ab75065f8fc71e6ec9bab.tar.xz | |
Merge branch 'netdev_lockdep_set_classes'
Eric Dumazet says:
====================
net: better lockdep annotations
Introduction of qdisc->running seqcount added lockdep false positives.
While chasing the bug, it came to me that we had a lot of copies of the
same stuff in virtual drivers.
This patch series has the qdisc->running fix (considers that a trylock
is attempted in lockdep terminology), and adds a generic helper so
that we no longer have to patch many virtual drivers when a new per-device
or per-qdisc lock is added.
Thanks to David Ahern for reporting the issue and testing my patches :)
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/netdevice.h | 17 | ||||
| -rw-r--r-- | include/net/sch_generic.h | 6 |
2 files changed, 22 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 541562333ba5..4f234b102892 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1946,6 +1946,23 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, f(dev, &dev->_tx[i], arg); } +#define netdev_lockdep_set_classes(dev) \ +{ \ + static struct lock_class_key qdisc_tx_busylock_key; \ + static struct lock_class_key qdisc_running_key; \ + static struct lock_class_key qdisc_xmit_lock_key; \ + static struct lock_class_key dev_addr_list_lock_key; \ + unsigned int i; \ + \ + (dev)->qdisc_tx_busylock = &qdisc_tx_busylock_key; \ + (dev)->qdisc_running_key = &qdisc_running_key; \ + lockdep_set_class(&(dev)->addr_list_lock, \ + &dev_addr_list_lock_key); \ + for (i = 0; i < (dev)->num_tx_queues; i++) \ + lockdep_set_class(&(dev)->_tx[i]._xmit_lock, \ + &qdisc_xmit_lock_key); \ +} + struct netdev_queue *netdev_pick_tx(struct net_device *dev, struct sk_buff *skb, void *accel_priv); diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 49534e28824b..a4c0f1649e2b 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -97,7 +97,11 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) { if (qdisc_is_running(qdisc)) return false; - write_seqcount_begin(&qdisc->running); + /* Variant of write_seqcount_begin() telling lockdep a trylock + * was attempted. + */ + raw_write_seqcount_begin(&qdisc->running); + seqcount_acquire(&qdisc->running.dep_map, 0, 1, _RET_IP_); return true; } |
