Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127093
b: refs/heads/master
c: a45d575
h: refs/heads/master
i:
  127091: 062ea3b
v: v3
  • Loading branch information
Robin Getz authored and Bryan Wu committed Jan 7, 2009
1 parent fc7e8c0 commit c0c9600
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f768a0eb90831ced2129df6ccba6f1177fa5a0fa
refs/heads/master: a45d575f53c9ed2926840377e59aa19e2024ee87
16 changes: 16 additions & 0 deletions trunk/arch/blackfin/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ menu "Kernel hacking"

source "lib/Kconfig.debug"

config DEBUG_STACKOVERFLOW
bool "Check for stack overflows"
depends on DEBUG_KERNEL
help
This option will cause messages to be printed if free stack space
drops below a certain limit.

config DEBUG_STACK_USAGE
bool "Enable stack utilization instrumentation"
depends on DEBUG_KERNEL
help
Enables the display of the minimum amount of free stack which each
task has ever had available in the sysrq-T output.

This option will slow down process creation somewhat.

config HAVE_ARCH_KGDB
def_bool y

Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/blackfin/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ static inline void wrusp(unsigned long usp)
__asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
}

static inline unsigned long __get_SP(void)
{
unsigned long sp;

__asm__ __volatile__("%0 = sp;\n\t" : "=da"(sp));
return sp;
}

/*
* User space process size: 1st byte beyond user address space.
* Fairly meaningless on nommu. Parts of user programs can be scattered
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/blackfin/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
*/
#define THREAD_SIZE_ORDER 1
#define THREAD_SIZE 8192 /* 2 pages */
#define STACK_WARN (THREAD_SIZE/8)

#ifndef __ASSEMBLY__

Expand Down
16 changes: 15 additions & 1 deletion trunk/arch/blackfin/kernel/irqchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,21 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
desc = &bad_irq_desc;

irq_enter();

#ifdef CONFIG_DEBUG_STACKOVERFLOW
/* 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
generic_handle_irq(irq);

/* If we're the only interrupt running (ignoring IRQ15 which is for
Expand Down

0 comments on commit c0c9600

Please sign in to comment.