linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 4/4] powerpc/xmon: Disable ftrace while in xmon
Date: Thu,  1 Jun 2017 16:18:18 +0530	[thread overview]
Message-ID: <7a15c553c743c24f69859945042efd6345beead3.1496309487.git.naveen.n.rao@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1496309487.git.naveen.n.rao@linux.vnet.ibm.com>
In-Reply-To: <cover.1496309487.git.naveen.n.rao@linux.vnet.ibm.com>

Disable ftrace when we enter xmon so as not to clobber/pollute the
trace buffer. In addition, we cannot have function_graph enabled while
in xmon since we use setjmp/longjmp which confuses the function call
history maintained by function_graph.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
v2: Disable ftrace, rather than just pausing function_graph.

 arch/powerpc/xmon/xmon.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index a728e1919613..e51ce32d21fd 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -28,6 +28,7 @@
 #include <linux/bug.h>
 #include <linux/nmi.h>
 #include <linux/ctype.h>
+#include <linux/ftrace.h>
 
 #include <asm/debugfs.h>
 #include <asm/ptrace.h>
@@ -456,10 +457,13 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
 	int cpu;
 	int secondary;
 #endif
+	int save_ftrace_enabled;
 
 	local_irq_save(flags);
 	hard_irq_disable();
 
+	save_ftrace_enabled = __ftrace_enabled_save();
+
 	bp = in_breakpoint_table(regs->nip, &offset);
 	if (bp != NULL) {
 		regs->nip = bp->address + offset;
@@ -654,6 +658,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
 	insert_cpu_bpts();
 
 	touch_nmi_watchdog();
+	__ftrace_enabled_restore(save_ftrace_enabled);
 	local_irq_restore(flags);
 
 	return cmd != 'X' && cmd != EOF;
-- 
2.12.2

      parent reply	other threads:[~2017-06-01 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 10:48 [PATCH v2 0/4] ftrace/kprobe fixes Naveen N. Rao
2017-06-01 10:48 ` [PATCH v2 1/4] powerpc/kprobes: Pause function_graph tracing during jprobes handling Naveen N. Rao
2017-06-08 13:43   ` Masami Hiramatsu
2017-06-08 15:33     ` Steven Rostedt
2017-06-19 12:22   ` [v2, " Michael Ellerman
2017-06-01 10:48 ` [PATCH v2 2/4] powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS Naveen N. Rao
2017-06-19 12:22   ` [v2, " Michael Ellerman
2017-06-01 10:48 ` [PATCH v2 3/4] powerpc/kprobes_on_ftrace: Skip livepatch_handler() for jprobes Naveen N. Rao
2017-06-08 13:59   ` Masami Hiramatsu
2017-06-15 11:19   ` Michael Ellerman
2017-06-15 15:32     ` Naveen N. Rao
2017-06-19 12:22   ` [v2, " Michael Ellerman
2017-06-01 10:48 ` Naveen N. Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a15c553c743c24f69859945042efd6345beead3.1496309487.git.naveen.n.rao@linux.vnet.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhiramat@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).