aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-22 18:46:14 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:20:32 -0400
commita9a5776380208a3e48a92d0c763ee1a3b486fb73 (patch)
tree5ecd41c3b373e2156f5bf748ae777e022296a30c /kernel/trace
parent0405ab80aa94afb13bf9ac4a6fc9f2923d4b9114 (diff)
tracing: Allow events to share their print functions
Multiple events may use the same method to print their data. Instead of having all events have a pointer to their print funtions, the trace_event structure now points to a trace_event_functions structure that will hold the way to print ouf the event. The event itself is now passed to the print function to let the print function know what kind of event it should print. This opens the door to consolidating the way several events print their output. text data bss dec hex filename 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4900382 1048964 861512 6810858 67ecea vmlinux.init 4900446 1049028 861512 6810986 67ed6a vmlinux.preprint This change slightly increases the size but is needed for the next change. v3: Fix the branch tracer events to handle this change. v2: Fix the new function graph tracer event calls to handle this change. 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 'kernel/trace')
-rw-r--r--kernel/trace/blktrace.c13
-rw-r--r--kernel/trace/kmemtrace.c28
-rw-r--r--kernel/trace/trace.c9
-rw-r--r--kernel/trace/trace_branch.c8
-rw-r--r--kernel/trace/trace_functions_graph.c13
-rw-r--r--kernel/trace/trace_kprobe.c22
-rw-r--r--kernel/trace/trace_output.c137
-rw-r--r--kernel/trace/trace_output.h2
-rw-r--r--kernel/trace/trace_syscalls.c6
9 files changed, 160 insertions, 78 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 19d93f83e3c3..36ea2b65dcdc 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1336,7 +1336,7 @@ out:
1336} 1336}
1337 1337
1338static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, 1338static enum print_line_t blk_trace_event_print(struct trace_iterator *iter,
1339 int flags) 1339 int flags, struct trace_event *event)
1340{ 1340{
1341 return print_one_line(iter, false); 1341 return print_one_line(iter, false);
1342} 1342}
@@ -1358,7 +1358,8 @@ static int blk_trace_synthesize_old_trace(struct trace_iterator *iter)
1358} 1358}
1359 1359
1360static enum print_line_t 1360static enum print_line_t
1361blk_trace_event_print_binary(struct trace_iterator *iter, int flags) 1361blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
1362 struct trace_event *event)
1362{ 1363{
1363 return blk_trace_synthesize_old_trace(iter) ? 1364 return blk_trace_synthesize_old_trace(iter) ?
1364 TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; 1365 TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
@@ -1396,12 +1397,16 @@ static struct tracer blk_tracer __read_mostly = {
1396 .set_flag = blk_tracer_set_flag, 1397 .set_flag = blk_tracer_set_flag,
1397}; 1398};
1398 1399
1399static struct trace_event trace_blk_event = { 1400static struct trace_event_functions trace_blk_event_funcs = {
1400 .type = TRACE_BLK,
1401 .trace = blk_trace_event_print, 1401 .trace = blk_trace_event_print,
1402 .binary = blk_trace_event_print_binary, 1402 .binary = blk_trace_event_print_binary,
1403}; 1403};
1404 1404
1405static struct trace_event trace_blk_event = {
1406 .type = TRACE_BLK,
1407 .funcs = &trace_blk_event_funcs,
1408};
1409
1405static int __init init_blk_tracer(void) 1410static int __init init_blk_tracer(void)
1406{ 1411{
1407 if (!register_ftrace_event(&trace_blk_event)) { 1412 if (!register_ftrace_event(&trace_blk_event)) {
diff --git a/kernel/trace/kmemtrace.c b/kernel/trace/kmemtrace.c
index 7253d0c1c32f..bbfc1bb1660b 100644
--- a/kernel/trace/kmemtrace.c
+++ b/kernel/trace/kmemtrace.c
@@ -243,7 +243,8 @@ struct kmemtrace_user_event_alloc {
243}; 243};
244 244
245static enum print_line_t 245static enum print_line_t
246kmemtrace_print_alloc(struct trace_iterator *iter, int flags) 246kmemtrace_print_alloc(struct trace_iterator *iter, int flags,
247 struct trace_event *event)
247{ 248{
248 struct trace_seq *s = &iter->seq; 249 struct trace_seq *s = &iter->seq;
249 struct kmemtrace_alloc_entry *entry; 250 struct kmemtrace_alloc_entry *entry;
@@ -263,7 +264,8 @@ kmemtrace_print_alloc(struct trace_iterator *iter, int flags)
263} 264}
264 265
265static enum print_line_t 266static enum print_line_t
266kmemtrace_print_free(struct trace_iterator *iter, int flags) 267kmemtrace_print_free(struct trace_iterator *iter, int flags,
268 struct trace_event *event)
267{ 269{
268 struct trace_seq *s = &iter->seq; 270 struct trace_seq *s = &iter->seq;
269 struct kmemtrace_free_entry *entry; 271 struct kmemtrace_free_entry *entry;
@@ -281,7 +283,8 @@ kmemtrace_print_free(struct trace_iterator *iter, int flags)
281} 283}
282 284
283static enum print_line_t 285static enum print_line_t
284kmemtrace_print_alloc_user(struct trace_iterator *iter, int flags) 286kmemtrace_print_alloc_user(struct trace_iterator *iter, int flags,
287 struct trace_event *event)
285{ 288{
286 struct trace_seq *s = &iter->seq; 289 struct trace_seq *s = &iter->seq;
287 struct kmemtrace_alloc_entry *entry; 290 struct kmemtrace_alloc_entry *entry;
@@ -315,7 +318,8 @@ kmemtrace_print_alloc_user(struct trace_iterator *iter, int flags)
315} 318}
316 319
317static enum print_line_t 320static enum print_line_t
318kmemtrace_print_free_user(struct trace_iterator *iter, int flags) 321kmemtrace_print_free_user(struct trace_iterator *iter, int flags,
322 struct trace_event *event)
319{ 323{
320 struct trace_seq *s = &iter->seq; 324 struct trace_seq *s = &iter->seq;
321 struct kmemtrace_free_entry *entry; 325 struct kmemtrace_free_entry *entry;
@@ -469,18 +473,26 @@ static enum print_line_t kmemtrace_print_line(struct trace_iterator *iter)
469 } 473 }
470} 474}
471 475
472static struct trace_event kmem_trace_alloc = { 476static struct trace_event_functions kmem_trace_alloc_funcs = {
473 .type = TRACE_KMEM_ALLOC,
474 .trace = kmemtrace_print_alloc, 477 .trace = kmemtrace_print_alloc,
475 .binary = kmemtrace_print_alloc_user, 478 .binary = kmemtrace_print_alloc_user,
476}; 479};
477 480
478static struct trace_event kmem_trace_free = { 481static struct trace_event kmem_trace_alloc = {
479 .type = TRACE_KMEM_FREE, 482 .type = TRACE_KMEM_ALLOC,
483 .funcs = &kmem_trace_alloc_funcs,
484};
485
486static struct trace_event_functions kmem_trace_free_funcs = {
480 .trace = kmemtrace_print_free, 487 .trace = kmemtrace_print_free,
481 .binary = kmemtrace_print_free_user, 488 .binary = kmemtrace_print_free_user,
482}; 489};
483 490
491static struct trace_event kmem_trace_free = {
492 .type = TRACE_KMEM_FREE,
493 .funcs = &kmem_trace_free_funcs,
494};
495
484static struct tracer kmem_tracer __read_mostly = { 496static struct tracer kmem_tracer __read_mostly = {
485 .name = "kmemtrace", 497 .name = "kmemtrace",
486 .init = kmem_trace_init, 498 .init = kmem_trace_init,
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 756d7283318b..ba0ec81158b2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1936,7 +1936,7 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
1936 } 1936 }
1937 1937
1938 if (event) 1938 if (event)
1939 return event->trace(iter, sym_flags); 1939 return event->funcs->trace(iter, sym_flags, event);
1940 1940
1941 if (!trace_seq_printf(s, "Unknown type %d\n", entry->type)) 1941 if (!trace_seq_printf(s, "Unknown type %d\n", entry->type))
1942 goto partial; 1942 goto partial;
@@ -1962,7 +1962,7 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
1962 1962
1963 event = ftrace_find_event(entry->type); 1963 event = ftrace_find_event(entry->type);
1964 if (event) 1964 if (event)
1965 return event->raw(iter, 0); 1965 return event->funcs->raw(iter, 0, event);
1966 1966
1967 if (!trace_seq_printf(s, "%d ?\n", entry->type)) 1967 if (!trace_seq_printf(s, "%d ?\n", entry->type))
1968 goto partial; 1968 goto partial;
@@ -1989,7 +1989,7 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)
1989 1989
1990 event = ftrace_find_event(entry->type); 1990 event = ftrace_find_event(entry->type);
1991 if (event) { 1991 if (event) {
1992 enum print_line_t ret = event->hex(iter, 0); 1992 enum print_line_t ret = event->funcs->hex(iter, 0, event);
1993 if (ret != TRACE_TYPE_HANDLED) 1993 if (ret != TRACE_TYPE_HANDLED)
1994 return ret; 1994 return ret;
1995 } 1995 }
@@ -2014,7 +2014,8 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
2014 } 2014 }
2015 2015
2016 event = ftrace_find_event(entry->type); 2016 event = ftrace_find_event(entry->type);
2017 return event ? event->binary(iter, 0) : TRACE_TYPE_HANDLED; 2017 return event ? event->funcs->binary(iter, 0, event) :
2018 TRACE_TYPE_HANDLED;
2018} 2019}
2019 2020
2020int trace_empty(struct trace_iterator *iter) 2021int trace_empty(struct trace_iterator *iter)
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index b9bc4d470177..8d3538b4ea5f 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -143,7 +143,7 @@ static void branch_trace_reset(struct trace_array *tr)
143} 143}
144 144
145static enum print_line_t trace_branch_print(struct trace_iterator *iter, 145static enum print_line_t trace_branch_print(struct trace_iterator *iter,
146 int flags) 146 int flags, struct trace_event *event)
147{ 147{
148 struct trace_branch *field; 148 struct trace_branch *field;
149 149
@@ -167,9 +167,13 @@ static void branch_print_header(struct seq_file *s)
167 " |\n"); 167 " |\n");
168} 168}
169 169
170static struct trace_event_functions trace_branch_funcs = {
171 .trace = trace_branch_print,
172};
173
170static struct trace_event trace_branch_event = { 174static struct trace_event trace_branch_event = {
171 .type = TRACE_BRANCH, 175 .type = TRACE_BRANCH,
172 .trace = trace_branch_print, 176 .funcs = &trace_branch_funcs,
173}; 177};
174 178
175static struct tracer branch_trace __read_mostly = 179static struct tracer branch_trace __read_mostly =
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index dd11c830eb84..79f4bac99a94 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1025,7 +1025,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
1025 if (!event) 1025 if (!event)
1026 return TRACE_TYPE_UNHANDLED; 1026 return TRACE_TYPE_UNHANDLED;
1027 1027
1028 ret = event->trace(iter, sym_flags); 1028 ret = event->funcs->trace(iter, sym_flags, event);
1029 if (ret != TRACE_TYPE_HANDLED) 1029 if (ret != TRACE_TYPE_HANDLED)
1030 return ret; 1030 return ret;
1031 } 1031 }
@@ -1112,7 +1112,8 @@ print_graph_function(struct trace_iterator *iter)
1112} 1112}
1113 1113
1114static enum print_line_t 1114static enum print_line_t
1115print_graph_function_event(struct trace_iterator *iter, int flags) 1115print_graph_function_event(struct trace_iterator *iter, int flags,
1116 struct trace_event *event)
1116{ 1117{
1117 return print_graph_function(iter); 1118 return print_graph_function(iter);
1118} 1119}
@@ -1225,14 +1226,18 @@ void graph_trace_close(struct trace_iterator *iter)
1225 } 1226 }
1226} 1227}
1227 1228
1229static struct trace_event_functions graph_functions = {
1230 .trace = print_graph_function_event,
1231};
1232
1228static struct trace_event graph_trace_entry_event = { 1233static struct trace_event graph_trace_entry_event = {
1229 .type = TRACE_GRAPH_ENT, 1234 .type = TRACE_GRAPH_ENT,
1230 .trace = print_graph_function_event, 1235 .funcs = &graph_functions,
1231}; 1236};
1232 1237
1233static struct trace_event graph_trace_ret_event = { 1238static struct trace_event graph_trace_ret_event = {
1234 .type = TRACE_GRAPH_RET, 1239 .type = TRACE_GRAPH_RET,
1235 .trace = print_graph_function_event, 1240 .funcs = &graph_functions
1236}; 1241};
1237 1242
1238static struct tracer graph_trace __read_mostly = { 1243static struct tracer graph_trace __read_mostly = {
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 428f4a52de69..b989ae229a20 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1011,16 +1011,15 @@ static __kprobes void kretprobe_trace_func(struct kretprobe_instance *ri,
1011 1011
1012/* Event entry printers */ 1012/* Event entry printers */
1013enum print_line_t 1013enum print_line_t
1014print_kprobe_event(struct trace_iterator *iter, int flags) 1014print_kprobe_event(struct trace_iterator *iter, int flags,
1015 struct trace_event *event)
1015{ 1016{
1016 struct kprobe_trace_entry *field; 1017 struct kprobe_trace_entry *field;
1017 struct trace_seq *s = &iter->seq; 1018 struct trace_seq *s = &iter->seq;
1018 struct trace_event *event;
1019 struct trace_probe *tp; 1019 struct trace_probe *tp;
1020 int i; 1020 int i;
1021 1021
1022 field = (struct kprobe_trace_entry *)iter->ent; 1022 field = (struct kprobe_trace_entry *)iter->ent;
1023 event = ftrace_find_event(field->ent.type);
1024 tp = container_of(event, struct trace_probe, event); 1023 tp = container_of(event, struct trace_probe, event);
1025 1024
1026 if (!trace_seq_printf(s, "%s: (", tp->call.name)) 1025 if (!trace_seq_printf(s, "%s: (", tp->call.name))
@@ -1046,16 +1045,15 @@ partial:
1046} 1045}
1047 1046
1048enum print_line_t 1047enum print_line_t
1049print_kretprobe_event(struct trace_iterator *iter, int flags) 1048print_kretprobe_event(struct trace_iterator *iter, int flags,
1049 struct trace_event *event)
1050{ 1050{
1051 struct kretprobe_trace_entry *field; 1051 struct kretprobe_trace_entry *field;
1052 struct trace_seq *s = &iter->seq; 1052 struct trace_seq *s = &iter->seq;
1053 struct trace_event *event;
1054 struct trace_probe *tp; 1053 struct trace_probe *tp;
1055 int i; 1054 int i;
1056 1055
1057 field = (struct kretprobe_trace_entry *)iter->ent; 1056 field = (struct kretprobe_trace_entry *)iter->ent;
1058 event = ftrace_find_event(field->ent.type);
1059 tp = container_of(event, struct trace_probe, event); 1057 tp = container_of(event, struct trace_probe, event);
1060 1058
1061 if (!trace_seq_printf(s, "%s: (", tp->call.name)) 1059 if (!trace_seq_printf(s, "%s: (", tp->call.name))
@@ -1351,6 +1349,14 @@ int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
1351 return 0; /* We don't tweek kernel, so just return 0 */ 1349 return 0; /* We don't tweek kernel, so just return 0 */
1352} 1350}
1353 1351
1352static struct trace_event_functions kretprobe_funcs = {
1353 .trace = print_kretprobe_event
1354};
1355
1356static struct trace_event_functions kprobe_funcs = {
1357 .trace = print_kprobe_event
1358};
1359
1354static int register_probe_event(struct trace_probe *tp) 1360static int register_probe_event(struct trace_probe *tp)
1355{ 1361{
1356 struct ftrace_event_call *call = &tp->call; 1362 struct ftrace_event_call *call = &tp->call;
@@ -1358,13 +1364,13 @@ static int register_probe_event(struct trace_probe *tp)
1358 1364
1359 /* Initialize ftrace_event_call */ 1365 /* Initialize ftrace_event_call */
1360 if (probe_is_return(tp)) { 1366 if (probe_is_return(tp)) {
1361 tp->event.trace = print_kretprobe_event; 1367 tp->event.funcs = &kretprobe_funcs;
1362 INIT_LIST_HEAD(&call->class->fields); 1368 INIT_LIST_HEAD(&call->class->fields);
1363 call->class->raw_init = probe_event_raw_init; 1369 call->class->raw_init = probe_event_raw_init;
1364 call->class->define_fields = kretprobe_event_define_fields; 1370 call->class->define_fields = kretprobe_event_define_fields;
1365 } else { 1371 } else {
1366 INIT_LIST_HEAD(&call->class->fields); 1372 INIT_LIST_HEAD(&call->class->fields);
1367 tp->event.trace = print_kprobe_event; 1373 tp->event.funcs = &kprobe_funcs;
1368 call->class->raw_init = probe_event_raw_init; 1374 call->class->raw_init = probe_event_raw_init;
1369 call->class->define_fields = kprobe_event_define_fields; 1375 call->class->define_fields = kprobe_event_define_fields;
1370 } 1376 }
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 2404c129a8c9..fc9d4dbb089e 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -726,6 +726,9 @@ int register_ftrace_event(struct trace_event *event)
726 if (WARN_ON(!event)) 726 if (WARN_ON(!event))
727 goto out; 727 goto out;
728 728
729 if (WARN_ON(!event->funcs))
730 goto out;
731
729 INIT_LIST_HEAD(&event->list); 732 INIT_LIST_HEAD(&event->list);
730 733
731 if (!event->type) { 734 if (!event->type) {
@@ -758,14 +761,14 @@ int register_ftrace_event(struct trace_event *event)
758 goto out; 761 goto out;
759 } 762 }
760 763
761 if (event->trace == NULL) 764 if (event->funcs->trace == NULL)
762 event->trace = trace_nop_print; 765 event->funcs->trace = trace_nop_print;
763 if (event->raw == NULL) 766 if (event->funcs->raw == NULL)
764 event->raw = trace_nop_print; 767 event->funcs->raw = trace_nop_print;
765 if (event->hex == NULL) 768 if (event->funcs->hex == NULL)
766 event->hex = trace_nop_print; 769 event->funcs->hex = trace_nop_print;
767 if (event->binary == NULL) 770 if (event->funcs->binary == NULL)
768 event->binary = trace_nop_print; 771 event->funcs->binary = trace_nop_print;
769 772
770 key = event->type & (EVENT_HASHSIZE - 1); 773 key = event->type & (EVENT_HASHSIZE - 1);
771 774
@@ -807,13 +810,15 @@ EXPORT_SYMBOL_GPL(unregister_ftrace_event);
807 * Standard events 810 * Standard events
808 */ 811 */
809 812
810enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags) 813enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags,
814 struct trace_event *event)
811{ 815{
812 return TRACE_TYPE_HANDLED; 816 return TRACE_TYPE_HANDLED;
813} 817}
814 818
815/* TRACE_FN */ 819/* TRACE_FN */
816static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags) 820static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags,
821 struct trace_event *event)
817{ 822{
818 struct ftrace_entry *field; 823 struct ftrace_entry *field;
819 struct trace_seq *s = &iter->seq; 824 struct trace_seq *s = &iter->seq;
@@ -840,7 +845,8 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags)
840 return TRACE_TYPE_PARTIAL_LINE; 845 return TRACE_TYPE_PARTIAL_LINE;
841} 846}
842 847
843static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags) 848static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags,
849 struct trace_event *event)
844{ 850{
845 struct ftrace_entry *field; 851 struct ftrace_entry *field;
846 852
@@ -854,7 +860,8 @@ static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags)
854 return TRACE_TYPE_HANDLED; 860 return TRACE_TYPE_HANDLED;
855} 861}
856 862
857static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags) 863static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags,
864 struct trace_event *event)
858{ 865{
859 struct ftrace_entry *field; 866 struct ftrace_entry *field;
860 struct trace_seq *s = &iter->seq; 867 struct trace_seq *s = &iter->seq;
@@ -867,7 +874,8 @@ static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags)
867 return TRACE_TYPE_HANDLED; 874 return TRACE_TYPE_HANDLED;
868} 875}
869 876
870static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags) 877static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags,
878 struct trace_event *event)
871{ 879{
872 struct ftrace_entry *field; 880 struct ftrace_entry *field;
873 struct trace_seq *s = &iter->seq; 881 struct trace_seq *s = &iter->seq;
@@ -880,14 +888,18 @@ static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags)
880 return TRACE_TYPE_HANDLED; 888 return TRACE_TYPE_HANDLED;
881} 889}
882 890
883static struct trace_event trace_fn_event = { 891static struct trace_event_functions trace_fn_funcs = {
884 .type = TRACE_FN,
885 .trace = trace_fn_trace, 892 .trace = trace_fn_trace,
886 .raw = trace_fn_raw, 893 .raw = trace_fn_raw,
887 .hex = trace_fn_hex, 894 .hex = trace_fn_hex,
888 .binary = trace_fn_bin, 895 .binary = trace_fn_bin,
889}; 896};
890 897
898static struct trace_event trace_fn_event = {
899 .type = TRACE_FN,
900 .funcs = &trace_fn_funcs,
901};
902
891/* TRACE_CTX an TRACE_WAKE */ 903/* TRACE_CTX an TRACE_WAKE */
892static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter, 904static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
893 char *delim) 905 char *delim)
@@ -916,13 +928,14 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
916 return TRACE_TYPE_HANDLED; 928 return TRACE_TYPE_HANDLED;
917} 929}
918 930
919static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags) 931static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags,
932 struct trace_event *event)
920{ 933{
921 return trace_ctxwake_print(iter, "==>"); 934 return trace_ctxwake_print(iter, "==>");
922} 935}
923 936
924static enum print_line_t trace_wake_print(struct trace_iterator *iter, 937static enum print_line_t trace_wake_print(struct trace_iterator *iter,
925 int flags) 938 int flags, struct trace_event *event)
926{ 939{
927 return trace_ctxwake_print(iter, " +"); 940 return trace_ctxwake_print(iter, " +");
928} 941}
@@ -950,12 +963,14 @@ static int trace_ctxwake_raw(struct trace_iterator *iter, char S)
950 return TRACE_TYPE_HANDLED; 963 return TRACE_TYPE_HANDLED;
951} 964}
952 965
953static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags) 966static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags,
967 struct trace_event *event)
954{ 968{
955 return trace_ctxwake_raw(iter, 0); 969 return trace_ctxwake_raw(iter, 0);
956} 970}
957 971
958static enum print_line_t trace_wake_raw(struct trace_iterator *iter, int flags) 972static enum print_line_t trace_wake_raw(struct trace_iterator *iter, int flags,
973 struct trace_event *event)
959{ 974{
960 return trace_ctxwake_raw(iter, '+'); 975 return trace_ctxwake_raw(iter, '+');
961} 976}
@@ -984,18 +999,20 @@ static int trace_ctxwake_hex(struct trace_iterator *iter, char S)
984 return TRACE_TYPE_HANDLED; 999 return TRACE_TYPE_HANDLED;
985} 1000}
986 1001
987static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags) 1002static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags,
1003 struct trace_event *event)
988{ 1004{
989 return trace_ctxwake_hex(iter, 0); 1005 return trace_ctxwake_hex(iter, 0);
990} 1006}
991 1007
992static enum print_line_t trace_wake_hex(struct trace_iterator *iter, int flags) 1008static enum print_line_t trace_wake_hex(struct trace_iterator *iter, int flags,
1009 struct trace_event *event)
993{ 1010{
994 return trace_ctxwake_hex(iter, '+'); 1011 return trace_ctxwake_hex(iter, '+');
995} 1012}
996 1013
997static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter, 1014static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter,
998 int flags) 1015 int flags, struct trace_event *event)
999{ 1016{
1000 struct ctx_switch_entry *field; 1017 struct ctx_switch_entry *field;
1001 struct trace_seq *s = &iter->seq; 1018 struct trace_seq *s = &iter->seq;
@@ -1012,25 +1029,33 @@ static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter,
1012 return TRACE_TYPE_HANDLED; 1029 return TRACE_TYPE_HANDLED;
1013} 1030}
1014 1031
1015static struct trace_event trace_ctx_event = { 1032static struct trace_event_functions trace_ctx_funcs = {
1016 .type = TRACE_CTX,
1017 .trace = trace_ctx_print, 1033 .trace = trace_ctx_print,
1018 .raw = trace_ctx_raw, 1034 .raw = trace_ctx_raw,
1019 .hex = trace_ctx_hex, 1035 .hex = trace_ctx_hex,
1020 .binary = trace_ctxwake_bin, 1036 .binary = trace_ctxwake_bin,
1021}; 1037};
1022 1038
1023static struct trace_event trace_wake_event = { 1039static struct trace_event trace_ctx_event = {
1024 .type = TRACE_WAKE, 1040 .type = TRACE_CTX,
1041 .funcs = &trace_ctx_funcs,
1042};
1043
1044static struct trace_event_functions trace_wake_funcs = {
1025 .trace = trace_wake_print, 1045 .trace = trace_wake_print,
1026 .raw = trace_wake_raw, 1046 .raw = trace_wake_raw,
1027 .hex = trace_wake_hex, 1047 .hex = trace_wake_hex,
1028 .binary = trace_ctxwake_bin, 1048 .binary = trace_ctxwake_bin,
1029}; 1049};
1030 1050
1051static struct trace_event trace_wake_event = {
1052 .type = TRACE_WAKE,
1053 .funcs = &trace_wake_funcs,
1054};
1055
1031/* TRACE_SPECIAL */ 1056/* TRACE_SPECIAL */
1032static enum print_line_t trace_special_print(struct trace_iterator *iter, 1057static enum print_line_t trace_special_print(struct trace_iterator *iter,
1033 int flags) 1058 int flags, struct trace_event *event)
1034{ 1059{
1035 struct special_entry *field; 1060 struct special_entry *field;
1036 1061
@@ -1046,7 +1071,7 @@ static enum print_line_t trace_special_print(struct trace_iterator *iter,
1046} 1071}
1047 1072
1048static enum print_line_t trace_special_hex(struct trace_iterator *iter, 1073static enum print_line_t trace_special_hex(struct trace_iterator *iter,
1049 int flags) 1074 int flags, struct trace_event *event)
1050{ 1075{
1051 struct special_entry *field; 1076 struct special_entry *field;
1052 struct trace_seq *s = &iter->seq; 1077 struct trace_seq *s = &iter->seq;
@@ -1061,7 +1086,7 @@ static enum print_line_t trace_special_hex(struct trace_iterator *iter,
1061} 1086}
1062 1087
1063static enum print_line_t trace_special_bin(struct trace_iterator *iter, 1088static enum print_line_t trace_special_bin(struct trace_iterator *iter,
1064 int flags) 1089 int flags, struct trace_event *event)
1065{ 1090{
1066 struct special_entry *field; 1091 struct special_entry *field;
1067 struct trace_seq *s = &iter->seq; 1092 struct trace_seq *s = &iter->seq;
@@ -1075,18 +1100,22 @@ static enum print_line_t trace_special_bin(struct trace_iterator *iter,
1075 return TRACE_TYPE_HANDLED; 1100 return TRACE_TYPE_HANDLED;
1076} 1101}
1077 1102
1078static struct trace_event trace_special_event = { 1103static struct trace_event_functions trace_special_funcs = {
1079 .type = TRACE_SPECIAL,
1080 .trace = trace_special_print, 1104 .trace = trace_special_print,
1081 .raw = trace_special_print, 1105 .raw = trace_special_print,
1082 .hex = trace_special_hex, 1106 .hex = trace_special_hex,
1083 .binary = trace_special_bin, 1107 .binary = trace_special_bin,
1084}; 1108};
1085 1109
1110static struct trace_event trace_special_event = {
1111 .type = TRACE_SPECIAL,
1112 .funcs = &trace_special_funcs,
1113};
1114
1086/* TRACE_STACK */ 1115/* TRACE_STACK */
1087 1116
1088static enum print_line_t trace_stack_print(struct trace_iterator *iter, 1117static enum print_line_t trace_stack_print(struct trace_iterator *iter,
1089 int flags) 1118 int flags, struct trace_event *event)
1090{ 1119{
1091 struct stack_entry *field; 1120 struct stack_entry *field;
1092 struct trace_seq *s = &iter->seq; 1121 struct trace_seq *s = &iter->seq;
@@ -1114,17 +1143,21 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
1114 return TRACE_TYPE_PARTIAL_LINE; 1143 return TRACE_TYPE_PARTIAL_LINE;
1115} 1144}
1116 1145
1117static struct trace_event trace_stack_event = { 1146static struct trace_event_functions trace_stack_funcs = {
1118 .type = TRACE_STACK,
1119 .trace = trace_stack_print, 1147 .trace = trace_stack_print,
1120 .raw = trace_special_print, 1148 .raw = trace_special_print,
1121 .hex = trace_special_hex, 1149 .hex = trace_special_hex,
1122 .binary = trace_special_bin, 1150 .binary = trace_special_bin,
1123}; 1151};
1124 1152
1153static struct trace_event trace_stack_event = {
1154 .type = TRACE_STACK,
1155 .funcs = &trace_stack_funcs,
1156};
1157
1125/* TRACE_USER_STACK */ 1158/* TRACE_USER_STACK */
1126static enum print_line_t trace_user_stack_print(struct trace_iterator *iter, 1159static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
1127 int flags) 1160 int flags, struct trace_event *event)
1128{ 1161{
1129 struct userstack_entry *field; 1162 struct userstack_entry *field;
1130 struct trace_seq *s = &iter->seq; 1163 struct trace_seq *s = &iter->seq;
@@ -1143,17 +1176,22 @@ static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
1143 return TRACE_TYPE_PARTIAL_LINE; 1176 return TRACE_TYPE_PARTIAL_LINE;
1144} 1177}
1145 1178
1146static struct trace_event trace_user_stack_event = { 1179static struct trace_event_functions trace_user_stack_funcs = {
1147 .type = TRACE_USER_STACK,
1148 .trace = trace_user_stack_print, 1180 .trace = trace_user_stack_print,
1149 .raw = trace_special_print, 1181 .raw = trace_special_print,
1150 .hex = trace_special_hex, 1182 .hex = trace_special_hex,
1151 .binary = trace_special_bin, 1183 .binary = trace_special_bin,
1152}; 1184};
1153 1185
1186static struct trace_event trace_user_stack_event = {
1187 .type = TRACE_USER_STACK,
1188 .funcs = &trace_user_stack_funcs,
1189};
1190
1154/* TRACE_BPRINT */ 1191/* TRACE_BPRINT */
1155static enum print_line_t 1192static enum print_line_t
1156trace_bprint_print(struct trace_iterator *iter, int flags) 1193trace_bprint_print(struct trace_iterator *iter, int flags,
1194 struct trace_event *event)
1157{ 1195{
1158 struct trace_entry *entry = iter->ent; 1196 struct trace_entry *entry = iter->ent;
1159 struct trace_seq *s = &iter->seq; 1197 struct trace_seq *s = &iter->seq;
@@ -1178,7 +1216,8 @@ trace_bprint_print(struct trace_iterator *iter, int flags)
1178 1216
1179 1217
1180static enum print_line_t 1218static enum print_line_t
1181trace_bprint_raw(struct trace_iterator *iter, int flags) 1219trace_bprint_raw(struct trace_iterator *iter, int flags,
1220 struct trace_event *event)
1182{ 1221{
1183 struct bprint_entry *field; 1222 struct bprint_entry *field;
1184 struct trace_seq *s = &iter->seq; 1223 struct trace_seq *s = &iter->seq;
@@ -1197,16 +1236,19 @@ trace_bprint_raw(struct trace_iterator *iter, int flags)
1197 return TRACE_TYPE_PARTIAL_LINE; 1236 return TRACE_TYPE_PARTIAL_LINE;
1198} 1237}
1199 1238
1239static struct trace_event_functions trace_bprint_funcs = {
1240 .trace = trace_bprint_print,
1241 .raw = trace_bprint_raw,
1242};
1200 1243
1201static struct trace_event trace_bprint_event = { 1244static struct trace_event trace_bprint_event = {
1202 .type = TRACE_BPRINT, 1245 .type = TRACE_BPRINT,
1203 .trace = trace_bprint_print, 1246 .funcs = &trace_bprint_funcs,
1204 .raw = trace_bprint_raw,
1205}; 1247};
1206 1248
1207/* TRACE_PRINT */ 1249/* TRACE_PRINT */
1208static enum print_line_t trace_print_print(struct trace_iterator *iter, 1250static enum print_line_t trace_print_print(struct trace_iterator *iter,
1209 int flags) 1251 int flags, struct trace_event *event)
1210{ 1252{
1211 struct print_entry *field; 1253 struct print_entry *field;
1212 struct trace_seq *s = &iter->seq; 1254 struct trace_seq *s = &iter->seq;
@@ -1225,7 +1267,8 @@ static enum print_line_t trace_print_print(struct trace_iterator *iter,
1225 return TRACE_TYPE_PARTIAL_LINE; 1267 return TRACE_TYPE_PARTIAL_LINE;
1226} 1268}
1227 1269
1228static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags) 1270static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags,
1271 struct trace_event *event)
1229{ 1272{
1230 struct print_entry *field; 1273 struct print_entry *field;
1231 1274
@@ -1240,12 +1283,16 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags)
1240 return TRACE_TYPE_PARTIAL_LINE; 1283 return TRACE_TYPE_PARTIAL_LINE;
1241} 1284}
1242 1285
1243static struct trace_event trace_print_event = { 1286static struct trace_event_functions trace_print_funcs = {
1244 .type = TRACE_PRINT,
1245 .trace = trace_print_print, 1287 .trace = trace_print_print,
1246 .raw = trace_print_raw, 1288 .raw = trace_print_raw,
1247}; 1289};
1248 1290
1291static struct trace_event trace_print_event = {
1292 .type = TRACE_PRINT,
1293 .funcs = &trace_print_funcs,
1294};
1295
1249 1296
1250static struct trace_event *events[] __initdata = { 1297static struct trace_event *events[] __initdata = {
1251 &trace_fn_event, 1298 &trace_fn_event,
diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
index 9d91c72ba38b..c038eba0492b 100644
--- a/kernel/trace/trace_output.h
+++ b/kernel/trace/trace_output.h
@@ -25,7 +25,7 @@ extern void trace_event_read_unlock(void);
25extern struct trace_event *ftrace_find_event(int type); 25extern struct trace_event *ftrace_find_event(int type);
26 26
27extern enum print_line_t trace_nop_print(struct trace_iterator *iter, 27extern enum print_line_t trace_nop_print(struct trace_iterator *iter,
28 int flags); 28 int flags, struct trace_event *event);
29extern int 29extern int
30trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry); 30trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry);
31 31
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 1c1b9bf3ccc6..3751c81998cb 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -93,7 +93,8 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr)
93} 93}
94 94
95enum print_line_t 95enum print_line_t
96print_syscall_enter(struct trace_iterator *iter, int flags) 96print_syscall_enter(struct trace_iterator *iter, int flags,
97 struct trace_event *event)
97{ 98{
98 struct trace_seq *s = &iter->seq; 99 struct trace_seq *s = &iter->seq;
99 struct trace_entry *ent = iter->ent; 100 struct trace_entry *ent = iter->ent;
@@ -145,7 +146,8 @@ end:
145} 146}
146 147
147enum print_line_t 148enum print_line_t
148print_syscall_exit(struct trace_iterator *iter, int flags) 149print_syscall_exit(struct trace_iterator *iter, int flags,
150 struct trace_event *event)
149{ 151{
150 struct trace_seq *s = &iter->seq; 152 struct trace_seq *s = &iter->seq;
151 struct trace_entry *ent = iter->ent; 153 struct trace_entry *ent = iter->ent;