diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-04-22 11:46:44 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-14 14:20:30 -0400 |
commit | 0405ab80aa94afb13bf9ac4a6fc9f2923d4b9114 (patch) | |
tree | 43eedc09bb15ecfda26adb661d59badeacea0de6 | |
parent | 2e33af029556cb8bd22bf4f86f42d540249177ea (diff) |
tracing: Move raw_init from events to class
The raw_init function pointer in the event is used to initialize
various kinds of events. The type of initialization needed is usually
classed to the kind of event it is.
Two events with the same class will always have the same initialization
function, so it makes sense to move this to the class structure.
Perhaps even making a special system structure would work since
the initialization is the same for all events within a system.
But since there's no system structure (yet), this will just move it
to the class.
text data bss dec hex filename
4913961 1088356 861512 6863829 68bbd5 vmlinux.orig
4900375 1053380 861512 6815267 67fe23 vmlinux.fields
4900382 1048964 861512 6810858 67ecea vmlinux.init
The text grew very slightly, but this is a constant growth that happened
with the changing of the C files that call the init code.
The bigger savings is the data which will be saved the more events share
a class.
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>
-rw-r--r-- | include/linux/ftrace_event.h | 2 | ||||
-rw-r--r-- | include/linux/syscalls.h | 2 | ||||
-rw-r--r-- | include/trace/ftrace.h | 9 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 12 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_kprobe.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 2 |
7 files changed, 17 insertions, 18 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 479c3c1876e6..393a8394df0e 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -133,6 +133,7 @@ struct ftrace_event_class { | |||
133 | int (*define_fields)(struct ftrace_event_call *); | 133 | int (*define_fields)(struct ftrace_event_call *); |
134 | struct list_head *(*get_fields)(struct ftrace_event_call *); | 134 | struct list_head *(*get_fields)(struct ftrace_event_call *); |
135 | struct list_head fields; | 135 | struct list_head fields; |
136 | int (*raw_init)(struct ftrace_event_call *); | ||
136 | }; | 137 | }; |
137 | 138 | ||
138 | struct ftrace_event_call { | 139 | struct ftrace_event_call { |
@@ -144,7 +145,6 @@ struct ftrace_event_call { | |||
144 | int enabled; | 145 | int enabled; |
145 | int id; | 146 | int id; |
146 | const char *print_fmt; | 147 | const char *print_fmt; |
147 | int (*raw_init)(struct ftrace_event_call *); | ||
148 | int filter_active; | 148 | int filter_active; |
149 | struct event_filter *filter; | 149 | struct event_filter *filter; |
150 | void *mod; | 150 | void *mod; |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fd0f1f248cd8..211c704a71ed 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -135,7 +135,6 @@ extern struct ftrace_event_class event_class_syscall_exit; | |||
135 | .name = "sys_enter"#sname, \ | 135 | .name = "sys_enter"#sname, \ |
136 | .class = &event_class_syscall_enter, \ | 136 | .class = &event_class_syscall_enter, \ |
137 | .event = &enter_syscall_print_##sname, \ | 137 | .event = &enter_syscall_print_##sname, \ |
138 | .raw_init = init_syscall_trace, \ | ||
139 | .data = (void *)&__syscall_meta_##sname,\ | 138 | .data = (void *)&__syscall_meta_##sname,\ |
140 | } | 139 | } |
141 | 140 | ||
@@ -153,7 +152,6 @@ extern struct ftrace_event_class event_class_syscall_exit; | |||
153 | .name = "sys_exit"#sname, \ | 152 | .name = "sys_exit"#sname, \ |
154 | .class = &event_class_syscall_exit, \ | 153 | .class = &event_class_syscall_exit, \ |
155 | .event = &exit_syscall_print_##sname, \ | 154 | .event = &exit_syscall_print_##sname, \ |
156 | .raw_init = init_syscall_trace, \ | ||
157 | .data = (void *)&__syscall_meta_##sname,\ | 155 | .data = (void *)&__syscall_meta_##sname,\ |
158 | } | 156 | } |
159 | 157 | ||
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index c7e3bcd5d52f..e7eb33420b06 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -431,8 +431,9 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
431 | * static struct ftrace_event_class __used event_class_<template> = { | 431 | * static struct ftrace_event_class __used event_class_<template> = { |
432 | * .system = "<system>", | 432 | * .system = "<system>", |
433 | * .define_fields = ftrace_define_fields_<call>, | 433 | * .define_fields = ftrace_define_fields_<call>, |
434 | * .fields = LIST_HEAD_INIT(event_class_##call.fields), \ | 434 | * .fields = LIST_HEAD_INIT(event_class_##call.fields), |
435 | * .probe = ftrace_raw_event_##call, \ | 435 | * .raw_init = trace_event_raw_init, |
436 | * .probe = ftrace_raw_event_##call, | ||
436 | * }; | 437 | * }; |
437 | * | 438 | * |
438 | * static struct ftrace_event_call __used | 439 | * static struct ftrace_event_call __used |
@@ -440,7 +441,6 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
440 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 441 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
441 | * .name = "<call>", | 442 | * .name = "<call>", |
442 | * .class = event_class_<template>, | 443 | * .class = event_class_<template>, |
443 | * .raw_init = trace_event_raw_init, | ||
444 | * .event = &ftrace_event_type_<call>, | 444 | * .event = &ftrace_event_type_<call>, |
445 | * .print_fmt = print_fmt_<call>, | 445 | * .print_fmt = print_fmt_<call>, |
446 | * }; | 446 | * }; |
@@ -566,6 +566,7 @@ static struct ftrace_event_class __used event_class_##call = { \ | |||
566 | .system = __stringify(TRACE_SYSTEM), \ | 566 | .system = __stringify(TRACE_SYSTEM), \ |
567 | .define_fields = ftrace_define_fields_##call, \ | 567 | .define_fields = ftrace_define_fields_##call, \ |
568 | .fields = LIST_HEAD_INIT(event_class_##call.fields),\ | 568 | .fields = LIST_HEAD_INIT(event_class_##call.fields),\ |
569 | .raw_init = trace_event_raw_init, \ | ||
569 | .probe = ftrace_raw_event_##call, \ | 570 | .probe = ftrace_raw_event_##call, \ |
570 | _TRACE_PERF_INIT(call) \ | 571 | _TRACE_PERF_INIT(call) \ |
571 | }; | 572 | }; |
@@ -579,7 +580,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
579 | .name = #call, \ | 580 | .name = #call, \ |
580 | .class = &event_class_##template, \ | 581 | .class = &event_class_##template, \ |
581 | .event = &ftrace_event_type_##call, \ | 582 | .event = &ftrace_event_type_##call, \ |
582 | .raw_init = trace_event_raw_init, \ | ||
583 | .print_fmt = print_fmt_##template, \ | 583 | .print_fmt = print_fmt_##template, \ |
584 | }; | 584 | }; |
585 | 585 | ||
@@ -594,7 +594,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
594 | .name = #call, \ | 594 | .name = #call, \ |
595 | .class = &event_class_##template, \ | 595 | .class = &event_class_##template, \ |
596 | .event = &ftrace_event_type_##call, \ | 596 | .event = &ftrace_event_type_##call, \ |
597 | .raw_init = trace_event_raw_init, \ | ||
598 | .print_fmt = print_fmt_##call, \ | 597 | .print_fmt = print_fmt_##call, \ |
599 | } | 598 | } |
600 | 599 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index acc0f55742c3..8e94255a45e7 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -1008,8 +1008,8 @@ static int __trace_add_event_call(struct ftrace_event_call *call) | |||
1008 | if (!call->name) | 1008 | if (!call->name) |
1009 | return -EINVAL; | 1009 | return -EINVAL; |
1010 | 1010 | ||
1011 | if (call->raw_init) { | 1011 | if (call->class->raw_init) { |
1012 | ret = call->raw_init(call); | 1012 | ret = call->class->raw_init(call); |
1013 | if (ret < 0) { | 1013 | if (ret < 0) { |
1014 | if (ret != -ENOSYS) | 1014 | if (ret != -ENOSYS) |
1015 | pr_warning("Could not initialize trace " | 1015 | pr_warning("Could not initialize trace " |
@@ -1170,8 +1170,8 @@ static void trace_module_add_events(struct module *mod) | |||
1170 | /* The linker may leave blanks */ | 1170 | /* The linker may leave blanks */ |
1171 | if (!call->name) | 1171 | if (!call->name) |
1172 | continue; | 1172 | continue; |
1173 | if (call->raw_init) { | 1173 | if (call->class->raw_init) { |
1174 | ret = call->raw_init(call); | 1174 | ret = call->class->raw_init(call); |
1175 | if (ret < 0) { | 1175 | if (ret < 0) { |
1176 | if (ret != -ENOSYS) | 1176 | if (ret != -ENOSYS) |
1177 | pr_warning("Could not initialize trace " | 1177 | pr_warning("Could not initialize trace " |
@@ -1324,8 +1324,8 @@ static __init int event_trace_init(void) | |||
1324 | /* The linker may leave blanks */ | 1324 | /* The linker may leave blanks */ |
1325 | if (!call->name) | 1325 | if (!call->name) |
1326 | continue; | 1326 | continue; |
1327 | if (call->raw_init) { | 1327 | if (call->class->raw_init) { |
1328 | ret = call->raw_init(call); | 1328 | ret = call->class->raw_init(call); |
1329 | if (ret < 0) { | 1329 | if (ret < 0) { |
1330 | if (ret != -ENOSYS) | 1330 | if (ret != -ENOSYS) |
1331 | pr_warning("Could not initialize trace " | 1331 | pr_warning("Could not initialize trace " |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index e700a0c1803f..e878d06c0ac0 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -158,6 +158,7 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call) | |||
158 | struct ftrace_event_class event_class_ftrace_##call = { \ | 158 | struct ftrace_event_class event_class_ftrace_##call = { \ |
159 | .system = __stringify(TRACE_SYSTEM), \ | 159 | .system = __stringify(TRACE_SYSTEM), \ |
160 | .define_fields = ftrace_define_fields_##call, \ | 160 | .define_fields = ftrace_define_fields_##call, \ |
161 | .raw_init = ftrace_raw_init_event, \ | ||
161 | }; \ | 162 | }; \ |
162 | \ | 163 | \ |
163 | struct ftrace_event_call __used \ | 164 | struct ftrace_event_call __used \ |
@@ -166,7 +167,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
166 | .name = #call, \ | 167 | .name = #call, \ |
167 | .id = type, \ | 168 | .id = type, \ |
168 | .class = &event_class_ftrace_##call, \ | 169 | .class = &event_class_ftrace_##call, \ |
169 | .raw_init = ftrace_raw_init_event, \ | ||
170 | .print_fmt = print, \ | 170 | .print_fmt = print, \ |
171 | }; \ | 171 | }; \ |
172 | 172 | ||
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index b14bf745356f..428f4a52de69 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1359,13 +1359,13 @@ static int register_probe_event(struct trace_probe *tp) | |||
1359 | /* Initialize ftrace_event_call */ | 1359 | /* Initialize ftrace_event_call */ |
1360 | if (probe_is_return(tp)) { | 1360 | if (probe_is_return(tp)) { |
1361 | tp->event.trace = print_kretprobe_event; | 1361 | tp->event.trace = print_kretprobe_event; |
1362 | call->raw_init = probe_event_raw_init; | ||
1363 | INIT_LIST_HEAD(&call->class->fields); | 1362 | INIT_LIST_HEAD(&call->class->fields); |
1363 | call->class->raw_init = probe_event_raw_init; | ||
1364 | call->class->define_fields = kretprobe_event_define_fields; | 1364 | call->class->define_fields = kretprobe_event_define_fields; |
1365 | } else { | 1365 | } else { |
1366 | tp->event.trace = print_kprobe_event; | ||
1367 | call->raw_init = probe_event_raw_init; | ||
1368 | INIT_LIST_HEAD(&call->class->fields); | 1366 | INIT_LIST_HEAD(&call->class->fields); |
1367 | tp->event.trace = print_kprobe_event; | ||
1368 | call->class->raw_init = probe_event_raw_init; | ||
1369 | call->class->define_fields = kprobe_event_define_fields; | 1369 | call->class->define_fields = kprobe_event_define_fields; |
1370 | } | 1370 | } |
1371 | if (set_print_fmt(tp) < 0) | 1371 | if (set_print_fmt(tp) < 0) |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index cceccf0d2e91..1c1b9bf3ccc6 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -44,6 +44,7 @@ struct ftrace_event_class event_class_syscall_enter = { | |||
44 | .reg = syscall_enter_register, | 44 | .reg = syscall_enter_register, |
45 | .define_fields = syscall_enter_define_fields, | 45 | .define_fields = syscall_enter_define_fields, |
46 | .get_fields = syscall_get_enter_fields, | 46 | .get_fields = syscall_get_enter_fields, |
47 | .raw_init = init_syscall_trace, | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | struct ftrace_event_class event_class_syscall_exit = { | 50 | struct ftrace_event_class event_class_syscall_exit = { |
@@ -51,6 +52,7 @@ struct ftrace_event_class event_class_syscall_exit = { | |||
51 | .reg = syscall_exit_register, | 52 | .reg = syscall_exit_register, |
52 | .define_fields = syscall_exit_define_fields, | 53 | .define_fields = syscall_exit_define_fields, |
53 | .get_fields = syscall_get_exit_fields, | 54 | .get_fields = syscall_get_exit_fields, |
55 | .raw_init = init_syscall_trace, | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | extern unsigned long __start_syscalls_metadata[]; | 58 | extern unsigned long __start_syscalls_metadata[]; |