Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651Ab0DMIzk (ORCPT ); Tue, 13 Apr 2010 04:55:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52356 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752567Ab0DMIzi (ORCPT ); Tue, 13 Apr 2010 04:55:38 -0400 Message-ID: <4BC43214.6030009@redhat.com> Date: Tue, 13 Apr 2010 16:57:56 +0800 From: Cong Wang User-Agent: Thunderbird 2.0.0.23 (X11/20091001) MIME-Version: 1.0 To: Stephen Hemminger CC: Eric Dumazet , Jay Vosburgh , Neil Horman , netdev@vger.kernel.org, Matt Mackall , bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, David Miller , Jeff Moyer , Andy Gospodarek , bonding-devel@lists.sourceforge.net Subject: Re: [Bonding-devel] [v3 Patch 2/3] bridge: make bridge support netpoll References: <20100408062234.4499.17042.sendpatchset@localhost.localdomain> <20100408062246.4499.5670.sendpatchset@localhost.localdomain> <20100408083710.2b61ee44@nehalam> <4BC2F7E2.7020309@redhat.com> <1271068737.16881.18.camel@edumazet-laptop> <20100412083842.26d71bda@nehalam> In-Reply-To: <20100412083842.26d71bda@nehalam> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1642 Lines: 45 Stephen Hemminger wrote: > On Mon, 12 Apr 2010 12:38:57 +0200 > Eric Dumazet wrote: > >> Le lundi 12 avril 2010 à 18:37 +0800, Cong Wang a écrit : >>> Stephen Hemminger wrote: >>>> 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... >> Yes, its RTNL that protects priv_flags changes, hopefully... >> > > The patch was not protecting priv_flags with RTNL. > For example.. > > > @@ -308,7 +312,9 @@ static void netpoll_send_skb(struct netp > tries > 0; --tries) { > if (__netif_tx_trylock(txq)) { > if (!netif_tx_queue_stopped(txq)) { > + dev->priv_flags |= IFF_IN_NETPOLL; > status = ops->ndo_start_xmit(skb, dev); > + dev->priv_flags &= ~IFF_IN_NETPOLL; > if (status == NETDEV_TX_OK) > txq_trans_update(txq); Hmm, but I checked the bonding case (IFF_BONDING), it doesn't hold rtnl_lock. Strange. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/