[PATCH] i386: fix stack dump loglevel

Recent changes caused part of stack traces from SysRq-T to print at
KERN_EMERG loglevel. Also, parts of stack dump during oops were failing to
print at that level when they should.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Chuck Ebbert and committed by Linus Torvalds 7aa89746 ce63ad78

+39 -18
+39 -18
arch/i386/kernel/traps.c
··· 112 p < (void *)tinfo + THREAD_SIZE - 3; 113 } 114 115 static inline unsigned long print_context_stack(struct thread_info *tinfo, 116 - unsigned long *stack, unsigned long ebp) 117 { 118 unsigned long addr; 119 120 #ifdef CONFIG_FRAME_POINTER 121 while (valid_stack_ptr(tinfo, (void *)ebp)) { 122 addr = *(unsigned long *)(ebp + 4); 123 - printk(KERN_EMERG " [<%08lx>] ", addr); 124 - print_symbol("%s", addr); 125 - printk("\n"); 126 ebp = *(unsigned long *)ebp; 127 } 128 #else 129 while (valid_stack_ptr(tinfo, stack)) { 130 addr = *stack++; 131 - if (__kernel_text_address(addr)) { 132 - printk(KERN_EMERG " [<%08lx>]", addr); 133 - print_symbol(" %s", addr); 134 - printk("\n"); 135 - } 136 } 137 #endif 138 return ebp; 139 } 140 141 - void show_trace(struct task_struct *task, unsigned long * stack) 142 { 143 unsigned long ebp; 144 ··· 162 struct thread_info *context; 163 context = (struct thread_info *) 164 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 165 - ebp = print_context_stack(context, stack, ebp); 166 stack = (unsigned long*)context->previous_esp; 167 if (!stack) 168 break; ··· 170 } 171 } 172 173 - void show_stack(struct task_struct *task, unsigned long *esp) 174 { 175 unsigned long *stack; 176 int i; ··· 189 } 190 191 stack = esp; 192 - printk(KERN_EMERG); 193 for(i = 0; i < kstack_depth_to_print; i++) { 194 if (kstack_end(stack)) 195 break; 196 - if (i && ((i % 8) == 0)) 197 - printk("\n" KERN_EMERG " "); 198 printk("%08lx ", *stack++); 199 } 200 - printk("\n" KERN_EMERG "Call Trace:\n"); 201 - show_trace(task, esp); 202 } 203 204 /* ··· 259 u8 __user *eip; 260 261 printk("\n" KERN_EMERG "Stack: "); 262 - show_stack(NULL, (unsigned long*)esp); 263 264 printk(KERN_EMERG "Code: "); 265
··· 112 p < (void *)tinfo + THREAD_SIZE - 3; 113 } 114 115 + static void print_addr_and_symbol(unsigned long addr, char *log_lvl) 116 + { 117 + printk(log_lvl); 118 + printk(" [<%08lx>] ", addr); 119 + print_symbol("%s", addr); 120 + printk("\n"); 121 + } 122 + 123 static inline unsigned long print_context_stack(struct thread_info *tinfo, 124 + unsigned long *stack, unsigned long ebp, 125 + char *log_lvl) 126 { 127 unsigned long addr; 128 129 #ifdef CONFIG_FRAME_POINTER 130 while (valid_stack_ptr(tinfo, (void *)ebp)) { 131 addr = *(unsigned long *)(ebp + 4); 132 + print_addr_and_symbol(addr, log_lvl); 133 ebp = *(unsigned long *)ebp; 134 } 135 #else 136 while (valid_stack_ptr(tinfo, stack)) { 137 addr = *stack++; 138 + if (__kernel_text_address(addr)) 139 + print_addr_and_symbol(addr, log_lvl); 140 } 141 #endif 142 return ebp; 143 } 144 145 + static void show_trace_log_lvl(struct task_struct *task, 146 + unsigned long *stack, char *log_lvl) 147 { 148 unsigned long ebp; 149 ··· 157 struct thread_info *context; 158 context = (struct thread_info *) 159 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 160 + ebp = print_context_stack(context, stack, ebp, log_lvl); 161 stack = (unsigned long*)context->previous_esp; 162 if (!stack) 163 break; ··· 165 } 166 } 167 168 + void show_trace(struct task_struct *task, unsigned long * stack) 169 + { 170 + show_trace_log_lvl(task, stack, ""); 171 + } 172 + 173 + static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp, 174 + char *log_lvl) 175 { 176 unsigned long *stack; 177 int i; ··· 178 } 179 180 stack = esp; 181 + printk(log_lvl); 182 for(i = 0; i < kstack_depth_to_print; i++) { 183 if (kstack_end(stack)) 184 break; 185 + if (i && ((i % 8) == 0)) { 186 + printk("\n"); 187 + printk(log_lvl); 188 + printk(" "); 189 + } 190 printk("%08lx ", *stack++); 191 } 192 + printk("\n"); 193 + printk(log_lvl); 194 + printk("Call Trace:\n"); 195 + show_trace_log_lvl(task, esp, log_lvl); 196 + } 197 + 198 + void show_stack(struct task_struct *task, unsigned long *esp) 199 + { 200 + show_stack_log_lvl(task, esp, ""); 201 } 202 203 /* ··· 238 u8 __user *eip; 239 240 printk("\n" KERN_EMERG "Stack: "); 241 + show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG); 242 243 printk(KERN_EMERG "Code: "); 244