aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
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 /kernel/trace/trace.h
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 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index d1cf5159bec0..12d1a612a73e 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1007,9 +1007,9 @@ struct filter_pred {
1007 1007
1008extern enum regex_type 1008extern enum regex_type
1009filter_parse_regex(char *buff, int len, char **search, int *not); 1009filter_parse_regex(char *buff, int len, char **search, int *not);
1010extern void print_event_filter(struct ftrace_event_call *call, 1010extern void print_event_filter(struct ftrace_event_file *file,
1011 struct trace_seq *s); 1011 struct trace_seq *s);
1012extern int apply_event_filter(struct ftrace_event_call *call, 1012extern int apply_event_filter(struct ftrace_event_file *file,
1013 char *filter_string); 1013 char *filter_string);
1014extern int apply_subsystem_event_filter(struct ftrace_subsystem_dir *dir, 1014extern int apply_subsystem_event_filter(struct ftrace_subsystem_dir *dir,
1015 char *filter_string); 1015 char *filter_string);
@@ -1020,20 +1020,6 @@ extern int filter_assign_type(const char *type);
1020struct ftrace_event_field * 1020struct ftrace_event_field *
1021trace_find_event_field(struct ftrace_event_call *call, char *name); 1021trace_find_event_field(struct ftrace_event_call *call, char *name);
1022 1022
1023static inline int
1024filter_check_discard(struct ftrace_event_call *call, void *rec,
1025 struct ring_buffer *buffer,
1026 struct ring_buffer_event *event)
1027{
1028 if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&
1029 !filter_match_preds(call->filter, rec)) {
1030 ring_buffer_discard_commit(buffer, event);
1031 return 1;
1032 }
1033
1034 return 0;
1035}
1036
1037extern void trace_event_enable_cmd_record(bool enable); 1023extern void trace_event_enable_cmd_record(bool enable);
1038extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr); 1024extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);
1039extern int event_trace_del_tracer(struct trace_array *tr); 1025extern int event_trace_del_tracer(struct trace_array *tr);