diff options
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index b1342c5d37c..616b135c9eb 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -212,13 +212,11 @@ int trace_graph_entry(struct ftrace_graph_ent *trace) | |||
212 | int cpu; | 212 | int cpu; |
213 | int pc; | 213 | int pc; |
214 | 214 | ||
215 | if (unlikely(!tr)) | ||
216 | return 0; | ||
217 | |||
218 | if (!ftrace_trace_task(current)) | 215 | if (!ftrace_trace_task(current)) |
219 | return 0; | 216 | return 0; |
220 | 217 | ||
221 | if (!ftrace_graph_addr(trace->func)) | 218 | /* trace it when it is-nested-in or is a function enabled. */ |
219 | if (!(trace->depth || ftrace_graph_addr(trace->func))) | ||
222 | return 0; | 220 | return 0; |
223 | 221 | ||
224 | local_irq_save(flags); | 222 | local_irq_save(flags); |
@@ -231,9 +229,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace) | |||
231 | } else { | 229 | } else { |
232 | ret = 0; | 230 | ret = 0; |
233 | } | 231 | } |
234 | /* Only do the atomic if it is not already set */ | ||
235 | if (!test_tsk_trace_graph(current)) | ||
236 | set_tsk_trace_graph(current); | ||
237 | 232 | ||
238 | atomic_dec(&data->disabled); | 233 | atomic_dec(&data->disabled); |
239 | local_irq_restore(flags); | 234 | local_irq_restore(flags); |
@@ -281,17 +276,24 @@ void trace_graph_return(struct ftrace_graph_ret *trace) | |||
281 | pc = preempt_count(); | 276 | pc = preempt_count(); |
282 | __trace_graph_return(tr, trace, flags, pc); | 277 | __trace_graph_return(tr, trace, flags, pc); |
283 | } | 278 | } |
284 | if (!trace->depth) | ||
285 | clear_tsk_trace_graph(current); | ||
286 | atomic_dec(&data->disabled); | 279 | atomic_dec(&data->disabled); |
287 | local_irq_restore(flags); | 280 | local_irq_restore(flags); |
288 | } | 281 | } |
289 | 282 | ||
283 | void set_graph_array(struct trace_array *tr) | ||
284 | { | ||
285 | graph_array = tr; | ||
286 | |||
287 | /* Make graph_array visible before we start tracing */ | ||
288 | |||
289 | smp_mb(); | ||
290 | } | ||
291 | |||
290 | static int graph_trace_init(struct trace_array *tr) | 292 | static int graph_trace_init(struct trace_array *tr) |
291 | { | 293 | { |
292 | int ret; | 294 | int ret; |
293 | 295 | ||
294 | graph_array = tr; | 296 | set_graph_array(tr); |
295 | ret = register_ftrace_graph(&trace_graph_return, | 297 | ret = register_ftrace_graph(&trace_graph_return, |
296 | &trace_graph_entry); | 298 | &trace_graph_entry); |
297 | if (ret) | 299 | if (ret) |
@@ -301,11 +303,6 @@ static int graph_trace_init(struct trace_array *tr) | |||
301 | return 0; | 303 | return 0; |
302 | } | 304 | } |
303 | 305 | ||
304 | void set_graph_array(struct trace_array *tr) | ||
305 | { | ||
306 | graph_array = tr; | ||
307 | } | ||
308 | |||
309 | static void graph_trace_reset(struct trace_array *tr) | 306 | static void graph_trace_reset(struct trace_array *tr) |
310 | { | 307 | { |
311 | tracing_stop_cmdline_record(); | 308 | tracing_stop_cmdline_record(); |