Skip to content

Commit 60ba770

Browse files
Steven Rostedtrostedt
authored andcommitted
tracing: add filter event logic to special, mmiotrace and boot tracers
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>
1 parent 51df5fc commit 60ba770

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎kernel/trace/trace.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ ftrace_trace_special(void *__tr,
12061206
unsigned long arg1, unsigned long arg2, unsigned long arg3,
12071207
int pc)
12081208
{
1209+
struct ftrace_event_call *call = &event_special;
12091210
struct ring_buffer_event *event;
12101211
struct trace_array *tr = __tr;
12111212
struct ring_buffer *buffer = tr->buffer;
@@ -1219,7 +1220,9 @@ ftrace_trace_special(void *__tr,
12191220
entry->arg1 = arg1;
12201221
entry->arg2 = arg2;
12211222
entry->arg3 = arg3;
1222-
trace_buffer_unlock_commit(buffer, event, 0, pc);
1223+
1224+
if (!filter_check_discard(call, entry, buffer, event))
1225+
trace_buffer_unlock_commit(buffer, event, 0, pc);
12231226
}
12241227

12251228
void

‎kernel/trace/trace_boot.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct tracer boot_tracer __read_mostly =
129129

130130
void trace_boot_call(struct boot_trace_call *bt, initcall_t fn)
131131
{
132+
struct ftrace_event_call *call = &event_boot_call;
132133
struct ring_buffer_event *event;
133134
struct ring_buffer *buffer;
134135
struct trace_boot_call *entry;
@@ -150,13 +151,15 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn)
150151
goto out;
151152
entry = ring_buffer_event_data(event);
152153
entry->boot_call = *bt;
153-
trace_buffer_unlock_commit(buffer, event, 0, 0);
154+
if (!filter_check_discard(call, entry, buffer, event))
155+
trace_buffer_unlock_commit(buffer, event, 0, 0);
154156
out:
155157
preempt_enable();
156158
}
157159

158160
void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn)
159161
{
162+
struct ftrace_event_call *call = &event_boot_ret;
160163
struct ring_buffer_event *event;
161164
struct ring_buffer *buffer;
162165
struct trace_boot_ret *entry;
@@ -175,7 +178,8 @@ void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn)
175178
goto out;
176179
entry = ring_buffer_event_data(event);
177180
entry->boot_ret = *bt;
178-
trace_buffer_unlock_commit(buffer, event, 0, 0);
181+
if (!filter_check_discard(call, entry, buffer, event))
182+
trace_buffer_unlock_commit(buffer, event, 0, 0);
179183
out:
180184
preempt_enable();
181185
}

‎kernel/trace/trace_mmiotrace.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
307307
struct trace_array_cpu *data,
308308
struct mmiotrace_rw *rw)
309309
{
310+
struct ftrace_event_call *call = &event_mmiotrace_rw;
310311
struct ring_buffer *buffer = tr->buffer;
311312
struct ring_buffer_event *event;
312313
struct trace_mmiotrace_rw *entry;
@@ -320,7 +321,9 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
320321
}
321322
entry = ring_buffer_event_data(event);
322323
entry->rw = *rw;
323-
trace_buffer_unlock_commit(buffer, event, 0, pc);
324+
325+
if (!filter_check_discard(call, entry, buffer, event))
326+
trace_buffer_unlock_commit(buffer, event, 0, pc);
324327
}
325328

326329
void mmio_trace_rw(struct mmiotrace_rw *rw)
@@ -334,6 +337,7 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
334337
struct trace_array_cpu *data,
335338
struct mmiotrace_map *map)
336339
{
340+
struct ftrace_event_call *call = &event_mmiotrace_map;
337341
struct ring_buffer *buffer = tr->buffer;
338342
struct ring_buffer_event *event;
339343
struct trace_mmiotrace_map *entry;
@@ -347,7 +351,9 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
347351
}
348352
entry = ring_buffer_event_data(event);
349353
entry->map = *map;
350-
trace_buffer_unlock_commit(buffer, event, 0, pc);
354+
355+
if (!filter_check_discard(call, entry, buffer, event))
356+
trace_buffer_unlock_commit(buffer, event, 0, pc);
351357
}
352358

353359
void mmio_trace_mapping(struct mmiotrace_map *map)

0 commit comments

Comments
 (0)