Skip to content

Commit 49e4154

Browse files
Zheng Yejianrostedt
authored andcommitted
tracing: Remove TRACE_EVENT_FL_FILTERED logic
After commit dcb0b55 ("tracing: Remove TRACE_EVENT_FL_USE_CALL_FILTER logic"), no one's going to set the TRACE_EVENT_FL_FILTERED or change the call->filter, so remove related logic. Link: https://lore.kernel.org/[email protected] Signed-off-by: Zheng Yejian <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 2aa746e commit 49e4154

File tree

10 files changed

+20
-78
lines changed

10 files changed

+20
-78
lines changed

include/linux/trace_events.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer,
326326
void trace_event_buffer_commit(struct trace_event_buffer *fbuffer);
327327

328328
enum {
329-
TRACE_EVENT_FL_FILTERED_BIT,
330329
TRACE_EVENT_FL_CAP_ANY_BIT,
331330
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
332331
TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
@@ -341,7 +340,6 @@ enum {
341340

342341
/*
343342
* Event flags:
344-
* FILTERED - The event has a filter attached
345343
* CAP_ANY - Any user can enable for perf
346344
* NO_SET_FILTER - Set when filter has error and is to be ignored
347345
* IGNORE_ENABLE - For trace internal events, do not enable with debugfs file
@@ -356,7 +354,6 @@ enum {
356354
* to a tracepoint yet, then it is cleared when it is.
357355
*/
358356
enum {
359-
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
360357
TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
361358
TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
362359
TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
@@ -381,7 +378,6 @@ struct trace_event_call {
381378
};
382379
struct trace_event event;
383380
char *print_fmt;
384-
struct event_filter *filter;
385381
/*
386382
* Static events can disappear with modules,
387383
* where as dynamic ones need their own ref count.

kernel/trace/trace.c

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -593,19 +593,6 @@ int tracing_check_open_get_tr(struct trace_array *tr)
593593
return 0;
594594
}
595595

596-
int call_filter_check_discard(struct trace_event_call *call, void *rec,
597-
struct trace_buffer *buffer,
598-
struct ring_buffer_event *event)
599-
{
600-
if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&
601-
!filter_match_preds(call->filter, rec)) {
602-
__trace_event_discard_commit(buffer, event);
603-
return 1;
604-
}
605-
606-
return 0;
607-
}
608-
609596
/**
610597
* trace_find_filtered_pid - check if a pid exists in a filtered_pid list
611598
* @filtered_pids: The list of pids to check
@@ -2889,7 +2876,6 @@ void
28892876
trace_function(struct trace_array *tr, unsigned long ip, unsigned long
28902877
parent_ip, unsigned int trace_ctx)
28912878
{
2892-
struct trace_event_call *call = &event_function;
28932879
struct trace_buffer *buffer = tr->array_buffer.buffer;
28942880
struct ring_buffer_event *event;
28952881
struct ftrace_entry *entry;
@@ -2902,11 +2888,9 @@ trace_function(struct trace_array *tr, unsigned long ip, unsigned long
29022888
entry->ip = ip;
29032889
entry->parent_ip = parent_ip;
29042890

2905-
if (!call_filter_check_discard(call, entry, buffer, event)) {
2906-
if (static_branch_unlikely(&trace_function_exports_enabled))
2907-
ftrace_exports(event, TRACE_EXPORT_FUNCTION);
2908-
__buffer_unlock_commit(buffer, event);
2909-
}
2891+
if (static_branch_unlikely(&trace_function_exports_enabled))
2892+
ftrace_exports(event, TRACE_EXPORT_FUNCTION);
2893+
__buffer_unlock_commit(buffer, event);
29102894
}
29112895

29122896
#ifdef CONFIG_STACKTRACE
@@ -2932,7 +2916,6 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
29322916
unsigned int trace_ctx,
29332917
int skip, struct pt_regs *regs)
29342918
{
2935-
struct trace_event_call *call = &event_kernel_stack;
29362919
struct ring_buffer_event *event;
29372920
unsigned int size, nr_entries;
29382921
struct ftrace_stack *fstack;
@@ -2986,8 +2969,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
29862969
memcpy(&entry->caller, fstack->calls,
29872970
flex_array_size(entry, caller, nr_entries));
29882971

2989-
if (!call_filter_check_discard(call, entry, buffer, event))
2990-
__buffer_unlock_commit(buffer, event);
2972+
__buffer_unlock_commit(buffer, event);
29912973

29922974
out:
29932975
/* Again, don't let gcc optimize things here */
@@ -3060,7 +3042,6 @@ static void
30603042
ftrace_trace_userstack(struct trace_array *tr,
30613043
struct trace_buffer *buffer, unsigned int trace_ctx)
30623044
{
3063-
struct trace_event_call *call = &event_user_stack;
30643045
struct ring_buffer_event *event;
30653046
struct userstack_entry *entry;
30663047

@@ -3094,8 +3075,7 @@ ftrace_trace_userstack(struct trace_array *tr,
30943075
memset(&entry->caller, 0, sizeof(entry->caller));
30953076

30963077
stack_trace_save_user(entry->caller, FTRACE_STACK_ENTRIES);
3097-
if (!call_filter_check_discard(call, entry, buffer, event))
3098-
__buffer_unlock_commit(buffer, event);
3078+
__buffer_unlock_commit(buffer, event);
30993079

31003080
out_drop_count:
31013081
__this_cpu_dec(user_stack_count);
@@ -3264,7 +3244,6 @@ static void trace_printk_start_stop_comm(int enabled)
32643244
*/
32653245
int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
32663246
{
3267-
struct trace_event_call *call = &event_bprint;
32683247
struct ring_buffer_event *event;
32693248
struct trace_buffer *buffer;
32703249
struct trace_array *tr = READ_ONCE(printk_trace);
@@ -3308,10 +3287,8 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
33083287
entry->fmt = fmt;
33093288

33103289
memcpy(entry->buf, tbuffer, sizeof(u32) * len);
3311-
if (!call_filter_check_discard(call, entry, buffer, event)) {
3312-
__buffer_unlock_commit(buffer, event);
3313-
ftrace_trace_stack(tr, buffer, trace_ctx, 6, NULL);
3314-
}
3290+
__buffer_unlock_commit(buffer, event);
3291+
ftrace_trace_stack(tr, buffer, trace_ctx, 6, NULL);
33153292

33163293
out:
33173294
ring_buffer_nest_end(buffer);
@@ -3331,7 +3308,6 @@ static int
33313308
__trace_array_vprintk(struct trace_buffer *buffer,
33323309
unsigned long ip, const char *fmt, va_list args)
33333310
{
3334-
struct trace_event_call *call = &event_print;
33353311
struct ring_buffer_event *event;
33363312
int len = 0, size;
33373313
struct print_entry *entry;
@@ -3366,10 +3342,8 @@ __trace_array_vprintk(struct trace_buffer *buffer,
33663342
entry->ip = ip;
33673343

33683344
memcpy(&entry->buf, tbuffer, len + 1);
3369-
if (!call_filter_check_discard(call, entry, buffer, event)) {
3370-
__buffer_unlock_commit(buffer, event);
3371-
ftrace_trace_stack(printk_trace, buffer, trace_ctx, 6, NULL);
3372-
}
3345+
__buffer_unlock_commit(buffer, event);
3346+
ftrace_trace_stack(printk_trace, buffer, trace_ctx, 6, NULL);
33733347

33743348
out:
33753349
ring_buffer_nest_end(buffer);

kernel/trace/trace.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,10 +1429,6 @@ struct trace_subsystem_dir {
14291429
int nr_events;
14301430
};
14311431

1432-
extern int call_filter_check_discard(struct trace_event_call *call, void *rec,
1433-
struct trace_buffer *buffer,
1434-
struct ring_buffer_event *event);
1435-
14361432
void trace_buffer_unlock_commit_regs(struct trace_array *tr,
14371433
struct trace_buffer *buffer,
14381434
struct ring_buffer_event *event,

kernel/trace/trace_branch.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static struct trace_array *branch_tracer;
3030
static void
3131
probe_likely_condition(struct ftrace_likely_data *f, int val, int expect)
3232
{
33-
struct trace_event_call *call = &event_branch;
3433
struct trace_array *tr = branch_tracer;
3534
struct trace_buffer *buffer;
3635
struct trace_array_cpu *data;
@@ -80,8 +79,7 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect)
8079
entry->line = f->data.line;
8180
entry->correct = val == expect;
8281

83-
if (!call_filter_check_discard(call, entry, buffer, event))
84-
trace_buffer_unlock_commit_nostack(buffer, event);
82+
trace_buffer_unlock_commit_nostack(buffer, event);
8583

8684
out:
8785
current->trace_recursion &= ~TRACE_BRANCH_BIT;

kernel/trace/trace_events.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,8 +3149,6 @@ static void __trace_remove_event_call(struct trace_event_call *call)
31493149
{
31503150
event_remove(call);
31513151
trace_destroy_fields(call);
3152-
free_event_filter(call->filter);
3153-
call->filter = NULL;
31543152
}
31553153

31563154
static int probe_remove_event_call(struct trace_event_call *call)

kernel/trace/trace_functions_graph.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ int __trace_graph_entry(struct trace_array *tr,
102102
struct ftrace_graph_ent *trace,
103103
unsigned int trace_ctx)
104104
{
105-
struct trace_event_call *call = &event_funcgraph_entry;
106105
struct ring_buffer_event *event;
107106
struct trace_buffer *buffer = tr->array_buffer.buffer;
108107
struct ftrace_graph_ent_entry *entry;
@@ -113,8 +112,7 @@ int __trace_graph_entry(struct trace_array *tr,
113112
return 0;
114113
entry = ring_buffer_event_data(event);
115114
entry->graph_ent = *trace;
116-
if (!call_filter_check_discard(call, entry, buffer, event))
117-
trace_buffer_unlock_commit_nostack(buffer, event);
115+
trace_buffer_unlock_commit_nostack(buffer, event);
118116

119117
return 1;
120118
}
@@ -223,7 +221,6 @@ void __trace_graph_return(struct trace_array *tr,
223221
struct ftrace_graph_ret *trace,
224222
unsigned int trace_ctx)
225223
{
226-
struct trace_event_call *call = &event_funcgraph_exit;
227224
struct ring_buffer_event *event;
228225
struct trace_buffer *buffer = tr->array_buffer.buffer;
229226
struct ftrace_graph_ret_entry *entry;
@@ -234,8 +231,7 @@ void __trace_graph_return(struct trace_array *tr,
234231
return;
235232
entry = ring_buffer_event_data(event);
236233
entry->ret = *trace;
237-
if (!call_filter_check_discard(call, entry, buffer, event))
238-
trace_buffer_unlock_commit_nostack(buffer, event);
234+
trace_buffer_unlock_commit_nostack(buffer, event);
239235
}
240236

241237
void trace_graph_return(struct ftrace_graph_ret *trace,

kernel/trace/trace_hwlat.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static bool hwlat_busy;
130130
static void trace_hwlat_sample(struct hwlat_sample *sample)
131131
{
132132
struct trace_array *tr = hwlat_trace;
133-
struct trace_event_call *call = &event_hwlat;
134133
struct trace_buffer *buffer = tr->array_buffer.buffer;
135134
struct ring_buffer_event *event;
136135
struct hwlat_entry *entry;
@@ -148,8 +147,7 @@ static void trace_hwlat_sample(struct hwlat_sample *sample)
148147
entry->nmi_count = sample->nmi_count;
149148
entry->count = sample->count;
150149

151-
if (!call_filter_check_discard(call, entry, buffer, event))
152-
trace_buffer_unlock_commit_nostack(buffer, event);
150+
trace_buffer_unlock_commit_nostack(buffer, event);
153151
}
154152

155153
/* Macros to encapsulate the time capturing infrastructure */

kernel/trace/trace_mmiotrace.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
294294
struct trace_array_cpu *data,
295295
struct mmiotrace_rw *rw)
296296
{
297-
struct trace_event_call *call = &event_mmiotrace_rw;
298297
struct trace_buffer *buffer = tr->array_buffer.buffer;
299298
struct ring_buffer_event *event;
300299
struct trace_mmiotrace_rw *entry;
@@ -310,8 +309,7 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
310309
entry = ring_buffer_event_data(event);
311310
entry->rw = *rw;
312311

313-
if (!call_filter_check_discard(call, entry, buffer, event))
314-
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
312+
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
315313
}
316314

317315
void mmio_trace_rw(struct mmiotrace_rw *rw)
@@ -325,7 +323,6 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
325323
struct trace_array_cpu *data,
326324
struct mmiotrace_map *map)
327325
{
328-
struct trace_event_call *call = &event_mmiotrace_map;
329326
struct trace_buffer *buffer = tr->array_buffer.buffer;
330327
struct ring_buffer_event *event;
331328
struct trace_mmiotrace_map *entry;
@@ -341,8 +338,7 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
341338
entry = ring_buffer_event_data(event);
342339
entry->map = *map;
343340

344-
if (!call_filter_check_discard(call, entry, buffer, event))
345-
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
341+
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
346342
}
347343

348344
void mmio_trace_mapping(struct mmiotrace_map *map)

kernel/trace/trace_osnoise.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ static void print_osnoise_headers(struct seq_file *s)
499499
static void
500500
__trace_osnoise_sample(struct osnoise_sample *sample, struct trace_buffer *buffer)
501501
{
502-
struct trace_event_call *call = &event_osnoise;
503502
struct ring_buffer_event *event;
504503
struct osnoise_entry *entry;
505504

@@ -517,8 +516,7 @@ __trace_osnoise_sample(struct osnoise_sample *sample, struct trace_buffer *buffe
517516
entry->softirq_count = sample->softirq_count;
518517
entry->thread_count = sample->thread_count;
519518

520-
if (!call_filter_check_discard(call, entry, buffer, event))
521-
trace_buffer_unlock_commit_nostack(buffer, event);
519+
trace_buffer_unlock_commit_nostack(buffer, event);
522520
}
523521

524522
/*
@@ -578,7 +576,6 @@ static void print_timerlat_headers(struct seq_file *s)
578576
static void
579577
__trace_timerlat_sample(struct timerlat_sample *sample, struct trace_buffer *buffer)
580578
{
581-
struct trace_event_call *call = &event_osnoise;
582579
struct ring_buffer_event *event;
583580
struct timerlat_entry *entry;
584581

@@ -591,8 +588,7 @@ __trace_timerlat_sample(struct timerlat_sample *sample, struct trace_buffer *buf
591588
entry->context = sample->context;
592589
entry->timer_latency = sample->timer_latency;
593590

594-
if (!call_filter_check_discard(call, entry, buffer, event))
595-
trace_buffer_unlock_commit_nostack(buffer, event);
591+
trace_buffer_unlock_commit_nostack(buffer, event);
596592
}
597593

598594
/*
@@ -654,7 +650,6 @@ static void timerlat_save_stack(int skip)
654650
static void
655651
__timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, unsigned int size)
656652
{
657-
struct trace_event_call *call = &event_osnoise;
658653
struct ring_buffer_event *event;
659654
struct stack_entry *entry;
660655

@@ -668,8 +663,7 @@ __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, u
668663
memcpy(&entry->caller, fstack->calls, size);
669664
entry->size = fstack->nr_entries;
670665

671-
if (!call_filter_check_discard(call, entry, buffer, event))
672-
trace_buffer_unlock_commit_nostack(buffer, event);
666+
trace_buffer_unlock_commit_nostack(buffer, event);
673667
}
674668

675669
/*

kernel/trace/trace_sched_wakeup.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ tracing_sched_switch_trace(struct trace_array *tr,
378378
struct task_struct *next,
379379
unsigned int trace_ctx)
380380
{
381-
struct trace_event_call *call = &event_context_switch;
382381
struct trace_buffer *buffer = tr->array_buffer.buffer;
383382
struct ring_buffer_event *event;
384383
struct ctx_switch_entry *entry;
@@ -396,8 +395,7 @@ tracing_sched_switch_trace(struct trace_array *tr,
396395
entry->next_state = task_state_index(next);
397396
entry->next_cpu = task_cpu(next);
398397

399-
if (!call_filter_check_discard(call, entry, buffer, event))
400-
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
398+
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
401399
}
402400

403401
static void
@@ -406,7 +404,6 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
406404
struct task_struct *curr,
407405
unsigned int trace_ctx)
408406
{
409-
struct trace_event_call *call = &event_wakeup;
410407
struct ring_buffer_event *event;
411408
struct ctx_switch_entry *entry;
412409
struct trace_buffer *buffer = tr->array_buffer.buffer;
@@ -424,8 +421,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
424421
entry->next_state = task_state_index(wakee);
425422
entry->next_cpu = task_cpu(wakee);
426423

427-
if (!call_filter_check_discard(call, entry, buffer, event))
428-
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
424+
trace_buffer_unlock_commit(tr, buffer, event, trace_ctx);
429425
}
430426

431427
static void notrace

0 commit comments

Comments
 (0)