* [PATCH] powerpc/xmon: Change printk() to pr_cont() @ 2020-12-04 10:35 Christophe Leroy 2020-12-04 10:56 ` Michael Ellerman 2020-12-10 11:29 ` Michael Ellerman 0 siblings, 2 replies; 4+ messages in thread From: Christophe Leroy @ 2020-12-04 10:35 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: linux-kernel, linuxppc-dev Since some time now, printk() adds carriage return, leading to unusable xmon output: [ 54.288722] sysrq: Entering xmon [ 54.292209] Vector: 0 at [cace3d2c] [ 54.292274] pc: [ 54.292331] c0023650 [ 54.292468] : xmon+0x28/0x58 [ 54.292519] [ 54.292574] lr: [ 54.292630] c0023724 [ 54.292749] : sysrq_handle_xmon+0xa4/0xfc [ 54.292801] [ 54.292867] sp: cace3de8 [ 54.292931] msr: 9032 [ 54.292999] current = 0xc28d0000 [ 54.293072] pid = 377, comm = sh [ 54.293157] Linux version 5.10.0-rc6-s3k-dev-01364-gedf13f0ccd76-dirty (root@po17688vm.idsi0.si.c-s.fr) (powerpc64-linux-gcc (GCC) 10.1.0, GNU ld (GNU Binutils) 2.34) #4211 PREEMPT Fri Dec 4 09:32:11 UTC 2020 [ 54.293287] enter ? for help [ 54.293470] [cace3de8] [ 54.293532] c0023724 [ 54.293654] sysrq_handle_xmon+0xa4/0xfc [ 54.293711] (unreliable) [ 54.293859] [cace3e18] [ 54.293918] c03885a8 [ 54.294056] __handle_sysrq+0xe4/0x1d4 [ 54.294108] [ 54.294255] [cace3e48] [ 54.294314] c0388704 [ 54.294441] write_sysrq_trigger+0x34/0x74 [ 54.294493] [ 54.294641] [cace3e68] [ 54.294700] c01f65d0 [ 54.294822] proc_reg_write+0xac/0x11c [ 54.294875] [ 54.295023] [cace3e88] [ 54.295082] c0179910 [ 54.295198] vfs_write+0x134/0x46c [ 54.295250] [ 54.295396] [cace3f08] [ 54.295455] c0179de8 [ 54.295567] ksys_write+0x78/0x11c [ 54.295619] [ 54.295766] [cace3f38] [ 54.295825] c00110d0 [ 54.295951] ret_from_syscall+0x0/0x34 [ 54.296002] [ 54.296159] --- Exception: c01 (System Call) at [ 54.296217] 0fd4e784 [ 54.296303] [ 54.296375] SP (7fca6ff0) is in userspace [ 54.296431] mon> [ 54.296484] <no input ...> Use pr_cont() instead. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines") Cc: stable@vger.kernel.org --- arch/powerpc/xmon/nonstdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c index 5c1a50912229..9b0d85bff021 100644 --- a/arch/powerpc/xmon/nonstdio.c +++ b/arch/powerpc/xmon/nonstdio.c @@ -178,7 +178,7 @@ void xmon_printf(const char *format, ...) if (n && rc == 0) { /* No udbg hooks, fallback to printk() - dangerous */ - printk("%s", xmon_outbuf); + pr_cont("%s", xmon_outbuf); } } -- 2.25.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/xmon: Change printk() to pr_cont() 2020-12-04 10:35 [PATCH] powerpc/xmon: Change printk() to pr_cont() Christophe Leroy @ 2020-12-04 10:56 ` Michael Ellerman 2020-12-04 15:55 ` Joe Perches 2020-12-10 11:29 ` Michael Ellerman 1 sibling, 1 reply; 4+ messages in thread From: Michael Ellerman @ 2020-12-04 10:56 UTC (permalink / raw) To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras Cc: linux-kernel, linuxppc-dev Christophe Leroy <christophe.leroy@csgroup.eu> writes: > Since some time now, printk() adds carriage return, leading to > unusable xmon output: > > [ 54.288722] sysrq: Entering xmon > [ 54.292209] Vector: 0 at [cace3d2c] > [ 54.292274] pc: > [ 54.292331] c0023650 ... > diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c > index 5c1a50912229..9b0d85bff021 100644 > --- a/arch/powerpc/xmon/nonstdio.c > +++ b/arch/powerpc/xmon/nonstdio.c > @@ -178,7 +178,7 @@ void xmon_printf(const char *format, ...) > > if (n && rc == 0) { > /* No udbg hooks, fallback to printk() - dangerous */ > - printk("%s", xmon_outbuf); > + pr_cont("%s", xmon_outbuf); > } Ah OK, in the case where there's no udbg backend. We basically always have a udbg backend on 64-bit, via hvc console. Which explains why we haven't noticed it. Will pick up the patch. cheers ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/xmon: Change printk() to pr_cont() 2020-12-04 10:56 ` Michael Ellerman @ 2020-12-04 15:55 ` Joe Perches 0 siblings, 0 replies; 4+ messages in thread From: Joe Perches @ 2020-12-04 15:55 UTC (permalink / raw) To: Michael Ellerman, Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras Cc: linux-kernel, linuxppc-dev On Fri, 2020-12-04 at 21:56 +1100, Michael Ellerman wrote: > Christophe Leroy <christophe.leroy@csgroup.eu> writes: > > Since some time now, printk() adds carriage return, leading to > > unusable xmon output: > > > > [ 54.288722] sysrq: Entering xmon > > [ 54.292209] Vector: 0 at [cace3d2c] > > [ 54.292274] pc: > > [ 54.292331] c0023650 > > ... > > > diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c > > index 5c1a50912229..9b0d85bff021 100644 > > --- a/arch/powerpc/xmon/nonstdio.c > > +++ b/arch/powerpc/xmon/nonstdio.c > > @@ -178,7 +178,7 @@ void xmon_printf(const char *format, ...) > > > > > > if (n && rc == 0) { > > /* No udbg hooks, fallback to printk() - dangerous */ > > - printk("%s", xmon_outbuf); > > + pr_cont("%s", xmon_outbuf); > > } > > Ah OK, in the case where there's no udbg backend. We basically always > have a udbg backend on 64-bit, via hvc console. Which explains why we > haven't noticed it. > > Will pick up the patch. > > cheers Perhaps all of these bare printks should be inspected for defects: $ git grep -P -n '\bprintk\s*\(\s*(?!KERN_\w+)"[^\\n]*"' arch/powerpc arch/powerpc/kernel/process.c:1475: printk("NIP: "REG" LR: "REG" CTR: "REG"\n", arch/powerpc/kernel/process.c:1479: printk("MSR: "REG" ", regs->msr); arch/powerpc/kernel/process.c:1513: printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip); arch/powerpc/kernel/process.c:1514: printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link); arch/powerpc/kernel/process.c:2157: printk("%s["REG"] ["REG"] %pS", arch/powerpc/kernel/traps.c:621: printk("Caused by (from MCSR=%lx): ", reason); arch/powerpc/kernel/traps.c:726: printk("Caused by (from MCSR=%lx): ", reason); arch/powerpc/kernel/traps.c:766: printk("Caused by (from MCSR=%lx): ", reason); arch/powerpc/kernel/traps.c:791: printk("Caused by (from SRR1=%lx): ", reason); arch/powerpc/kernel/udbg.c:95: printk("%s", s); arch/powerpc/math-emu/fabs.c:13: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/fctiw.c:22: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/fctiwz.c:29: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/fmr.c:13: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/fnabs.c:13: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/fneg.c:13: printk("%s: D %p, B %p: ", __func__, frD, frB); arch/powerpc/math-emu/lfd.c:15: printk("%s: D %p, ea %p: ", __func__, frD, ea); arch/powerpc/math-emu/stfd.c:11: printk("%s: S %p, ea %p: ", __func__, frS, ea); arch/powerpc/mm/nohash/44x.c:192: printk("%d ", i); arch/powerpc/platforms/4xx/machine_check.c:19: printk("Data"); arch/powerpc/platforms/chrp/pci.c:256: printk(" at %llx", (unsigned long long)r.start); arch/powerpc/platforms/embedded6xx/ls_uart.c:47: printk("%c", in_8(avr_addr + UART_RX)); arch/powerpc/platforms/powermac/pfunc_core.c:83: printk("%s", title); arch/powerpc/platforms/powermac/pfunc_core.c:85: printk("%02x ", *((u8 *)blob)); arch/powerpc/platforms/powernv/pci-ioda.c:81: printk("%spci %s: [PE# %.2x] %pV", arch/powerpc/sysdev/tsi108_pci.c:63: printk("PCI CFG write : "); arch/powerpc/sysdev/tsi108_pci.c:64: printk("%d:0x%x:0x%x ", bus->number, devfunc, offset); arch/powerpc/sysdev/tsi108_pci.c:65: printk("%d ADDR=0x%08x ", len, (uint) cfg_addr); arch/powerpc/sysdev/tsi108_pci.c:164: printk("PCI CFG read : "); arch/powerpc/sysdev/tsi108_pci.c:165: printk("%d:0x%x:0x%x ", bus->number, devfn, offset); arch/powerpc/sysdev/tsi108_pci.c:166: printk("%d ADDR=0x%08x ", len, (uint) cfg_addr); arch/powerpc/sysdev/tsi108_pci.c:315: printk("cfg_ctl=0x%08x ", temp); arch/powerpc/xmon/nonstdio.c:181: printk("%s", xmon_outbuf); ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/xmon: Change printk() to pr_cont() 2020-12-04 10:35 [PATCH] powerpc/xmon: Change printk() to pr_cont() Christophe Leroy 2020-12-04 10:56 ` Michael Ellerman @ 2020-12-10 11:29 ` Michael Ellerman 1 sibling, 0 replies; 4+ messages in thread From: Michael Ellerman @ 2020-12-10 11:29 UTC (permalink / raw) To: Benjamin Herrenschmidt, Christophe Leroy, Paul Mackerras, Michael Ellerman Cc: linux-kernel, linuxppc-dev On Fri, 4 Dec 2020 10:35:38 +0000 (UTC), Christophe Leroy wrote: > Since some time now, printk() adds carriage return, leading to > unusable xmon output: > > [ 54.288722] sysrq: Entering xmon > [ 54.292209] Vector: 0 at [cace3d2c] > [ 54.292274] pc: > [ 54.292331] c0023650 > [ 54.292468] : xmon+0x28/0x58 > [ 54.292519] > [ 54.292574] lr: > [ 54.292630] c0023724 > [ 54.292749] : sysrq_handle_xmon+0xa4/0xfc > [ 54.292801] > [ 54.292867] sp: cace3de8 > [ 54.292931] msr: 9032 > [ 54.292999] current = 0xc28d0000 > [ 54.293072] pid = 377, comm = sh > [ 54.293157] Linux version 5.10.0-rc6-s3k-dev-01364-gedf13f0ccd76-dirty (root@po17688vm.idsi0.si.c-s.fr) (powerpc64-linux-gcc (GCC) 10.1.0, GNU ld (GNU Binutils) 2.34) #4211 PREEMPT Fri Dec 4 09:32:11 UTC 2020 > [ 54.293287] enter ? for help > [ 54.293470] [cace3de8] > [ 54.293532] c0023724 > [ 54.293654] sysrq_handle_xmon+0xa4/0xfc > [ 54.293711] (unreliable) > [ 54.293859] [cace3e18] > [ 54.293918] c03885a8 > [ 54.294056] __handle_sysrq+0xe4/0x1d4 > [ 54.294108] > [ 54.294255] [cace3e48] > [ 54.294314] c0388704 > [ 54.294441] write_sysrq_trigger+0x34/0x74 > [ 54.294493] > [ 54.294641] [cace3e68] > [ 54.294700] c01f65d0 > [ 54.294822] proc_reg_write+0xac/0x11c > [ 54.294875] > [ 54.295023] [cace3e88] > [ 54.295082] c0179910 > [ 54.295198] vfs_write+0x134/0x46c > [ 54.295250] > [ 54.295396] [cace3f08] > [ 54.295455] c0179de8 > [ 54.295567] ksys_write+0x78/0x11c > [ 54.295619] > [ 54.295766] [cace3f38] > [ 54.295825] c00110d0 > [ 54.295951] ret_from_syscall+0x0/0x34 > [ 54.296002] > [ 54.296159] --- Exception: c01 (System Call) at > [ 54.296217] 0fd4e784 > [ 54.296303] > [ 54.296375] SP (7fca6ff0) is in userspace > [ 54.296431] mon> > [ 54.296484] <no input ...> > > [...] Applied to powerpc/next. [1/1] powerpc/xmon: Change printk() to pr_cont() https://git.kernel.org/powerpc/c/7c6c86b36a36dd4a13d30bba07718e767aa2e7a1 cheers ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-10 11:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-04 10:35 [PATCH] powerpc/xmon: Change printk() to pr_cont() Christophe Leroy 2020-12-04 10:56 ` Michael Ellerman 2020-12-04 15:55 ` Joe Perches 2020-12-10 11:29 ` 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).