powerpc/xmon: make dumping log buffer contents more reliable
authorNathan Lynch <nathanl@linux.ibm.com>
Fri, 14 May 2021 16:24:20 +0000 (11:24 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 23 May 2021 10:51:35 +0000 (20:51 +1000)
Log buffer entries that are too long for dump_log_buf()'s small
local buffer are:

* silently discarded when a single-line entry is too long;
  kmsg_dump_get_line() returns true but sets &len to 0.
* silently truncated to the last fitting new line when a multi-line
  entry is too long, e.g. register dumps from __show_regs(); this
  seems undetectable via the kmsg_dump API.

xmon_printf()'s internal buffer is already 1KB; enlarge
dump_log_buf()'s own buffer to match and make it statically
allocated. Verified that this allows complete printing of register
dumps on ppc64le with both CONFIG_PRINTK_TIME=y and
CONFIG_PRINTK_CALLER=y.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210514162420.2911458-1-nathanl@linux.ibm.com
arch/powerpc/xmon/xmon.c

index c8173e9..f73c108 100644 (file)
@@ -2975,7 +2975,7 @@ static void
 dump_log_buf(void)
 {
        struct kmsg_dump_iter iter;
-       unsigned char buf[128];
+       static unsigned char buf[1024];
        size_t len;
 
        if (setjmp(bus_error_jmp) != 0) {