Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread David Miller
From: "Paul E. McKenney" Date: Fri, 29 Mar 2013 12:20:11 -0700 > On Fri, Mar 29, 2013 at 06:01:22AM -0700, Eric Dumazet wrote: >> [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister() >> >> commit 35d48903e97819 (bonding: fix rx_handler lock

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Eric Dumazet
On Fri, 2013-03-29 at 12:20 -0700, Paul E. McKenney wrote: > Reviewed-by: Paul E. McKenney > > With kudos to Steven Rostedt for his analogy between RCU and > Schrödinger's cat. ;-) Thanks Paul ! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a messa

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Paul E. McKenney
unregister); > > > > > > Nope this changes nothing at all. > > However, we can fix the bug in a different way, if we want to avoid a > test in fast path. > > With following patch, we can make sure that a reader seeing a non NULL > rx_handler has a guaran

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Eric Dumazet
On Fri, 2013-03-29 at 17:12 +0100, Jiri Pirko wrote: > Fri, Mar 29, 2013 at 04:38:15PM CET, eric.duma...@gmail.com wrote: > >On Fri, 2013-03-29 at 16:11 +0100, Ivan Vecera wrote: > > > >> Erik, why doesn't help the write barrier between the assignments. It > >> should guarantee their orders... or

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Jiri Pirko
Fri, Mar 29, 2013 at 04:38:15PM CET, eric.duma...@gmail.com wrote: >On Fri, 2013-03-29 at 16:11 +0100, Ivan Vecera wrote: > >> Erik, why doesn't help the write barrier between the assignments. It >> should guarantee their orders... or not? >> > >Its not enough, I wont explain here why as RCU is q

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Eric Dumazet
On Fri, 2013-03-29 at 16:11 +0100, Ivan Vecera wrote: > Erik, why doesn't help the write barrier between the assignments. It > should guarantee their orders... or not? > Its not enough, I wont explain here why as RCU is quite well documented in Documentation/RCU -- To unsubscribe from this l

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Ivan Vecera
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/n

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Eric Dumazet
On Fri, 2013-03-29 at 09:17 -0400, Steven Rostedt wrote: > I've thought about this too, but I wasn't sure we wanted two > synchronize_*() functions, as the caller does a synchronize as well. > That said, I think this is the more robust solution and it lets all > rx_handler() functions assume that

Re: [PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Steven Rostedt
On Fri, 2013-03-29 at 06:01 -0700, Eric Dumazet wrote: > From: Eric Dumazet > > On Fri, 2013-03-29 at 10:48 +0100, Jiri Pirko wrote: > > > Hmm. I think that this might be issue introduced by: > > commit a9b3cd7f323b2e57593e7215362a7b02fc933e3a > > Author: Stephen Hemminger > > Date: Mon Aug 1

[PATCH] net: add a synchronize_net() in netdev_rx_handler_unregister()

2013-03-29 Thread Eric Dumazet
> EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); > > Nope this changes nothing at all. However, we can fix the bug in a different way, if we want to avoid a test in fast path. With following patch, we can make sure that a reader seeing a non NULL rx_handler has a guarantee to