diff options
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r-- | include/trace/ftrace.h | 60 |
1 files changed, 12 insertions, 48 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index f23a0ca6910a..0804cd594803 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -376,7 +376,7 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
376 | 376 | ||
377 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 377 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
378 | 378 | ||
379 | #ifdef CONFIG_EVENT_PROFILE | 379 | #ifdef CONFIG_PERF_EVENTS |
380 | 380 | ||
381 | /* | 381 | /* |
382 | * Generate the functions needed for tracepoint perf_event support. | 382 | * Generate the functions needed for tracepoint perf_event support. |
@@ -421,7 +421,7 @@ ftrace_profile_disable_##name(struct ftrace_event_call *unused) \ | |||
421 | 421 | ||
422 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 422 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
423 | 423 | ||
424 | #endif | 424 | #endif /* CONFIG_PERF_EVENTS */ |
425 | 425 | ||
426 | /* | 426 | /* |
427 | * Stage 4 of the trace events. | 427 | * Stage 4 of the trace events. |
@@ -505,7 +505,7 @@ ftrace_profile_disable_##name(struct ftrace_event_call *unused) \ | |||
505 | * | 505 | * |
506 | */ | 506 | */ |
507 | 507 | ||
508 | #ifdef CONFIG_EVENT_PROFILE | 508 | #ifdef CONFIG_PERF_EVENTS |
509 | 509 | ||
510 | #define _TRACE_PROFILE_INIT(call) \ | 510 | #define _TRACE_PROFILE_INIT(call) \ |
511 | .profile_enable = ftrace_profile_enable_##call, \ | 511 | .profile_enable = ftrace_profile_enable_##call, \ |
@@ -513,7 +513,7 @@ ftrace_profile_disable_##name(struct ftrace_event_call *unused) \ | |||
513 | 513 | ||
514 | #else | 514 | #else |
515 | #define _TRACE_PROFILE_INIT(call) | 515 | #define _TRACE_PROFILE_INIT(call) |
516 | #endif | 516 | #endif /* CONFIG_PERF_EVENTS */ |
517 | 517 | ||
518 | #undef __entry | 518 | #undef __entry |
519 | #define __entry entry | 519 | #define __entry entry |
@@ -736,7 +736,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
736 | * } | 736 | * } |
737 | */ | 737 | */ |
738 | 738 | ||
739 | #ifdef CONFIG_EVENT_PROFILE | 739 | #ifdef CONFIG_PERF_EVENTS |
740 | 740 | ||
741 | #undef __entry | 741 | #undef __entry |
742 | #define __entry entry | 742 | #define __entry entry |
@@ -761,22 +761,12 @@ ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \ | |||
761 | proto) \ | 761 | proto) \ |
762 | { \ | 762 | { \ |
763 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 763 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
764 | extern int perf_swevent_get_recursion_context(void); \ | ||
765 | extern void perf_swevent_put_recursion_context(int rctx); \ | ||
766 | extern void perf_tp_event(int, u64, u64, void *, int); \ | ||
767 | struct ftrace_raw_##call *entry; \ | 764 | struct ftrace_raw_##call *entry; \ |
768 | u64 __addr = 0, __count = 1; \ | 765 | u64 __addr = 0, __count = 1; \ |
769 | unsigned long irq_flags; \ | 766 | unsigned long irq_flags; \ |
770 | struct trace_entry *ent; \ | ||
771 | int __entry_size; \ | 767 | int __entry_size; \ |
772 | int __data_size; \ | 768 | int __data_size; \ |
773 | char *trace_buf; \ | ||
774 | char *raw_data; \ | ||
775 | int __cpu; \ | ||
776 | int rctx; \ | 769 | int rctx; \ |
777 | int pc; \ | ||
778 | \ | ||
779 | pc = preempt_count(); \ | ||
780 | \ | 770 | \ |
781 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ | 771 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
782 | __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ | 772 | __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ |
@@ -786,42 +776,16 @@ ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \ | |||
786 | if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \ | 776 | if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \ |
787 | "profile buffer not large enough")) \ | 777 | "profile buffer not large enough")) \ |
788 | return; \ | 778 | return; \ |
789 | \ | 779 | entry = (struct ftrace_raw_##call *)ftrace_perf_buf_prepare( \ |
790 | local_irq_save(irq_flags); \ | 780 | __entry_size, event_call->id, &rctx, &irq_flags); \ |
791 | \ | 781 | if (!entry) \ |
792 | rctx = perf_swevent_get_recursion_context(); \ | 782 | return; \ |
793 | if (rctx < 0) \ | ||
794 | goto end_recursion; \ | ||
795 | \ | ||
796 | __cpu = smp_processor_id(); \ | ||
797 | \ | ||
798 | if (in_nmi()) \ | ||
799 | trace_buf = rcu_dereference(perf_trace_buf_nmi); \ | ||
800 | else \ | ||
801 | trace_buf = rcu_dereference(perf_trace_buf); \ | ||
802 | \ | ||
803 | if (!trace_buf) \ | ||
804 | goto end; \ | ||
805 | \ | ||
806 | raw_data = per_cpu_ptr(trace_buf, __cpu); \ | ||
807 | \ | ||
808 | *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ | ||
809 | entry = (struct ftrace_raw_##call *)raw_data; \ | ||
810 | ent = &entry->ent; \ | ||
811 | tracing_generic_entry_update(ent, irq_flags, pc); \ | ||
812 | ent->type = event_call->id; \ | ||
813 | \ | ||
814 | tstruct \ | 783 | tstruct \ |
815 | \ | 784 | \ |
816 | { assign; } \ | 785 | { assign; } \ |
817 | \ | 786 | \ |
818 | perf_tp_event(event_call->id, __addr, __count, entry, \ | 787 | ftrace_perf_buf_submit(entry, __entry_size, rctx, __addr, \ |
819 | __entry_size); \ | 788 | __count, irq_flags); \ |
820 | \ | ||
821 | end: \ | ||
822 | perf_swevent_put_recursion_context(rctx); \ | ||
823 | end_recursion: \ | ||
824 | local_irq_restore(irq_flags); \ | ||
825 | } | 789 | } |
826 | 790 | ||
827 | #undef DEFINE_EVENT | 791 | #undef DEFINE_EVENT |
@@ -838,7 +802,7 @@ static notrace void ftrace_profile_##call(proto) \ | |||
838 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | 802 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
839 | 803 | ||
840 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 804 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
841 | #endif /* CONFIG_EVENT_PROFILE */ | 805 | #endif /* CONFIG_PERF_EVENTS */ |
842 | 806 | ||
843 | #undef _TRACE_PROFILE_INIT | 807 | #undef _TRACE_PROFILE_INIT |
844 | 808 | ||