diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-06-15 06:18:38 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-22 21:15:43 -0400 |
commit | 6f10fdabdce356aac3c948e659f39b6f1e2f7382 (patch) | |
tree | ab34b944e187609a2712883bfec6a9d5a5690762 /arch/blackfin | |
parent | 46f288a0f983401ebadb918751d342cbf819cde5 (diff) |
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: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/irqchip.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c index 8abb642283b4..7378440792a4 100644 --- a/arch/blackfin/kernel/irqchip.c +++ b/arch/blackfin/kernel/irqchip.c | |||
@@ -88,6 +88,22 @@ int show_interrupts(struct seq_file *p, void *v) | |||
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | ||
92 | static void check_stack_overflow(int irq) | ||
93 | { | ||
94 | /* Debugging check for stack overflow: is there less than STACK_WARN free? */ | ||
95 | long sp = __get_SP() & (THREAD_SIZE - 1); | ||
96 | |||
97 | if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { | ||
98 | dump_stack(); | ||
99 | pr_emerg("irq%i: possible stack overflow only %ld bytes free\n", | ||
100 | irq, sp - sizeof(struct thread_info)); | ||
101 | } | ||
102 | } | ||
103 | #else | ||
104 | static inline void check_stack_overflow(int irq) { } | ||
105 | #endif | ||
106 | |||
91 | /* | 107 | /* |
92 | * do_IRQ handles all hardware IRQs. Decoded IRQs should not | 108 | * do_IRQ handles all hardware IRQs. Decoded IRQs should not |
93 | * come via this function. Instead, they should provide their | 109 | * 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 | 121 | ||
106 | irq_enter(); | 122 | irq_enter(); |
107 | 123 | ||
108 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 124 | check_stack_overflow(irq); |
109 | /* Debugging check for stack overflow: is there less than STACK_WARN free? */ | ||
110 | { | ||
111 | long sp; | ||
112 | |||
113 | sp = __get_SP() & (THREAD_SIZE-1); | ||
114 | |||
115 | if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { | ||
116 | dump_stack(); | ||
117 | printk(KERN_EMERG "%s: possible stack overflow while handling irq %i " | ||
118 | " only %ld bytes free\n", | ||
119 | __func__, irq, sp - sizeof(struct thread_info)); | ||
120 | } | ||
121 | } | ||
122 | #endif | ||
123 | 125 | ||
124 | /* | 126 | /* |
125 | * Some hardware gives randomly wrong interrupts. Rather | 127 | * Some hardware gives randomly wrong interrupts. Rather |