History log of /linux-master/arch/powerpc/xmon/nonstdio.c
Revision Date Author Comments
# 7c6c86b3 04-Dec-2020 Christophe Leroy <christophe.leroy@csgroup.eu>

powerpc/xmon: Change printk() to pr_cont()

Since some time now, printk() adds carriage return, leading to
unusable xmon output if there is no udbg backend available:

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

Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
Cc: stable@vger.kernel.org # v4.9+
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Mention that it only happens when udbg is not available]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c8a6ec704416ecd5ff2bd26213c9bc026bdd19de.1607077340.git.christophe.leroy@csgroup.eu


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 958b7c80 07-Oct-2015 Sam bobroff <sam.bobroff@au1.ibm.com>

powerpc/xmon: Paged output for paca display

The paca display is already more than 24 lines, which can be problematic
if you have an old school 80x24 terminal, or more likely you are on a
virtual terminal which does not scroll for whatever reason.

This patch adds a new command "#", which takes a single (hex) numeric
argument: lines per page. It will cause the output of "dp" and "dpa"
to be broken into pages, if necessary.

Sample output:

0:mon> # 10
0:mon> dp1
paca for cpu 0x1 @ c00000000fdc0480:
possible = yes
present = yes
online = yes
lock_token = 0x8000 (0x8)
paca_index = 0x1 (0xa)
kernel_toc = 0xc000000000eb2400 (0x10)
kernelbase = 0xc000000000000000 (0x18)
kernel_msr = 0xb000000000001032 (0x20)
emergency_sp = 0xc00000003ffe8000 (0x28)
mc_emergency_sp = 0xc00000003ffe4000 (0x2e0)
in_mce = 0x0 (0x2e8)
data_offset = 0x7f170000 (0x30)
hw_cpu_id = 0x8 (0x38)
cpu_start = 0x1 (0x3a)
kexec_state = 0x0 (0x3b)
[Hit a key (a:all, q:truncate, any:next page)]
0:mon>
__current = 0xc00000007e696620 (0x290)
kstack = 0xc00000007e6ebe30 (0x298)
stab_rr = 0xb (0x2a0)
saved_r1 = 0xc00000007ef37860 (0x2a8)
trap_save = 0x0 (0x2b8)
soft_enabled = 0x0 (0x2ba)
irq_happened = 0x1 (0x2bb)
io_sync = 0x0 (0x2bc)
irq_work_pending = 0x0 (0x2bd)
nap_state_lost = 0x0 (0x2be)
0:mon>

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
[mpe: Use bool, make some variables static]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>


# 50b66dbf 10-Jun-2014 Kees Cook <keescook@chromium.org>

powerpc/xmon: avoid format string leaking to printk

This makes sure format strings cannot leak into printk (the string has
already been correctly processed for format arguments).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# b2bb65f6 08-Oct-2012 Michael Ellerman <michael@ellerman.id.au>

powerpc/xmon: Fallback to printk() in xmon_printf() if udbg is not setup

It is possible to configure a kernel which has xmon enabled, but has no
udbg backend to provide IO. This can make xmon rather confusing, as it
produces no output, blocks for two seconds, and then returns.

As a last resort we can instead try to printk(), which may deadlock or
otherwise crash, but tries quite hard not to.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 33b5cd68 08-Oct-2012 Michael Ellerman <michael@ellerman.id.au>

powerpc/xmon: Merge start.c into nonstdio.c

The routines in start.c are only ever called from nonstdio.c, so if we
move them in there they can become static which is nice.

I suspect the idea behind the separation was that start.c could be
replaced in order to build xmon in userland. If anyone still cares about
doing that we could handle that with an ifdef or two.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 88c6d626 08-Oct-2012 Michael Ellerman <michael@ellerman.id.au>

powerpc/xmon: Make xmon_getchar() static

xmon_getchar() is only called from within nonstdio.c, so make it static.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# eb1c2abb 08-Oct-2012 Michael Ellerman <michael@ellerman.id.au>

powerpc/xmon: Remove unused xmon_expect() & xmon_read_poll()

It looks like xmon_expect() was used for doing xmon over a modem (!?),
that code was dropped in 2005 in commit 51d3082 "Unify udbg (#2)".

Once xmon_expect() is gone xmon_read_poll() is unused, drop it too.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 4d404edc 18-Jul-2007 Ishizaki Kou <kou.ishizaki@toshiba.co.jp>

[POWERPC] fix showing xmon help

In some configuration, xmon help string is larger than xmon_printf
buffer. We need not to use printf. This patch adds xmon_puts and
change to use it to show help string.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# fca5dcd4 08-Nov-2005 Paul Mackerras <paulus@samba.org>

powerpc: Simplify and clean up the xmon terminal I/O

This factors out the common bits of arch/powerpc/xmon/start_*.c into
a new nonstdio.c, and removes some stuff that was supposed to make
xmon's I/O routines somewhat stdio-like but was never used.

It also makes the parsing of the xmon= command line option common,
so that ppc32 can now use xmon={off,on,early} also.

Signed-off-by: Paul Mackerras <paulus@samba.org>