Re: [PATCH] trace: add graph output support for wakeup tracer

From: Steven Rostedt
Date: Tue Sep 07 2010 - 11:07:59 EST


On Tue, 2010-09-07 at 16:18 +0200, Frederic Weisbecker wrote:
> On Thu, Aug 05, 2010 at 04:57:27PM +0200, Jiri Olsa wrote:

> > +static void wakeup_graph_return(struct ftrace_graph_ret *trace)
> > +{
> > + struct trace_array *tr = wakeup_trace;
> > + struct trace_array_cpu *data;
> > + unsigned long flags;
> > + long disabled;
> > + int cpu, pc;
> > +
> > + if (likely(!wakeup_task))
> > + return;
> > +
> > + pc = preempt_count();
> > + preempt_disable_notrace();
> > +
> > + cpu = raw_smp_processor_id();
> > + if (cpu != wakeup_current_cpu)
> > + goto out_enable;
> > +
> > + data = tr->data[cpu];
> > + disabled = atomic_inc_return(&data->disabled);
> > + if (unlikely(disabled != 1))
> > + goto out;
> > +
> > + local_irq_save(flags);
> > + __trace_graph_return(tr, trace, flags, pc);
> > + local_irq_restore(flags);
>
>
>
> Do you disable irqs to avoid losing traces? If so there is a race
> window between the recursion barrier in data->disabled and the
> time you disable irqs.
>
> If you don't want to lose anything (except NMIs), you need to
> replace the preempt_disable by the local_irq_save, ie disable
> irqs before the recursion protection.
>


Or is it just to get the flags variable? If so then use
local_save_flags() instead.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/