Commit 9aa8d719 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Thomas Gleixner

i386: clean up oops/bug reports

Typically the oops first lines look like this:

BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000
 printing eip:
c049dfbd
*pde = 00000000
Oops: 0002 [#1]
PREEMPT SMP
...

Such output is gained with some ugly if (!nl) printk("\n"); code and
besides being a waste of lines, this is also annoying to read. The
following output looks better (and it is how it looks on x86_64):

BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000
printing eip: c049dfbd *pde = 00000000
Oops: 0002 [#1] PREEMPT SMP
...

[ tglx: arch/x86 adaptation ]
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent c1e3619e
...@@ -398,31 +398,24 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -398,31 +398,24 @@ void die(const char * str, struct pt_regs * regs, long err)
local_save_flags(flags); local_save_flags(flags);
if (++die.lock_owner_depth < 3) { if (++die.lock_owner_depth < 3) {
int nl = 0;
unsigned long esp; unsigned long esp;
unsigned short ss; unsigned short ss;
report_bug(regs->eip, regs); report_bug(regs->eip, regs);
printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff,
++die_counter);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
printk(KERN_EMERG "PREEMPT "); printk("PREEMPT ");
nl = 1;
#endif #endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (!nl)
printk(KERN_EMERG);
printk("SMP "); printk("SMP ");
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;
#endif #endif
if (nl)
printk("\n"); printk("\n");
if (notify_die(DIE_OOPS, str, regs, err, if (notify_die(DIE_OOPS, str, regs, err,
current->thread.trap_no, SIGSEGV) != current->thread.trap_no, SIGSEGV) !=
NOTIFY_STOP) { NOTIFY_STOP) {
......
...@@ -539,23 +539,22 @@ no_context: ...@@ -539,23 +539,22 @@ no_context:
printk(KERN_ALERT "BUG: unable to handle kernel paging" printk(KERN_ALERT "BUG: unable to handle kernel paging"
" request"); " request");
printk(" at virtual address %08lx\n",address); printk(" at virtual address %08lx\n",address);
printk(KERN_ALERT " printing eip:\n"); printk(KERN_ALERT "printing eip: %08lx ", regs->eip);
printk("%08lx\n", regs->eip);
page = read_cr3(); page = read_cr3();
page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT];
#ifdef CONFIG_X86_PAE #ifdef CONFIG_X86_PAE
printk(KERN_ALERT "*pdpt = %016Lx\n", page); printk("*pdpt = %016Lx ", page);
if ((page >> PAGE_SHIFT) < max_low_pfn if ((page >> PAGE_SHIFT) < max_low_pfn
&& page & _PAGE_PRESENT) { && page & _PAGE_PRESENT) {
page &= PAGE_MASK; page &= PAGE_MASK;
page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT) page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT)
& (PTRS_PER_PMD - 1)]; & (PTRS_PER_PMD - 1)];
printk(KERN_ALERT "*pde = %016Lx\n", page); printk(KERN_ALERT "*pde = %016Lx ", page);
page &= ~_PAGE_NX; page &= ~_PAGE_NX;
} }
#else #else
printk(KERN_ALERT "*pde = %08lx\n", page); printk("*pde = %08lx ", page);
#endif #endif
/* /*
...@@ -569,8 +568,10 @@ no_context: ...@@ -569,8 +568,10 @@ no_context:
page &= PAGE_MASK; page &= PAGE_MASK;
page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
& (PTRS_PER_PTE - 1)]; & (PTRS_PER_PTE - 1)];
printk(KERN_ALERT "*pte = %0*Lx\n", sizeof(page)*2, (u64)page); printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page);
} }
printk("\n");
} }
tsk->thread.cr2 = address; tsk->thread.cr2 = address;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment