Skip to contentSkip to conversation

x86: Make page fault oopses similar

RFC PATCH In review Harvey Harrison 2 participants 3 messages Jan 21, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/2 x86: Make page fault oopses similar

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.

---
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(-)
arch/x86/kernel/traps_32.c +5 -0
index e0a7615..9edad42 100644
@@ -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 &&
arch/x86/kernel/traps_64.c +2 -5
index 2289f80..a462e2f 100644
@@ -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)
arch/x86/mm/fault_32.c +7 -6
index fda3997..93259f3 100644
@@ -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);
 }
arch/x86/mm/fault_64.c +6 -3
index 1897704..97e6bb6 100644
@@ -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);
 }
Signature · 1 line
1.5.4.rc3.1118.gf6754c
#1 lore raw
Quoted 4 lines · On Mon, 21 Jan 2008 13:20:46 -0800 Harvey Harrison <[email protected]>…

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.

I'm not entirely convinced on this; I need to look closer but it appears the 32 bit version doesn't use the "reliable" argument to print a ? in front of the dubious backtrace entries; that would be sort of a step backwards; (

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#2 lore raw
Quoted 12 lines · Arjan van de Ven
Quoted 4 lines · On Mon, 21 Jan 2008 13:20:46 -0800 Harvey Harrison <[email protected]>…

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.

I'm not entirely convinced on this; I need to look closer but it appears the 32 bit version doesn't use the "reliable" argument to print a ? in front of the dubious backtrace entries; that would be sort of a step backwards; (

Sorry, I should have made it clearer that this was more for discussion of the actual formatting.

printk_address needs to be ported to X86_32, the one in this patch is just a placeholder. Looking at the X86_64 version it looks like it can be brought straight across, but I haven't tested that yet.

Harvey