mips: add arch_trigger_all_cpu_backtrace() function
PATCH 1/1 mips: add arch_trigger_all_cpu_backtrace() function
Currently, arch_trigger_all_cpu_backtrace() is defined in only x86 and sparc which has nmi interrupt.
But in case of softlockup not a hardlockup, 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.
This patch adds arch_trigger_all_cpu_backtrace() for mips architecture.
Maybe someone make better patch than this. I just suggest the idea.
--- arch/mips/include/asm/irq.h | 3 +++ arch/mips/kernel/process.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-)
arch/mips/include/asm/irq.h +3 -0
@@ -48,4 +48,7 @@ extern int cp0_compare_irq;extern int cp0_compare_irq_shift;extern int cp0_perfcount_irq; +void arch_trigger_all_cpu_backtrace (bool ); +#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace +#endif /* _ASM_IRQ_H */
arch/mips/kernel/process.c +18 -0
@@ -42,6 +42,7 @@#include <asm/isadep.h> #include <asm/inst.h> #include <asm/stacktrace.h> +#include <asm/irq_regs.h> #ifdef CONFIG_HOTPLUG_CPU void arch_cpu_idle_dead (void )
@@ -532,3 +533,20 @@ unsigned long arch_align_stack(unsigned long sp)return sp &ALMASK ; } + +static void arch_dump_stack (void *info) +{ +struct pt_regs *regs; + + regs =get_irq_regs (); + +if (regs) +show_regs (regs); + +dump_stack (); +} + +void arch_trigger_all_cpu_backtrace (bool include_self) +{ +smp_call_function (arch_dump_stack,NULL ,1 ); +}
Signature · 2 lines
1.7.0.1
�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�Hi Eubong,
one small question inline ...
Quoted 26 lines · Eunbong Song
Currently,
arch_trigger_all_cpu_backtrace()is defined in only x86 and sparc which has nmi interrupt. But in case of softlockup not a hardlockup, 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(). Anddump_stack()print only backtrace for "CPU 0". If CPU1's backtrace is printed it's very helpful.This patch adds
arch_trigger_all_cpu_backtrace()for mips architecture.Maybe someone make better patch than this. I just suggest the
idea. ---arch/mips/include/asm/irq.h| 3 +++arch/mips/kernel/process.c| 18 ++++++++++++++++++ 2 files
changed, 21 insertions(+), 0 deletions(-)
Quoted 8 lines
(quoted diff) +0
-0
b/arch/mips/include/asm/irq.hindex 39f07ae..5a4e1bb 100644 ---a/arch/mips/include/asm/irq.h+++b/arch/mips/include/asm/irq.h@@ -48,4 +48,7 @@ extern intcp0_compare_irq; extern intcp0_compare_irq_shift; extern intcp0_perfcount_irq;+void
arch_trigger_all_cpu_backtrace(bool); +#definearch_trigger_all_cpu_backtracearch_trigger_all_cpu_backtrace
What is the purpose of this define ? is this maybe a leftover from some regex/cleanups ?
John
Quoted 15 lines
+ #endif /*
_ASM_IRQ_H*/ diff --gita/arch/mips/kernel/process.cb/arch/mips/kernel/process.cindex 636b074..9f51d3d 100644 ---a/arch/mips/kernel/process.c+++b/arch/mips/kernel/process.c@@ -42,6 +42,7 @@ #include <asm/isadep.h> #include <asm/inst.h> #include <asm/stacktrace.h> +#include <asm/irq_regs.h>#ifdef
CONFIG_HOTPLUG_CPUvoidarch_cpu_idle_dead(void)@@ -532,3 +533,20 @@ unsigned longarch_align_stack(unsigned long sp)return sp & ALMASK; } + +static void
arch_dump_stack(void *info)(quoted diff) +2
-0+{ + struct pt_regs *regs; + + regs = get_irq_regs(); + + if(regs) + show_regs(regs); + + dump_stack(); +} + +void
arch_trigger_all_cpu_backtrace(bool include_self)+{ +smp_call_function(arch_dump_stack, NULL, 1); +}
On Wed, Oct 22, 2014 at 06:39:56AM +0000, Eunbong Song wrote:
Applying - but:
arch/mips/kernel/process.c unsigned long arch_align_stack(unsigned long sp) · line 543
Quoted 1 line
arch/mips/kernel/process.c +1
-0+if (regs)
^^^
There should be a blank between if and opening parenthesis.
Ralf
Quoted 1 line · Eunbong Song
This patch adds
arch_trigger_all_cpu_backtrace()for mips architecture.
Don't forget your Signed-off-by
Quoted 5 lines
arch/mips/kernel/process.c +5
-0+static void arch_dump_stack (void *info) +{ +struct pt_regs *regs; + + regs =get_irq_regs ();
arch/mips/kernel/process.c unsigned long arch_align_stack(unsigned long sp) · line 551
Quoted 10 lines
arch/mips/kernel/process.c +10
-0+ +if (regs) +show_regs (regs); + +dump_stack (); +} + +void arch_trigger_all_cpu_backtrace (bool include_self) +{ +smp_call_function (arch_dump_stack,NULL ,1 );
should this call arch_dump_stack directly too if include_self?
Cheers
James