diff mbox

[1/3] powerpc/xmon: Dump ftrace buffers for the current CPU

Message ID 1501521731-12123-1-git-send-email-leitao@debian.org (mailing list archive)
State Superseded
Headers show

Commit Message

Breno Leitao July 31, 2017, 5:22 p.m. UTC
Current xmon 'dt' command dumps the tracing buffer for all the CPUs,
which makes it possibly hard to read the logs 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>
---
 arch/powerpc/xmon/xmon.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

kernel test robot Aug. 2, 2017, 3:43 p.m. UTC | #1
Hi Breno,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.13-rc3 next-20170802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Breno-Leitao/powerpc-xmon-Dump-ftrace-buffers-for-the-current-CPU/20170801-054818
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-amigaone_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/xmon/xmon.c: In function 'dump':
>> arch/powerpc/xmon/xmon.c:2525:3: error: implicit declaration of function 'dump_tracing' [-Werror=implicit-function-declaration]
      dump_tracing();
      ^~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/dump_tracing +2525 arch/powerpc/xmon/xmon.c

  2523	
  2524		if (c == 't') {
> 2525			dump_tracing();
  2526			return;
  2527		}
  2528	
  2529		if (c == '\n')
  2530			termch = c;
  2531	
  2532		scanhex((void *)&adrs);
  2533		if (termch != '\n')
  2534			termch = 0;
  2535		if (c == 'i') {
  2536			scanhex(&nidump);
  2537			if (nidump == 0)
  2538				nidump = 16;
  2539			else if (nidump > MAX_DUMP)
  2540				nidump = MAX_DUMP;
  2541			adrs += ppc_inst_dump(adrs, nidump, 1);
  2542			last_cmd = "di\n";
  2543		} else if (c == 'l') {
  2544			dump_log_buf();
  2545		} else if (c == 'o') {
  2546			dump_opal_msglog();
  2547		} else if (c == 'r') {
  2548			scanhex(&ndump);
  2549			if (ndump == 0)
  2550				ndump = 64;
  2551			xmon_rawdump(adrs, ndump);
  2552			adrs += ndump;
  2553			last_cmd = "dr\n";
  2554		} else {
  2555			scanhex(&ndump);
  2556			if (ndump == 0)
  2557				ndump = 64;
  2558			else if (ndump > MAX_DUMP)
  2559				ndump = MAX_DUMP;
  2560	
  2561			switch (c) {
  2562			case '8':
  2563			case '4':
  2564			case '2':
  2565			case '1':
  2566				ndump = ALIGN(ndump, 16);
  2567				dump_by_size(adrs, ndump, c - '0');
  2568				last[1] = c;
  2569				last_cmd = last;
  2570				break;
  2571			default:
  2572				prdump(adrs, ndump);
  2573				last_cmd = "d\n";
  2574			}
  2575	
  2576			adrs += ndump;
  2577		}
  2578	}
  2579	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 08e367e3e8c3..0cbd910193fa 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -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\
@@ -2342,6 +2343,19 @@  static void dump_one_paca(int cpu)
 	sync();
 }
 
+static void dump_tracing(void)
+{
+	int c;
+
+	c = inchar();
+	if (c == 'c')
+		ftrace_dump(DUMP_ORIG);
+	else
+		ftrace_dump(DUMP_ALL);
+
+	tracing_on();
+}
+
 static void dump_all_pacas(void)
 {
 	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)