powerpc/xmon: Dump ftrace buffers for the current CPU only
authorBreno Leitao <leitao@debian.org>
Wed, 2 Aug 2017 20:14:05 +0000 (17:14 -0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Aug 2017 11:57:56 +0000 (21:57 +1000)
Current xmon 'dt' command dumps the tracing buffer for all the CPUs,
which makes it very hard to read due to the fact that most of
powerpc machines currently have many CPUs. Other than that, the CPU
lines are interleaved in the ftrace log.

This new option just dumps the ftrace buffer for the current CPU.

Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/xmon/xmon.c

index 08e367e3e8c3128ef6da58b3cd5caa5c511e98b4..e0522f60f0eeb310657684bd1c01c65f439cf8e7 100644 (file)
@@ -234,6 +234,7 @@ Commands:\n\
   "\
   dr   dump stream of raw bytes\n\
   dt   dump the tracing buffers (uses printk)\n\
+  dtc  dump the tracing buffers for current CPU (uses printk)\n\
 "
 #ifdef CONFIG_PPC_POWERNV
 "  dx#   dump xive on CPU #\n\
@@ -2231,6 +2232,19 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
        printf("\n");
 }
 
+static void dump_tracing(void)
+{
+       int c;
+
+       c = inchar();
+       if (c == 'c')
+               ftrace_dump(DUMP_ORIG);
+       else
+               ftrace_dump(DUMP_ALL);
+
+       tracing_on();
+}
+
 #ifdef CONFIG_PPC64
 static void dump_one_paca(int cpu)
 {
@@ -2507,6 +2521,11 @@ dump(void)
        }
 #endif
 
+       if (c == 't') {
+               dump_tracing();
+               return;
+       }
+
        if (c == '\n')
                termch = c;
 
@@ -2525,9 +2544,6 @@ 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)