lkml.org 
[lkml]   [2011]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] ktrace - function graph trace support
Date
adding function graph support

wbr,
jirka
---
arch/x86/Kconfig | 2 +-
arch/x86/kernel/entry_64.S | 27 +++++++++++++++++++++++++++
kernel/trace/ftrace.c | 10 ++++++++++
3 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a02718c..befe1e0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -36,7 +36,7 @@ config X86
select HAVE_DYNAMIC_FTRACE
select HAVE_FUNCTION_TRACER
select HAVE_FUNCTION_GRAPH_TRACER
- select HAVE_FUNCTION_GRAPH_FP_TEST
+ select HAVE_FUNCTION_GRAPH_FP_TEST if !KTRACE
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE || KTRACE
select HAVE_SYSCALL_TRACEPOINTS
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 4d70019..ec9e234 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -69,6 +69,14 @@ ENTRY(ktrace_callback)

cmpq $ftrace_stub, ftrace_trace_function
jnz ktrace_trace
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ cmpq $ftrace_stub, ftrace_graph_return
+ jnz ktrace_graph_caller
+
+ cmpq $ftrace_graph_entry_stub, ftrace_graph_entry
+ jnz ktrace_graph_caller
+#endif
retq

ktrace_trace:
@@ -83,6 +91,25 @@ ktrace_trace:

retq
END(ktrace_callback)
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(ktrace_graph_caller)
+ cmpl $0, function_trace_stop
+ jne ftrace_stub
+
+ MCOUNT_SAVE_FRAME
+
+ leaq 0x50(%rsp), %rdi
+ movq 0x48(%rsp), %rsi
+ movq $0, %rdx
+
+ call prepare_ftrace_return
+
+ MCOUNT_RESTORE_FRAME
+
+ retq
+END(ktrace_graph_caller)
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
#endif /* CONFIG_KTRACE */

#ifdef CONFIG_DYNAMIC_FTRACE
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 762e2b3..f6e30a8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3404,7 +3404,11 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
ftrace_graph_return = retfunc;
ftrace_graph_entry = entryfunc;

+#ifdef CONFIG_KTRACE
+ ktrace_startup();
+#else
ftrace_startup(FTRACE_START_FUNC_RET);
+#endif

out:
mutex_unlock(&ftrace_lock);
@@ -3421,7 +3425,13 @@ void unregister_ftrace_graph(void)
ftrace_graph_active--;
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
ftrace_graph_entry = ftrace_graph_entry_stub;
+
+#ifdef CONFIG_KTRACE
+ ktrace_shutdown();
+#else
ftrace_shutdown(FTRACE_STOP_FUNC_RET);
+#endif
+
unregister_pm_notifier(&ftrace_suspend_notifier);
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);

--
1.7.1


\
 
 \ /
  Last update: 2011-02-03 16:47    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site