diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-12-02 23:50:05 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-03 02:56:26 -0500 |
commit | e49dc19c6a19ea112fcb94b7c62ec62cdd5c08aa (patch) | |
tree | 851dcdfe321e16a327d656ecd7040ef6e8590bec /kernel/trace | |
parent | 7ee991fbc6f947e9b04f29c9c6c1d057d0671a16 (diff) |
ftrace: function graph return for function entry
Impact: feature, let entry function decide to trace or not
This patch lets the graph tracer entry function decide if the tracing
should be done at the end as well. This requires all function graph
entry functions return 1 if it should trace, or 0 if the return should
not be traced.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 10 | ||||
-rw-r--r-- | kernel/trace/trace.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a44af05ae2d0..65b9e863056b 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1636,11 +1636,15 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
1636 | 1636 | ||
1637 | static atomic_t ftrace_graph_active; | 1637 | static atomic_t ftrace_graph_active; |
1638 | 1638 | ||
1639 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) | ||
1640 | { | ||
1641 | return 0; | ||
1642 | } | ||
1643 | |||
1639 | /* The callbacks that hook a function */ | 1644 | /* The callbacks that hook a function */ |
1640 | trace_func_graph_ret_t ftrace_graph_return = | 1645 | trace_func_graph_ret_t ftrace_graph_return = |
1641 | (trace_func_graph_ret_t)ftrace_stub; | 1646 | (trace_func_graph_ret_t)ftrace_stub; |
1642 | trace_func_graph_ent_t ftrace_graph_entry = | 1647 | trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub; |
1643 | (trace_func_graph_ent_t)ftrace_stub; | ||
1644 | 1648 | ||
1645 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ | 1649 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ |
1646 | static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list) | 1650 | static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list) |
@@ -1738,7 +1742,7 @@ void unregister_ftrace_graph(void) | |||
1738 | 1742 | ||
1739 | atomic_dec(&ftrace_graph_active); | 1743 | atomic_dec(&ftrace_graph_active); |
1740 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 1744 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
1741 | ftrace_graph_entry = (trace_func_graph_ent_t)ftrace_stub; | 1745 | ftrace_graph_entry = ftrace_graph_entry_stub; |
1742 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 1746 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
1743 | 1747 | ||
1744 | mutex_unlock(&ftrace_sysctl_lock); | 1748 | mutex_unlock(&ftrace_sysctl_lock); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 380de630ebce..8b6409a62b54 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1200,7 +1200,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip) | |||
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1202 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
1203 | void trace_graph_entry(struct ftrace_graph_ent *trace) | 1203 | int trace_graph_entry(struct ftrace_graph_ent *trace) |
1204 | { | 1204 | { |
1205 | struct trace_array *tr = &global_trace; | 1205 | struct trace_array *tr = &global_trace; |
1206 | struct trace_array_cpu *data; | 1206 | struct trace_array_cpu *data; |
@@ -1219,6 +1219,8 @@ void trace_graph_entry(struct ftrace_graph_ent *trace) | |||
1219 | } | 1219 | } |
1220 | atomic_dec(&data->disabled); | 1220 | atomic_dec(&data->disabled); |
1221 | local_irq_restore(flags); | 1221 | local_irq_restore(flags); |
1222 | |||
1223 | return 1; | ||
1222 | } | 1224 | } |
1223 | 1225 | ||
1224 | void trace_graph_return(struct ftrace_graph_ret *trace) | 1226 | void trace_graph_return(struct ftrace_graph_ret *trace) |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index f96f4e787ff3..0565ae9a2210 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -412,7 +412,7 @@ void trace_function(struct trace_array *tr, | |||
412 | unsigned long flags, int pc); | 412 | unsigned long flags, int pc); |
413 | 413 | ||
414 | void trace_graph_return(struct ftrace_graph_ret *trace); | 414 | void trace_graph_return(struct ftrace_graph_ret *trace); |
415 | void trace_graph_entry(struct ftrace_graph_ent *trace); | 415 | int trace_graph_entry(struct ftrace_graph_ent *trace); |
416 | void trace_bts(struct trace_array *tr, | 416 | void trace_bts(struct trace_array *tr, |
417 | unsigned long from, | 417 | unsigned long from, |
418 | unsigned long to); | 418 | unsigned long to); |