From: Cong Wang <amwang@redhat.com>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Jay Vosburgh <fubar@us.ibm.com>,
Neil Horman <nhorman@tuxdriver.com>,
netdev@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
David Miller <davem@davemloft.net>,
Jeff Moyer <jmoyer@redhat.com>,
Andy Gospodarek <gospo@redhat.com>,
bonding-devel@lists.sourceforge.net
Subject: Re: [Bridge] [v3 Patch 2/3] bridge: make bridge support netpoll
Date: Mon, 12 Apr 2010 18:37:22 +0800 [thread overview]
Message-ID: <4BC2F7E2.7020309@redhat.com> (raw)
In-Reply-To: <20100408083710.2b61ee44@nehalam>
Stephen Hemminger wrote:
>> Index: linux-2.6/net/bridge/br_forward.c
>> ===================================================================
>> --- linux-2.6.orig/net/bridge/br_forward.c
>> +++ linux-2.6/net/bridge/br_forward.c
>> @@ -15,6 +15,7 @@
>> #include <linux/slab.h>
>> #include <linux/kernel.h>
>> #include <linux/netdevice.h>
>> +#include <linux/netpoll.h>
>> #include <linux/skbuff.h>
>> #include <linux/if_vlan.h>
>> #include <linux/netfilter_bridge.h>
>> @@ -50,7 +51,13 @@ int br_dev_queue_push_xmit(struct sk_buf
>> else {
>> skb_push(skb, ETH_HLEN);
>>
>> - dev_queue_xmit(skb);
>> +#ifdef CONFIG_NET_POLL_CONTROLLER
>> + if (skb->dev->priv_flags & IFF_IN_NETPOLL) {
>> + netpoll_send_skb(skb->dev->npinfo->netpoll, skb);
>> + skb->dev->priv_flags &= ~IFF_IN_NETPOLL;
>> + } else
>> +#endif
>
> There is no protection on dev->priv_flags for SMP access.
> It would better bit value in dev->state if you are using it as control flag.
>
> Then you could use
> if (unlikely(test_and_clear_bit(__IN_NETPOLL, &skb->dev->state)))
> netpoll_send_skb(...)
>
>
Hmm, I think we can't use ->state here, it is not for this kind of purpose,
according to its comments.
Also, I find other usages of IFF_XXX flags of ->priv_flags are also using
&, | to set or clear the flags. So there must be some other things preventing
the race...
Thanks.
WARNING: multiple messages have this Message-ID (diff)
From: Cong Wang <amwang@redhat.com>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bridge@lists.linux-foundation.org,
Andy Gospodarek <gospo@redhat.com>,
Neil Horman <nhorman@tuxdriver.com>,
Jeff Moyer <jmoyer@redhat.com>, Matt Mackall <mpm@selenic.com>,
bonding-devel@lists.sourceforge.net,
Jay Vosburgh <fubar@us.ibm.com>,
David Miller <davem@davemloft.net>
Subject: Re: [v3 Patch 2/3] bridge: make bridge support netpoll
Date: Mon, 12 Apr 2010 18:37:22 +0800 [thread overview]
Message-ID: <4BC2F7E2.7020309@redhat.com> (raw)
In-Reply-To: <20100408083710.2b61ee44@nehalam>
Stephen Hemminger wrote:
>> Index: linux-2.6/net/bridge/br_forward.c
>> ===================================================================
>> --- linux-2.6.orig/net/bridge/br_forward.c
>> +++ linux-2.6/net/bridge/br_forward.c
>> @@ -15,6 +15,7 @@
>> #include <linux/slab.h>
>> #include <linux/kernel.h>
>> #include <linux/netdevice.h>
>> +#include <linux/netpoll.h>
>> #include <linux/skbuff.h>
>> #include <linux/if_vlan.h>
>> #include <linux/netfilter_bridge.h>
>> @@ -50,7 +51,13 @@ int br_dev_queue_push_xmit(struct sk_buf
>> else {
>> skb_push(skb, ETH_HLEN);
>>
>> - dev_queue_xmit(skb);
>> +#ifdef CONFIG_NET_POLL_CONTROLLER
>> + if (skb->dev->priv_flags & IFF_IN_NETPOLL) {
>> + netpoll_send_skb(skb->dev->npinfo->netpoll, skb);
>> + skb->dev->priv_flags &= ~IFF_IN_NETPOLL;
>> + } else
>> +#endif
>
> There is no protection on dev->priv_flags for SMP access.
> It would better bit value in dev->state if you are using it as control flag.
>
> Then you could use
> if (unlikely(test_and_clear_bit(__IN_NETPOLL, &skb->dev->state)))
> netpoll_send_skb(...)
>
>
Hmm, I think we can't use ->state here, it is not for this kind of purpose,
according to its comments.
Also, I find other usages of IFF_XXX flags of ->priv_flags are also using
&, | to set or clear the flags. So there must be some other things preventing
the race...
Thanks.
next prev parent reply other threads:[~2010-04-12 10:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 6:18 [Bridge] [v3 Patch 1/3] netpoll: add generic support for bridge and bonding devices Amerigo Wang
2010-04-08 6:18 ` Amerigo Wang
2010-04-08 6:18 ` [Bridge] [v3 Patch 2/3] bridge: make bridge support netpoll Amerigo Wang
2010-04-08 6:18 ` Amerigo Wang
2010-04-08 15:37 ` [Bridge] " Stephen Hemminger
2010-04-08 15:37 ` Stephen Hemminger
2010-04-09 5:43 ` [Bridge] " Cong Wang
2010-04-09 5:43 ` Cong Wang
2010-04-12 10:37 ` Cong Wang [this message]
2010-04-12 10:37 ` Cong Wang
2010-04-12 10:38 ` [Bridge] " Eric Dumazet
2010-04-12 10:38 ` Eric Dumazet
2010-04-12 15:38 ` [Bridge] [Bonding-devel] " Stephen Hemminger
2010-04-12 15:38 ` Stephen Hemminger
2010-04-13 8:57 ` [Bridge] " Cong Wang
2010-04-13 8:57 ` Cong Wang
2010-04-13 16:52 ` [Bridge] " Jay Vosburgh
2010-04-13 16:52 ` Jay Vosburgh
2010-04-13 17:33 ` [Bridge] " Stephen Hemminger
2010-04-13 17:33 ` Stephen Hemminger
2010-04-14 8:16 ` [Bridge] " Cong Wang
2010-04-14 8:16 ` Cong Wang
2010-04-14 8:11 ` [Bridge] " Cong Wang
2010-04-14 8:11 ` Cong Wang
2010-04-08 6:19 ` [Bridge] [v3 Patch 3/3] bonding: make bonding " Amerigo Wang
2010-04-08 6:19 ` Amerigo Wang
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=4BC2F7E2.7020309@redhat.com \
--to=amwang@redhat.com \
--cc=bonding-devel@lists.sourceforge.net \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=gospo@redhat.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=shemminger@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.