Commit 6f10fdab authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: simplify irq stack overflow checking

Take a page from x86 and abstract the stack checking out of the
asm_do_IRQ() function so that the result is easier to digest.
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 46f288a0
...@@ -88,6 +88,22 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -88,6 +88,22 @@ int show_interrupts(struct seq_file *p, void *v)
} }
#endif #endif
#ifdef CONFIG_DEBUG_STACKOVERFLOW
static void check_stack_overflow(int irq)
{
/* Debugging check for stack overflow: is there less than STACK_WARN free? */
long sp = __get_SP() & (THREAD_SIZE - 1);
if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
dump_stack();
pr_emerg("irq%i: possible stack overflow only %ld bytes free\n",
irq, sp - sizeof(struct thread_info));
}
}
#else
static inline void check_stack_overflow(int irq) { }
#endif
/* /*
* do_IRQ handles all hardware IRQs. Decoded IRQs should not * do_IRQ handles all hardware IRQs. Decoded IRQs should not
* come via this function. Instead, they should provide their * come via this function. Instead, they should provide their
...@@ -105,21 +121,7 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs) ...@@ -105,21 +121,7 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
irq_enter(); irq_enter();
#ifdef CONFIG_DEBUG_STACKOVERFLOW check_stack_overflow(irq);
/* Debugging check for stack overflow: is there less than STACK_WARN free? */
{
long sp;
sp = __get_SP() & (THREAD_SIZE-1);
if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
dump_stack();
printk(KERN_EMERG "%s: possible stack overflow while handling irq %i "
" only %ld bytes free\n",
__func__, irq, sp - sizeof(struct thread_info));
}
}
#endif
/* /*
* Some hardware gives randomly wrong interrupts. Rather * Some hardware gives randomly wrong interrupts. Rather
......
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