diff options
-rw-r--r-- | kernel/trace/trace_functions.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 8c30ca733a5c..a3bddbfd0874 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -375,12 +375,23 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, | |||
375 | */ | 375 | */ |
376 | #define STACK_SKIP 4 | 376 | #define STACK_SKIP 4 |
377 | 377 | ||
378 | static __always_inline void trace_stack(struct trace_array *tr) | ||
379 | { | ||
380 | unsigned long flags; | ||
381 | int pc; | ||
382 | |||
383 | local_save_flags(flags); | ||
384 | pc = preempt_count(); | ||
385 | |||
386 | __trace_stack(tr, flags, STACK_SKIP, pc); | ||
387 | } | ||
388 | |||
378 | static void | 389 | static void |
379 | ftrace_stacktrace(unsigned long ip, unsigned long parent_ip, | 390 | ftrace_stacktrace(unsigned long ip, unsigned long parent_ip, |
380 | struct trace_array *tr, struct ftrace_probe_ops *ops, | 391 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
381 | void *data) | 392 | void *data) |
382 | { | 393 | { |
383 | trace_dump_stack(STACK_SKIP); | 394 | trace_stack(tr); |
384 | } | 395 | } |
385 | 396 | ||
386 | static void | 397 | static void |
@@ -398,7 +409,7 @@ ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip, | |||
398 | 409 | ||
399 | /* unlimited? */ | 410 | /* unlimited? */ |
400 | if (!mapper) { | 411 | if (!mapper) { |
401 | trace_dump_stack(STACK_SKIP); | 412 | trace_stack(tr); |
402 | return; | 413 | return; |
403 | } | 414 | } |
404 | 415 | ||
@@ -417,7 +428,7 @@ ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip, | |||
417 | new_count = old_count - 1; | 428 | new_count = old_count - 1; |
418 | new_count = cmpxchg(count, old_count, new_count); | 429 | new_count = cmpxchg(count, old_count, new_count); |
419 | if (new_count == old_count) | 430 | if (new_count == old_count) |
420 | trace_dump_stack(STACK_SKIP); | 431 | trace_stack(tr); |
421 | 432 | ||
422 | if (!tracing_is_on()) | 433 | if (!tracing_is_on()) |
423 | return; | 434 | return; |