tracing: add filter event logic to special, mmiotrace and boot tracers
authorSteven Rostedt <srostedt@redhat.com>
Sun, 13 Sep 2009 03:34:04 +0000 (23:34 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Sun, 13 Sep 2009 03:34:04 +0000 (23:34 -0400)
Now that the pluging tracers use macros to create the structures and
automate the exporting of their formats to the format files, they also
automatically get a filter file.

This patch adds the code to implement the filter logic in the trace
recordings.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c
kernel/trace/trace_boot.c
kernel/trace/trace_mmiotrace.c

index ef82a7fabf3b285825bad541adb7d98bc12929cc..fd52a19dd1725d0c28829b9096eced2e6af9adae 100644 (file)
@@ -1206,6 +1206,7 @@ ftrace_trace_special(void *__tr,
                     unsigned long arg1, unsigned long arg2, unsigned long arg3,
                     int pc)
 {
+       struct ftrace_event_call *call = &event_special;
        struct ring_buffer_event *event;
        struct trace_array *tr = __tr;
        struct ring_buffer *buffer = tr->buffer;
@@ -1219,7 +1220,9 @@ ftrace_trace_special(void *__tr,
        entry->arg1                     = arg1;
        entry->arg2                     = arg2;
        entry->arg3                     = arg3;
-       trace_buffer_unlock_commit(buffer, event, 0, pc);
+
+       if (!filter_check_discard(call, entry, buffer, event))
+               trace_buffer_unlock_commit(buffer, event, 0, pc);
 }
 
 void
index 19bfc75d467e34927593243341effcdab9c51747..c21d5f3956ad790f58a3672a94d5ba09243260fe 100644 (file)
@@ -129,6 +129,7 @@ struct tracer boot_tracer __read_mostly =
 
 void trace_boot_call(struct boot_trace_call *bt, initcall_t fn)
 {
+       struct ftrace_event_call *call = &event_boot_call;
        struct ring_buffer_event *event;
        struct ring_buffer *buffer;
        struct trace_boot_call *entry;
@@ -150,13 +151,15 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn)
                goto out;
        entry   = ring_buffer_event_data(event);
        entry->boot_call = *bt;
-       trace_buffer_unlock_commit(buffer, event, 0, 0);
+       if (!filter_check_discard(call, entry, buffer, event))
+               trace_buffer_unlock_commit(buffer, event, 0, 0);
  out:
        preempt_enable();
 }
 
 void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn)
 {
+       struct ftrace_event_call *call = &event_boot_ret;
        struct ring_buffer_event *event;
        struct ring_buffer *buffer;
        struct trace_boot_ret *entry;
@@ -175,7 +178,8 @@ void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn)
                goto out;
        entry   = ring_buffer_event_data(event);
        entry->boot_ret = *bt;
-       trace_buffer_unlock_commit(buffer, event, 0, 0);
+       if (!filter_check_discard(call, entry, buffer, event))
+               trace_buffer_unlock_commit(buffer, event, 0, 0);
  out:
        preempt_enable();
 }
index c4c9bbda53d3a5753ac986d83f669fee4a4264f6..0acd834659ed9f9306165d40b81d34a563604095 100644 (file)
@@ -307,6 +307,7 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
                                struct trace_array_cpu *data,
                                struct mmiotrace_rw *rw)
 {
+       struct ftrace_event_call *call = &event_mmiotrace_rw;
        struct ring_buffer *buffer = tr->buffer;
        struct ring_buffer_event *event;
        struct trace_mmiotrace_rw *entry;
@@ -320,7 +321,9 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
        }
        entry   = ring_buffer_event_data(event);
        entry->rw                       = *rw;
-       trace_buffer_unlock_commit(buffer, event, 0, pc);
+
+       if (!filter_check_discard(call, entry, buffer, event))
+               trace_buffer_unlock_commit(buffer, event, 0, pc);
 }
 
 void mmio_trace_rw(struct mmiotrace_rw *rw)
@@ -334,6 +337,7 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
                                struct trace_array_cpu *data,
                                struct mmiotrace_map *map)
 {
+       struct ftrace_event_call *call = &event_mmiotrace_map;
        struct ring_buffer *buffer = tr->buffer;
        struct ring_buffer_event *event;
        struct trace_mmiotrace_map *entry;
@@ -347,7 +351,9 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
        }
        entry   = ring_buffer_event_data(event);
        entry->map                      = *map;
-       trace_buffer_unlock_commit(buffer, event, 0, pc);
+
+       if (!filter_check_discard(call, entry, buffer, event))
+               trace_buffer_unlock_commit(buffer, event, 0, pc);
 }
 
 void mmio_trace_mapping(struct mmiotrace_map *map)