Re: [RFC][PATCH 3/3] x86/nmi: Perform a safe NMI stack trace on all CPUs

From: Steven Rostedt
Date: Fri Jun 20 2014 - 10:21:49 EST


On Fri, 20 Jun 2014 09:58:15 -0400
Don Zickus <dzickus@xxxxxxxxxx> wrote:

> On Thu, Jun 19, 2014 at 05:33:32PM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
> >
> > When trigger_all_cpu_backtrace() is called on x86, it will trigger an
> > NMI on each CPU and call show_regs(). But this can lead to a hard lock
> > up if the NMI comes in on another printk().
> >
> > In order to avoid this, when the NMI triggers, it switches the printk
> > routine for that CPU to call a NMI safe printk function that records the
> > printk in a per_cpu trace_seq descriptor. After all NMIs have finished
> > recording its data, the trace_seqs are printed in a safe context.
>
> Ah, if there is other places that need to call a printk from an NMI
> context, do we have to copy and paste this code there too? That would
> seem a little much. :-) I guess my only concern really is the seq_init
> and seq print stuff. The handler seems relatively simple.

This is a special case for printing from NMI. As you can trigger it
with sysrq-l. But any other prints from NMI should only be in the BUG()
case, where we should just force the output and override any locks in
printk.

>
> Can we isolate this to a pr_nmi() routine or something? Or maybe a
> pr_nmi_queue and pr_nmi_dump or something?
>

We'll have to see how traction this gets. It's just an RFC.

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