> On Tue, Apr 21, 2009 at 05:11:58PM -0400, Mathieu Desnoyers wrote:
> > * Paul E. McKenney (
paulmck@linux.vnet.ibm.com) wrote:
> > > On Tue, Apr 21, 2009 at 11:10:35AM -0400, Mathieu Desnoyers wrote:
> > > > * Paul E. McKenney (
paulmck@linux.vnet.ibm.com) wrote:
> > >
> > > [ . . . ]
> > >
> > > > > +void synchronize_rcu_fgp(void)
> > > > > +{
> > > > > + mutex_lock(&rcu_fgp_mutex);
> > > > > +
> > > > > + /* CPUs must see earlier change before parity flip. */
> > > > > + smp_call_function(rcu_fgp_do_mb, NULL, 1);
> > > > > +
> > > >
> > > > Hrm, my original comment about missing smp_mb() here still applies, I
> > > > don't think we have come to an agreement yet.
> > >
> > > My argument is that smp_call_function() must necessarily contain a
> > > full memory barrier, otherwise it cannot function properly. ;-)
> > >
> >
> > Looking at :
> >
> > kernel/smp.c
> >
> > smp_call_function_many() indeed has a smp_mb(). It is called by
> > smp_call_function(). I wonder if it could eventually be turned into a
> > smp_wmb() instead ? If this is even a remote possibility, then the fact
> > that
> >
> > - The rcu_fgp code does not document that it expects smp_call_function()
> > to have a smp_mb().
> > - The fact that smp_call_function_many() comments do not state that this
> > function provides the guarantee to run a smp_mb().
> >
> > are both asking for an eventual bug to creep into the kernel.
>
> Many bugs -- I believe that a number of users of smp_call_function()
> assume that it maintains ordering between the calling code and all
> invocations of the function passed to smp_call_function().
>
> > So your assumption seems OK, but I think it needs to be explicitly
> > documented.
>
> That might well be a good thing.
>
> Thanx, Paul