[RFC][PATCH 0/3] x86/nmi: Print all cpu stacks from NMI safely

From: Steven Rostedt
Date: Thu Jun 19 2014 - 17:40:27 EST


This is my proposal to print the NMI stack traces from an RCU stall safely.
Here's the gist of it.

Patch 1: move the trace_seq out of the tracing code. It's useful for other
purposes too. Like writing from an NMI context.

Patch 2: Add a per_cpu "printk_func" that printk calls. By default it calls
vprintk_def() which does what it has always done. This allows us to
override what printk() calls normally on a per cpu basis.

Patch 3: Have the NMI handler that dumps the stack trace just change the
printk_func to call a NMI safe printk function that writes to a per cpu
trace_seq. When all NMI handlers chimed in, the original caller prints
out the trace_seqs for each CPU from a printk safe context.

This is much less intrusive than the other versions out there.

Note, The biggest change was the moving of trace_seq code out of trace_output.c
and into the new trace_seq.c library.

Thoughts?


Steven Rostedt (Red Hat) (3):
trace_seq: Move the trace_seq code to lib/
printk: Add per_cpu printk func to allow printk to be diverted
x86/nmi: Perform a safe NMI stack trace on all CPUs

----
arch/x86/kernel/apic/hw_nmi.c | 66 ++++++++-
include/linux/percpu.h | 3 +
include/linux/printk.h | 2 +
include/linux/trace_seq.h | 68 ++--------
kernel/printk/printk.c | 38 ++++--
kernel/trace/trace.c | 24 ----
kernel/trace/trace_output.c | 268 -------------------------------------
kernel/trace/trace_output.h | 16 ---
lib/Makefile | 2 +-
lib/trace_seq.c | 303 ++++++++++++++++++++++++++++++++++++++++++
10 files changed, 412 insertions(+), 378 deletions(-)
--
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/