lkml.org 
[lkml]   [2008]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] [RFC] x86: Make page fault oopses similar
From
Date
Introduce printk_address to X86_32 in a simplified form for
now. Reformat X86_64 printk_address to avoid two declarations.

Change the printk formats on X86_32 and 64 to be similar.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Ingo, this changes oops printing format, consider this just to
get the discussion started on how people would like this to
look.

arch/x86/kernel/traps_32.c | 5 +++++
arch/x86/kernel/traps_64.c | 7 ++-----
arch/x86/mm/fault_32.c | 13 +++++++------
arch/x86/mm/fault_64.c | 9 ++++++---
4 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index e0a7615..9edad42 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -102,6 +102,11 @@ asmlinkage void machine_check(void);
int kstack_depth_to_print = 24;
static unsigned int code_bytes = 64;

+void printk_address(unsigned long address, int reliable)
+{
+ printk(" [<%08lx>]\n", address);
+}
+
static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
{
return p > (void *)tinfo &&
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 2289f80..a462e2f 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -100,9 +100,9 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)

int kstack_depth_to_print = 12;

-#ifdef CONFIG_KALLSYMS
void printk_address(unsigned long address, int reliable)
{
+#ifdef CONFIG_KALLSYMS
unsigned long offset = 0, symsize;
const char *symname;
char *modname;
@@ -123,13 +123,10 @@ void printk_address(unsigned long address, int reliable)
modname = delim = "";
printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
address, reliab, delim, modname, delim, symname, offset, symsize);
-}
#else
-void printk_address(unsigned long address, int reliable)
-{
printk(" [<%016lx>]\n", address);
-}
#endif
+}

static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
unsigned *usedp, char **idp)
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index fda3997..93259f3 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -340,14 +340,15 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
"(uid: %d)\n", current->uid);
}
#endif
+ printk(KERN_ALERT "BUG: unable to handle kernel ");
if (address < PAGE_SIZE)
- printk(KERN_ALERT "BUG: unable to handle kernel NULL "
- "pointer dereference");
+ printk(KERN_CONT "NULL pointer dereference");
else
- printk(KERN_ALERT "BUG: unable to handle kernel paging"
- " request");
- printk(" at virtual address %08lx\n", address);
- printk(KERN_ALERT "printing ip: %08lx ", regs->ip);
+ printk(KERN_CONT "paging request");
+
+ printk(KERN_CONT " at %08lx\n", address);
+ printk(KERN_ALERT "IP:");
+ printk_address(regs->ip, 1);

dump_pagetable(address);
}
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 1897704..97e6bb6 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -296,11 +296,14 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
unsigned long address)
{
+ printk(KERN_ALERT "Unable to handle kernel ");
if (address < PAGE_SIZE)
- printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
+ printk(KERN_CONT "NULL pointer dereference");
else
- printk(KERN_ALERT "Unable to handle kernel paging request");
- printk(" at %016lx RIP: \n" KERN_ALERT, address);
+ printk(KERN_CONT "paging request");
+ printk(KERN_CONT " at %016lx\n", address);
+ printk(KERN_ALERT "IP:");
+
printk_address(regs->ip, 1);
dump_pagetable(address);
}
--
1.5.4.rc3.1118.gf6754c


\
 
 \ /
  Last update: 2008-01-21 22:23    [W:0.053 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site