From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
David Ahern <dsa@cumulusnetworks.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH v3 net-next 1/5] net: sched: fix qdisc->running lockdep annotations
Date: Thu, 9 Jun 2016 07:45:11 -0700 [thread overview]
Message-ID: <1465483515-10821-2-git-send-email-edumazet@google.com> (raw)
In-Reply-To: <1465483515-10821-1-git-send-email-edumazet@google.com>
1) qdisc_run_begin() is really using the equivalent of a trylock.
Instead of using write_seqcount_begin(), use a combination of
raw_write_seqcount_begin() and correct lockdep annotation.
2) sch_direct_xmit() should use regular spin_lock(root_lock)
Fixes: f9eb8aea2a1e ("net_sched: transform qdisc running bit into a seqcount")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: David Ahern <dsa@cumulusnetworks.com>
---
include/net/sch_generic.h | 6 +++++-
net/sched/sch_generic.c | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c4f5749342ec..d53ecfc1d60e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -104,7 +104,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;
}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index cebea73e70ac..cad810b45e31 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -137,10 +137,10 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
HARD_TX_UNLOCK(dev, txq);
} else {
- spin_lock_nested(root_lock, SINGLE_DEPTH_NESTING);
+ spin_lock(root_lock);
return qdisc_qlen(q);
}
- spin_lock_nested(root_lock, SINGLE_DEPTH_NESTING);
+ spin_lock(root_lock);
if (dev_xmit_complete(ret)) {
/* Driver sent out skb successfully or skb was consumed */
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-06-09 14:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 14:45 [PATCH v3 net-next 0/5] net: better lockdep annotations Eric Dumazet
2016-06-09 14:45 ` Eric Dumazet [this message]
2016-06-09 14:45 ` [PATCH v3 net-next 2/5] net: add netdev_lockdep_set_classes() helper Eric Dumazet
2016-06-09 14:45 ` [PATCH v3 net-next 3/5] net: vrf: call netdev_lockdep_set_classes() Eric Dumazet
2016-06-09 15:05 ` David Ahern
2016-06-09 14:45 ` [PATCH v3 net-next 4/5] net: macvlan: " Eric Dumazet
2016-06-09 14:45 ` [PATCH v3 net-next 5/5] net: ipvlan: " Eric Dumazet
2016-06-09 20:29 ` [PATCH v3 net-next 0/5] net: better lockdep annotations David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465483515-10821-2-git-send-email-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).