Re: [PATCH 2/2] tracing/events/lockdep: move tracepoints withinrecursive protection

From: Steven Rostedt
Date: Thu Apr 16 2009 - 14:13:21 EST



On Thu, 16 Apr 2009, Peter Zijlstra wrote:
>
> > That is, at thread context, you are at level 0, if an interrupt comes
> > in, it sets you to level 1, if another interrupt comes in, it sets you to
> > level 2, and so on.
> >
> > I guess we could add this into the irq_enter/exit sofirq_enter/exit and
> > nmi_enter/exit.
> >
> > Thus we can have each task with a bitmask. When we start to trace, we set
> > the bit coresponding to the level the task is at.
> >
> > Ie. in thread context, we set bit 0, if we are interrupted by a
> > softirq/irq/nmi, we set the level bit we are at. Hmm, we might be able to
> > do this via the preempt count already :-/
> >
> > Just add the softirq/irq/nmi bits together.
> >
> > The if the bit is already set we can dump out a warning.
> >
> > I'll try that out.
>
> static int *perf_swcounter_recursion_context(struct perf_cpu_context *cpuctx)
> {
> if (in_nmi())
> return &cpuctx->recursion[3];
>
> if (in_irq())
> return &cpuctx->recursion[2];
>
> if (in_softirq())
> return &cpuctx->recursion[1];
>
> return &cpuctx->recursion[0];
> }
>
> Is what I use for perf-counters.

But does that allow multi nested interrupts?

I'll try the preempt_count and let you know.

Thanks,

-- 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/