public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [2.6.36-rc5] INET?: possible irq lock inversion dependency
Date: Wed, 22 Sep 2010 10:38:01 +0200	[thread overview]
Message-ID: <1285144681.2639.102.camel@edumazet-laptop> (raw)
In-Reply-To: <1285144471.2639.96.camel@edumazet-laptop>

Le mercredi 22 septembre 2010 à 10:34 +0200, Eric Dumazet a écrit :

> small bug in my patch , please delete the orphan line :
> 
> >  			af_callback_keys + sk->sk_family,
> 
> 
> >  			af_family_clock_key_strings[sk->sk_family]);
> >  
> 

Updated and booted/tested patch :

 include/net/sock.h |    1 +
 net/core/sock.c    |    8 ++++++--
 net/ipv4/udp.c     |    3 +++
 net/ipv4/udplite.c |    3 +++
 net/ipv6/udp.c     |    3 +++
 net/ipv6/udplite.c |    3 +++
 6 files changed, 19 insertions(+), 2 deletions(-)


diff --git a/include/net/sock.h b/include/net/sock.h
index adab9dc..c5104bc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -800,6 +800,7 @@ struct proto {
 #ifdef SOCK_REFCNT_DEBUG
 	atomic_t		socks;
 #endif
+	struct lock_class_key *callback_key;
 };
 
 extern int proto_register(struct proto *prot, int alloc_slab);
diff --git a/net/core/sock.c b/net/core/sock.c
index b05b9b6..79ef50a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1210,7 +1210,9 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
 		spin_lock_init(&newsk->sk_dst_lock);
 		rwlock_init(&newsk->sk_callback_lock);
 		lockdep_set_class_and_name(&newsk->sk_callback_lock,
-				af_callback_keys + newsk->sk_family,
+				sk->sk_prot->callback_key ?
+					sk->sk_prot->callback_key :
+					af_callback_keys + newsk->sk_family,
 				af_family_clock_key_strings[newsk->sk_family]);
 
 		newsk->sk_dst_cache	= NULL;
@@ -1965,7 +1967,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
 	spin_lock_init(&sk->sk_dst_lock);
 	rwlock_init(&sk->sk_callback_lock);
 	lockdep_set_class_and_name(&sk->sk_callback_lock,
-			af_callback_keys + sk->sk_family,
+			sk->sk_prot->callback_key ?
+				sk->sk_prot->callback_key :
+				af_callback_keys + sk->sk_family,
 			af_family_clock_key_strings[sk->sk_family]);
 
 	sk->sk_state_change	=	sock_def_wakeup;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index fb23c2e..c0877b6 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1870,6 +1870,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
 }
 EXPORT_SYMBOL(udp_poll);
 
+static struct lock_class_key udp_callback_key;
+
 struct proto udp_prot = {
 	.name		   = "UDP",
 	.owner		   = THIS_MODULE,
@@ -1899,6 +1901,7 @@ struct proto udp_prot = {
 	.compat_setsockopt = compat_udp_setsockopt,
 	.compat_getsockopt = compat_udp_getsockopt,
 #endif
+	.callback_key	   = &udp_callback_key,
 };
 EXPORT_SYMBOL(udp_prot);
 
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index ab76aa9..51b159d 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -32,6 +32,8 @@ static const struct net_protocol udplite_protocol = {
 	.netns_ok	= 1,
 };
 
+static struct lock_class_key udplite_callback_key;
+
 struct proto 	udplite_prot = {
 	.name		   = "UDP-Lite",
 	.owner		   = THIS_MODULE,
@@ -57,6 +59,7 @@ struct proto 	udplite_prot = {
 	.compat_setsockopt = compat_udp_setsockopt,
 	.compat_getsockopt = compat_udp_getsockopt,
 #endif
+	.callback_key	   = &udplite_callback_key,
 };
 EXPORT_SYMBOL(udplite_prot);
 
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 5acb356..0777934 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1441,6 +1441,8 @@ void udp6_proc_exit(struct net *net) {
 
 /* ------------------------------------------------------------------------ */
 
+static struct lock_class_key udp6_callback_key;
+
 struct proto udpv6_prot = {
 	.name		   = "UDPv6",
 	.owner		   = THIS_MODULE,
@@ -1469,6 +1471,7 @@ struct proto udpv6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
+	.callback_key	   = &udp6_callback_key,
 };
 
 static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 5f48fad..7bbb627 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -31,6 +31,8 @@ static const struct inet6_protocol udplitev6_protocol = {
 	.flags		=	INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
 };
 
+static struct lock_class_key udp6lite_callback_key;
+
 struct proto udplitev6_prot = {
 	.name		   = "UDPLITEv6",
 	.owner		   = THIS_MODULE,
@@ -55,6 +57,7 @@ struct proto udplitev6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
+	.callback_key	   = &udp6lite_callback_key,
 };
 
 static struct inet_protosw udplite6_protosw = {


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-09-22  8:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24 11:53 [2.6.35-rc3] NFS: possible irq lock inversion dependency Tetsuo Handa
2010-09-07 12:32 ` [2.6.36-rc3] " Tetsuo Handa
2010-09-21  6:51   ` [2.6.35-rc5] INET?: " Tetsuo Handa
2010-09-21  7:56     ` Eric Dumazet
2010-09-21  9:10       ` [2.6.36-rc5] " Tetsuo Handa
2010-09-21  9:35         ` Eric Dumazet
2010-09-21 10:13           ` Eric Dumazet
2010-09-22  7:14             ` Tetsuo Handa
2010-09-22  8:31               ` Eric Dumazet
2010-09-22  8:34                 ` Eric Dumazet
2010-09-22  8:38                   ` Eric Dumazet [this message]
2010-09-22  8:58                     ` Tetsuo Handa
2010-09-22 17:35                       ` Eric Dumazet
2010-09-22 19:34                         ` [PATCH] net: fix a lockdep splat Eric Dumazet
2010-09-22 20:33                           ` David Miller
2010-09-22 22:13                           ` Jarek Poplawski
2010-09-22 22:43                             ` Eric Dumazet
2010-09-23  3:53                               ` David Miller
2010-09-23  4:23                                 ` David Miller
2010-09-23  5:05                                   ` Eric Dumazet
2010-09-23  5:42                               ` Eric Dumazet
2010-09-23  6:32                               ` Tetsuo Handa
2010-09-23  6:44                                 ` Eric Dumazet
2010-09-25  5:26                                 ` 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=1285144681.2639.102.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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