Re: [RFC][PATCH 1/5] tracing: Make sure RCU is watching before calling a stack trace
From: Steven Rostedt
Date: Fri May 12 2017 - 14:36:30 EST
On Fri, 12 May 2017 11:25:35 -0700
"Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
> On Fri, May 12, 2017 at 01:15:45PM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>
> >
> > As stack tracing now requires "rcu watching", force RCU to be watching when
> > recording a stack trace.
> >
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
>
> Assuming that you never get to __trace_stack() if in an NMI handler,
> this looks good to me!
>
> In contrast, if if __trace_stack() ever is called from an NMI handler,
> invoking rcu_irq_enter() can be fatal.
Then someone may die.
OK, what's the case of running this in nmi? How does perf do it?
Do we just skip the check if it is in an nmi?
if (!in_nmi()) {
if (unlikely(rcu_irq_enter_disabled()))
return;
rcu_irq_enter();
}
__ftrace_trace_stack();
if (!in_nmi())
rcu_irq_exit();
?
-- Steve