lkml.org 
[lkml]   [2013]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 01/18 v2] ftrace: Add hash list to save RCU unsafe functions
On Tue, 3 Sep 2013 21:18:28 -0700
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:

> On Tue, Sep 03, 2013 at 10:03:25PM -0400, Steven Rostedt wrote:
> > On Tue, 3 Sep 2013 22:01:15 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > On Tue, 3 Sep 2013 18:24:04 -0700
> > > "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> > >
> > >
> > > > > static DEFINE_PER_CPU(unsigned long, ftrace_rcu_func);
> > > > > @@ -588,15 +593,14 @@ static void
> > > > > ftrace_unsafe_callback(unsigned long ip, unsigned long parent_ip,
> > > > > struct ftrace_ops *op, struct pt_regs *pt_regs)
> > > > > {
> > > > > - int bit;
> > > > > -
> > > > > + /* Make sure we see disabled or not first */
> > > > > + smp_rmb();
> > > >
> > > > smp_mb__before_atomic_inc()?
> > > >
> > >
> > > Ah, but this is before an atomic_read(), and not an atomic_inc(), thus
> > > the normal smp_rmb() is still required.
> > >
> >
> > Here's the changes against this one:
> >
> > diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
> > index cdcf187..9e6902a 100644
> > --- a/kernel/trace/trace_functions.c
> > +++ b/kernel/trace/trace_functions.c
> > @@ -569,14 +569,14 @@ void ftrace_unsafe_rcu_checker_disable(void)
> > {
> > atomic_inc(&ftrace_unsafe_rcu_disabled);
> > /* Make sure the update is seen immediately */
> > - smp_wmb();
> > + smp_mb__after_atomic_inc();
> > }
> >
> > void ftrace_unsafe_rcu_checker_enable(void)
> > {
> > atomic_dec(&ftrace_unsafe_rcu_disabled);
> > /* Make sure the update is seen immediately */
> > - smp_wmb();
> > + smp_mb__after_atomic_dec();
> > }
> >
> > static void
> >
> >
> >
> > Which is nice, because the smp_mb() are now in the really slow path.
>
> Looks good!
>
> But now that I look at it more carefully, including the comments...
> The smp_mb__after_atomic_dec() isn't going to make the update be seen
> faster -- instead, it will guarantee that if some other CPU sees this
> CPU's later write, then that CPU will also see the results of the
> atomic_dec().

I don't need to have it seen "faster", just before anything that comes
next after the call to ftrace_unsafe_rcu_checker_disable(). That's
what I meant by the comment. In other words, don't delay this write, it
needs to go first.

-- Steve



\
 
 \ /
  Last update: 2013-09-04 14:21    [W:0.475 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site