linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] sh: Modernize printing of kernel messages
@ 2020-06-17 14:36 Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 1/9] sh: fault: Fix duplicate printing of "PC:" Geert Uytterhoeven
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

	Hi all,

This patch series fixes the broken lines in kernel output, which I
presume have been happening since commit 4bcc595ccd80decb ("printk:
reinstate KERN_CONT for printing continuat ion lines").
Most annoying are the ones in call traces and disassembly dumps, as they
cause lots of small bits of information to fly by your serial console.

Changes compared to v1[1]:
  - Add Tested-by,
  - Drop "sh: fault: Modernize printing of kernel messages", which was
    picked up by Mike and Andrew, but subject to an unintended mutation,
  - Add a fix for the mutation,
  - Rebase on top of "[PATCHv3 00/50] Add log level to show_stack()":
      - Drop conversion of remaining printk() calls to pr_*(), as they
	have all received a loglvl parameter,
      - Remove loglvl parameters from continuations.
  - Add two reverts for commits in the above series, due to people being
    mislead by the lack of pr_cont() use,
  - Add note about printk(KERN_DEBUG ...).

Thanks!

[1] https://lore.kernel.org/r/20191203162645.19950-1-geert+renesas@glider.be

Geert Uytterhoeven (9):
  sh: fault: Fix duplicate printing of "PC:"
  Revert "sh: add loglvl to printk_address()"
  Revert "sh: remove needless printk()"
  sh: kernel: disassemble: Fix broken lines in disassembly dumps
  sh: dump_stack: Fix broken lines and ptrval in calltrace dumps
  sh: process: Fix broken lines in register dumps
  sh: sh2007: Modernize printing of kernel messages
  sh: pci: Modernize printing of kernel messages
  sh: machvec: Modernize printing of kernel messages

 arch/sh/boards/board-sh2007.c    |   4 +-
 arch/sh/drivers/pci/common.c     |   6 +-
 arch/sh/drivers/pci/pci-sh7780.c |  23 ++++---
 arch/sh/drivers/pci/pci.c        |  11 ++--
 arch/sh/include/asm/kdebug.h     |   3 +-
 arch/sh/kernel/disassemble.c     | 103 ++++++++++++++++---------------
 arch/sh/kernel/dumpstack.c       |  23 +++----
 arch/sh/kernel/machvec.c         |   8 +--
 arch/sh/kernel/process_32.c      |  38 +++++-------
 arch/sh/mm/fault.c               |   3 +-
 10 files changed, 108 insertions(+), 114 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH v2 1/9] sh: fault: Fix duplicate printing of "PC:"
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 2/9] Revert "sh: add loglvl to printk_address()" Geert Uytterhoeven
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

Somewhere along the patch handling path, both the old "printk(KERN_ALERT
...)" and the new "pr_alert(...)" were retained, leading to the
duplicate printing of "PC:".

Drop the old one.

Fixes: eaabf98b0932a540 ("sh: fault: modernize printing of kernel messages")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - New.
---
 arch/sh/mm/fault.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index fbe1f2fe9a8c8f55..acd1c75994983825 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -208,7 +208,6 @@ show_fault_oops(struct pt_regs *regs, unsigned long address)
 	if (!oops_may_print())
 		return;
 
-	printk(KERN_ALERT "PC:");
 	pr_alert("BUG: unable to handle kernel %s at %08lx\n",
 		 address < PAGE_SIZE ? "NULL pointer dereference"
 				     : "paging request",
-- 
2.17.1


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

* [PATCH v2 2/9] Revert "sh: add loglvl to printk_address()"
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 1/9] sh: fault: Fix duplicate printing of "PC:" Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 3/9] Revert "sh: remove needless printk()" Geert Uytterhoeven
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

This reverts commit 2deebe4d56d638269a4a728086d64de5734b460a.

printk_address() is always used as a continuation of the previous
logging, hence it should not include a log level.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - New.
---
 arch/sh/include/asm/kdebug.h | 3 +--
 arch/sh/kernel/dumpstack.c   | 6 +++---
 arch/sh/mm/fault.c           | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h
index 960545306afa4d93..de8693fabb1d95b5 100644
--- a/arch/sh/include/asm/kdebug.h
+++ b/arch/sh/include/asm/kdebug.h
@@ -12,8 +12,7 @@ enum die_val {
 };
 
 /* arch/sh/kernel/dumpstack.c */
-extern void printk_address(unsigned long address, int reliable,
-			   const char *loglvl);
+extern void printk_address(unsigned long address, int reliable);
 extern void dump_mem(const char *str, const char *loglvl,
 		     unsigned long bottom, unsigned long top);
 
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index a13c045804ed1027..ad548fc976350c50 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -44,9 +44,9 @@ void dump_mem(const char *str, const char *loglvl,
 	}
 }
 
-void printk_address(unsigned long address, int reliable, const char *loglvl)
+void printk_address(unsigned long address, int reliable)
 {
-	printk("%s [<%p>] %s%pS\n", loglvl, (void *) address,
+	printk(" [<%p>] %s%pS\n", (void *) address,
 			reliable ? "" : "? ", (void *) address);
 }
 
@@ -118,7 +118,7 @@ static int print_trace_stack(void *data, char *name)
  */
 static void print_trace_address(void *data, unsigned long addr, int reliable)
 {
-	printk_address(addr, reliable, (char *)data);
+	printk_address(addr, reliable);
 }
 
 static const struct stacktrace_ops print_trace_ops = {
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index acd1c75994983825..92b1ce105f4b6c6f 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -213,7 +213,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long address)
 				     : "paging request",
 		 address);
 	pr_alert("PC:");
-	printk_address(regs->pc, 1, KERN_ALERT);
+	printk_address(regs->pc, 1);
 
 	show_pte(NULL, address);
 }
-- 
2.17.1


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

* [PATCH v2 3/9] Revert "sh: remove needless printk()"
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 1/9] sh: fault: Fix duplicate printing of "PC:" Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 2/9] Revert "sh: add loglvl to printk_address()" Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 4/9] sh: kernel: disassemble: Fix broken lines in disassembly dumps Geert Uytterhoeven
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

This reverts commit 8b92f34877225c8eb85e3ab7f1177fc248ba26d0.

"data" became the log level in commit 539e786cc37ee5cb ("sh: add loglvl
to show_trace()"), so we do need to keep the printk() before the
continuation in print_trace_address().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - New.
---
 arch/sh/kernel/dumpstack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index ad548fc976350c50..cc8063a01284bf64 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -118,6 +118,7 @@ static int print_trace_stack(void *data, char *name)
  */
 static void print_trace_address(void *data, unsigned long addr, int reliable)
 {
+	printk("%s", (char *)data);
 	printk_address(addr, reliable);
 }
 
-- 
2.17.1


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

* [PATCH v2 4/9] sh: kernel: disassemble: Fix broken lines in disassembly dumps
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 3/9] Revert "sh: remove needless printk()" Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 5/9] sh: dump_stack: Fix broken lines and ptrval in calltrace dumps Geert Uytterhoeven
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

Rejoin the broken lines by using pr_cont().
Convert the remaining printk() calls to pr_*() while at it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by.

Sample impact:

 Code:
-  8c043d00:
-bf.s
-8c043d08
-
-  8c043d02:
-tst
-r2
-,
-r2
-
-  8c043d04:
-bf
-8c043d08
-
-->8c043d06:
-trapa
-#62
-
-  8c043d08:
-mov.l
-8c043d78 <dma_alloc_attrs+0xa4/0xb0>
-,
-r0
-  ! 8c044d14 <dma_alloc_from_dev_coherent+0x0/0x38>
-
-  8c043d0a:
-mov
-r15
-,
-r7
-
-  8c043d0c:
-mov
-r13
-,
-r6
-
-  8c043d0e:
-add
-#4
-,
-r7
-
-  8c043d10:
-mov
-r11
-,
-r5
-
+  8c043cf4:  bf.s      8c043cfc
+  8c043cf6:  tst       r2, r2
+  8c043cf8:  bf        8c043cfc
+->8c043cfa:  trapa     #62
+  8c043cfc:  mov.l     8c043d6c <dma_alloc_attrs+0xa4/0xb0>, r0  ! 8c044d08 <dma_alloc_from_dev_coherent+0x0/0x38>
+  8c043cfe:  mov       r15, r7
+  8c043d00:  mov       r13, r6
+  8c043d02:  add       #4, r7
+  8c043d04:  mov       r11, r5
---
 arch/sh/kernel/disassemble.c | 103 ++++++++++++++++++-----------------
 1 file changed, 52 insertions(+), 51 deletions(-)

diff --git a/arch/sh/kernel/disassemble.c b/arch/sh/kernel/disassemble.c
index 845543780cc55014..08e1af63edd9623c 100644
--- a/arch/sh/kernel/disassemble.c
+++ b/arch/sh/kernel/disassemble.c
@@ -376,148 +376,148 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 		}
 
 	ok:
-		printk("%-8s  ", op->name);
+		pr_cont("%-8s  ", op->name);
 		lastsp = (op->arg[0] == A_END);
 		disp_pc = 0;
 		for (n = 0; n < 6 && op->arg[n] != A_END; n++) {
 			if (n && op->arg[1] != A_END)
-				printk(", ");
+				pr_cont(", ");
 			switch (op->arg[n]) {
 			case A_IMM:
-				printk("#%d", (char)(imm));
+				pr_cont("#%d", (char)(imm));
 				break;
 			case A_R0:
-				printk("r0");
+				pr_cont("r0");
 				break;
 			case A_REG_N:
-				printk("r%d", rn);
+				pr_cont("r%d", rn);
 				break;
 			case A_INC_N:
-				printk("@r%d+", rn);
+				pr_cont("@r%d+", rn);
 				break;
 			case A_DEC_N:
-				printk("@-r%d", rn);
+				pr_cont("@-r%d", rn);
 				break;
 			case A_IND_N:
-				printk("@r%d", rn);
+				pr_cont("@r%d", rn);
 				break;
 			case A_DISP_REG_N:
-				printk("@(%d,r%d)", imm, rn);
+				pr_cont("@(%d,r%d)", imm, rn);
 				break;
 			case A_REG_M:
-				printk("r%d", rm);
+				pr_cont("r%d", rm);
 				break;
 			case A_INC_M:
-				printk("@r%d+", rm);
+				pr_cont("@r%d+", rm);
 				break;
 			case A_DEC_M:
-				printk("@-r%d", rm);
+				pr_cont("@-r%d", rm);
 				break;
 			case A_IND_M:
-				printk("@r%d", rm);
+				pr_cont("@r%d", rm);
 				break;
 			case A_DISP_REG_M:
-				printk("@(%d,r%d)", imm, rm);
+				pr_cont("@(%d,r%d)", imm, rm);
 				break;
 			case A_REG_B:
-				printk("r%d_bank", rb);
+				pr_cont("r%d_bank", rb);
 				break;
 			case A_DISP_PC:
 				disp_pc = 1;
 				disp_pc_addr = imm + 4 + (memaddr & relmask);
-				printk("%08x <%pS>", disp_pc_addr,
-				       (void *)disp_pc_addr);
+				pr_cont("%08x <%pS>", disp_pc_addr,
+					(void *)disp_pc_addr);
 				break;
 			case A_IND_R0_REG_N:
-				printk("@(r0,r%d)", rn);
+				pr_cont("@(r0,r%d)", rn);
 				break;
 			case A_IND_R0_REG_M:
-				printk("@(r0,r%d)", rm);
+				pr_cont("@(r0,r%d)", rm);
 				break;
 			case A_DISP_GBR:
-				printk("@(%d,gbr)",imm);
+				pr_cont("@(%d,gbr)", imm);
 				break;
 			case A_R0_GBR:
-				printk("@(r0,gbr)");
+				pr_cont("@(r0,gbr)");
 				break;
 			case A_BDISP12:
 			case A_BDISP8:
-				printk("%08x", imm + memaddr);
+				pr_cont("%08x", imm + memaddr);
 				break;
 			case A_SR:
-				printk("sr");
+				pr_cont("sr");
 				break;
 			case A_GBR:
-				printk("gbr");
+				pr_cont("gbr");
 				break;
 			case A_VBR:
-				printk("vbr");
+				pr_cont("vbr");
 				break;
 			case A_SSR:
-				printk("ssr");
+				pr_cont("ssr");
 				break;
 			case A_SPC:
-				printk("spc");
+				pr_cont("spc");
 				break;
 			case A_MACH:
-				printk("mach");
+				pr_cont("mach");
 				break;
 			case A_MACL:
-				printk("macl");
+				pr_cont("macl");
 				break;
 			case A_PR:
-				printk("pr");
+				pr_cont("pr");
 				break;
 			case A_SGR:
-				printk("sgr");
+				pr_cont("sgr");
 				break;
 			case A_DBR:
-				printk("dbr");
+				pr_cont("dbr");
 				break;
 			case FD_REG_N:
 			case F_REG_N:
-				printk("fr%d", rn);
+				pr_cont("fr%d", rn);
 				break;
 			case F_REG_M:
-				printk("fr%d", rm);
+				pr_cont("fr%d", rm);
 				break;
 			case DX_REG_N:
 				if (rn & 1) {
-					printk("xd%d", rn & ~1);
+					pr_cont("xd%d", rn & ~1);
 					break;
 				}
 				/* else, fall through */
 			case D_REG_N:
-				printk("dr%d", rn);
+				pr_cont("dr%d", rn);
 				break;
 			case DX_REG_M:
 				if (rm & 1) {
-					printk("xd%d", rm & ~1);
+					pr_cont("xd%d", rm & ~1);
 					break;
 				}
 				/* else, fall through */
 			case D_REG_M:
-				printk("dr%d", rm);
+				pr_cont("dr%d", rm);
 				break;
 			case FPSCR_M:
 			case FPSCR_N:
-				printk("fpscr");
+				pr_cont("fpscr");
 				break;
 			case FPUL_M:
 			case FPUL_N:
-				printk("fpul");
+				pr_cont("fpul");
 				break;
 			case F_FR0:
-				printk("fr0");
+				pr_cont("fr0");
 				break;
 			case V_REG_N:
-				printk("fv%d", rn*4);
+				pr_cont("fv%d", rn*4);
 				break;
 			case V_REG_M:
-				printk("fv%d", rm*4);
+				pr_cont("fv%d", rm*4);
 				break;
 			case XMTRX_M4:
-				printk("xmtrx");
+				pr_cont("xmtrx");
 				break;
 			default:
 				return;
@@ -532,7 +532,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 			else
 				__get_user(val, (u32 *)disp_pc_addr);
 
-			printk("  ! %08x <%pS>", val, (void *)val);
+			pr_cont("  ! %08x <%pS>", val, (void *)val);
 		}
 
 		return;
@@ -541,7 +541,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 
 	}
 
-	printk(".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]);
+	pr_info(".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]);
 }
 
 void show_code(struct pt_regs *regs)
@@ -552,20 +552,21 @@ void show_code(struct pt_regs *regs)
 	if (regs->pc & 0x1)
 		return;
 
-	printk("Code:\n");
+	pr_info("Code:\n");
 
 	for (i = -3 ; i < 6 ; i++) {
 		unsigned short insn;
 
 		if (__get_user(insn, pc + i)) {
-			printk(" (Bad address in pc)\n");
+			pr_err(" (Bad address in pc)\n");
 			break;
 		}
 
-		printk("%s%08lx:  ", (i ? "  ": "->"), (unsigned long)(pc + i));
+		pr_info("%s%08lx:  ", (i ? "  " : "->"),
+			(unsigned long)(pc + i));
 		print_sh_insn((unsigned long)(pc + i), insn);
-		printk("\n");
+		pr_cont("\n");
 	}
 
-	printk("\n");
+	pr_info("\n");
 }
-- 
2.17.1


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

* [PATCH v2 5/9] sh: dump_stack: Fix broken lines and ptrval in calltrace dumps
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 4/9] sh: kernel: disassemble: Fix broken lines in disassembly dumps Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 6/9] sh: process: Fix broken lines in register dumps Geert Uytterhoeven
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

Rejoin the broken lines by dropping the log level parameters and using
pr_cont().
Use "%px" to print sensible addresses in call traces.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by,
  - Rebase on top of "[PATCHv3 00/50] Add log level to show_stack()":
      - Drop conversion of remaining printk() calls to pr_*(), as they
	have all received a loglvl parameter,
      - Remove loglvl parameters from continuations.

Sample impact:

-Stack: (0x8e8b1d58 to 0x8e8b2000)
-1d40:
-
-
-
-
-
-
-8c09a2b4
-8fb51b40
-
-1d60:
-8fbf400c
-00000000
-8c09a7da
-00000122
-8fbf4010
-00000001
-00000002
-8fbf4000
-
-1d80:
-00000002
-8fbf400c
-0030f231
-00000100
-8e8b1db0
-00000000
-8e8b1dac
-8c2b64b4
+Stack: (0x8eeabc80 to 0x8eeac000)
+bc80: 8c09a2a8 8fb5cce0 8fbf400c 00000000 8c09a7ce 00000122 8fbf4010 00000002
+bca0: 00000001 8fbf4000 00000001 8fbf400c 0030f231 00000100 8eeabcd8 00000000
+bcc0: 00001000 8c2b64b4 00460000 00000004 232d0f3f 8c21b788 8fb075a4 8fb50e44

 [...]

 Call trace:
- [<(ptrval)>] free_pcppages_bulk+0x106/0x348
- [<(ptrval)>] __get_free_pages+0xe/0x54
- [<(ptrval)>] free_unref_page_list+0xca/0x12c
- [<(ptrval)>] arch_local_irq_restore+0x0/0x24
- [<(ptrval)>] free_unref_page_commit.isra.141+0x0/0x74
+ [<8c09a7ce>] free_pcppages_bulk+0x106/0x348
+ [<8c21b788>] _cond_resched+0x38/0x54
+ [<8c09bb5a>] free_unref_page_list+0xca/0x12c
+ [<8c002808>] arch_local_irq_restore+0x0/0x24
+ [<8c09aaf8>] free_unref_page_commit.isra.141+0x0/0x74
---
 arch/sh/kernel/dumpstack.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index cc8063a01284bf64..0a69588e343f7b98 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -16,8 +16,8 @@
 #include <asm/unwinder.h>
 #include <asm/stacktrace.h>
 
-void dump_mem(const char *str, const char *loglvl,
-	      unsigned long bottom, unsigned long top)
+void dump_mem(const char *str, const char *loglvl, unsigned long bottom,
+	      unsigned long top)
 {
 	unsigned long p;
 	int i;
@@ -31,23 +31,23 @@ void dump_mem(const char *str, const char *loglvl,
 			unsigned int val;
 
 			if (p < bottom || p >= top)
-				printk("%s         ", loglvl);
+				pr_cont("         ");
 			else {
 				if (__get_user(val, (unsigned int __user *)p)) {
-					printk("%s\n", loglvl);
+					pr_cont("\n");
 					return;
 				}
-				printk("%s%08x ", loglvl, val);
+				pr_cont("%08x ", val);
 			}
 		}
-		printk("%s\n", loglvl);
+		pr_cont("\n");
 	}
 }
 
 void printk_address(unsigned long address, int reliable)
 {
-	printk(" [<%p>] %s%pS\n", (void *) address,
-			reliable ? "" : "? ", (void *) address);
+	pr_cont(" [<%px>] %s%pS\n", (void *) address,
+		reliable ? "" : "? ", (void *) address);
 }
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -137,7 +137,7 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
 
 	unwind_stack(tsk, regs, sp, &print_trace_ops, (void *)loglvl);
 
-	printk("%s\n", loglvl);
+	pr_cont("\n");
 
 	if (!tsk)
 		tsk = current;
-- 
2.17.1


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

* [PATCH v2 6/9] sh: process: Fix broken lines in register dumps
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 5/9] sh: dump_stack: Fix broken lines and ptrval in calltrace dumps Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 7/9] sh: sh2007: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

Rejoin the broken lines by using pr_cont().
Convert the remaining printk() calls to pr_*() while at it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by.

Sample impact:

 PC is at dma_alloc_attrs+0x32/0xb0
 PR is at platform_resource_setup_memory+0xbc/0x150
-PC  : 8c043d06 SP  : 8f41fe9c SR  : 40000001
-TEA : 00000000
-R0  : 8c043cd4 R1  : 00000000 R2  : 00000000 R3  : 8c213e7c
+PC  : 8c043cfa SP  : 8f41fe9c SR  : 40000001 TEA : 8c00369e
+R0  : 8c043cc8 R1  : 00000000 R2  : 00000000 R3  : 8c213e7c
 R4  : 8c29cc38 R5  : 00100000 R6  : 8f41fecc R7  : 00000cc0
 R8  : 8c29cc38 R9  : 8c29720c R10 : 00000cc0 R11 : 00100000
-R12 : 00000000 R13 : 8f41fecc R14 : 8c274773
-MACH: 00000001 MACL: b16b1ded GBR : 09102e96 PR  : 8c2c0524
+R12 : 00000000 R13 : 8f41fecc R14 : 8c27479f
+MACH: 00000001 MACL: b16b1ded GBR : 004c5450 PR  : 8c2c0524
---
 arch/sh/kernel/process_32.c | 38 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 456cc8d171f7258a..049f11a5f9abae7a 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -30,34 +30,30 @@
 
 void show_regs(struct pt_regs * regs)
 {
-	printk("\n");
+	pr_info("\n");
 	show_regs_print_info(KERN_DEFAULT);
 
-	printk("PC is at %pS\n", (void *)instruction_pointer(regs));
-	printk("PR is at %pS\n", (void *)regs->pr);
+	pr_info("PC is at %pS\n", (void *)instruction_pointer(regs));
+	pr_info("PR is at %pS\n", (void *)regs->pr);
 
-	printk("PC  : %08lx SP  : %08lx SR  : %08lx ",
-	       regs->pc, regs->regs[15], regs->sr);
+	pr_info("PC  : %08lx SP  : %08lx SR  : %08lx ", regs->pc,
+		regs->regs[15], regs->sr);
 #ifdef CONFIG_MMU
-	printk("TEA : %08x\n", __raw_readl(MMU_TEA));
+	pr_cont("TEA : %08x\n", __raw_readl(MMU_TEA));
 #else
-	printk("\n");
+	pr_cont("\n");
 #endif
 
-	printk("R0  : %08lx R1  : %08lx R2  : %08lx R3  : %08lx\n",
-	       regs->regs[0],regs->regs[1],
-	       regs->regs[2],regs->regs[3]);
-	printk("R4  : %08lx R5  : %08lx R6  : %08lx R7  : %08lx\n",
-	       regs->regs[4],regs->regs[5],
-	       regs->regs[6],regs->regs[7]);
-	printk("R8  : %08lx R9  : %08lx R10 : %08lx R11 : %08lx\n",
-	       regs->regs[8],regs->regs[9],
-	       regs->regs[10],regs->regs[11]);
-	printk("R12 : %08lx R13 : %08lx R14 : %08lx\n",
-	       regs->regs[12],regs->regs[13],
-	       regs->regs[14]);
-	printk("MACH: %08lx MACL: %08lx GBR : %08lx PR  : %08lx\n",
-	       regs->mach, regs->macl, regs->gbr, regs->pr);
+	pr_info("R0  : %08lx R1  : %08lx R2  : %08lx R3  : %08lx\n",
+		regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3]);
+	pr_info("R4  : %08lx R5  : %08lx R6  : %08lx R7  : %08lx\n",
+		regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]);
+	pr_info("R8  : %08lx R9  : %08lx R10 : %08lx R11 : %08lx\n",
+		regs->regs[8], regs->regs[9], regs->regs[10], regs->regs[11]);
+	pr_info("R12 : %08lx R13 : %08lx R14 : %08lx\n",
+		regs->regs[12], regs->regs[13], regs->regs[14]);
+	pr_info("MACH: %08lx MACL: %08lx GBR : %08lx PR  : %08lx\n",
+		regs->mach, regs->macl, regs->gbr, regs->pr);
 
 	show_trace(NULL, (unsigned long *)regs->regs[15], regs, KERN_DEFAULT);
 	show_code(regs);
-- 
2.17.1


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

* [PATCH v2 7/9] sh: sh2007: Modernize printing of kernel messages
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 6/9] sh: process: Fix broken lines in register dumps Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 8/9] sh: pci: " Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 9/9] sh: machvec: " Geert Uytterhoeven
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

  - Convert from printk() to pr_*(),
  - Add missing continuation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by.
---
 arch/sh/boards/board-sh2007.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/boards/board-sh2007.c b/arch/sh/boards/board-sh2007.c
index ef9c87deeb08828c..6ea85e4808512f94 100644
--- a/arch/sh/boards/board-sh2007.c
+++ b/arch/sh/boards/board-sh2007.c
@@ -126,14 +126,14 @@ static void __init sh2007_init_irq(void)
  */
 static void __init sh2007_setup(char **cmdline_p)
 {
-	printk(KERN_INFO "SH-2007 Setup...");
+	pr_info("SH-2007 Setup...");
 
 	/* setup wait control registers for area 5 */
 	__raw_writel(CS5BCR_D, CS5BCR);
 	__raw_writel(CS5WCR_D, CS5WCR);
 	__raw_writel(CS5PCR_D, CS5PCR);
 
-	printk(KERN_INFO " done.\n");
+	pr_cont(" done.\n");
 }
 
 /*
-- 
2.17.1


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

* [PATCH v2 8/9] sh: pci: Modernize printing of kernel messages
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 7/9] sh: sh2007: Modernize printing of kernel messages Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  2020-06-17 14:36 ` [PATCH v2 9/9] sh: machvec: " Geert Uytterhoeven
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

  - Convert from printk() to pr_*(),
  - Add missing continuations,
  - Join broken messages.

Note that printk(KERN_DEBUG ...) is retained, to preserve behavior
(pr_debug() is a dummy if DEBUG is not defined).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by,
  - Add note about printk(KERN_DEBUG ...).
---
 arch/sh/drivers/pci/common.c     |  6 +++---
 arch/sh/drivers/pci/pci-sh7780.c | 23 +++++++++++------------
 arch/sh/drivers/pci/pci.c        | 11 +++++------
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index fe163ecd07197073..2fd2b77e12cec1f2 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -54,7 +54,7 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 	int cap66 = -1;
 	u16 stat;
 
-	printk(KERN_INFO "PCI: Checking 66MHz capabilities...\n");
+	pr_info("PCI: Checking 66MHz capabilities...\n");
 
 	for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
 		if (PCI_FUNC(pci_devfn))
@@ -134,7 +134,7 @@ unsigned int pcibios_handle_status_errors(unsigned long addr,
 		pcibios_report_status(PCI_STATUS_REC_TARGET_ABORT |
 				      PCI_STATUS_SIG_TARGET_ABORT |
 				      PCI_STATUS_REC_MASTER_ABORT, 1);
-		printk("\n");
+		pr_cont("\n");
 
 		cmd |= PCI_STATUS_REC_TARGET_ABORT;
 	}
@@ -143,7 +143,7 @@ unsigned int pcibios_handle_status_errors(unsigned long addr,
 		printk(KERN_DEBUG "PCI: parity error detected: ");
 		pcibios_report_status(PCI_STATUS_PARITY |
 				      PCI_STATUS_DETECTED_PARITY, 1);
-		printk("\n");
+		pr_cont("\n");
 
 		cmd |= PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY;
 
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index 287b3a68570cf0ff..9a624a6ee3547924 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -148,7 +148,7 @@ static irqreturn_t sh7780_pci_serr_irq(int irq, void *dev_id)
 
 	printk(KERN_DEBUG "PCI: system error received: ");
 	pcibios_report_status(PCI_STATUS_SIG_SYSTEM_ERROR, 1);
-	printk("\n");
+	pr_cont("\n");
 
 	/* Deassert SERR */
 	__raw_writel(SH4_PCIINTM_SDIM, hose->reg_base + SH4_PCIINTM);
@@ -179,7 +179,7 @@ static int __init sh7780_pci_setup_irqs(struct pci_channel *hose)
 	ret = request_irq(hose->serr_irq, sh7780_pci_serr_irq, 0,
 			  "PCI SERR interrupt", hose);
 	if (unlikely(ret)) {
-		printk(KERN_ERR "PCI: Failed hooking SERR IRQ\n");
+		pr_err("PCI: Failed hooking SERR IRQ\n");
 		return ret;
 	}
 
@@ -250,7 +250,7 @@ static int __init sh7780_pci_init(void)
 	const char *type;
 	int ret, i;
 
-	printk(KERN_NOTICE "PCI: Starting initialization.\n");
+	pr_notice("PCI: Starting initialization.\n");
 
 	chan->reg_base = 0xfe040000;
 
@@ -270,7 +270,7 @@ static int __init sh7780_pci_init(void)
 
 	id = __raw_readw(chan->reg_base + PCI_VENDOR_ID);
 	if (id != PCI_VENDOR_ID_RENESAS) {
-		printk(KERN_ERR "PCI: Unknown vendor ID 0x%04x.\n", id);
+		pr_err("PCI: Unknown vendor ID 0x%04x.\n", id);
 		return -ENODEV;
 	}
 
@@ -281,14 +281,13 @@ static int __init sh7780_pci_init(void)
 	       (id == PCI_DEVICE_ID_RENESAS_SH7785) ? "SH7785" :
 					  NULL;
 	if (unlikely(!type)) {
-		printk(KERN_ERR "PCI: Found an unsupported Renesas host "
-		       "controller, device id 0x%04x.\n", id);
+		pr_err("PCI: Found an unsupported Renesas host controller, device id 0x%04x.\n",
+		       id);
 		return -EINVAL;
 	}
 
-	printk(KERN_NOTICE "PCI: Found a Renesas %s host "
-	       "controller, revision %d.\n", type,
-	       __raw_readb(chan->reg_base + PCI_REVISION_ID));
+	pr_notice("PCI: Found a Renesas %s host controller, revision %d.\n",
+		  type, __raw_readb(chan->reg_base + PCI_REVISION_ID));
 
 	/*
 	 * Now throw it in to register initialization mode and
@@ -395,9 +394,9 @@ static int __init sh7780_pci_init(void)
 
 	sh7780_pci66_init(chan);
 
-	printk(KERN_NOTICE "PCI: Running at %dMHz.\n",
-	       (__raw_readw(chan->reg_base + PCI_STATUS) & PCI_STATUS_66MHZ) ?
-	       66 : 33);
+	pr_notice("PCI: Running at %dMHz.\n",
+		  (__raw_readw(chan->reg_base + PCI_STATUS) & PCI_STATUS_66MHZ)
+		  ? 66 : 33);
 
 	return 0;
 
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index c7784e1569644d76..6ab0b7377f6634fc 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -120,8 +120,7 @@ int register_pci_controller(struct pci_channel *hose)
 	 * Do not panic here but later - this might happen before console init.
 	 */
 	if (!hose->io_map_base) {
-		printk(KERN_WARNING
-		       "registering PCI controller with io_map_base unset\n");
+		pr_warn("registering PCI controller with io_map_base unset\n");
 	}
 
 	/*
@@ -145,7 +144,7 @@ int register_pci_controller(struct pci_channel *hose)
 	for (--i; i >= 0; i--)
 		release_resource(&hose->resources[i]);
 
-	printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n");
+	pr_warn("Skipping PCI bus scan due to resource conflict\n");
 	return -1;
 }
 
@@ -213,8 +212,8 @@ pcibios_bus_report_status_early(struct pci_channel *hose,
 					pci_devfn, PCI_STATUS,
 					status & status_mask);
 		if (warn)
-			printk("(%02x:%02x: %04X) ", current_bus,
-			       pci_devfn, status);
+			pr_cont("(%02x:%02x: %04X) ", current_bus, pci_devfn,
+				status);
 	}
 }
 
@@ -249,7 +248,7 @@ pcibios_bus_report_status(struct pci_bus *bus, unsigned int status_mask,
 		pci_write_config_word(dev, PCI_STATUS, status & status_mask);
 
 		if (warn)
-			printk("(%s: %04X) ", pci_name(dev), status);
+			pr_cont("(%s: %04X) ", pci_name(dev), status);
 	}
 
 	list_for_each_entry(dev, &bus->devices, bus_list)
-- 
2.17.1


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

* [PATCH v2 9/9] sh: machvec: Modernize printing of kernel messages
  2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
                   ` (7 preceding siblings ...)
  2020-06-17 14:36 ` [PATCH v2 8/9] sh: pci: " Geert Uytterhoeven
@ 2020-06-17 14:36 ` Geert Uytterhoeven
  8 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 14:36 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: Andrew Morton, Mike Rapoport, Dmitry Safonov, Guenter Roeck,
	linux-sh, linux-kernel, Geert Uytterhoeven

  - Convert from printk() to pr_*(),
  - Add missing continuations.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
v2:
  - Add Tested-by.
---
 arch/sh/kernel/machvec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index beadbbdb44867759..0e9fa33a9b6ab38c 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -64,10 +64,10 @@ static int __init early_parse_mv(char *from)
 
 	mvp = get_mv_byname(mv_name);
 	if (unlikely(!mvp)) {
-		printk("Available vectors:\n\n\t'%s', ", sh_mv.mv_name);
+		pr_info("Available vectors:\n\n\t'%s', ", sh_mv.mv_name);
 		for_each_mv(mvp)
-			printk("'%s', ", mvp->mv_name);
-		printk("\n\n");
+			pr_cont("'%s', ", mvp->mv_name);
+		pr_cont("\n\n");
 		panic("Failed to select machvec '%s' -- halting.\n",
 		      mv_name);
 	} else
@@ -104,7 +104,7 @@ void __init sh_mv_setup(void)
 			sh_mv = *(struct sh_machine_vector *)&__machvec_start;
 	}
 
-	printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type());
+	pr_notice("Booting machvec: %s\n", get_system_type());
 
 	/*
 	 * Manually walk the vec, fill in anything that the board hasn't yet
-- 
2.17.1


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

end of thread, other threads:[~2020-06-17 14:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 14:36 [PATCH v2 0/9] sh: Modernize printing of kernel messages Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 1/9] sh: fault: Fix duplicate printing of "PC:" Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 2/9] Revert "sh: add loglvl to printk_address()" Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 3/9] Revert "sh: remove needless printk()" Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 4/9] sh: kernel: disassemble: Fix broken lines in disassembly dumps Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 5/9] sh: dump_stack: Fix broken lines and ptrval in calltrace dumps Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 6/9] sh: process: Fix broken lines in register dumps Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 7/9] sh: sh2007: Modernize printing of kernel messages Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 8/9] sh: pci: " Geert Uytterhoeven
2020-06-17 14:36 ` [PATCH v2 9/9] sh: machvec: " Geert Uytterhoeven

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