提交 9c107805 编写于 作者: D Dave Jones 提交者: Linus Torvalds

[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: NDave Jones <davej@redhat.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 51989b9f
...@@ -120,7 +120,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, ...@@ -120,7 +120,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
while (valid_stack_ptr(tinfo, (void *)ebp)) { while (valid_stack_ptr(tinfo, (void *)ebp)) {
addr = *(unsigned long *)(ebp + 4); addr = *(unsigned long *)(ebp + 4);
printk(" [<%08lx>] ", addr); printk(KERN_EMERG " [<%08lx>] ", addr);
print_symbol("%s", addr); print_symbol("%s", addr);
printk("\n"); printk("\n");
ebp = *(unsigned long *)ebp; ebp = *(unsigned long *)ebp;
...@@ -129,7 +129,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, ...@@ -129,7 +129,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
while (valid_stack_ptr(tinfo, stack)) { while (valid_stack_ptr(tinfo, stack)) {
addr = *stack++; addr = *stack++;
if (__kernel_text_address(addr)) { if (__kernel_text_address(addr)) {
printk(" [<%08lx>]", addr); printk(KERN_EMERG " [<%08lx>]", addr);
print_symbol(" %s", addr); print_symbol(" %s", addr);
printk("\n"); printk("\n");
} }
...@@ -161,7 +161,7 @@ void show_trace(struct task_struct *task, unsigned long * stack) ...@@ -161,7 +161,7 @@ void show_trace(struct task_struct *task, unsigned long * stack)
stack = (unsigned long*)context->previous_esp; stack = (unsigned long*)context->previous_esp;
if (!stack) if (!stack)
break; break;
printk(" =======================\n"); printk(KERN_EMERG " =======================\n");
} }
} }
...@@ -178,14 +178,15 @@ void show_stack(struct task_struct *task, unsigned long *esp) ...@@ -178,14 +178,15 @@ void show_stack(struct task_struct *task, unsigned long *esp)
} }
stack = esp; stack = esp;
printk(KERN_EMERG);
for(i = 0; i < kstack_depth_to_print; i++) { for(i = 0; i < kstack_depth_to_print; i++) {
if (kstack_end(stack)) if (kstack_end(stack))
break; break;
if (i && ((i % 8) == 0)) if (i && ((i % 8) == 0))
printk("\n "); printk("\n" KERN_EMERG " ");
printk("%08lx ", *stack++); printk("%08lx ", *stack++);
} }
printk("\nCall Trace:\n"); printk("\n" KERN_EMERG "Call Trace:\n");
show_trace(task, esp); show_trace(task, esp);
} }
...@@ -216,18 +217,18 @@ void show_registers(struct pt_regs *regs) ...@@ -216,18 +217,18 @@ void show_registers(struct pt_regs *regs)
ss = regs->xss & 0xffff; ss = regs->xss & 0xffff;
} }
print_modules(); print_modules();
printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx" printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n"
" (%s) \n", "EFLAGS: %08lx (%s) \n",
smp_processor_id(), 0xffff & regs->xcs, regs->eip, smp_processor_id(), 0xffff & regs->xcs, regs->eip,
print_tainted(), regs->eflags, system_utsname.release); print_tainted(), regs->eflags, system_utsname.release);
print_symbol("EIP is at %s\n", regs->eip); print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
regs->eax, regs->ebx, regs->ecx, regs->edx); regs->eax, regs->ebx, regs->ecx, regs->edx);
printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
regs->esi, regs->edi, regs->ebp, esp); regs->esi, regs->edi, regs->ebp, esp);
printk("ds: %04x es: %04x ss: %04x\n", printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
regs->xds & 0xffff, regs->xes & 0xffff, ss); regs->xds & 0xffff, regs->xes & 0xffff, ss);
printk("Process %s (pid: %d, threadinfo=%p task=%p)", printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
current->comm, current->pid, current_thread_info(), current); current->comm, current->pid, current_thread_info(), current);
/* /*
* When in-kernel, we also print out the stack and code at the * 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,10 +237,10 @@ void show_registers(struct pt_regs *regs)
if (in_kernel) { if (in_kernel) {
u8 __user *eip; u8 __user *eip;
printk("\nStack: "); printk("\n" KERN_EMERG "Stack: ");
show_stack(NULL, (unsigned long*)esp); show_stack(NULL, (unsigned long*)esp);
printk("Code: "); printk(KERN_EMERG "Code: ");
eip = (u8 __user *)regs->eip - 43; eip = (u8 __user *)regs->eip - 43;
for (i = 0; i < 64; i++, eip++) { for (i = 0; i < 64; i++, eip++) {
...@@ -280,15 +281,15 @@ static void handle_BUG(struct pt_regs *regs) ...@@ -280,15 +281,15 @@ static void handle_BUG(struct pt_regs *regs)
(unsigned long)file < PAGE_OFFSET || __get_user(c, file)) (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
file = "<bad filename>"; file = "<bad filename>";
printk("------------[ cut here ]------------\n"); printk(KERN_EMERG "------------[ cut here ]------------\n");
printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
no_bug: no_bug:
return; return;
/* Here we know it was a BUG but file-n-line is unavailable */ /* Here we know it was a BUG but file-n-line is unavailable */
bug: bug:
printk("Kernel BUG\n"); printk(KERN_EMERG "Kernel BUG\n");
} }
/* This is gone through when something in the kernel /* 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,16 +322,20 @@ void die(const char * str, struct pt_regs * regs, long err)
if (++die.lock_owner_depth < 3) { if (++die.lock_owner_depth < 3) {
int nl = 0; int nl = 0;
handle_BUG(regs); handle_BUG(regs);
printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
printk("PREEMPT "); printk(KERN_EMERG "PREEMPT ");
nl = 1; nl = 1;
#endif #endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (!nl)
printk(KERN_EMERG);
printk("SMP "); printk("SMP ");
nl = 1; nl = 1;
#endif #endif
#ifdef CONFIG_DEBUG_PAGEALLOC #ifdef CONFIG_DEBUG_PAGEALLOC
if (!nl)
printk(KERN_EMERG);
printk("DEBUG_PAGEALLOC"); printk("DEBUG_PAGEALLOC");
nl = 1; nl = 1;
#endif #endif
...@@ -339,7 +344,7 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -339,7 +344,7 @@ void die(const char * str, struct pt_regs * regs, long err)
notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
show_registers(regs); show_registers(regs);
} else } else
printk(KERN_ERR "Recursive die() failure, output suppressed\n"); printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
bust_spinlocks(0); bust_spinlocks(0);
die.lock_owner = -1; die.lock_owner = -1;
...@@ -527,8 +532,10 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs, ...@@ -527,8 +532,10 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
static void mem_parity_error(unsigned char reason, struct pt_regs * regs) static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
{ {
printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying "
printk("You probably have a hardware problem with your RAM chips\n"); "to continue\n");
printk(KERN_EMERG "You probably have a hardware problem with your RAM "
"chips\n");
/* Clear and disable the memory parity error line. */ /* Clear and disable the memory parity error line. */
clear_mem_error(reason); clear_mem_error(reason);
...@@ -538,7 +545,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs) ...@@ -538,7 +545,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs)
{ {
unsigned long i; unsigned long i;
printk("NMI: IOCK error (debug interrupt?)\n"); printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
show_registers(regs); show_registers(regs);
/* Re-enable the IOCK line, wait for a few seconds */ /* 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,11 +587,11 @@ void die_nmi (struct pt_regs *regs, const char *msg)
* to get a message out. * to get a message out.
*/ */
bust_spinlocks(1); bust_spinlocks(1);
printk(msg); printk(KERN_EMERG "%s", msg);
printk(" on CPU%d, eip %08lx, registers:\n", printk(" on CPU%d, eip %08lx, registers:\n",
smp_processor_id(), regs->eip); smp_processor_id(), regs->eip);
show_registers(regs); show_registers(regs);
printk("console shuts up ...\n"); printk(KERN_EMERG "console shuts up ...\n");
console_silent(); console_silent();
spin_unlock(&nmi_print_lock); spin_unlock(&nmi_print_lock);
bust_spinlocks(0); bust_spinlocks(0);
...@@ -990,8 +997,8 @@ asmlinkage void math_state_restore(struct pt_regs regs) ...@@ -990,8 +997,8 @@ asmlinkage void math_state_restore(struct pt_regs regs)
asmlinkage void math_emulate(long arg) asmlinkage void math_emulate(long arg)
{ {
printk("math-emulation not enabled and no coprocessor found.\n"); printk(KERN_EMERG "math-emulation not enabled and no coprocessor found.\n");
printk("killing %s.\n",current->comm); printk(KERN_EMERG "killing %s.\n",current->comm);
force_sig(SIGFPE,current); force_sig(SIGFPE,current);
schedule(); schedule();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册