aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace_event.h1
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/trace/ftrace.h35
-rw-r--r--kernel/trace/trace_events.c14
4 files changed, 21 insertions, 33 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 38f8d6553831..ea44b8911094 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -158,6 +158,7 @@ enum {
158 FILTER_PTR_STRING, 158 FILTER_PTR_STRING,
159}; 159};
160 160
161extern int trace_event_raw_init(struct ftrace_event_call *call);
161extern int trace_define_common_fields(struct ftrace_event_call *call); 162extern int trace_define_common_fields(struct ftrace_event_call *call);
162extern int trace_define_field(struct ftrace_event_call *call, const char *type, 163extern int trace_define_field(struct ftrace_event_call *call, const char *type,
163 const char *name, int offset, int size, 164 const char *name, int offset, int size,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index bc70c5810fec..94ac28437bef 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -145,7 +145,7 @@ struct perf_event_attr;
145 .name = "sys_enter"#sname, \ 145 .name = "sys_enter"#sname, \
146 .system = "syscalls", \ 146 .system = "syscalls", \
147 .event = &enter_syscall_print_##sname, \ 147 .event = &enter_syscall_print_##sname, \
148 .raw_init = init_syscall_trace, \ 148 .raw_init = trace_event_raw_init, \
149 .show_format = syscall_enter_format, \ 149 .show_format = syscall_enter_format, \
150 .define_fields = syscall_enter_define_fields, \ 150 .define_fields = syscall_enter_define_fields, \
151 .regfunc = reg_event_syscall_enter, \ 151 .regfunc = reg_event_syscall_enter, \
@@ -167,7 +167,7 @@ struct perf_event_attr;
167 .name = "sys_exit"#sname, \ 167 .name = "sys_exit"#sname, \
168 .system = "syscalls", \ 168 .system = "syscalls", \
169 .event = &exit_syscall_print_##sname, \ 169 .event = &exit_syscall_print_##sname, \
170 .raw_init = init_syscall_trace, \ 170 .raw_init = trace_event_raw_init, \
171 .show_format = syscall_exit_format, \ 171 .show_format = syscall_exit_format, \
172 .define_fields = syscall_exit_define_fields, \ 172 .define_fields = syscall_exit_define_fields, \
173 .regfunc = reg_event_syscall_exit, \ 173 .regfunc = reg_event_syscall_exit, \
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c4eca380204e..6055b0604c86 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -623,23 +623,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
623 * .trace = ftrace_raw_output_<call>, <-- stage 2 623 * .trace = ftrace_raw_output_<call>, <-- stage 2
624 * }; 624 * };
625 * 625 *
626 * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused)
627 * {
628 * int id;
629 *
630 * id = register_ftrace_event(&ftrace_event_type_<call>);
631 * if (!id)
632 * return -ENODEV;
633 * event_<call>.id = id;
634 * return 0;
635 * }
636 *
637 * static struct ftrace_event_call __used 626 * static struct ftrace_event_call __used
638 * __attribute__((__aligned__(4))) 627 * __attribute__((__aligned__(4)))
639 * __attribute__((section("_ftrace_events"))) event_<call> = { 628 * __attribute__((section("_ftrace_events"))) event_<call> = {
640 * .name = "<call>", 629 * .name = "<call>",
641 * .system = "<system>", 630 * .system = "<system>",
642 * .raw_init = ftrace_raw_init_event_<call>, 631 * .raw_init = trace_event_raw_init,
643 * .regfunc = ftrace_reg_event_<call>, 632 * .regfunc = ftrace_reg_event_<call>,
644 * .unregfunc = ftrace_unreg_event_<call>, 633 * .unregfunc = ftrace_unreg_event_<call>,
645 * .show_format = ftrace_format_<call>, 634 * .show_format = ftrace_format_<call>,
@@ -647,9 +636,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
647 * 636 *
648 */ 637 */
649 638
650#undef TP_FMT
651#define TP_FMT(fmt, args...) fmt "\n", ##args
652
653#ifdef CONFIG_EVENT_PROFILE 639#ifdef CONFIG_EVENT_PROFILE
654 640
655#define _TRACE_PROFILE_INIT(call) \ 641#define _TRACE_PROFILE_INIT(call) \
@@ -744,19 +730,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
744 \ 730 \
745static struct trace_event ftrace_event_type_##call = { \ 731static struct trace_event ftrace_event_type_##call = { \
746 .trace = ftrace_raw_output_##call, \ 732 .trace = ftrace_raw_output_##call, \
747}; \ 733};
748 \
749static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\
750{ \
751 int id; \
752 \
753 id = register_ftrace_event(&ftrace_event_type_##call); \
754 if (!id) \
755 return -ENODEV; \
756 event_##call.id = id; \
757 INIT_LIST_HEAD(&event_##call.fields); \
758 return 0; \
759}
760 734
761#undef DEFINE_EVENT_PRINT 735#undef DEFINE_EVENT_PRINT
762#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 736#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
@@ -776,7 +750,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
776 .name = #call, \ 750 .name = #call, \
777 .system = __stringify(TRACE_SYSTEM), \ 751 .system = __stringify(TRACE_SYSTEM), \
778 .event = &ftrace_event_type_##call, \ 752 .event = &ftrace_event_type_##call, \
779 .raw_init = ftrace_raw_init_event_##call, \ 753 .raw_init = trace_event_raw_init, \
780 .regfunc = ftrace_raw_reg_event_##call, \ 754 .regfunc = ftrace_raw_reg_event_##call, \
781 .unregfunc = ftrace_raw_unreg_event_##call, \ 755 .unregfunc = ftrace_raw_unreg_event_##call, \
782 .show_format = ftrace_format_##template, \ 756 .show_format = ftrace_format_##template, \
@@ -793,7 +767,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
793 .name = #call, \ 767 .name = #call, \
794 .system = __stringify(TRACE_SYSTEM), \ 768 .system = __stringify(TRACE_SYSTEM), \
795 .event = &ftrace_event_type_##call, \ 769 .event = &ftrace_event_type_##call, \
796 .raw_init = ftrace_raw_init_event_##call, \ 770 .raw_init = trace_event_raw_init, \
797 .regfunc = ftrace_raw_reg_event_##call, \ 771 .regfunc = ftrace_raw_reg_event_##call, \
798 .unregfunc = ftrace_raw_unreg_event_##call, \ 772 .unregfunc = ftrace_raw_unreg_event_##call, \
799 .show_format = ftrace_format_##call, \ 773 .show_format = ftrace_format_##call, \
@@ -953,7 +927,6 @@ end: \
953 perf_swevent_put_recursion_context(rctx); \ 927 perf_swevent_put_recursion_context(rctx); \
954end_recursion: \ 928end_recursion: \
955 local_irq_restore(irq_flags); \ 929 local_irq_restore(irq_flags); \
956 \
957} 930}
958 931
959#undef DEFINE_EVENT 932#undef DEFINE_EVENT
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 1d18315dc836..8ed66e0d476b 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -105,6 +105,20 @@ void trace_destroy_fields(struct ftrace_event_call *call)
105 } 105 }
106} 106}
107 107
108int trace_event_raw_init(struct ftrace_event_call *call)
109{
110 int id;
111
112 id = register_ftrace_event(call->event);
113 if (!id)
114 return -ENODEV;
115 call->id = id;
116 INIT_LIST_HEAD(&call->fields);
117
118 return 0;
119}
120EXPORT_SYMBOL_GPL(trace_event_raw_init);
121
108static void ftrace_event_enable_disable(struct ftrace_event_call *call, 122static void ftrace_event_enable_disable(struct ftrace_event_call *call,
109 int enable) 123 int enable)
110{ 124{