powerpc/xmon: Add 'dt' command to dump trace buffers
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 6 Nov 2015 02:21:17 +0000 (13:21 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 25 Nov 2016 03:30:27 +0000 (14:30 +1100)
There is a nice interface for asking ftrace to dump all its tracing
buffers. The only down side for use in xmon is that it uses printk.
Depending on circumstances printk may not work when in xmon, but it also
may, so add a 'dt' command which dumps the ftrace buffers, and add a
note to the help to mentiont that it uses printk.

Calling this routine also disables tracing, which is problematic if you
return from xmon and expect the system to keep operating normally. So
after we do the dump turn tracing back on.

Both functions already have nop versions defined for when ftrace is not
enabled, so we don't need any extra #ifdefs.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/xmon/xmon.c

index 7605455..9c0e17c 100644 (file)
@@ -10,6 +10,8 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  */
+
+#include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
@@ -225,6 +227,7 @@ Commands:\n\
 #endif
   "\
   dr   dump stream of raw bytes\n\
+  dt   dump the tracing buffers (uses printk)\n\
   e    print exception information\n\
   f    flush cache\n\
   la   lookup symbol+offset of specified address\n\
@@ -2364,6 +2367,9 @@ dump(void)
                dump_log_buf();
        } else if (c == 'o') {
                dump_opal_msglog();
+       } else if (c == 't') {
+               ftrace_dump(DUMP_ALL);
+               tracing_on();
        } else if (c == 'r') {
                scanhex(&ndump);
                if (ndump == 0)