From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755184Ab3C2PMe (ORCPT ); Fri, 29 Mar 2013 11:12:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12995 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917Ab3C2PMd (ORCPT ); Fri, 29 Mar 2013 11:12:33 -0400 Message-ID: <5155AF24.3090305@redhat.com> Date: Fri, 29 Mar 2013 16:11:32 +0100 From: Ivan Vecera User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130318 Thunderbird/17.0.4 MIME-Version: 1.0 To: Eric Dumazet CC: Jiri Pirko , Steven Rostedt , Andy Gospodarek , "David S. Miller" , LKML , netdev , =?UTF-8?B?Tmljb2xhcyBkZSBQZXNsb8O8YW4=?= , Thomas Gleixner , Guy Streeter , "Paul E. McKenney" , stephen@networkplumber.org Subject: Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister() References: <1364490997.6345.237.camel@gandalf.local.home> <1364491792.15753.47.camel@edumazet-glaptop> <20130329094856.GB1677@minipsycho.orion> <1364562082.5113.16.camel@edumazet-glaptop> In-Reply-To: <1364562082.5113.16.camel@edumazet-glaptop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/29/2013 02:01 PM, Eric Dumazet wrote: >> CPU0 will see rx_handler set and yet, rx_handler_data nulled. Write >> >barrier in rcu_assign_pointer() might prevent this reorder from happening. >> >Therefore I suggest: >> > >> >diff --git a/net/core/dev.c b/net/core/dev.c >> >index 0caa38e..c16b829 100644 >> >--- a/net/core/dev.c >> >+++ b/net/core/dev.c >> >@@ -3332,8 +3332,8 @@ void netdev_rx_handler_unregister(struct net_device *dev) >> > { >> > >> > ASSERT_RTNL(); >> >- RCU_INIT_POINTER(dev->rx_handler, NULL); >> >- RCU_INIT_POINTER(dev->rx_handler_data, NULL); >> >+ rcu_assign_pointer(dev->rx_handler, NULL); >> >+ rcu_assign_pointer(dev->rx_handler_data, NULL); >> > } >> > EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); >> > >> > > Nope this changes nothing at all. Erik, why doesn't help the write barrier between the assignments. It should guarantee their orders... or not? Thanks, Ivan