Re: [PATCH 5/5] tracing: Do not record user stack trace from NMI context

From: Steven Rostedt
Date: Sun Mar 14 2010 - 18:29:54 EST


On Sun, 2010-03-14 at 23:05 +0100, John Kacur wrote:
> On Sat, Mar 13, 2010 at 3:57 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 484337d..e52683f 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -1284,6 +1284,13 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
> > if (!(trace_flags & TRACE_ITER_USERSTACKTRACE))
> > return;
> >
> > + /*
> > + * NMIs can not handle page faults, even with fix ups.
> > + * The save user stack can (and often does) fault.
> > + */
> > + if (unlikely(in_nmi()))
> > + return;
> > +
> > event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
> > sizeof(*entry), flags, pc);
> > if (!event)
> > --
> > 1.7.0
> >
>
> That is some awfully cool detective work. Just one question, if it is
> so easy to trigger, why did you wrap it in "unlikely"?

It was not easy to trigger until I had a case to trigger it. Currently,
the only time that this should trigger is for the lockdep tracing, which
only happens when lockdep is enabled. Most of the time, this should
never trigger.

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