[net-next] net: add RCU annotation to sk_dst_cache field

Submitted by Amerigo Wang on Jan. 23, 2013, 4:43 a.m.

Details

Message ID 1358916229-19004-1-git-send-email-amwang@redhat.com
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message

Amerigo Wang Jan. 23, 2013, 4:43 a.m.
From: Cong Wang <amwang@redhat.com>

sock->sk_dst_cache is protected by RCU.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

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

Comments

Eric Dumazet Jan. 23, 2013, 4:50 a.m.
On Wed, 2013-01-23 at 12:43 +0800, Cong Wang wrote:
> From: Cong Wang <amwang@redhat.com>
> 
> sock->sk_dst_cache is protected by RCU.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> 
> ---
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 5a34e2f..c4b64c6 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -337,7 +337,7 @@ struct sock {
>  #endif
>  	unsigned long 		sk_flags;
>  	struct dst_entry	*sk_rx_dst;
> -	struct dst_entry	*sk_dst_cache;
> +	struct dst_entry __rcu	*sk_dst_cache;
>  	spinlock_t		sk_dst_lock;
>  	atomic_t		sk_wmem_alloc;
>  	atomic_t		sk_omem_alloc;

Thats not a complete patch.

You'll have to fix the errors it brings.



--
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
Amerigo Wang Jan. 23, 2013, 4:58 a.m.
On Tue, 2013-01-22 at 20:50 -0800, Eric Dumazet wrote:
> On Wed, 2013-01-23 at 12:43 +0800, Cong Wang wrote:
> > From: Cong Wang <amwang@redhat.com>
> > 
> > sock->sk_dst_cache is protected by RCU.
> > 
> > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Cong Wang <amwang@redhat.com>
> > 
> > ---
> > diff --git a/include/net/sock.h b/include/net/sock.h
> > index 5a34e2f..c4b64c6 100644
> > --- a/include/net/sock.h
> > +++ b/include/net/sock.h
> > @@ -337,7 +337,7 @@ struct sock {
> >  #endif
> >  	unsigned long 		sk_flags;
> >  	struct dst_entry	*sk_rx_dst;
> > -	struct dst_entry	*sk_dst_cache;
> > +	struct dst_entry __rcu	*sk_dst_cache;
> >  	spinlock_t		sk_dst_lock;
> >  	atomic_t		sk_wmem_alloc;
> >  	atomic_t		sk_omem_alloc;
> 
> Thats not a complete patch.
> 
> You'll have to fix the errors it brings.

It does fix this warning:

net/core/flow_dissector.c:280:37: sparse: incompatible types in
comparison expression (different address spaces)


--
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
Eric Dumazet Jan. 23, 2013, 5:06 a.m.
On Wed, 2013-01-23 at 12:58 +0800, Cong Wang wrote:

> It does fix this warning:
> 
> net/core/flow_dissector.c:280:37: sparse: incompatible types in
> comparison expression (different address spaces)

Thats not a good enough reason.

It adds 10 new warnings.


--
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
Amerigo Wang Jan. 23, 2013, 5:30 a.m.
On Tue, 2013-01-22 at 21:06 -0800, Eric Dumazet wrote:
> On Wed, 2013-01-23 at 12:58 +0800, Cong Wang wrote:
> 
> > It does fix this warning:
> > 
> > net/core/flow_dissector.c:280:37: sparse: incompatible types in
> > comparison expression (different address spaces)
> 
> Thats not a good enough reason.
> 
> It adds 10 new warnings.
> 
> 

I expect most of them are from decnet, which is (partially) deprecated?


--
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
Eric Dumazet Jan. 23, 2013, 5:34 a.m.
On Wed, 2013-01-23 at 13:30 +0800, Cong Wang wrote:

> 
> I expect most of them are from decnet, which is (partially) deprecated?

How many answers to you want exactly from me ?


--
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
David Miller Jan. 23, 2013, 5:36 a.m.
From: Cong Wang <amwang@redhat.com>
Date: Wed, 23 Jan 2013 13:30:57 +0800

> I expect most of them are from decnet, which is (partially) deprecated?

decnet is not deprecated, people use and test it, just fix the
warnings, implement your patch properly, and stop arguing.
--
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

Patch hide | download patch | download mbox

diff --git a/include/net/sock.h b/include/net/sock.h
index 5a34e2f..c4b64c6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -337,7 +337,7 @@  struct sock {
 #endif
 	unsigned long 		sk_flags;
 	struct dst_entry	*sk_rx_dst;
-	struct dst_entry	*sk_dst_cache;
+	struct dst_entry __rcu	*sk_dst_cache;
 	spinlock_t		sk_dst_lock;
 	atomic_t		sk_wmem_alloc;
 	atomic_t		sk_omem_alloc;