Skip to content

Commit 856839b

Browse files
EunBongSongralfbaechle
authored andcommitted
MIPS: Add arch_trigger_all_cpu_backtrace() function
Currently, arch_trigger_all_cpu_backtrace() is defined in only x86 and sparc which have an NMI. But in case of softlockup, it could be possible to dump backtrace of all cpus. and this could be helpful for debugging. for example, if system has 2 cpus. CPU 0 CPU 1 acquire read_lock() try to do write_lock() ,,, missing read_unlock() In this case, softlockup will occur becasuse CPU 0 does not call read_unlock(). And dump_stack() print only backtrace for "CPU 0". If CPU1's backtrace is printed it's very helpful. [ralf@linux-mips.org: Fixed whitespace and formatting issues.] Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/8200/
1 parent 635c990 commit 856839b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

arch/mips/include/asm/irq.h

+3
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ extern int cp0_compare_irq;
4848
extern int cp0_compare_irq_shift;
4949
extern int cp0_perfcount_irq;
5050

51+
void arch_trigger_all_cpu_backtrace(bool);
52+
#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
53+
5154
#endif /* _ASM_IRQ_H */

arch/mips/kernel/process.c

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <asm/isadep.h>
4343
#include <asm/inst.h>
4444
#include <asm/stacktrace.h>
45+
#include <asm/irq_regs.h>
4546

4647
#ifdef CONFIG_HOTPLUG_CPU
4748
void arch_cpu_idle_dead(void)
@@ -532,3 +533,20 @@ unsigned long arch_align_stack(unsigned long sp)
532533

533534
return sp & ALMASK;
534535
}
536+
537+
static void arch_dump_stack(void *info)
538+
{
539+
struct pt_regs *regs;
540+
541+
regs = get_irq_regs();
542+
543+
if (regs)
544+
show_regs(regs);
545+
546+
dump_stack();
547+
}
548+
549+
void arch_trigger_all_cpu_backtrace(bool include_self)
550+
{
551+
smp_call_function(arch_dump_stack, NULL, 1);
552+
}

0 commit comments

Comments
 (0)