aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-11-26 00:16:25 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-26 00:52:55 -0500
commite53a6319cca69111c1643dc9f18f4465d7f1cbf0 (patch)
tree867bd86a05aa590516aaa60221f297017cd31781 /kernel/trace/ftrace.c
parent5a45cfe1c64862e8cd3b0d79d7c4ba71c3118915 (diff)
ftrace: let function tracing and function return run together
Impact: feature This patch enables function tracing and function return to run together. I've tested this by enabling the stack tracer and return tracer, where both the function entry and function return are used together with dynamic ftrace. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 5f7c8642d58b..cbf8b09f63a5 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -53,9 +53,6 @@ static int ftrace_pid_trace = -1;
53/* Quick disabling of function tracer. */ 53/* Quick disabling of function tracer. */
54int function_trace_stop; 54int function_trace_stop;
55 55
56/* By default, current tracing type is normal tracing. */
57enum ftrace_tracing_type_t ftrace_tracing_type = FTRACE_TYPE_ENTER;
58
59/* 56/*
60 * ftrace_disabled is set when an anomaly is discovered. 57 * ftrace_disabled is set when an anomaly is discovered.
61 * ftrace_disabled is much stronger than ftrace_enabled. 58 * ftrace_disabled is much stronger than ftrace_enabled.
@@ -1576,15 +1573,9 @@ int register_ftrace_function(struct ftrace_ops *ops)
1576 1573
1577 mutex_lock(&ftrace_sysctl_lock); 1574 mutex_lock(&ftrace_sysctl_lock);
1578 1575
1579 if (ftrace_tracing_type == FTRACE_TYPE_RETURN) {
1580 ret = -EBUSY;
1581 goto out;
1582 }
1583
1584 ret = __register_ftrace_function(ops); 1576 ret = __register_ftrace_function(ops);
1585 ftrace_startup(0); 1577 ftrace_startup(0);
1586 1578
1587out:
1588 mutex_unlock(&ftrace_sysctl_lock); 1579 mutex_unlock(&ftrace_sysctl_lock);
1589 return ret; 1580 return ret;
1590} 1581}
@@ -1731,23 +1722,16 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
1731 1722
1732 mutex_lock(&ftrace_sysctl_lock); 1723 mutex_lock(&ftrace_sysctl_lock);
1733 1724
1734 /*
1735 * Don't launch return tracing if normal function
1736 * tracing is already running.
1737 */
1738 if (ftrace_trace_function != ftrace_stub) {
1739 ret = -EBUSY;
1740 goto out;
1741 }
1742 atomic_inc(&ftrace_graph_active); 1725 atomic_inc(&ftrace_graph_active);
1743 ret = start_graph_tracing(); 1726 ret = start_graph_tracing();
1744 if (ret) { 1727 if (ret) {
1745 atomic_dec(&ftrace_graph_active); 1728 atomic_dec(&ftrace_graph_active);
1746 goto out; 1729 goto out;
1747 } 1730 }
1748 ftrace_tracing_type = FTRACE_TYPE_RETURN; 1731
1749 ftrace_graph_return = retfunc; 1732 ftrace_graph_return = retfunc;
1750 ftrace_graph_entry = entryfunc; 1733 ftrace_graph_entry = entryfunc;
1734
1751 ftrace_startup(FTRACE_START_FUNC_RET); 1735 ftrace_startup(FTRACE_START_FUNC_RET);
1752 1736
1753out: 1737out:
@@ -1763,8 +1747,6 @@ void unregister_ftrace_graph(void)
1763 ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; 1747 ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
1764 ftrace_graph_entry = (trace_func_graph_ent_t)ftrace_stub; 1748 ftrace_graph_entry = (trace_func_graph_ent_t)ftrace_stub;
1765 ftrace_shutdown(FTRACE_STOP_FUNC_RET); 1749 ftrace_shutdown(FTRACE_STOP_FUNC_RET);
1766 /* Restore normal tracing type */
1767 ftrace_tracing_type = FTRACE_TYPE_ENTER;
1768 1750
1769 mutex_unlock(&ftrace_sysctl_lock); 1751 mutex_unlock(&ftrace_sysctl_lock);
1770} 1752}