[PATCH v2 4/4] powerpc/xmon: Disable ftrace while in xmon
Naveen N. Rao
naveen.n.rao at linux.vnet.ibm.com
Thu Jun 1 20:48:18 AEST 2017
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 at 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
More information about the Linuxppc-dev
mailing list