Commit ddde7f68 authored by Keith M. Wesolowski's avatar Keith M. Wesolowski

[SPARC]: Add stack usage instrumentation

parent c61660c3
...@@ -380,11 +380,32 @@ source "drivers/char/watchdog/Kconfig" ...@@ -380,11 +380,32 @@ source "drivers/char/watchdog/Kconfig"
menu "Kernel hacking" menu "Kernel hacking"
config DEBUG_KERNEL
bool "Kernel debugging"
help
Say Y here if you are developing drivers or trying to debug and
identify kernel problems.
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 and sysrq-P debug output.
This option will slow down process creation somewhat.
config DEBUG_SLAB config DEBUG_SLAB
bool "Debug memory allocations" bool "Debug memory allocations"
depends on DEBUG_KERNEL
help
Say Y here to have the kernel do limited verification on memory
allocation as well as poisoning memory on free to catch use of freed
memory.
config MAGIC_SYSRQ config MAGIC_SYSRQ
bool "Magic SysRq key" bool "Magic SysRq key"
depends on DEBUG_KERNEL
help help
If you say Y here, you will have some control over the system even If you say Y here, you will have some control over the system even
if the system crashes for example during kernel debugging (e.g., you if the system crashes for example during kernel debugging (e.g., you
...@@ -398,22 +419,30 @@ config MAGIC_SYSRQ ...@@ -398,22 +419,30 @@ config MAGIC_SYSRQ
config DEBUG_SPINLOCK config DEBUG_SPINLOCK
bool "Spinlock debugging" bool "Spinlock debugging"
depends on DEBUG_KERNEL
help
Say Y here and build SMP to catch missing spinlock initialization
and certain other kinds of spinlock errors commonly made. This is
best used in conjunction with the NMI watchdog so that spinlock
deadlocks are also debuggable.
config DEBUG_HIGHMEM config DEBUG_HIGHMEM
bool "Highmem debugging" bool "Highmem debugging"
depends on DEBUG_KERNEL && HIGHMEM depends on DEBUG_KERNEL && HIGHMEM
help help
This options enables addition error checking for high memory systems. This options enables additional error checking for high memory
Disable for production systems. systems. Disable for production systems.
config DEBUG_SPINLOCK_SLEEP config DEBUG_SPINLOCK_SLEEP
bool "Sleep-inside-spinlock checking" bool "Sleep-inside-spinlock checking"
depends on DEBUG_KERNEL
help help
If you say Y here, various routines which may sleep will become very If you say Y here, various routines which may sleep will become very
noisy if they are called with a spinlock held. noisy if they are called with a spinlock held.
config DEBUG_BUGVERBOSE config DEBUG_BUGVERBOSE
bool "Verbose BUG() reporting (adds 70K)" bool "Verbose BUG() reporting (adds 70K)"
depends on DEBUG_KERNEL
help help
Say Y here to make BUG() panics output the file name and line number Say Y here to make BUG() panics output the file name and line number
of the BUG call as well as the EIP and oops trace. This aids of the BUG call as well as the EIP and oops trace. This aids
......
...@@ -627,8 +627,15 @@ static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len) ...@@ -627,8 +627,15 @@ static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
*/ */
struct thread_info *srmmu_alloc_thread_info(void) struct thread_info *srmmu_alloc_thread_info(void)
{ {
return (struct thread_info *) struct thread_info *ret;
__get_free_pages(GFP_KERNEL, THREAD_INFO_ORDER);
ret = (struct thread_info *)__get_free_pages(GFP_KERNEL,
THREAD_INFO_ORDER);
#ifdef CONFIG_DEBUG_STACK_USAGE
memset(ret, 0, PAGE_SIZE << THREAD_INFO_ORDER);
#endif /* DEBUG_STACK_USAGE */
return ret;
} }
static void srmmu_free_thread_info(struct thread_info *ti) static void srmmu_free_thread_info(struct thread_info *ti)
......
...@@ -1058,6 +1058,11 @@ static struct thread_info *sun4c_alloc_thread_info(void) ...@@ -1058,6 +1058,11 @@ static struct thread_info *sun4c_alloc_thread_info(void)
#ifndef CONFIG_SUN4 #ifndef CONFIG_SUN4
sun4c_put_pte(addr + PAGE_SIZE, BUCKET_PTE(pages + PAGE_SIZE)); sun4c_put_pte(addr + PAGE_SIZE, BUCKET_PTE(pages + PAGE_SIZE));
#endif #endif
#ifdef CONFIG_DEBUG_STACK_USAGE
memset((void *)addr, 0, PAGE_SIZE << THREAD_INFO_ORDER);
#endif /* DEBUG_STACK_USAGE */
return (struct thread_info *) addr; return (struct thread_info *) addr;
} }
......
...@@ -79,9 +79,9 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -79,9 +79,9 @@ register struct thread_info *current_thread_info_reg asm("g6");
/* /*
* thread information allocation * thread information allocation
*/ */
#ifdef CONFIG_SUN4 #if PAGE_SHIFT == 13
#define THREAD_INFO_ORDER 0 #define THREAD_INFO_ORDER 0
#else #else /* PAGE_SHIFT */
#define THREAD_INFO_ORDER 1 #define THREAD_INFO_ORDER 1
#endif #endif
......
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