[patch] lockdep, annotate slocks: turn lockdep off for them

From: Ingo Molnar
Date: Fri Jun 30 2006 - 03:25:47 EST



Miles, does the patch below make the message go away?

Ingo

----------------
Subject: lockdep, annotate slocks: turn lockdep off for them
From: Ingo Molnar <mingo@xxxxxxx>

temporary solution to turn off slock related false positives:
the slock is pretty much the only lock type in the kernel that
is half spinlock, half waitqueue. "Process level" and "softirq level"
uses of slock are excluded - albeit the spinlock itself is not
permanently held in process context.

The right solution will be to annotate slock uses with
acquire()/release(). (i.e. to treat sock_owned_by_user() flagged
areas as an exclusion area too)

(this temporary solution is not as bad as it might sound, because it
does not eliminate the various ->sk_backlog_rcv() related dependencies
from the validator's dependency graph - what it does is that it doesnt
record them relative to slock. [the callbacks will still be executed and
covered when the backlog is processed.])

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
net/core/sock.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux/net/core/sock.c
===================================================================
--- linux.orig/net/core/sock.c
+++ linux/net/core/sock.c
@@ -250,9 +250,17 @@ int sk_receive_skb(struct sock *sk, stru
skb->dev = NULL;

bh_lock_sock(sk);
- if (!sock_owned_by_user(sk))
+ if (!sock_owned_by_user(sk)) {
+ /*
+ * FIXME: teach the validator about slocks.
+ *
+ * For now we dont record dependencies in
+ * this codepath.
+ */
+ lockdep_off();
rc = sk->sk_backlog_rcv(sk, skb);
- else
+ lockdep_on();
+ } else
sk_add_backlog(sk, skb);
bh_unlock_sock(sk);
out:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/