linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix kernel log of oops/panic instruction dump
@ 2012-01-06 22:34 Ira W. Snyder
  2012-01-06 22:50 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Ira W. Snyder @ 2012-01-06 22:34 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

A kernel oops/panic prints an instruction dump showing several
instructions before and after the instruction which caused the
oops/panic.

The code intended that the faulting instruction be enclosed in angle
brackets, however a bug caused the faulting instruction to be
interpreted by printk() as the message log level.

To fix this, the KERN_CONT log level is added before the actualy text of
the printed message.

=== Before the patch ===

[ 1081.587266] Instruction dump:
[ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
[ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
[ 1081.602500]  4e800020 3803ffd0 2b800009

<4>[ 1081.587266] Instruction dump:
<4>[ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
<4>[ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
<98090000>[ 1081.602500]  4e800020 3803ffd0 2b800009

=== After the patch ===

[   51.385216] Instruction dump:
[   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
[   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009

<4>[   51.385216] Instruction dump:
<4>[   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
<4>[   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
---

In the above examples, the first block is what is shown on the serial
console as the machine dies. The second block is the dump as captured by
mtdoops.

 arch/powerpc/kernel/process.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 6457574..271f809 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -566,12 +566,12 @@ static void show_instructions(struct pt_regs *regs)
 		 */
 		if (!__kernel_text_address(pc) ||
 		     __get_user(instr, (unsigned int __user *)pc)) {
-			printk("XXXXXXXX ");
+			printk(KERN_CONT "XXXXXXXX ");
 		} else {
 			if (regs->nip == pc)
-				printk("<%08x> ", instr);
+				printk(KERN_CONT "<%08x> ", instr);
 			else
-				printk("%08x ", instr);
+				printk(KERN_CONT "%08x ", instr);
 		}
 
 		pc += sizeof(int);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: fix kernel log of oops/panic instruction dump
  2012-01-06 22:34 [PATCH] powerpc: fix kernel log of oops/panic instruction dump Ira W. Snyder
@ 2012-01-06 22:50 ` Benjamin Herrenschmidt
  2012-01-06 23:26   ` Ira W. Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2012-01-06 22:50 UTC (permalink / raw)
  To: Ira W. Snyder; +Cc: Paul Mackerras, linuxppc-dev

On Fri, 2012-01-06 at 14:34 -0800, Ira W. Snyder wrote:
> A kernel oops/panic prints an instruction dump showing several
> instructions before and after the instruction which caused the
> oops/panic.
> 
> The code intended that the faulting instruction be enclosed in angle
> brackets, however a bug caused the faulting instruction to be
> interpreted by printk() as the message log level.
> 
> To fix this, the KERN_CONT log level is added before the actualy text of
> the printed message.

Nice one, thanks.

Cheers,
Ben.

> === Before the patch ===
> 
> [ 1081.587266] Instruction dump:
> [ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> [ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
> [ 1081.602500]  4e800020 3803ffd0 2b800009
> 
> <4>[ 1081.587266] Instruction dump:
> <4>[ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> <4>[ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
> <98090000>[ 1081.602500]  4e800020 3803ffd0 2b800009
> 
> === After the patch ===
> 
> [   51.385216] Instruction dump:
> [   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> [   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009
> 
> <4>[   51.385216] Instruction dump:
> <4>[   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> <4>[   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009
> 
> Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> 
> In the above examples, the first block is what is shown on the serial
> console as the machine dies. The second block is the dump as captured by
> mtdoops.
> 
>  arch/powerpc/kernel/process.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 6457574..271f809 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -566,12 +566,12 @@ static void show_instructions(struct pt_regs *regs)
>  		 */
>  		if (!__kernel_text_address(pc) ||
>  		     __get_user(instr, (unsigned int __user *)pc)) {
> -			printk("XXXXXXXX ");
> +			printk(KERN_CONT "XXXXXXXX ");
>  		} else {
>  			if (regs->nip == pc)
> -				printk("<%08x> ", instr);
> +				printk(KERN_CONT "<%08x> ", instr);
>  			else
> -				printk("%08x ", instr);
> +				printk(KERN_CONT "%08x ", instr);
>  		}
>  
>  		pc += sizeof(int);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: fix kernel log of oops/panic instruction dump
  2012-01-06 22:50 ` Benjamin Herrenschmidt
@ 2012-01-06 23:26   ` Ira W. Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Ira W. Snyder @ 2012-01-06 23:26 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Paul Mackerras, linuxppc-dev

On Sat, Jan 07, 2012 at 09:50:10AM +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2012-01-06 at 14:34 -0800, Ira W. Snyder wrote:
> > A kernel oops/panic prints an instruction dump showing several
> > instructions before and after the instruction which caused the
> > oops/panic.
> > 
> > The code intended that the faulting instruction be enclosed in angle
> > brackets, however a bug caused the faulting instruction to be
> > interpreted by printk() as the message log level.
> > 
> > To fix this, the KERN_CONT log level is added before the actualy text of

If you could fix the text above to say 'actual' (instead of 'actualy')
when you commit this, that would be great. Darn typos. :)

> > the printed message.
> 
> Nice one, thanks.
> 
> Cheers,
> Ben.
> 
> > === Before the patch ===
> > 
> > [ 1081.587266] Instruction dump:
> > [ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> > [ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
> > [ 1081.602500]  4e800020 3803ffd0 2b800009
> > 
> > <4>[ 1081.587266] Instruction dump:
> > <4>[ 1081.590236] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> > <4>[ 1081.598034] 3d20c03a 9009a114 7c0004ac 39200000
> > <98090000>[ 1081.602500]  4e800020 3803ffd0 2b800009
> > 
> > === After the patch ===
> > 
> > [   51.385216] Instruction dump:
> > [   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> > [   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009
> > 
> > <4>[   51.385216] Instruction dump:
> > <4>[   51.388186] 7c000110 7c0000f8 5400077c 552907f6 7d290378 992b0003 4e800020 38000001
> > <4>[   51.395986] 3d20c03a 9009a114 7c0004ac 39200000 <98090000> 4e800020 3803ffd0 2b800009
> > 
> > Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > 
> > In the above examples, the first block is what is shown on the serial
> > console as the machine dies. The second block is the dump as captured by
> > mtdoops.
> > 
> >  arch/powerpc/kernel/process.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> > index 6457574..271f809 100644
> > --- a/arch/powerpc/kernel/process.c
> > +++ b/arch/powerpc/kernel/process.c
> > @@ -566,12 +566,12 @@ static void show_instructions(struct pt_regs *regs)
> >  		 */
> >  		if (!__kernel_text_address(pc) ||
> >  		     __get_user(instr, (unsigned int __user *)pc)) {
> > -			printk("XXXXXXXX ");
> > +			printk(KERN_CONT "XXXXXXXX ");
> >  		} else {
> >  			if (regs->nip == pc)
> > -				printk("<%08x> ", instr);
> > +				printk(KERN_CONT "<%08x> ", instr);
> >  			else
> > -				printk("%08x ", instr);
> > +				printk(KERN_CONT "%08x ", instr);
> >  		}
> >  
> >  		pc += sizeof(int);
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-06 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-06 22:34 [PATCH] powerpc: fix kernel log of oops/panic instruction dump Ira W. Snyder
2012-01-06 22:50 ` Benjamin Herrenschmidt
2012-01-06 23:26   ` Ira W. Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).