diff options
authorDaniel Thompson <daniel.thompson@linaro.org>2015-01-05 12:39:33 +0000
committerDaniel Thompson <daniel.thompson@linaro.org>2015-01-27 11:58:27 +0000
commitb304ea3e164714e1540b7bc69b3205a12d953e79 (patch)
parent42b4d4e439f05dc85bd8cbddb1c25fac87533e3a (diff)
ARM: Fix on-demand backtrace triggered by IRQ
Currently if arch_trigger_all_cpu_backtrace() is called with interrupts disabled and on a platform the delivers IPI_CPU_BACKTRACE using regular IRQ requests the system will wedge for ten seconds waiting for the current CPU to react to a masked interrupt. This patch resolves this issue by calling directly into the backtrace dump code instead of generating an IPI. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Russell King <linux@arm.linux.org.uk>
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 7bf6a06a00ee..899da46b0d00 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -751,6 +751,16 @@ void arch_trigger_all_cpu_backtrace(bool include_self)
cpumask_clear_cpu(this_cpu, to_cpumask(backtrace_mask));
cpumask_copy(&printtrace_mask, to_cpumask(backtrace_mask));
+ /*
+ * If irqs are disabled on the current processor then, if
+ * IPI_CPU_BACKTRACE is delivered using IRQ, we will won't be able to
+ * react to IPI_CPU_BACKTRACE until we leave this function. We avoid
+ * the potential timeout (not to mention the failure to print useful
+ * information) by calling the backtrace directly.
+ */
+ if (include_self && irqs_disabled())
+ ipi_cpu_backtrace(in_interrupt() ? get_irq_regs() : NULL);
if (!cpumask_empty(to_cpumask(backtrace_mask))) {
pr_info("Sending FIQ to %s CPUs:\n",
(include_self ? "all" : "other"));
@@ -779,7 +789,10 @@ void ipi_cpu_backtrace(struct pt_regs *regs)
if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
orig = this_cpu_begin_nmi_printk();
pr_warn("FIQ backtrace for cpu %d\n", cpu);
- show_regs(regs);
+ if (regs != NULL)
+ show_regs(regs);
+ else
+ dump_stack();
cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));