aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-01-09 23:51:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:25 -0500
commit9c107805aba774667debc01704718960339c24b9 (patch)
tree7cad57c658bab6a728327bb969cfc0a8e46781d8 /arch
parent51989b9ffeea58999054fe3f21bd0cd0bd207e5a (diff)
[PATCH] printk levels for i386 oops code.
Especially useful when users have booted with 'quiet'. In the regular 'oops' path, we set the console_loglevel before we start spewing debug info, but we can call the backtrace code from other places now too, such as the spinlock debugging code. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/traps.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 53ad954e3ba4..b9f0030a2ebb 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -120,7 +120,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
120#ifdef CONFIG_FRAME_POINTER 120#ifdef CONFIG_FRAME_POINTER
121 while (valid_stack_ptr(tinfo, (void *)ebp)) { 121 while (valid_stack_ptr(tinfo, (void *)ebp)) {
122 addr = *(unsigned long *)(ebp + 4); 122 addr = *(unsigned long *)(ebp + 4);
123 printk(" [<%08lx>] ", addr); 123 printk(KERN_EMERG " [<%08lx>] ", addr);
124 print_symbol("%s", addr); 124 print_symbol("%s", addr);
125 printk("\n"); 125 printk("\n");
126 ebp = *(unsigned long *)ebp; 126 ebp = *(unsigned long *)ebp;
@@ -129,7 +129,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
129 while (valid_stack_ptr(tinfo, stack)) { 129 while (valid_stack_ptr(tinfo, stack)) {
130 addr = *stack++; 130 addr = *stack++;
131 if (__kernel_text_address(addr)) { 131 if (__kernel_text_address(addr)) {
132 printk(" [<%08lx>]", addr); 132 printk(KERN_EMERG " [<%08lx>]", addr);
133 print_symbol(" %s", addr); 133 print_symbol(" %s", addr);
134 printk("\n"); 134 printk("\n");
135 } 135 }
@@ -161,7 +161,7 @@ void show_trace(struct task_struct *task, unsigned long * stack)
161 stack = (unsigned long*)context->previous_esp; 161 stack = (unsigned long*)context->previous_esp;
162 if (!stack) 162 if (!stack)
163 break; 163 break;
164 printk(" =======================\n"); 164 printk(KERN_EMERG " =======================\n");
165 } 165 }
166} 166}
167 167
@@ -178,14 +178,15 @@ void show_stack(struct task_struct *task, unsigned long *esp)
178 } 178 }
179 179
180 stack = esp; 180 stack = esp;
181 printk(KERN_EMERG);
181 for(i = 0; i < kstack_depth_to_print; i++) { 182 for(i = 0; i < kstack_depth_to_print; i++) {
182 if (kstack_end(stack)) 183 if (kstack_end(stack))
183 break; 184 break;
184 if (i && ((i % 8) == 0)) 185 if (i && ((i % 8) == 0))
185 printk("\n "); 186 printk("\n" KERN_EMERG " ");
186 printk("%08lx ", *stack++); 187 printk("%08lx ", *stack++);
187 } 188 }
188 printk("\nCall Trace:\n"); 189 printk("\n" KERN_EMERG "Call Trace:\n");
189 show_trace(task, esp); 190 show_trace(task, esp);
190} 191}
191 192
@@ -216,18 +217,18 @@ void show_registers(struct pt_regs *regs)
216 ss = regs->xss & 0xffff; 217 ss = regs->xss & 0xffff;
217 } 218 }
218 print_modules(); 219 print_modules();
219 printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx" 220 printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n"
220 " (%s) \n", 221 "EFLAGS: %08lx (%s) \n",
221 smp_processor_id(), 0xffff & regs->xcs, regs->eip, 222 smp_processor_id(), 0xffff & regs->xcs, regs->eip,
222 print_tainted(), regs->eflags, system_utsname.release); 223 print_tainted(), regs->eflags, system_utsname.release);
223 print_symbol("EIP is at %s\n", regs->eip); 224 print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
224 printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 225 printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
225 regs->eax, regs->ebx, regs->ecx, regs->edx); 226 regs->eax, regs->ebx, regs->ecx, regs->edx);
226 printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 227 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
227 regs->esi, regs->edi, regs->ebp, esp); 228 regs->esi, regs->edi, regs->ebp, esp);
228 printk("ds: %04x es: %04x ss: %04x\n", 229 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
229 regs->xds & 0xffff, regs->xes & 0xffff, ss); 230 regs->xds & 0xffff, regs->xes & 0xffff, ss);
230 printk("Process %s (pid: %d, threadinfo=%p task=%p)", 231 printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
231 current->comm, current->pid, current_thread_info(), current); 232 current->comm, current->pid, current_thread_info(), current);
232 /* 233 /*
233 * When in-kernel, we also print out the stack and code at the 234 * When in-kernel, we also print out the stack and code at the
@@ -236,10 +237,10 @@ void show_registers(struct pt_regs *regs)
236 if (in_kernel) { 237 if (in_kernel) {
237 u8 __user *eip; 238 u8 __user *eip;
238 239
239 printk("\nStack: "); 240 printk("\n" KERN_EMERG "Stack: ");
240 show_stack(NULL, (unsigned long*)esp); 241 show_stack(NULL, (unsigned long*)esp);
241 242
242 printk("Code: "); 243 printk(KERN_EMERG "Code: ");
243 244
244 eip = (u8 __user *)regs->eip - 43; 245 eip = (u8 __user *)regs->eip - 43;
245 for (i = 0; i < 64; i++, eip++) { 246 for (i = 0; i < 64; i++, eip++) {
@@ -280,15 +281,15 @@ static void handle_BUG(struct pt_regs *regs)
280 (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) 281 (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
281 file = "<bad filename>"; 282 file = "<bad filename>";
282 283
283 printk("------------[ cut here ]------------\n"); 284 printk(KERN_EMERG "------------[ cut here ]------------\n");
284 printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); 285 printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
285 286
286no_bug: 287no_bug:
287 return; 288 return;
288 289
289 /* Here we know it was a BUG but file-n-line is unavailable */ 290 /* Here we know it was a BUG but file-n-line is unavailable */
290bug: 291bug:
291 printk("Kernel BUG\n"); 292 printk(KERN_EMERG "Kernel BUG\n");
292} 293}
293 294
294/* This is gone through when something in the kernel 295/* This is gone through when something in the kernel
@@ -321,16 +322,20 @@ void die(const char * str, struct pt_regs * regs, long err)
321 if (++die.lock_owner_depth < 3) { 322 if (++die.lock_owner_depth < 3) {
322 int nl = 0; 323 int nl = 0;
323 handle_BUG(regs); 324 handle_BUG(regs);
324 printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 325 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
325#ifdef CONFIG_PREEMPT 326#ifdef CONFIG_PREEMPT
326 printk("PREEMPT "); 327 printk(KERN_EMERG "PREEMPT ");
327 nl = 1; 328 nl = 1;
328#endif 329#endif
329#ifdef CONFIG_SMP 330#ifdef CONFIG_SMP
331 if (!nl)
332 printk(KERN_EMERG);
330 printk("SMP "); 333 printk("SMP ");
331 nl = 1; 334 nl = 1;
332#endif 335#endif
333#ifdef CONFIG_DEBUG_PAGEALLOC 336#ifdef CONFIG_DEBUG_PAGEALLOC
337 if (!nl)
338 printk(KERN_EMERG);
334 printk("DEBUG_PAGEALLOC"); 339 printk("DEBUG_PAGEALLOC");
335 nl = 1; 340 nl = 1;
336#endif 341#endif
@@ -339,7 +344,7 @@ void die(const char * str, struct pt_regs * regs, long err)
339 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 344 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
340 show_registers(regs); 345 show_registers(regs);
341 } else 346 } else
342 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 347 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
343 348
344 bust_spinlocks(0); 349 bust_spinlocks(0);
345 die.lock_owner = -1; 350 die.lock_owner = -1;
@@ -527,8 +532,10 @@ gp_in_kernel:
527 532
528static void mem_parity_error(unsigned char reason, struct pt_regs * regs) 533static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
529{ 534{
530 printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); 535 printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying "
531 printk("You probably have a hardware problem with your RAM chips\n"); 536 "to continue\n");
537 printk(KERN_EMERG "You probably have a hardware problem with your RAM "
538 "chips\n");
532 539
533 /* Clear and disable the memory parity error line. */ 540 /* Clear and disable the memory parity error line. */
534 clear_mem_error(reason); 541 clear_mem_error(reason);
@@ -538,7 +545,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs)
538{ 545{
539 unsigned long i; 546 unsigned long i;
540 547
541 printk("NMI: IOCK error (debug interrupt?)\n"); 548 printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
542 show_registers(regs); 549 show_registers(regs);
543 550
544 /* Re-enable the IOCK line, wait for a few seconds */ 551 /* Re-enable the IOCK line, wait for a few seconds */
@@ -580,11 +587,11 @@ void die_nmi (struct pt_regs *regs, const char *msg)
580 * to get a message out. 587 * to get a message out.
581 */ 588 */
582 bust_spinlocks(1); 589 bust_spinlocks(1);
583 printk(msg); 590 printk(KERN_EMERG "%s", msg);
584 printk(" on CPU%d, eip %08lx, registers:\n", 591 printk(" on CPU%d, eip %08lx, registers:\n",
585 smp_processor_id(), regs->eip); 592 smp_processor_id(), regs->eip);
586 show_registers(regs); 593 show_registers(regs);
587 printk("console shuts up ...\n"); 594 printk(KERN_EMERG "console shuts up ...\n");
588 console_silent(); 595 console_silent();
589 spin_unlock(&nmi_print_lock); 596 spin_unlock(&nmi_print_lock);
590 bust_spinlocks(0); 597 bust_spinlocks(0);
@@ -990,8 +997,8 @@ asmlinkage void math_state_restore(struct pt_regs regs)
990 997
991asmlinkage void math_emulate(long arg) 998asmlinkage void math_emulate(long arg)
992{ 999{
993 printk("math-emulation not enabled and no coprocessor found.\n"); 1000 printk(KERN_EMERG "math-emulation not enabled and no coprocessor found.\n");
994 printk("killing %s.\n",current->comm); 1001 printk(KERN_EMERG "killing %s.\n",current->comm);
995 force_sig(SIGFPE,current); 1002 force_sig(SIGFPE,current);
996 schedule(); 1003 schedule();
997} 1004}