Skip to content

Commit 761efe8

Browse files
committed
function_graph: Remove the use of FTRACE_NOTRACE_DEPTH
The curr_ret_stack is no longer set to a negative value when a function is not to be traced by the function graph tracer. Remove the usage of FTRACE_NOTRACE_DEPTH, as it is no longer needed. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 421d106 commit 761efe8

3 files changed

Lines changed: 0 additions & 31 deletions

File tree

‎include/linux/ftrace.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
790790
*/
791791
#define __notrace_funcgraph notrace
792792

793-
#define FTRACE_NOTRACE_DEPTH 65536
794793
#define FTRACE_RETFUNC_DEPTH 50
795794
#define FTRACE_RETSTACK_ALLOC_SIZE 32
796795
extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,

‎kernel/trace/fgraph.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,6 @@ ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret,
112112

113113
index = current->curr_ret_stack;
114114

115-
/*
116-
* A negative index here means that it's just returned from a
117-
* notrace'd function. Recover index to get an original
118-
* return address. See ftrace_push_return_trace().
119-
*
120-
* TODO: Need to check whether the stack gets corrupted.
121-
*/
122-
if (index < 0)
123-
index += FTRACE_NOTRACE_DEPTH;
124-
125115
if (unlikely(index < 0 || index >= FTRACE_RETFUNC_DEPTH)) {
126116
ftrace_graph_stop();
127117
WARN_ON(1);
@@ -190,15 +180,6 @@ unsigned long ftrace_return_to_handler(unsigned long frame_pointer)
190180
*/
191181
barrier();
192182
current->curr_ret_stack--;
193-
/*
194-
* The curr_ret_stack can be less than -1 only if it was
195-
* filtered out and it's about to return from the function.
196-
* Recover the index and continue to trace normal functions.
197-
*/
198-
if (current->curr_ret_stack < -1) {
199-
current->curr_ret_stack += FTRACE_NOTRACE_DEPTH;
200-
return ret;
201-
}
202183

203184
if (unlikely(!ret)) {
204185
ftrace_graph_stop();

‎kernel/trace/trace_functions_graph.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
115115
if (ret != (unsigned long)return_to_handler)
116116
return ret;
117117

118-
if (index < -1)
119-
index += FTRACE_NOTRACE_DEPTH;
120-
121118
if (index < 0)
122119
return ret;
123120

@@ -675,10 +672,6 @@ print_graph_entry_leaf(struct trace_iterator *iter,
675672

676673
cpu_data = per_cpu_ptr(data->cpu_data, cpu);
677674

678-
/* If a graph tracer ignored set_graph_notrace */
679-
if (call->depth < -1)
680-
call->depth += FTRACE_NOTRACE_DEPTH;
681-
682675
/*
683676
* Comments display at + 1 to depth. Since
684677
* this is a leaf function, keep the comments
@@ -721,10 +714,6 @@ print_graph_entry_nested(struct trace_iterator *iter,
721714
struct fgraph_cpu_data *cpu_data;
722715
int cpu = iter->cpu;
723716

724-
/* If a graph tracer ignored set_graph_notrace */
725-
if (call->depth < -1)
726-
call->depth += FTRACE_NOTRACE_DEPTH;
727-
728717
cpu_data = per_cpu_ptr(data->cpu_data, cpu);
729718
cpu_data->depth = call->depth;
730719

0 commit comments

Comments
 (0)