aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-21 12:27:06 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:19:14 -0400
commit2239291aeb0379fe47980b0e560e0eb9fd7e82ec (patch)
treee75bb60ec24e6fd7137f01db48e0ea7e5b1eddd4 /include/linux
parent38516ab59fbc5b3bb278cf5e1fe2867c70cff32e (diff)
tracing: Remove per event trace registering
This patch removes the register functions of TRACE_EVENT() to enable and disable tracepoints. The registering of a event is now down directly in the trace_events.c file. The tracepoint_probe_register() is now called directly. The prototypes are no longer type checked, but this should not be an issue since the tracepoints are created automatically by the macros. If a prototype is incorrect in the TRACE_EVENT() macro, then other macros will catch it. The trace_event_class structure now holds the probes to be called by the callbacks. This removes needing to have each event have a separate pointer for the probe. To handle kprobes and syscalls, since they register probes in a different manner, a "reg" field is added to the ftrace_event_class structure. If the "reg" field is assigned, then it will be called for enabling and disabling of the probe for either ftrace or perf. To let the reg function know what is happening, a new enum (trace_reg) is created that has the type of control that is needed. With this new rework, the 82 kernel events and 618 syscall events has their footprint dramatically lowered: text data bss dec hex filename 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4914025 1088868 861512 6864405 68be15 vmlinux.class 4918492 1084612 861512 6864616 68bee8 vmlinux.tracepoint 4900252 1057412 861512 6819176 680d68 vmlinux.regs The size went from 6863829 to 6819176, that's a total of 44K in savings. With tracepoints being continuously added, this is critical that the footprint becomes minimal. v5: Added #ifdef CONFIG_PERF_EVENTS around a reference to perf specific structure in trace_events.c. v4: Fixed trace self tests to check probe because regfunc no longer exists. v3: Updated to handle void *data in beginning of probe parameters. Also added the tracepoint: check_trace_callback_type_##call(). v2: Changed the callback probes to pass void * and typecast the value within the function. Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ftrace_event.h19
-rw-r--r--include/linux/syscalls.h29
2 files changed, 19 insertions, 29 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 496eea898ee4..e665ed38b4bf 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -113,8 +113,23 @@ void tracing_record_cmdline(struct task_struct *tsk);
113 113
114struct event_filter; 114struct event_filter;
115 115
116enum trace_reg {
117 TRACE_REG_REGISTER,
118 TRACE_REG_UNREGISTER,
119 TRACE_REG_PERF_REGISTER,
120 TRACE_REG_PERF_UNREGISTER,
121};
122
123struct ftrace_event_call;
124
116struct ftrace_event_class { 125struct ftrace_event_class {
117 char *system; 126 char *system;
127 void *probe;
128#ifdef CONFIG_PERF_EVENTS
129 void *perf_probe;
130#endif
131 int (*reg)(struct ftrace_event_call *event,
132 enum trace_reg type);
118}; 133};
119 134
120struct ftrace_event_call { 135struct ftrace_event_call {
@@ -124,8 +139,6 @@ struct ftrace_event_call {
124 struct dentry *dir; 139 struct dentry *dir;
125 struct trace_event *event; 140 struct trace_event *event;
126 int enabled; 141 int enabled;
127 int (*regfunc)(struct ftrace_event_call *);
128 void (*unregfunc)(struct ftrace_event_call *);
129 int id; 142 int id;
130 const char *print_fmt; 143 const char *print_fmt;
131 int (*raw_init)(struct ftrace_event_call *); 144 int (*raw_init)(struct ftrace_event_call *);
@@ -137,8 +150,6 @@ struct ftrace_event_call {
137 void *data; 150 void *data;
138 151
139 int perf_refcount; 152 int perf_refcount;
140 int (*perf_event_enable)(struct ftrace_event_call *);
141 void (*perf_event_disable)(struct ftrace_event_call *);
142}; 153};
143 154
144#define PERF_MAX_TRACE_SIZE 2048 155#define PERF_MAX_TRACE_SIZE 2048
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index ac5791df2506..e3348c4c22e8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -103,22 +103,6 @@ struct perf_event_attr;
103#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 103#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
104#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 104#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
105 105
106#ifdef CONFIG_PERF_EVENTS
107
108#define TRACE_SYS_ENTER_PERF_INIT(sname) \
109 .perf_event_enable = perf_sysenter_enable, \
110 .perf_event_disable = perf_sysenter_disable,
111
112#define TRACE_SYS_EXIT_PERF_INIT(sname) \
113 .perf_event_enable = perf_sysexit_enable, \
114 .perf_event_disable = perf_sysexit_disable,
115#else
116#define TRACE_SYS_ENTER_PERF(sname)
117#define TRACE_SYS_ENTER_PERF_INIT(sname)
118#define TRACE_SYS_EXIT_PERF(sname)
119#define TRACE_SYS_EXIT_PERF_INIT(sname)
120#endif /* CONFIG_PERF_EVENTS */
121
122#ifdef CONFIG_FTRACE_SYSCALLS 106#ifdef CONFIG_FTRACE_SYSCALLS
123#define __SC_STR_ADECL1(t, a) #a 107#define __SC_STR_ADECL1(t, a) #a
124#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 108#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
@@ -134,7 +118,8 @@ struct perf_event_attr;
134#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) 118#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
135#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 119#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
136 120
137extern struct ftrace_event_class event_class_syscalls; 121extern struct ftrace_event_class event_class_syscall_enter;
122extern struct ftrace_event_class event_class_syscall_exit;
138 123
139#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 124#define SYSCALL_TRACE_ENTER_EVENT(sname) \
140 static const struct syscall_metadata __syscall_meta_##sname; \ 125 static const struct syscall_metadata __syscall_meta_##sname; \
@@ -148,14 +133,11 @@ extern struct ftrace_event_class event_class_syscalls;
148 __attribute__((section("_ftrace_events"))) \ 133 __attribute__((section("_ftrace_events"))) \
149 event_enter_##sname = { \ 134 event_enter_##sname = { \
150 .name = "sys_enter"#sname, \ 135 .name = "sys_enter"#sname, \
151 .class = &event_class_syscalls, \ 136 .class = &event_class_syscall_enter, \
152 .event = &enter_syscall_print_##sname, \ 137 .event = &enter_syscall_print_##sname, \
153 .raw_init = init_syscall_trace, \ 138 .raw_init = init_syscall_trace, \
154 .define_fields = syscall_enter_define_fields, \ 139 .define_fields = syscall_enter_define_fields, \
155 .regfunc = reg_event_syscall_enter, \
156 .unregfunc = unreg_event_syscall_enter, \
157 .data = (void *)&__syscall_meta_##sname,\ 140 .data = (void *)&__syscall_meta_##sname,\
158 TRACE_SYS_ENTER_PERF_INIT(sname) \
159 } 141 }
160 142
161#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 143#define SYSCALL_TRACE_EXIT_EVENT(sname) \
@@ -170,14 +152,11 @@ extern struct ftrace_event_class event_class_syscalls;
170 __attribute__((section("_ftrace_events"))) \ 152 __attribute__((section("_ftrace_events"))) \
171 event_exit_##sname = { \ 153 event_exit_##sname = { \
172 .name = "sys_exit"#sname, \ 154 .name = "sys_exit"#sname, \
173 .class = &event_class_syscalls, \ 155 .class = &event_class_syscall_exit, \
174 .event = &exit_syscall_print_##sname, \ 156 .event = &exit_syscall_print_##sname, \
175 .raw_init = init_syscall_trace, \ 157 .raw_init = init_syscall_trace, \
176 .define_fields = syscall_exit_define_fields, \ 158 .define_fields = syscall_exit_define_fields, \
177 .regfunc = reg_event_syscall_exit, \
178 .unregfunc = unreg_event_syscall_exit, \
179 .data = (void *)&__syscall_meta_##sname,\ 159 .data = (void *)&__syscall_meta_##sname,\
180 TRACE_SYS_EXIT_PERF_INIT(sname) \
181 } 160 }
182 161
183#define SYSCALL_METADATA(sname, nb) \ 162#define SYSCALL_METADATA(sname, nb) \