arch/tile: adopt the new nmi_backtrace framework
PATCH 119/127 arch/tile: adopt the new nmi_backtrace framework
From: Chris Metcalf <[email protected]>
Subject: arch/tile: adopt the new nmi_backtrace framework
Previously tile was rolling its own method of capturing backtrace data in the NMI handlers, but it was relying on running printk() from the NMI handler, which is not always safe. So adopt the nmi_backtrace model (with the new cpumask extension) instead.
So we can call the nmi_backtrace code directly from the nmi handler, move the nmi_enter()/exit() into the top-level tile NMI handler.
The semantics of the routine change slightly since it is now synchronous with the remote cores completing the backtraces. Previously it was asynchronous, but with protection to avoid starting a new remote backtrace if the old one was still in progress.
---
arch/tile/include/asm/irq.h | 5 +- arch/tile/kernel/pmc.c | 3 - arch/tile/kernel/process.c | 73 +++++++--------------------------- arch/tile/kernel/traps.c | 9 +++- 4 files changed, 27 insertions(+), 63 deletions(-)
arch/tile/include/asm/irq.h renamed from arch/tile/include/asm/irq.h~arch-tile-adopt-the-new-nmi_backtrace-framework +3 -2
@@ -79,8 +79,9 @@ void tile_irq_activate(unsigned int irq,void setup_irq_regs (void );#ifdef __tilegx__ -void arch_trigger_all_cpu_backtrace (bool self); -#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace +void arch_trigger_cpumask_backtrace (const struct cpumask *mask, +bool exclude_self); +#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace#endif #endif /* _ASM_TILE_IRQ_H */
arch/tile/kernel/pmc.c renamed from arch/tile/kernel/pmc.c~arch-tile-adopt-the-new-nmi_backtrace-framework +0 -3
@@ -16,7 +16,6 @@#include <linux/spinlock.h> #include <linux/module.h> #include <linux/atomic.h> -#include <linux/interrupt.h> #include <asm/processor.h> #include <asm/pmc.h>
@@ -29,9 +28,7 @@ int handle_perf_interrupt(struct pt_regsif (!perf_irq)panic ("Unexpected PERF_COUNT interrupt %d\n" , fault); -nmi_enter (); retval =perf_irq (regs, fault); -nmi_exit ();return retval; }
arch/tile/kernel/process.c renamed from arch/tile/kernel/process.c~arch-tile-adopt-the-new-nmi_backtrace-framework +17 -56
118 lines not on this page · raw message
arch/tile/kernel/traps.c renamed from arch/tile/kernel/traps.c~arch-tile-adopt-the-new-nmi_backtrace-framework +7 -2
@@ -20,6 +20,8 @@#include <linux/reboot.h> #include <linux/uaccess.h> #include <linux/ptrace.h> +#include <linux/hardirq.h> +#include <linux/nmi.h> #include <asm/stack.h> #include <asm/traps.h> #include <asm/setup.h>
@@ -392,14 +394,17 @@ void __kprobes do_trap(struct pt_regs *rvoid do_nmi (struct pt_regs *regs,int fault_num,unsigned long reason) { +nmi_enter ();switch (reason) { +#ifdef arch_trigger_cpumask_backtracecase TILE_NMI_DUMP_STACK : -do_nmi_dump_stack (regs); +nmi_cpu_backtrace (regs);break ; +#endif default :panic ("Unexpected do_nmi type %ld" , reason); -return ; } +nmi_exit (); }/* Deprecated function currently only used here. */
_