linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode
@ 2022-10-06  3:20 Michael Ellerman
  2022-10-06  3:20 ` [PATCH 2/2] powerpc: Print instruction dump on a single line Michael Ellerman
  2022-11-30  9:24 ` [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-10-06  3:20 UTC (permalink / raw)
  To: linuxppc-dev

Matt reported that scripts/decodecode doesn't work for the instruction
dump in the powerpc oops output. Although there are scripts around that
can decode it, it would be preferable if the standard in-tree script
worked.

All other arches prefix the instruction dump with "Code:", and that's
what the script looks for, so use that.

The script then works as expected:

  $ CROSS_COMPILE=powerpc64le-linux-gnu- ./scripts/decodecode
  Code:
  fbc1fff0 f821ffc1 7c7d1b78 7c9c2378 ebc30028 7fdff378 48000018 60000000
  60000000 ebff0008 7c3ef840 41820048 <815f0060> e93f0000 5529077c 7d295378
  ^D

  All code
  ========
     0:   f0 ff c1 fb     std     r30,-16(r1)
     4:   c1 ff 21 f8     stdu    r1,-64(r1)
     8:   78 1b 7d 7c     mr      r29,r3
     ...

Note that the script doesn't cope well with printk timestamps or printk
caller info.

Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 37df0428e4fb..1d22a539d45c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1359,7 +1359,7 @@ static void show_instructions(struct pt_regs *regs)
 	unsigned long nip = regs->nip;
 	unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int));
 
-	printk("Instruction dump:");
+	printk("Code:");
 
 	/*
 	 * If we were executing with the MMU off for instructions, adjust pc
-- 
2.37.3


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

* [PATCH 2/2] powerpc: Print instruction dump on a single line
  2022-10-06  3:20 [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman
@ 2022-10-06  3:20 ` Michael Ellerman
  2022-11-30  9:24 ` [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-10-06  3:20 UTC (permalink / raw)
  To: linuxppc-dev

Although the previous commit made the powerpc instruction dump usable
with scripts/decodecode, there are still some problems.

Because the dump is split across multiple lines, the script doesn't cope
with printk timestamps or caller info.

That can be fixed by printing the entire dump on one line, eg:

  [   12.016307][  T112] --- interrupt: c00
  [   12.016605][  T112] Code: 4b7aae15 60000000 3d22016e 3c62ffec 39291160 38639bc0 e8890000 4b7aadf9 60000000 4bfffee8 7c0802a6 60000000 <0fe00000> 60420000 3c4c008f 384268a0
  [   12.017655][  T112] ---[ end trace 0000000000000000 ]---

That output can then be piped directly into scripts/decodecode and
interpreted correctly.

Printing the dump on a single line does produce a very long line, about
173 characters. That is still shorter than x86, which prints nearly 200
characters even without timestamps etc.

All consoles I'm aware of will wrap the line if it's too long, so the
length should not be a functional problem. If anything it should help on
consoles like VGA by using less vertical space.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1d22a539d45c..49f82108bf41 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1359,7 +1359,7 @@ static void show_instructions(struct pt_regs *regs)
 	unsigned long nip = regs->nip;
 	unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int));
 
-	printk("Code:");
+	printk("Code: ");
 
 	/*
 	 * If we were executing with the MMU off for instructions, adjust pc
@@ -1373,9 +1373,6 @@ static void show_instructions(struct pt_regs *regs)
 	for (i = 0; i < NR_INSN_TO_PRINT; i++) {
 		int instr;
 
-		if (!(i % 8))
-			pr_cont("\n");
-
 		if (!__kernel_text_address(pc) ||
 		    get_kernel_nofault(instr, (const void *)pc)) {
 			pr_cont("XXXXXXXX ");
-- 
2.37.3


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

* Re: [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode
  2022-10-06  3:20 [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman
  2022-10-06  3:20 ` [PATCH 2/2] powerpc: Print instruction dump on a single line Michael Ellerman
@ 2022-11-30  9:24 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-11-30  9:24 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman

On Thu, 6 Oct 2022 14:20:18 +1100, Michael Ellerman wrote:
> Matt reported that scripts/decodecode doesn't work for the instruction
> dump in the powerpc oops output. Although there are scripts around that
> can decode it, it would be preferable if the standard in-tree script
> worked.
> 
> All other arches prefix the instruction dump with "Code:", and that's
> what the script looks for, so use that.
> 
> [...]

Applied to powerpc/next.

[1/2] powerpc: Make instruction dump work with scripts/decodecode
      https://git.kernel.org/powerpc/c/3e65412709293d5fb65249408e8e801b23b72635
[2/2] powerpc: Print instruction dump on a single line
      https://git.kernel.org/powerpc/c/d90bb7b4fdaff3f2fa68c7af85de2ce9e70189b1

cheers

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

end of thread, other threads:[~2022-11-30  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  3:20 [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman
2022-10-06  3:20 ` [PATCH 2/2] powerpc: Print instruction dump on a single line Michael Ellerman
2022-11-30  9:24 ` [PATCH 1/2] powerpc: Make instruction dump work with scripts/decodecode Michael Ellerman

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).