diff mbox

kernel panic in qdisc_match_from_root starting openvswitch

Message ID alpine.LNX.2.00.1608162150110.22028@cbobk.fhfr.pm
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Kosina Aug. 16, 2016, 7:51 p.m. UTC
On Tue, 16 Aug 2016, Jiri Kosina wrote:

> > I am hitting a kernel panic with '/etc/init.d/openvswitch-switch 
> > restart' Stack trace below. Reverting 59cc1f61f09c ("net: sched: convert 
> > qdisc linked list to hashtable") clears the problem.
> 
> Thanks a lot for the report. Could you please test either with the 
> attached two patches applied on top of net-next, or alternatively with 
> 'might-rebase/net-sched-qdiscs' branch of
> 
> 	git://git.kernel.org/pub/scm/linux/kernel/git/jikos/jikos.git
> 
> (HEAD of that branch is 60b3487ad7f) and report back to me whether it 
> fixes any issues you are seeing? Applying the attached patches on top of 
> net-next or testing with the git branch above should be equivalent test 
> wrt. qdiscs.

And this time hopefully with the actual patches ...

Comments

David Ahern Aug. 16, 2016, 8:06 p.m. UTC | #1
On 8/16/16 1:51 PM, Jiri Kosina wrote:
> On Tue, 16 Aug 2016, Jiri Kosina wrote:
> 
>>> I am hitting a kernel panic with '/etc/init.d/openvswitch-switch 
>>> restart' Stack trace below. Reverting 59cc1f61f09c ("net: sched: convert 
>>> qdisc linked list to hashtable") clears the problem.
>>
>> Thanks a lot for the report. Could you please test either with the 
>> attached two patches applied on top of net-next, or alternatively with 
>> 'might-rebase/net-sched-qdiscs' branch of
>>
>> 	git://git.kernel.org/pub/scm/linux/kernel/git/jikos/jikos.git
>>
>> (HEAD of that branch is 60b3487ad7f) and report back to me whether it 
>> fixes any issues you are seeing? Applying the attached patches on top of 
>> net-next or testing with the git branch above should be equivalent test 
>> wrt. qdiscs.
> 
> And this time hopefully with the actual patches ... 
> 

Applied both and no longer see the panic starting openvswitch.
diff mbox

Patch

From 60b3487ad7fad232f9e89973fee409c33a1f65a1 Mon Sep 17 00:00:00 2001
From: Jiri Kosina <jkosina@suse.cz>
Date: Tue, 16 Aug 2016 18:14:35 +0200
Subject: [PATCH 2/2] net: sched: avoid duplicates in qdisc dump

FIXME: add changelog

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 net/sched/sch_api.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 2b75d68..bb569ac 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1440,7 +1440,7 @@  err_out:
 
 static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
 			      struct netlink_callback *cb,
-			      int *q_idx_p, int s_q_idx)
+			      int *q_idx_p, int s_q_idx, bool one)
 {
 	int ret = 0, q_idx = *q_idx_p;
 	struct Qdisc *q;
@@ -1460,7 +1460,13 @@  static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
 		q_idx++;
 	}
 
-	if (!qdisc_dev(root))
+	/* If dumping singletons, there is no qdisc_dev(root) and the singleton
+	 * itself has already been dumped.
+	 *
+	 * If we've already dumped the top-level (ingress) qdisc above and the global
+	 * qdisc hashtable, we don't want to hit it again
+	 */
+	if (!qdisc_dev(root) || one)
 		goto out;
 
 	hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) {
@@ -1504,13 +1510,13 @@  static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
 			s_q_idx = 0;
 		q_idx = 0;
 
-		if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx) < 0)
+		if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx, false) < 0)
 			goto done;
 
 		dev_queue = dev_ingress_queue(dev);
 		if (dev_queue &&
 		    tc_dump_qdisc_root(dev_queue->qdisc_sleeping, skb, cb,
-				       &q_idx, s_q_idx) < 0)
+				       &q_idx, s_q_idx, true) < 0)
 			goto done;
 
 cont:
-- 
1.9.2