aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2013-10-24 09:34:17 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-11-05 16:50:20 -0500
commitf306cc82a93d6b19f01634b80c580b9755c8b7cc (patch)
tree1a9ef8d44ed192185e4d6da5f7154f9a1c2075cb /include/linux
parentf02b625d0341519238ab3d9cc8706ff4bd45fb89 (diff)
tracing: Update event filters for multibuffer
The trace event filters are still tied to event calls rather than event files, which means you don't get what you'd expect when using filters in the multibuffer case: Before: # echo 'bytes_alloc > 8192' > /sys/kernel/debug/tracing/events/kmem/kmalloc/filter # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/filter bytes_alloc > 8192 # mkdir /sys/kernel/debug/tracing/instances/test1 # echo 'bytes_alloc > 2048' > /sys/kernel/debug/tracing/instances/test1/events/kmem/kmalloc/filter # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/filter bytes_alloc > 2048 # cat /sys/kernel/debug/tracing/instances/test1/events/kmem/kmalloc/filter bytes_alloc > 2048 Setting the filter in tracing/instances/test1/events shouldn't affect the same event in tracing/events as it does above. After: # echo 'bytes_alloc > 8192' > /sys/kernel/debug/tracing/events/kmem/kmalloc/filter # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/filter bytes_alloc > 8192 # mkdir /sys/kernel/debug/tracing/instances/test1 # echo 'bytes_alloc > 2048' > /sys/kernel/debug/tracing/instances/test1/events/kmem/kmalloc/filter # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/filter bytes_alloc > 8192 # cat /sys/kernel/debug/tracing/instances/test1/events/kmem/kmalloc/filter bytes_alloc > 2048 We'd like to just move the filter directly from ftrace_event_call to ftrace_event_file, but there are a couple cases that don't yet have multibuffer support and therefore have to continue using the current event_call-based filters. For those cases, a new USE_CALL_FILTER bit is added to the event_call flags, whose main purpose is to keep the old behavior for those cases until they can be updated with multibuffer support; at that point, the USE_CALL_FILTER flag (and the new associated call_filter_check_discard() function) can go away. The multibuffer support also made filter_current_check_discard() redundant, so this change removes that function as well and replaces it with filter_check_discard() (or call_filter_check_discard() as appropriate). Link: http://lkml.kernel.org/r/f16e9ce4270c62f46b2e966119225e1c3cca7e60.1382620672.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ftrace_event.h25
-rw-r--r--include/linux/syscalls.h4
2 files changed, 22 insertions, 7 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5eaa746735ff..9abbe630c456 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -202,6 +202,7 @@ enum {
202 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 202 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
203 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 203 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
204 TRACE_EVENT_FL_WAS_ENABLED_BIT, 204 TRACE_EVENT_FL_WAS_ENABLED_BIT,
205 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
205}; 206};
206 207
207/* 208/*
@@ -213,6 +214,7 @@ enum {
213 * WAS_ENABLED - Set and stays set when an event was ever enabled 214 * WAS_ENABLED - Set and stays set when an event was ever enabled
214 * (used for module unloading, if a module event is enabled, 215 * (used for module unloading, if a module event is enabled,
215 * it is best to clear the buffers that used it). 216 * it is best to clear the buffers that used it).
217 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
216 */ 218 */
217enum { 219enum {
218 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 220 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -220,6 +222,7 @@ enum {
220 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 222 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
221 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 223 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
222 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 224 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
225 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
223}; 226};
224 227
225struct ftrace_event_call { 228struct ftrace_event_call {
@@ -238,6 +241,7 @@ struct ftrace_event_call {
238 * bit 2: failed to apply filter 241 * bit 2: failed to apply filter
239 * bit 3: ftrace internal event (do not enable) 242 * bit 3: ftrace internal event (do not enable)
240 * bit 4: Event was enabled by module 243 * bit 4: Event was enabled by module
244 * bit 5: use call filter rather than file filter
241 */ 245 */
242 int flags; /* static flags of different events */ 246 int flags; /* static flags of different events */
243 247
@@ -253,6 +257,8 @@ struct ftrace_subsystem_dir;
253enum { 257enum {
254 FTRACE_EVENT_FL_ENABLED_BIT, 258 FTRACE_EVENT_FL_ENABLED_BIT,
255 FTRACE_EVENT_FL_RECORDED_CMD_BIT, 259 FTRACE_EVENT_FL_RECORDED_CMD_BIT,
260 FTRACE_EVENT_FL_FILTERED_BIT,
261 FTRACE_EVENT_FL_NO_SET_FILTER_BIT,
256 FTRACE_EVENT_FL_SOFT_MODE_BIT, 262 FTRACE_EVENT_FL_SOFT_MODE_BIT,
257 FTRACE_EVENT_FL_SOFT_DISABLED_BIT, 263 FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
258}; 264};
@@ -261,6 +267,8 @@ enum {
261 * Ftrace event file flags: 267 * Ftrace event file flags:
262 * ENABLED - The event is enabled 268 * ENABLED - The event is enabled
263 * RECORDED_CMD - The comms should be recorded at sched_switch 269 * RECORDED_CMD - The comms should be recorded at sched_switch
270 * FILTERED - The event has a filter attached
271 * NO_SET_FILTER - Set when filter has error and is to be ignored
264 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED 272 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED
265 * SOFT_DISABLED - When set, do not trace the event (even though its 273 * SOFT_DISABLED - When set, do not trace the event (even though its
266 * tracepoint may be enabled) 274 * tracepoint may be enabled)
@@ -268,6 +276,8 @@ enum {
268enum { 276enum {
269 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT), 277 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
270 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT), 278 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
279 FTRACE_EVENT_FL_FILTERED = (1 << FTRACE_EVENT_FL_FILTERED_BIT),
280 FTRACE_EVENT_FL_NO_SET_FILTER = (1 << FTRACE_EVENT_FL_NO_SET_FILTER_BIT),
271 FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT), 281 FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
272 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT), 282 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
273}; 283};
@@ -275,6 +285,7 @@ enum {
275struct ftrace_event_file { 285struct ftrace_event_file {
276 struct list_head list; 286 struct list_head list;
277 struct ftrace_event_call *event_call; 287 struct ftrace_event_call *event_call;
288 struct event_filter *filter;
278 struct dentry *dir; 289 struct dentry *dir;
279 struct trace_array *tr; 290 struct trace_array *tr;
280 struct ftrace_subsystem_dir *system; 291 struct ftrace_subsystem_dir *system;
@@ -310,12 +321,16 @@ struct ftrace_event_file {
310 321
311#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 322#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
312 323
313extern void destroy_preds(struct ftrace_event_call *call); 324extern void destroy_preds(struct ftrace_event_file *file);
325extern void destroy_call_preds(struct ftrace_event_call *call);
314extern int filter_match_preds(struct event_filter *filter, void *rec); 326extern int filter_match_preds(struct event_filter *filter, void *rec);
315extern int filter_current_check_discard(struct ring_buffer *buffer, 327
316 struct ftrace_event_call *call, 328extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
317 void *rec, 329 struct ring_buffer *buffer,
318 struct ring_buffer_event *event); 330 struct ring_buffer_event *event);
331extern int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
332 struct ring_buffer *buffer,
333 struct ring_buffer_event *event);
319 334
320enum { 335enum {
321 FILTER_OTHER = 0, 336 FILTER_OTHER = 0,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7fac04e7ff6e..10bafa97049d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -120,7 +120,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
120 .class = &event_class_syscall_enter, \ 120 .class = &event_class_syscall_enter, \
121 .event.funcs = &enter_syscall_print_funcs, \ 121 .event.funcs = &enter_syscall_print_funcs, \
122 .data = (void *)&__syscall_meta_##sname,\ 122 .data = (void *)&__syscall_meta_##sname,\
123 .flags = TRACE_EVENT_FL_CAP_ANY, \ 123 .flags = TRACE_EVENT_FL_CAP_ANY | TRACE_EVENT_FL_USE_CALL_FILTER,\
124 }; \ 124 }; \
125 static struct ftrace_event_call __used \ 125 static struct ftrace_event_call __used \
126 __attribute__((section("_ftrace_events"))) \ 126 __attribute__((section("_ftrace_events"))) \
@@ -134,7 +134,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
134 .class = &event_class_syscall_exit, \ 134 .class = &event_class_syscall_exit, \
135 .event.funcs = &exit_syscall_print_funcs, \ 135 .event.funcs = &exit_syscall_print_funcs, \
136 .data = (void *)&__syscall_meta_##sname,\ 136 .data = (void *)&__syscall_meta_##sname,\
137 .flags = TRACE_EVENT_FL_CAP_ANY, \ 137 .flags = TRACE_EVENT_FL_CAP_ANY | TRACE_EVENT_FL_USE_CALL_FILTER,\
138 }; \ 138 }; \
139 static struct ftrace_event_call __used \ 139 static struct ftrace_event_call __used \
140 __attribute__((section("_ftrace_events"))) \ 140 __attribute__((section("_ftrace_events"))) \