netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set()
@ 2010-04-27  6:40 Eric Dumazet
  2010-04-27 16:17 ` Paul E. McKenney
  2010-04-27 19:55 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-04-27  6:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

__sk_dst_set() might be called while no state can be integrated in a
rcu_dereference_check() condition.

So use rcu_dereference_raw() to shutup lockdep warnings (if
CONFIG_PROVE_RCU is set)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/include/net/sock.h b/include/net/sock.h
index 86a8ca1..94dbdbc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1236,8 +1236,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
 	struct dst_entry *old_dst;
 
 	sk_tx_queue_clear(sk);
-	old_dst = rcu_dereference_check(sk->sk_dst_cache,
-					lockdep_is_held(&sk->sk_dst_lock));
+	/*
+	 * This can be called while sk is owned by the caller only,
+	 * with no state that can be checked in a rcu_dereference_check() cond
+	 */
+	old_dst = rcu_dereference_raw(sk->sk_dst_cache);
 	rcu_assign_pointer(sk->sk_dst_cache, dst);
 	dst_release(old_dst);
 }



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set()
  2010-04-27  6:40 [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set() Eric Dumazet
@ 2010-04-27 16:17 ` Paul E. McKenney
  2010-04-27 19:42   ` David Miller
  2010-04-27 19:55 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2010-04-27 16:17 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Tue, Apr 27, 2010 at 08:40:43AM +0200, Eric Dumazet wrote:
> __sk_dst_set() might be called while no state can be integrated in a
> rcu_dereference_check() condition.
> 
> So use rcu_dereference_raw() to shutup lockdep warnings (if
> CONFIG_PROVE_RCU is set)

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 86a8ca1..94dbdbc 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -1236,8 +1236,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
>  	struct dst_entry *old_dst;
> 
>  	sk_tx_queue_clear(sk);
> -	old_dst = rcu_dereference_check(sk->sk_dst_cache,
> -					lockdep_is_held(&sk->sk_dst_lock));
> +	/*
> +	 * This can be called while sk is owned by the caller only,
> +	 * with no state that can be checked in a rcu_dereference_check() cond
> +	 */
> +	old_dst = rcu_dereference_raw(sk->sk_dst_cache);
>  	rcu_assign_pointer(sk->sk_dst_cache, dst);
>  	dst_release(old_dst);
>  }
> 
> 
> --
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set()
  2010-04-27 16:17 ` Paul E. McKenney
@ 2010-04-27 19:42   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-04-27 19:42 UTC (permalink / raw)
  To: paulmck; +Cc: eric.dumazet, netdev

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date: Tue, 27 Apr 2010 09:17:16 -0700

> On Tue, Apr 27, 2010 at 08:40:43AM +0200, Eric Dumazet wrote:
>> __sk_dst_set() might be called while no state can be integrated in a
>> rcu_dereference_check() condition.
>> 
>> So use rcu_dereference_raw() to shutup lockdep warnings (if
>> CONFIG_PROVE_RCU is set)
> 
> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

I've applied this to net-next-2.6, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set()
  2010-04-27  6:40 [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set() Eric Dumazet
  2010-04-27 16:17 ` Paul E. McKenney
@ 2010-04-27 19:55 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-04-27 19:55 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 27 Apr 2010 08:40:43 +0200

> __sk_dst_set() might be called while no state can be integrated in a
> rcu_dereference_check() condition.
> 
> So use rcu_dereference_raw() to shutup lockdep warnings (if
> CONFIG_PROVE_RCU is set)
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-27 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-27  6:40 [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set() Eric Dumazet
2010-04-27 16:17 ` Paul E. McKenney
2010-04-27 19:42   ` David Miller
2010-04-27 19:55 ` David Miller

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).