[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120127103829.GB6294@m.brq.redhat.com>
Date: Fri, 27 Jan 2012 11:38:29 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, mingo@...hat.com,
paulus@...ba.org, acme@...stprotocols.net, a.p.zijlstra@...llo.nl,
linux-kernel@...r.kernel.org, aarapov@...hat.com
Subject: Re: [PATCH 2/7] ftrace: Add enable/disable ftrace_ops control
interface
On Fri, Jan 27, 2012 at 11:37:14AM +0100, Jiri Olsa wrote:
> On Thu, Jan 26, 2012 at 03:37:29AM +0100, Frederic Weisbecker wrote:
> > On Wed, Jan 25, 2012 at 06:13:41PM -0500, Steven Rostedt wrote:
> > > On Fri, 2012-01-20 at 18:02 +0100, Frederic Weisbecker wrote:
> > > >
> > > > > +/**
> > > > > + * ftrace_function_enable - enable controlled ftrace_ops on given cpu
> > > > > + *
> > > > > + * This function enables tracing on given cpu by decreasing
> > > > > + * the per cpu control variable.
> > > > > + * It must be called with preemption disabled and only on
> > > > > + * ftrace_ops registered with FTRACE_OPS_FL_CONTROL.
> > > > > + */
> > > > > +static inline void ftrace_function_enable(struct ftrace_ops *ops, int cpu)
> > > > > +{
> > > > > + atomic_t *disabled;
> > > > > +
> > > > > + if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL) ||
> > > > > + !preempt_count()))
> > > > > + return;
> > > > > +
> > > > > + disabled = per_cpu_ptr(ops->disabled, cpu);
> > > > > + atomic_dec(disabled);
> > > > > +}
> > > >
> > > > As you're using this for the local CPU exclusively, I suggest you rather
> > > > rename it to "ftrace_function_{dis,en}able_cpu(struct ftrace_ops *ops)"
> > >
> > > I wonder if "ftrace_function_local_{dis,en}able(ops)" would be better?
> > > That would match something like local_irq_disable/enable.
> >
> > Good idea.
> >
> > >
> > > > and use __get_cpu_var() that does the preempt check for you.
>
> I haven't found preempt check this_cpu_ptr path.. not sure I missed it..
> so I'm keeping the implicit preemt check.
> Attaching new version of the patch (I'll need to resend whole serie once
> this one is agreed).
>
> changes:
> - using this_cpu_ptr to touch ftrace_ops::disable
> - renamed ftrace_ops:disable API:
> void ftrace_function_local_enable(struct ftrace_ops *ops)
> void ftrace_function_local_disable(struct ftrace_ops *ops)
> int ftrace_function_local_disabled(struct ftrace_ops *ops)
ops, missed one... using int instead of atomic_t for ftrace_ops::disable
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists