netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net-next] bridge: add some missing __rcu marks
@ 2013-02-14  6:12 Cong Wang
  2013-02-14  6:39 ` Stephen Hemminger
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2013-02-14  6:12 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich, Stephen Hemminger, David S. Miller, Cong Wang

From: Cong Wang <amwang@redhat.com>


Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 6d314c4..0f115ba 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -328,7 +328,7 @@ extern void br_dev_delete(struct net_device *dev, struct list_head *list);
 extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
 			       struct net_device *dev);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
+static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
 {
 	return br->dev->npinfo;
 }
@@ -345,7 +345,7 @@ static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
 extern int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp);
 extern void br_netpoll_disable(struct net_bridge_port *p);
 #else
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
+static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
 {
 	return NULL;
 }
@@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
 extern struct net_bridge_port_group *br_multicast_new_port_group(
 				struct net_bridge_port *port,
 				struct br_ip *group,
-				struct net_bridge_port_group *next,
+				struct net_bridge_port_group __rcu *next,
 				unsigned char state);
 extern void br_mdb_init(void);
 extern void br_mdb_uninit(void);

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

* Re: [Patch net-next] bridge: add some missing __rcu marks
  2013-02-14  6:12 [Patch net-next] bridge: add some missing __rcu marks Cong Wang
@ 2013-02-14  6:39 ` Stephen Hemminger
  2013-02-14  8:23   ` Cong Wang
  2013-02-14  8:37   ` [Patch net-next v2] netpoll: add some missing __rcu marks in several places Cong Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2013-02-14  6:39 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Vlad Yasevich, David S. Miller

On Thu, 14 Feb 2013 14:12:30 +0800
Cong Wang <amwang@redhat.com> wrote:

> From: Cong Wang <amwang@redhat.com>
> 
> 
> Cc: Vlad Yasevich <vyasevic@redhat.com>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> 
> ---
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 6d314c4..0f115ba 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -328,7 +328,7 @@ extern void br_dev_delete(struct net_device *dev, struct list_head *list);
>  extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
>  			       struct net_device *dev);
>  #ifdef CONFIG_NET_POLL_CONTROLLER
> -static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
> +static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
>  {
>  	return br->dev->npinfo;
>  }


This doesn't seem right since there is no rcu_dereference() here.

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

* Re: [Patch net-next] bridge: add some missing __rcu marks
  2013-02-14  6:39 ` Stephen Hemminger
@ 2013-02-14  8:23   ` Cong Wang
  2013-02-14  8:37   ` [Patch net-next v2] netpoll: add some missing __rcu marks in several places Cong Wang
  1 sibling, 0 replies; 8+ messages in thread
From: Cong Wang @ 2013-02-14  8:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Vlad Yasevich, David S. Miller

On Wed, 2013-02-13 at 22:39 -0800, Stephen Hemminger wrote:
> On Thu, 14 Feb 2013 14:12:30 +0800
> Cong Wang <amwang@redhat.com> wrote:
> >  #ifdef CONFIG_NET_POLL_CONTROLLER
> > -static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
> > +static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
> >  {
> >  	return br->dev->npinfo;
> >  }
> 
> 
> This doesn't seem right since there is no rcu_dereference() here.

But we don't dereference ->npinfo here, we only check if it is NULL.

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

* [Patch net-next v2] netpoll: add some missing __rcu marks in several places
  2013-02-14  6:39 ` Stephen Hemminger
  2013-02-14  8:23   ` Cong Wang
@ 2013-02-14  8:37   ` Cong Wang
  2013-02-14 18:20     ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Cong Wang @ 2013-02-14  8:37 UTC (permalink / raw)
  To: netdev
  Cc: Jiri Pirko, Vlad Yasevich, Stephen Hemminger, David S. Miller,
	Cong Wang

From: Cong Wang <amwang@redhat.com>

This fixes sparse warnings like the one below:

drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
drivers/net/team/team.c:953:25:    expected struct netpoll_info *
drivers/net/team/team.c:953:25:    got struct netpoll_info [noderef] <asn:4>*npinfo

Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 94c1534..cc35a3e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1300,7 +1300,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g
 	return err;
 }
 
-static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
+static struct netpoll_info __rcu *bond_netpoll_info(struct bonding *bond)
 {
 	return bond->dev->npinfo;
 }
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 05c5efe..004fdd9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -948,7 +948,7 @@ static void team_port_disable_netpoll(struct team_port *port)
 	kfree(np);
 }
 
-static struct netpoll_info *team_netpoll_info(struct team *team)
+static struct netpoll_info __rcu *team_netpoll_info(struct team *team)
 {
 	return team->dev->npinfo;
 }
@@ -962,7 +962,7 @@ static int team_port_enable_netpoll(struct team *team, struct team_port *port,
 static void team_port_disable_netpoll(struct team_port *port)
 {
 }
-static struct netpoll_info *team_netpoll_info(struct team *team)
+static struct netpoll_info __rcu *team_netpoll_info(struct team *team)
 {
 	return NULL;
 }
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 6d314c4..0f115ba 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -328,7 +328,7 @@ extern void br_dev_delete(struct net_device *dev, struct list_head *list);
 extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
 			       struct net_device *dev);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
+static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
 {
 	return br->dev->npinfo;
 }
@@ -345,7 +345,7 @@ static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
 extern int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp);
 extern void br_netpoll_disable(struct net_bridge_port *p);
 #else
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
+static inline struct netpoll_info __rcu *br_netpoll_info(struct net_bridge *br)
 {
 	return NULL;
 }
@@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
 extern struct net_bridge_port_group *br_multicast_new_port_group(
 				struct net_bridge_port *port,
 				struct br_ip *group,
-				struct net_bridge_port_group *next,
+				struct net_bridge_port_group __rcu *next,
 				unsigned char state);
 extern void br_mdb_init(void);
 extern void br_mdb_uninit(void);

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

* Re: [Patch net-next v2] netpoll: add some missing __rcu marks in several places
  2013-02-14  8:37   ` [Patch net-next v2] netpoll: add some missing __rcu marks in several places Cong Wang
@ 2013-02-14 18:20     ` David Miller
  2013-02-16  3:16       ` Cong Wang
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2013-02-14 18:20 UTC (permalink / raw)
  To: amwang; +Cc: netdev, jiri, vyasevic, stephen

From: Cong Wang <amwang@redhat.com>
Date: Thu, 14 Feb 2013 16:37:19 +0800

> From: Cong Wang <amwang@redhat.com>
> 
> This fixes sparse warnings like the one below:
> 
> drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
> drivers/net/team/team.c:953:25:    expected struct netpoll_info *
> drivers/net/team/team.c:953:25:    got struct netpoll_info [noderef] <asn:4>*npinfo
> 
> Cc: Jiri Pirko <jiri@resnulli.us>
> Cc: Vlad Yasevich <vyasevic@redhat.com>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>

This is a very confusing patch submission.

You're posting a "v2" of a patch but with a completely different Subject
line so that it's hard, without looking into the details of the patch,
to determine what this patch is a "v2" of.

You've also not addressed Stephen's feedback about the lack of an
rcu_dereference() in these routines you've added __rcu annotations
to.

I'm tossing all versions of this patch, therefore.

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

* Re: [Patch net-next v2] netpoll: add some missing __rcu marks in several places
  2013-02-14 18:20     ` David Miller
@ 2013-02-16  3:16       ` Cong Wang
  2013-02-16  4:10         ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2013-02-16  3:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, jiri, vyasevic, stephen

On Thu, 2013-02-14 at 13:20 -0500, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Thu, 14 Feb 2013 16:37:19 +0800
> 
> > From: Cong Wang <amwang@redhat.com>
> > 
> > This fixes sparse warnings like the one below:
> > 
> > drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
> > drivers/net/team/team.c:953:25:    expected struct netpoll_info *
> > drivers/net/team/team.c:953:25:    got struct netpoll_info [noderef] <asn:4>*npinfo
> > 
> > Cc: Jiri Pirko <jiri@resnulli.us>
> > Cc: Vlad Yasevich <vyasevic@redhat.com>
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Cong Wang <amwang@redhat.com>
> 
> This is a very confusing patch submission.
> 
> You're posting a "v2" of a patch but with a completely different Subject
> line so that it's hard, without looking into the details of the patch,
> to determine what this patch is a "v2" of.
> 
> You've also not addressed Stephen's feedback about the lack of an
> rcu_dereference() in these routines you've added __rcu annotations
> to.
> 
> I'm tossing all versions of this patch, therefore.

The reason is we don't dereference ->npinfo pointer, we just check if it
is NULL, so doesn't need to call rcu_dereference(). Or am I missing
anything?

Thanks.

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

* Re: [Patch net-next v2] netpoll: add some missing __rcu marks in several places
  2013-02-16  3:16       ` Cong Wang
@ 2013-02-16  4:10         ` Eric Dumazet
  2013-02-16  5:33           ` Cong Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-02-16  4:10 UTC (permalink / raw)
  To: Cong Wang; +Cc: David Miller, netdev, jiri, vyasevic, stephen

On Sat, 2013-02-16 at 11:16 +0800, Cong Wang wrote:

> The reason is we don't dereference ->npinfo pointer, we just check if it
> is NULL, so doesn't need to call rcu_dereference(). Or am I missing
> anything?

Yes you are missing that the right thing to do is to use
rcu_access_pointer()

Sparse errors should not be fixed using random RCU verbs,
please be more careful.


diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 05c5efe..03e5949 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)
 
 static struct netpoll_info *team_netpoll_info(struct team *team)
 {
-	return team->dev->npinfo;
+	return rcu_access_pointer(team->dev->npinfo);
 }
 
 #else

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

* Re: [Patch net-next v2] netpoll: add some missing __rcu marks in several places
  2013-02-16  4:10         ` Eric Dumazet
@ 2013-02-16  5:33           ` Cong Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Cong Wang @ 2013-02-16  5:33 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, jiri, vyasevic, stephen

On Fri, 2013-02-15 at 20:10 -0800, Eric Dumazet wrote:
> On Sat, 2013-02-16 at 11:16 +0800, Cong Wang wrote:
> 
> > The reason is we don't dereference ->npinfo pointer, we just check if it
> > is NULL, so doesn't need to call rcu_dereference(). Or am I missing
> > anything?
> 
> Yes you are missing that the right thing to do is to use
> rcu_access_pointer()
> 
> Sparse errors should not be fixed using random RCU verbs,
> please be more careful.

Ah, I wasn't aware of that API. Will send v3.

Thanks!

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

end of thread, other threads:[~2013-02-16  5:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14  6:12 [Patch net-next] bridge: add some missing __rcu marks Cong Wang
2013-02-14  6:39 ` Stephen Hemminger
2013-02-14  8:23   ` Cong Wang
2013-02-14  8:37   ` [Patch net-next v2] netpoll: add some missing __rcu marks in several places Cong Wang
2013-02-14 18:20     ` David Miller
2013-02-16  3:16       ` Cong Wang
2013-02-16  4:10         ` Eric Dumazet
2013-02-16  5:33           ` Cong Wang

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