aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_export.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-02-15 09:51:53 -0500
committerSteven Rostedt <rostedt@goodmis.org>2012-02-21 11:08:29 -0500
commit02aa3162edaa166a01d193f80ccde890be8b55da (patch)
tree50f111c12472e5573b966d7fb076ba4b22c86669 /kernel/trace/trace_export.c
parentced39002f5ea736b716ae233fb68b26d59783912 (diff)
ftrace: Allow to specify filter field type for ftrace events
Adding FILTER_TRACE_FN event field type for function tracepoint event, so it can be properly recognized within filtering code. Currently all fields of ftrace subsystem events share the common field type FILTER_OTHER. Since the function trace fields need special care within the filtering code we need to recognize it properly, hence adding the FILTER_TRACE_FN event type. Adding filter parameter to the FTRACE_ENTRY macro, to specify the filter field type for the event. Link: http://lkml.kernel.org/r/1329317514-8131-7-git-send-email-jolsa@redhat.com Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_export.c')
-rw-r--r--kernel/trace/trace_export.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index a3dbee6d04cd..7b46c9bd22ae 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -23,8 +23,10 @@
23 * function and thus become accesible via perf. 23 * function and thus become accesible via perf.
24 */ 24 */
25#undef FTRACE_ENTRY_REG 25#undef FTRACE_ENTRY_REG
26#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \ 26#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, \
27 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print)) 27 filter, regfn) \
28 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
29 filter)
28 30
29/* not needed for this file */ 31/* not needed for this file */
30#undef __field_struct 32#undef __field_struct
@@ -52,21 +54,22 @@
52#define F_printk(fmt, args...) fmt, args 54#define F_printk(fmt, args...) fmt, args
53 55
54#undef FTRACE_ENTRY 56#undef FTRACE_ENTRY
55#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ 57#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \
56struct ____ftrace_##name { \ 58struct ____ftrace_##name { \
57 tstruct \ 59 tstruct \
58}; \ 60}; \
59static void __always_unused ____ftrace_check_##name(void) \ 61static void __always_unused ____ftrace_check_##name(void) \
60{ \ 62{ \
61 struct ____ftrace_##name *__entry = NULL; \ 63 struct ____ftrace_##name *__entry = NULL; \
62 \ 64 \
63 /* force compile-time check on F_printk() */ \ 65 /* force compile-time check on F_printk() */ \
64 printk(print); \ 66 printk(print); \
65} 67}
66 68
67#undef FTRACE_ENTRY_DUP 69#undef FTRACE_ENTRY_DUP
68#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \ 70#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print, filter) \
69 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print)) 71 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \
72 filter)
70 73
71#include "trace_entries.h" 74#include "trace_entries.h"
72 75
@@ -75,7 +78,7 @@ static void __always_unused ____ftrace_check_##name(void) \
75 ret = trace_define_field(event_call, #type, #item, \ 78 ret = trace_define_field(event_call, #type, #item, \
76 offsetof(typeof(field), item), \ 79 offsetof(typeof(field), item), \
77 sizeof(field.item), \ 80 sizeof(field.item), \
78 is_signed_type(type), FILTER_OTHER); \ 81 is_signed_type(type), filter_type); \
79 if (ret) \ 82 if (ret) \
80 return ret; 83 return ret;
81 84
@@ -85,7 +88,7 @@ static void __always_unused ____ftrace_check_##name(void) \
85 offsetof(typeof(field), \ 88 offsetof(typeof(field), \
86 container.item), \ 89 container.item), \
87 sizeof(field.container.item), \ 90 sizeof(field.container.item), \
88 is_signed_type(type), FILTER_OTHER); \ 91 is_signed_type(type), filter_type); \
89 if (ret) \ 92 if (ret) \
90 return ret; 93 return ret;
91 94
@@ -99,7 +102,7 @@ static void __always_unused ____ftrace_check_##name(void) \
99 ret = trace_define_field(event_call, event_storage, #item, \ 102 ret = trace_define_field(event_call, event_storage, #item, \
100 offsetof(typeof(field), item), \ 103 offsetof(typeof(field), item), \
101 sizeof(field.item), \ 104 sizeof(field.item), \
102 is_signed_type(type), FILTER_OTHER); \ 105 is_signed_type(type), filter_type); \
103 mutex_unlock(&event_storage_mutex); \ 106 mutex_unlock(&event_storage_mutex); \
104 if (ret) \ 107 if (ret) \
105 return ret; \ 108 return ret; \
@@ -112,7 +115,7 @@ static void __always_unused ____ftrace_check_##name(void) \
112 offsetof(typeof(field), \ 115 offsetof(typeof(field), \
113 container.item), \ 116 container.item), \
114 sizeof(field.container.item), \ 117 sizeof(field.container.item), \
115 is_signed_type(type), FILTER_OTHER); \ 118 is_signed_type(type), filter_type); \
116 if (ret) \ 119 if (ret) \
117 return ret; 120 return ret;
118 121
@@ -120,17 +123,18 @@ static void __always_unused ____ftrace_check_##name(void) \
120#define __dynamic_array(type, item) \ 123#define __dynamic_array(type, item) \
121 ret = trace_define_field(event_call, #type, #item, \ 124 ret = trace_define_field(event_call, #type, #item, \
122 offsetof(typeof(field), item), \ 125 offsetof(typeof(field), item), \
123 0, is_signed_type(type), FILTER_OTHER);\ 126 0, is_signed_type(type), filter_type);\
124 if (ret) \ 127 if (ret) \
125 return ret; 128 return ret;
126 129
127#undef FTRACE_ENTRY 130#undef FTRACE_ENTRY
128#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ 131#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \
129int \ 132int \
130ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ 133ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
131{ \ 134{ \
132 struct struct_name field; \ 135 struct struct_name field; \
133 int ret; \ 136 int ret; \
137 int filter_type = filter; \
134 \ 138 \
135 tstruct; \ 139 tstruct; \
136 \ 140 \
@@ -161,7 +165,8 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
161#define F_printk(fmt, args...) #fmt ", " __stringify(args) 165#define F_printk(fmt, args...) #fmt ", " __stringify(args)
162 166
163#undef FTRACE_ENTRY_REG 167#undef FTRACE_ENTRY_REG
164#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, regfn)\ 168#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, filter,\
169 regfn) \
165 \ 170 \
166struct ftrace_event_class event_class_ftrace_##call = { \ 171struct ftrace_event_class event_class_ftrace_##call = { \
167 .system = __stringify(TRACE_SYSTEM), \ 172 .system = __stringify(TRACE_SYSTEM), \
@@ -180,9 +185,9 @@ struct ftrace_event_call __used \
180__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; 185__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
181 186
182#undef FTRACE_ENTRY 187#undef FTRACE_ENTRY
183#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \ 188#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print, filter) \
184 FTRACE_ENTRY_REG(call, struct_name, etype, \ 189 FTRACE_ENTRY_REG(call, struct_name, etype, \
185 PARAMS(tstruct), PARAMS(print), NULL) 190 PARAMS(tstruct), PARAMS(print), filter, NULL)
186 191
187int ftrace_event_is_function(struct ftrace_event_call *call) 192int ftrace_event_is_function(struct ftrace_event_call *call)
188{ 193{