aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-11-18 18:36:19 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-08 20:54:07 -0500
commit76b42b63ed0d004961097d3a3cd979129d4afd26 (patch)
tree03c9c59eccb1b829441e139a13ba3b73f284f99d /kernel/trace/trace_functions_graph.c
parent688f7089d8851b1a81106f0c0b9b29181b2f2dc8 (diff)
function_graph: Move ftrace_graph_ret_addr() to fgraph.c
Move the function function_graph_ret_addr() to fgraph.c, as the management of the curr_ret_stack is going to change, and all the accesses to ret_stack needs to be done in fgraph.c. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 140b4b51ab34..c2af1560e856 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -94,61 +94,6 @@ static void
94print_graph_duration(struct trace_array *tr, unsigned long long duration, 94print_graph_duration(struct trace_array *tr, unsigned long long duration,
95 struct trace_seq *s, u32 flags); 95 struct trace_seq *s, u32 flags);
96 96
97/**
98 * ftrace_graph_ret_addr - convert a potentially modified stack return address
99 * to its original value
100 *
101 * This function can be called by stack unwinding code to convert a found stack
102 * return address ('ret') to its original value, in case the function graph
103 * tracer has modified it to be 'return_to_handler'. If the address hasn't
104 * been modified, the unchanged value of 'ret' is returned.
105 *
106 * 'idx' is a state variable which should be initialized by the caller to zero
107 * before the first call.
108 *
109 * 'retp' is a pointer to the return address on the stack. It's ignored if
110 * the arch doesn't have HAVE_FUNCTION_GRAPH_RET_ADDR_PTR defined.
111 */
112#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
113unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
114 unsigned long ret, unsigned long *retp)
115{
116 int index = task->curr_ret_stack;
117 int i;
118
119 if (ret != (unsigned long)return_to_handler)
120 return ret;
121
122 if (index < 0)
123 return ret;
124
125 for (i = 0; i <= index; i++)
126 if (task->ret_stack[i].retp == retp)
127 return task->ret_stack[i].ret;
128
129 return ret;
130}
131#else /* !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
132unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
133 unsigned long ret, unsigned long *retp)
134{
135 int task_idx;
136
137 if (ret != (unsigned long)return_to_handler)
138 return ret;
139
140 task_idx = task->curr_ret_stack;
141
142 if (!task->ret_stack || task_idx < *idx)
143 return ret;
144
145 task_idx -= *idx;
146 (*idx)++;
147
148 return task->ret_stack[task_idx].ret;
149}
150#endif /* HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */
151
152int __trace_graph_entry(struct trace_array *tr, 97int __trace_graph_entry(struct trace_array *tr,
153 struct ftrace_graph_ent *trace, 98 struct ftrace_graph_ent *trace,
154 unsigned long flags, 99 unsigned long flags,