Re: [PATCH]: Schedule correct qdisc in watchdog.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jarek Poplawski
Date: Monday, August 18, 2008 - 4:35 am

On Mon, Aug 18, 2008 at 11:20:22AM +0000, Jarek Poplawski wrote:

Or I'll better resend this, because of some problems with this link.
Denys, please apply this for testing until it's merged.

Jarek P.

------------------> (resend)

pkt_sched: Add lockdep annotation for qdisc locks

Qdisc locks are initialized in the same function, qdisc_alloc(), so
lockdep can't distinguish tx qdisc lock from rx and reports "possible
recursive locking detected" when both these locks are taken eg. while
using act_mirred with ifb. This looks like a false positive. Anyway,
after this patch these locks will be reported more exactly.


Reported-by: Denys Fedoryshchenko <denys@visp.net.lb>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

---

 net/sched/sch_api.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index c25465e..bf84181 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -27,6 +27,7 @@
 #include <linux/kmod.h>
 #include <linux/list.h>
 #include <linux/hrtimer.h>
+#include <linux/lockdep.h>
 
 #include <net/net_namespace.h>
 #include <net/sock.h>
@@ -707,6 +708,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
 	return err;
 }
 
+/* lockdep annotation is needed for ingress; egress gets it only for name */
+static struct lock_class_key qdisc_tx_lock;
+static struct lock_class_key qdisc_rx_lock;
+
 /*
    Allocate and initialize new qdisc.
 
@@ -767,6 +772,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
 	if (handle == TC_H_INGRESS) {
 		sch->flags |= TCQ_F_INGRESS;
 		handle = TC_H_MAKE(TC_H_INGRESS, 0);
+		lockdep_set_class(qdisc_lock(sch), &qdisc_rx_lock);
 	} else {
 		if (handle == 0) {
 			handle = qdisc_alloc_handle(dev);
@@ -774,6 +780,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
 			if (handle == 0)
 				goto err_out3;
 		}
+		lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock);
 	}
 
 	sch->handle = handle;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 1:39 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 2:10 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 2:31 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 2:47 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 3:10 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 3:35 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 3:43 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Denys Fedoryshchenko, (Mon Aug 18, 4:04 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 4:06 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 4:20 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 4:35 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Denys Fedoryshchenko, (Mon Aug 18, 5:45 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 5:58 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 8:55 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., Denys Fedoryshchenko, (Mon Aug 18, 11:05 am)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 4:56 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 8:51 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 8:54 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 9:08 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 10:37 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Mon Aug 18, 10:39 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 10:42 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., Jarek Poplawski, (Mon Aug 18, 11:59 pm)
Re: [PATCH]: Schedule correct qdisc in watchdog., David Miller, (Tue Aug 19, 12:03 am)