summaryrefslogtreecommitdiffstats
path: root/lib/nmi_backtrace.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@mellanox.com>2016-10-07 17:02:49 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 18:46:30 -0700
commit677664895278267a80bda0e3b26821d60cdbebf5 (patch)
tree6828a9d2fa2f84ddc47dcd2f7ad6a5b249b400e9 /lib/nmi_backtrace.c
parent9a01c3ed5cdb35d9004eb92510ee6ea11b4a5f16 (diff)
downloadlinux-677664895278267a80bda0e3b26821d60cdbebf5.tar.gz
linux-677664895278267a80bda0e3b26821d60cdbebf5.tar.bz2
linux-677664895278267a80bda0e3b26821d60cdbebf5.zip
nmi_backtrace: do a local dump_stack() instead of a self-NMI
Currently on arm there is code that checks whether it should call dump_stack() explicitly, to avoid trying to raise an NMI when the current context is not preemptible by the backtrace IPI. Similarly, the forthcoming arch/tile support uses an IPI mechanism that does not support generating an NMI to self. Accordingly, move the code that guards this case into the generic mechanism, and invoke it unconditionally whenever we want a backtrace of the current cpu. It seems plausible that in all cases, dump_stack() will generate better information than generating a stack from the NMI handler. The register state will be missing, but that state is likely not particularly helpful in any case. Or, if we think it is helpful, we should be capturing and emitting the current register state in all cases when regs == NULL is passed to nmi_cpu_backtrace(). Link: http://lkml.kernel.org/r/1472487169-14923-3-git-send-email-cmetcalf@mellanox.com Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com> Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm] Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Aaron Tomlin <atomlin@redhat.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Russell King <linux@arm.linux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/nmi_backtrace.c')
-rw-r--r--lib/nmi_backtrace.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index df347e355267..393a3cca1f47 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -49,6 +49,15 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
if (exclude_self)
cpumask_clear_cpu(this_cpu, to_cpumask(backtrace_mask));
+ /*
+ * Don't try to send an NMI to this cpu; it may work on some
+ * architectures, but on others it may not, and we'll get
+ * information at least as useful just by doing a dump_stack() here.
+ * Note that nmi_cpu_backtrace(NULL) will clear the cpu bit.
+ */
+ if (cpumask_test_cpu(this_cpu, to_cpumask(backtrace_mask)))
+ nmi_cpu_backtrace(NULL);
+
if (!cpumask_empty(to_cpumask(backtrace_mask))) {
pr_info("Sending NMI from CPU %d to CPUs %*pbl:\n",
this_cpu, nr_cpumask_bits, to_cpumask(backtrace_mask));