linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/xmon: Add 'dt' command to dump trace buffers
@ 2015-11-06  2:21 Michael Ellerman
  2016-11-28 12:15 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2015-11-06  2:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: rostedt

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 786bf01691c9..31e0d63d2442 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -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>
@@ -201,7 +203,9 @@ Commands:\n\
   di	dump instructions\n\
   df	dump float values\n\
   dd	dump double values\n\
-  dl    dump the kernel log buffer\n"
+  dl    dump the kernel log buffer\n\
+  dt    dump the tracing buffers (uses printk)\n\
+  "
 #ifdef CONFIG_PPC64
   "\
   dp[#]	dump paca for current cpu, or cpu #\n\
@@ -2255,6 +2259,9 @@ dump(void)
 		last_cmd = "di\n";
 	} else if (c == 'l') {
 		dump_log_buf();
+	} else if (c == 't') {
+		ftrace_dump(DUMP_ALL);
+		tracing_on();
 	} else if (c == 'r') {
 		scanhex(&ndump);
 		if (ndump == 0)
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: powerpc/xmon: Add 'dt' command to dump trace buffers
  2015-11-06  2:21 [PATCH] powerpc/xmon: Add 'dt' command to dump trace buffers Michael Ellerman
@ 2016-11-28 12:15 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2016-11-28 12:15 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: rostedt

On Fri, 2015-11-06 at 02:21:17 UTC, Michael Ellerman wrote:
> 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>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/56144ec7c93f6f18aa878560074633

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-28 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06  2:21 [PATCH] powerpc/xmon: Add 'dt' command to dump trace buffers Michael Ellerman
2016-11-28 12:15 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).