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