]> git.neil.brown.name Git - history.git/commitdiff
[SPARC]: Add stack usage instrumentation
authorKeith M. Wesolowski <wesolows@foobazco.org>
Thu, 4 Mar 2004 13:57:18 +0000 (05:57 -0800)
committerKeith M. Wesolowski <wesolows@foobazco.org>
Thu, 4 Mar 2004 13:57:18 +0000 (05:57 -0800)
arch/sparc/Kconfig
arch/sparc/mm/srmmu.c
arch/sparc/mm/sun4c.c
include/asm-sparc/thread_info.h

index e69b24e85ea94beab7393cbb47dbc8e510618edc..a1bdac06e7e4aa73434e447fa6e23107d8b35dbd 100644 (file)
@@ -380,11 +380,32 @@ source "drivers/char/watchdog/Kconfig"
 
 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
        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
        bool "Magic SysRq key"
+       depends on DEBUG_KERNEL
        help
          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
@@ -398,22 +419,30 @@ config MAGIC_SYSRQ
 
 config DEBUG_SPINLOCK
        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
        bool "Highmem debugging"
        depends on DEBUG_KERNEL && HIGHMEM
        help
-         This options enables addition error checking for high memory systems.
-         Disable for production systems.
+         This options enables additional error checking for high memory
+         systems.  Disable for production systems.
 
 config DEBUG_SPINLOCK_SLEEP
        bool "Sleep-inside-spinlock checking"
+       depends on DEBUG_KERNEL
        help
          If you say Y here, various routines which may sleep will become very
          noisy if they are called with a spinlock held.        
 
 config DEBUG_BUGVERBOSE
        bool "Verbose BUG() reporting (adds 70K)"
+       depends on DEBUG_KERNEL
        help
          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
index 0a0e52cad279fe55403da34f2b9501b580465807..d2f295234827e1d48dc79093c07d0db84863ceba 100644 (file)
@@ -627,8 +627,15 @@ static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
  */
 struct thread_info *srmmu_alloc_thread_info(void)
 {
-       return (struct thread_info *)
-           __get_free_pages(GFP_KERNEL, THREAD_INFO_ORDER);
+       struct thread_info *ret;
+
+       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)
index 3bacdbec393616f32336ef5c81552f6b4a99d297..cae26efed2f8d1818892609e286e186d20b51b06 100644 (file)
@@ -1058,6 +1058,11 @@ static struct thread_info *sun4c_alloc_thread_info(void)
 #ifndef CONFIG_SUN4    
        sun4c_put_pte(addr + PAGE_SIZE, BUCKET_PTE(pages + PAGE_SIZE));
 #endif
+
+#ifdef CONFIG_DEBUG_STACK_USAGE
+       memset((void *)addr, 0, PAGE_SIZE << THREAD_INFO_ORDER);
+#endif /* DEBUG_STACK_USAGE */
+
        return (struct thread_info *) addr;
 }
 
index 883cee86ec0860d1d3fd51aeb13d3110316efe8d..682f9fca9c5308a3a785b0b7b0d72be620b67179 100644 (file)
@@ -79,9 +79,9 @@ register struct thread_info *current_thread_info_reg asm("g6");
 /*
  * thread information allocation
  */
-#ifdef CONFIG_SUN4
+#if PAGE_SHIFT == 13
 #define THREAD_INFO_ORDER  0
-#else
+#else /* PAGE_SHIFT */
 #define THREAD_INFO_ORDER  1
 #endif