Skip to contentSkip to conversation

Split multi-line printk in oops output.

PATCH Dave Jones 2 participants 4 messages Sep 11, 2006

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

Sometimes, bug reports come in where we've had an oops, and the
only record we have is what the reporter saw on screen shortly
before the system locked up completely. Unfortunatly, syslog
only prints lines beginning with KERN_EMERG to the console, so
some lines get lost.
An example of this can be seen at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=203723

Some of this information isn't vital to diagnosis, but some parts are useful, such as the tainted flag.

arch/i386/kernel/traps.c renamed from arch/i386/kernel/traps.c~ +5 -4
@@ -291,10 +291,11 @@ void show_registers(struct pt_regs *regs
 		ss = regs->xss & 0xffff;
 	}
 	print_modules();
-	printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-			"EFLAGS: %08lx   (%s %.*s) \n",
-		smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-		print_tainted(), regs->eflags, system_utsname.release,
+	printk(KERN_EMERG "CPU:    %d\n", smp_processor_id());
+	printk(KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n",
+		0xffff & regs->xcs, regs->eip, print_tainted());
+	printk(KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",
+		regs->eflags, system_utsname.release,
 		(int)strcspn(system_utsname.version, " "),
 		system_utsname.version);
 	print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
Signature · 1 line
http://www.codemonkey.org.uk
#1 lore raw

arch/i386/kernel/traps.c void show_registers(struct pt_regs *regs · line 297

Quoted 10 lines
arch/i386/kernel/traps.c renamed from arch/i386/kernel/traps.c~ +4 -4
 	print_modules();
-	printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-			"EFLAGS: %08lx   (%s %.*s) \n",
-		smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-		print_tainted(), regs->eflags, system_utsname.release,
+	printk(KERN_EMERG "CPU:    %d\n", smp_processor_id());
+	printk(KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n",
+		0xffff & regs->xcs, regs->eip, print_tainted());
+	printk(KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",

Still only using a single printk would be slightly safer

-Andi

author
#2 lore raw
Quoted 12 lines · Andi Kleen

Review

Quoted 10 lines
(quoted diff) +4 -4
 	print_modules();
-	printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-			"EFLAGS: %08lx   (%s %.*s) \n",
-		smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-		print_tainted(), regs->eflags, system_utsname.release,
+	printk(KERN_EMERG "CPU:    %d\n", smp_processor_id());
+	printk(KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n",
+		0xffff & regs->xcs, regs->eip, print_tainted());
+	printk(KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",

Still only using a single printk would be slightly safer

arch/i386/kernel/traps.c +3 -2
index 7e9edaf..b30fc9e 100644
@@ -291,8 +291,9 @@ void show_registers(struct pt_regs *regs
 		ss = regs->xss & 0xffff;
 	}
 	print_modules();
-	printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-			"EFLAGS: %08lx   (%s %.*s) \n",
+	printk(KERN_EMERG "CPU:    %d\n"
+		KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n"
+		KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",
 		smp_processor_id(), 0xffff & regs->xcs, regs->eip,
 		print_tainted(), regs->eflags, system_utsname.release,
 		(int)strcspn(system_utsname.version, " "),
Signature · 1 line
http://www.codemonkey.org.uk
#3 lore raw
Quoted 13 lines · Dave Jones
Quoted 11 lines · Andi Kleen

Review

Quoted 9 lines
(quoted diff) +4 -4
 	print_modules();
-	printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-			"EFLAGS: %08lx   (%s %.*s) \n",
-		smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-		print_tainted(), regs->eflags, system_utsname.release,
+	printk(KERN_EMERG "CPU:    %d\n", smp_processor_id());
+	printk(KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n",
+		0xffff & regs->xcs, regs->eip, print_tainted());
+	printk(KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",

Still only using a single printk would be slightly safer

Quoted 1 line

Added thanks., Please include the full description on reposted patches in the future too.

-Andi