[PATCH 1/5] powerpc/oops: Fix missing KERN_CONT in show_stack()

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3565d

5 messages, 1 author, 2016-11-02 · open the first message on its own page

[PATCH 1/5] powerpc/oops: Fix missing KERN_CONT in show_stack()

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-02 11:21:05

Previously we got away with printing the stack trace in multiple pieces
and it usually looked right.  But since commit 4bcc595ccd80 ("printk:
reinstate KERN_CONT for printing continuation lines"), KERN_CONT is now
required when printing continuation lines.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ce6dc61b15b2..621d9b23df72 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1900,14 +1900,14 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
 			printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 			if ((ip == rth) && curr_frame >= 0) {
-				printk(" (%pS)",
+				pr_cont(" (%pS)",
 				       (void *)current->ret_stack[curr_frame].ret);
 				curr_frame--;
 			}
 #endif
 			if (firstframe)
-				printk(" (unreliable)");
-			printk("\n");
+				pr_cont(" (unreliable)");
+			pr_cont("\n");
 		}
 		firstframe = 0;
 
-- 
2.7.4

[PATCH 2/5] powerpc/oops: Fix missing pr_cont()s in print_msr_bits() et. al.

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-02 11:21:06

Since the KERN_CONT changes these are being horribly split across lines,
for example:

    MSR: 8000000000009033 <
    SF,EE
    ,ME,IR
    ,DR,RI
    ,LE>

So fix it by using pr_cont() where appropriate.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 621d9b23df72..38f85d7a1e06 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1282,7 +1282,7 @@ static void print_bits(unsigned long val, struct regbit *bits, const char *sep)
 
 	for (; bits->bit; ++bits)
 		if (val & bits->bit) {
-			printk("%s%s", s, bits->name);
+			pr_cont("%s%s", s, bits->name);
 			s = sep;
 		}
 }
@@ -1305,9 +1305,9 @@ static void print_tm_bits(unsigned long val)
  *   T: Transactional	(bit 34)
  */
 	if (val & (MSR_TM | MSR_TS_S | MSR_TS_T)) {
-		printk(",TM[");
+		pr_cont(",TM[");
 		print_bits(val, msr_tm_bits, "");
-		printk("]");
+		pr_cont("]");
 	}
 }
 #else
@@ -1316,10 +1316,10 @@ static void print_tm_bits(unsigned long val) {}
 
 static void print_msr_bits(unsigned long val)
 {
-	printk("<");
+	pr_cont("<");
 	print_bits(val, msr_bits, ",");
 	print_tm_bits(val);
-	printk(">");
+	pr_cont(">");
 }
 
 #ifdef CONFIG_PPC64
-- 
2.7.4

[PATCH 3/5] powerpc/oops: Fix printing of GPRs since KERN_CONT changes

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-02 11:21:07

Since the KERN_CONT changes our print out of the GPRs is messed up:

    GPR04:
    0000000000000001 c000000000155810
    0000000000000000 0000000000000001

    GPR08: 0000000000000007

Fix it for now by using pr_cont().

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 38f85d7a1e06..3898e381556f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1363,13 +1363,15 @@ void show_regs(struct pt_regs * regs)
 #endif
 
 	for (i = 0;  i < 32;  i++) {
-		if ((i % REGS_PER_LINE) == 0)
-			printk("\nGPR%02d: ", i);
-		printk(REG " ", regs->gpr[i]);
+		if ((i % REGS_PER_LINE) == 0) {
+			pr_cont("\n");
+			printk("GPR%02d: ", i);
+		}
+		pr_cont(REG " ", regs->gpr[i]);
 		if (i == LAST_VOLATILE && !FULL_REGS(regs))
 			break;
 	}
-	printk("\n");
+	pr_cont("\n");
 #ifdef CONFIG_KALLSYMS
 	/*
 	 * Lookup NIP late so we have the best change of getting the
-- 
2.7.4

[PATCH 4/5] powerpc/oops: Move printing of SOFTE before CFAR

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-02 11:21:08

Now that KERN_CONT is required to do continuation lines properly, our
oops output is messed up.

But as the code is currently written we can't actually use pr_cont()
correctly, because some of the output may or may not be a continuation
line, depending on what was printed previously.

So move the printing of SOFTE up, so that we always have a line to
continue (at least on 64-bit). While we're at it, pull the CFAR logic
inside the #ifdef PPC64, CFAR is 64-bit only.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 3898e381556f..84d334527fcd 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1346,17 +1346,17 @@ void show_regs(struct pt_regs * regs)
 	print_msr_bits(regs->msr);
 	printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
 	trap = TRAP(regs);
+#ifdef CONFIG_PPC64
+	printk("SOFTE: %ld ", regs->softe);
 	if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
 		printk("CFAR: "REG" ", regs->orig_gpr3);
+#endif
 	if (trap == 0x200 || trap == 0x300 || trap == 0x600)
 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
 		printk("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
 #else
 		printk("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
 #endif
-#ifdef CONFIG_PPC64
-	printk("SOFTE: %ld ", regs->softe);
-#endif
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	if (MSR_TM_ACTIVE(regs->msr))
 		printk("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
-- 
2.7.4

[PATCH 5/5] powerpc/oops: Fix remaining pr_cont() issues

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-02 11:21:10

Now that we print SOFTE first, it's clear that the rest of these lines
need to be continuations, so use pr_cont().

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 84d334527fcd..ea6fe2ea4a6f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1349,17 +1349,19 @@ void show_regs(struct pt_regs * regs)
 #ifdef CONFIG_PPC64
 	printk("SOFTE: %ld ", regs->softe);
 	if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
-		printk("CFAR: "REG" ", regs->orig_gpr3);
+		pr_cont("CFAR: "REG" ", regs->orig_gpr3);
 #endif
 	if (trap == 0x200 || trap == 0x300 || trap == 0x600)
 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
-		printk("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
+		pr_cont("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
 #else
-		printk("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
+		pr_cont("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
 #endif
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-	if (MSR_TM_ACTIVE(regs->msr))
-		printk("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
+	if (MSR_TM_ACTIVE(regs->msr)) {
+		pr_cont("\n");
+		printk("PACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
+	}
 #endif
 
 	for (i = 0;  i < 32;  i++) {
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help