Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-29 Thread Herbert Xu
On Tue, Nov 27, 2007 at 07:21:08PM +0300, Pavel Emelyanov wrote: This hook is protected with the RCU, so simple if (br_should_route_hook) br_should_route_hook(...) is not enough on some architectures. Use the rcu_dereference/rcu_assign_pointer in this case. Fixed

Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-29 Thread Paul E. McKenney
On Fri, Nov 30, 2007 at 12:04:20AM +1100, Herbert Xu wrote: On Tue, Nov 27, 2007 at 07:21:08PM +0300, Pavel Emelyanov wrote: This hook is protected with the RCU, so simple if (br_should_route_hook) br_should_route_hook(...) is not enough on some architectures.

Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-29 Thread Herbert Xu
On Thu, Nov 29, 2007 at 06:36:50AM -0800, Paul E. McKenney wrote: That certainly is an interesting tradeoff... Save a memory barrier when assigning NULL, but pay an extra test and branch in all cases. Though it does make for a simpler rule -- just use rcu_assign_pointer() in all cases. Of

Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-29 Thread Paul E. McKenney
On Fri, Nov 30, 2007 at 10:49:00AM +1100, Herbert Xu wrote: On Thu, Nov 29, 2007 at 06:36:50AM -0800, Paul E. McKenney wrote: That certainly is an interesting tradeoff... Save a memory barrier when assigning NULL, but pay an extra test and branch in all cases. Though it does make for a

Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-29 Thread Herbert Xu
On Thu, Nov 29, 2007 at 05:25:01PM -0800, Paul E. McKenney wrote: You have in mind something like the following? #define rcu_assign_pointer(p, v) \ ({ \ if (!__builtin_constant_p(v) || \ ((v) != NULL)) \ smp_wmb(); \

[PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook

2007-11-27 Thread Pavel Emelyanov
This hook is protected with the RCU, so simple if (br_should_route_hook) br_should_route_hook(...) is not enough on some architectures. Use the rcu_dereference/rcu_assign_pointer in this case. Fixed Stephen's comment concerning using the typeof(). Signed-off-by: Pavel