Commit 96f0e003 authored by Russell King's avatar Russell King

ARM: add basic support for on-demand backtrace of other CPUs

As we now have generic infrastructure to support backtracing of other
CPUs in the system on lockups, we can start to implement this for ARM.
Initially, we add an IPI based implementation, as the GIC code needs
modification to support the generation of FIQ IPIs, and not all ARM
platforms have the ability to raise a FIQ in the non-secure world.

This provides us with a "best efforts" implementation in the absence
of FIQs.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 4d7489ff
...@@ -35,6 +35,11 @@ extern void (*handle_arch_irq)(struct pt_regs *); ...@@ -35,6 +35,11 @@ extern void (*handle_arch_irq)(struct pt_regs *);
extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
#endif #endif
#ifdef CONFIG_SMP
extern void arch_trigger_all_cpu_backtrace(bool);
#define arch_trigger_all_cpu_backtrace(x) arch_trigger_all_cpu_backtrace(x)
#endif
#endif #endif
#endif #endif
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/nmi.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/completion.h> #include <linux/completion.h>
...@@ -72,6 +73,7 @@ enum ipi_msg_type { ...@@ -72,6 +73,7 @@ enum ipi_msg_type {
IPI_CPU_STOP, IPI_CPU_STOP,
IPI_IRQ_WORK, IPI_IRQ_WORK,
IPI_COMPLETION, IPI_COMPLETION,
IPI_CPU_BACKTRACE = 15,
}; };
static DECLARE_COMPLETION(cpu_running); static DECLARE_COMPLETION(cpu_running);
...@@ -630,6 +632,12 @@ void handle_IPI(int ipinr, struct pt_regs *regs) ...@@ -630,6 +632,12 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
irq_exit(); irq_exit();
break; break;
case IPI_CPU_BACKTRACE:
irq_enter();
nmi_cpu_backtrace(regs);
irq_exit();
break;
default: default:
pr_crit("CPU%u: Unknown IPI message 0x%x\n", pr_crit("CPU%u: Unknown IPI message 0x%x\n",
cpu, ipinr); cpu, ipinr);
...@@ -724,3 +732,13 @@ static int __init register_cpufreq_notifier(void) ...@@ -724,3 +732,13 @@ static int __init register_cpufreq_notifier(void)
core_initcall(register_cpufreq_notifier); core_initcall(register_cpufreq_notifier);
#endif #endif
static void raise_nmi(cpumask_t *mask)
{
smp_cross_call(mask, IPI_CPU_BACKTRACE);
}
void arch_trigger_all_cpu_backtrace(bool include_self)
{
nmi_trigger_all_cpu_backtrace(include_self, raise_nmi);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment