Messages in this thread | | | Subject | Re: [PATCH 06/13] tracing: remove dump_ran check in __ftrace_dump | From | Steven Rostedt <> | Date | Mon, 11 Mar 2013 11:58:17 -0400 |
| |
On Mon, 2013-03-11 at 23:35 +0800, Jovi Zhang wrote: > On Mon, Mar 11, 2013 at 10:08 PM, Steven Rostedt <rostedt@goodmis.org> wrote: > > On Mon, 2013-03-11 at 15:13 +0800, zhangwei(Jovi) wrote: > >> It's reasonable to call __ftrace_dump function not only once, > >> so remove the dump_ran variable checking. > > > > This needs a little more work. On an oops, I only want it dumped once, > > because a crash can cause another crash while its dumping, and without > > that check in will corrupt the buffer. > For reclusive dumping, it's already under the protection of > ftrace_dump_lock spinlock, > I missed something? would you explain more on this case?
Actually, it matters if it was called from NMI context or not. If an NMI triggered and did a dump while a reader was reading the buffer, the NMI can corrupt the buffer. It will print fine for the NMI, but if the reader continues, there's a chance it can get messed up and corrupt the buffer. The "dump once" is a paranoid method to say we only dump it once on oops and stop (hence the ftrace_kill() there too).
Now I think there's a possible deadlock here as well. If the dump was caused by something other than an NMI lock up, and while it is dumping the NMI goes off and triggers a bug, it too can enter this and that arch_spin_lock() will cause a deadlock. This will be something I need to clean up as well.
Thanks for calling my attention to this.
-- Steve
| |