Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Remove TRACE_EVENT_FL_FILTERED logic

After commit dcb0b5575d24 ("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/20240911010026.2302849-1-zhengyejian@huaweicloud.com
Signed-off-by: Zheng Yejian <zhengyejian@huaweicloud.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Zheng Yejian and committed by
Steven Rostedt (Google)
49e4154f 2aa746ec

+20 -78
-4
include/linux/trace_events.h
··· 326 326 void trace_event_buffer_commit(struct trace_event_buffer *fbuffer); 327 327 328 328 enum { 329 - TRACE_EVENT_FL_FILTERED_BIT, 330 329 TRACE_EVENT_FL_CAP_ANY_BIT, 331 330 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 332 331 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, ··· 340 341 341 342 /* 342 343 * Event flags: 343 - * FILTERED - The event has a filter attached 344 344 * CAP_ANY - Any user can enable for perf 345 345 * NO_SET_FILTER - Set when filter has error and is to be ignored 346 346 * IGNORE_ENABLE - For trace internal events, do not enable with debugfs file ··· 354 356 * to a tracepoint yet, then it is cleared when it is. 355 357 */ 356 358 enum { 357 - TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 358 359 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 359 360 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 360 361 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), ··· 378 381 }; 379 382 struct trace_event event; 380 383 char *print_fmt; 381 - struct event_filter *filter; 382 384 /* 383 385 * Static events can disappear with modules, 384 386 * where as dynamic ones need their own ref count.
+9 -35
kernel/trace/trace.c
··· 593 593 return 0; 594 594 } 595 595 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 - 609 596 /** 610 597 * trace_find_filtered_pid - check if a pid exists in a filtered_pid list 611 598 * @filtered_pids: The list of pids to check ··· 2876 2889 trace_function(struct trace_array *tr, unsigned long ip, unsigned long 2877 2890 parent_ip, unsigned int trace_ctx) 2878 2891 { 2879 - struct trace_event_call *call = &event_function; 2880 2892 struct trace_buffer *buffer = tr->array_buffer.buffer; 2881 2893 struct ring_buffer_event *event; 2882 2894 struct ftrace_entry *entry; ··· 2888 2902 entry->ip = ip; 2889 2903 entry->parent_ip = parent_ip; 2890 2904 2891 - if (!call_filter_check_discard(call, entry, buffer, event)) { 2892 - if (static_branch_unlikely(&trace_function_exports_enabled)) 2893 - ftrace_exports(event, TRACE_EXPORT_FUNCTION); 2894 - __buffer_unlock_commit(buffer, event); 2895 - } 2905 + if (static_branch_unlikely(&trace_function_exports_enabled)) 2906 + ftrace_exports(event, TRACE_EXPORT_FUNCTION); 2907 + __buffer_unlock_commit(buffer, event); 2896 2908 } 2897 2909 2898 2910 #ifdef CONFIG_STACKTRACE ··· 2916 2932 unsigned int trace_ctx, 2917 2933 int skip, struct pt_regs *regs) 2918 2934 { 2919 - struct trace_event_call *call = &event_kernel_stack; 2920 2935 struct ring_buffer_event *event; 2921 2936 unsigned int size, nr_entries; 2922 2937 struct ftrace_stack *fstack; ··· 2969 2986 memcpy(&entry->caller, fstack->calls, 2970 2987 flex_array_size(entry, caller, nr_entries)); 2971 2988 2972 - if (!call_filter_check_discard(call, entry, buffer, event)) 2973 - __buffer_unlock_commit(buffer, event); 2989 + __buffer_unlock_commit(buffer, event); 2974 2990 2975 2991 out: 2976 2992 /* Again, don't let gcc optimize things here */ ··· 3042 3060 ftrace_trace_userstack(struct trace_array *tr, 3043 3061 struct trace_buffer *buffer, unsigned int trace_ctx) 3044 3062 { 3045 - struct trace_event_call *call = &event_user_stack; 3046 3063 struct ring_buffer_event *event; 3047 3064 struct userstack_entry *entry; 3048 3065 ··· 3075 3094 memset(&entry->caller, 0, sizeof(entry->caller)); 3076 3095 3077 3096 stack_trace_save_user(entry->caller, FTRACE_STACK_ENTRIES); 3078 - if (!call_filter_check_discard(call, entry, buffer, event)) 3079 - __buffer_unlock_commit(buffer, event); 3097 + __buffer_unlock_commit(buffer, event); 3080 3098 3081 3099 out_drop_count: 3082 3100 __this_cpu_dec(user_stack_count); ··· 3244 3264 */ 3245 3265 int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) 3246 3266 { 3247 - struct trace_event_call *call = &event_bprint; 3248 3267 struct ring_buffer_event *event; 3249 3268 struct trace_buffer *buffer; 3250 3269 struct trace_array *tr = READ_ONCE(printk_trace); ··· 3287 3308 entry->fmt = fmt; 3288 3309 3289 3310 memcpy(entry->buf, tbuffer, sizeof(u32) * len); 3290 - if (!call_filter_check_discard(call, entry, buffer, event)) { 3291 - __buffer_unlock_commit(buffer, event); 3292 - ftrace_trace_stack(tr, buffer, trace_ctx, 6, NULL); 3293 - } 3311 + __buffer_unlock_commit(buffer, event); 3312 + ftrace_trace_stack(tr, buffer, trace_ctx, 6, NULL); 3294 3313 3295 3314 out: 3296 3315 ring_buffer_nest_end(buffer); ··· 3308 3331 __trace_array_vprintk(struct trace_buffer *buffer, 3309 3332 unsigned long ip, const char *fmt, va_list args) 3310 3333 { 3311 - struct trace_event_call *call = &event_print; 3312 3334 struct ring_buffer_event *event; 3313 3335 int len = 0, size; 3314 3336 struct print_entry *entry; ··· 3342 3366 entry->ip = ip; 3343 3367 3344 3368 memcpy(&entry->buf, tbuffer, len + 1); 3345 - if (!call_filter_check_discard(call, entry, buffer, event)) { 3346 - __buffer_unlock_commit(buffer, event); 3347 - ftrace_trace_stack(printk_trace, buffer, trace_ctx, 6, NULL); 3348 - } 3369 + __buffer_unlock_commit(buffer, event); 3370 + ftrace_trace_stack(printk_trace, buffer, trace_ctx, 6, NULL); 3349 3371 3350 3372 out: 3351 3373 ring_buffer_nest_end(buffer);
-4
kernel/trace/trace.h
··· 1429 1429 int nr_events; 1430 1430 }; 1431 1431 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 - 1436 1432 void trace_buffer_unlock_commit_regs(struct trace_array *tr, 1437 1433 struct trace_buffer *buffer, 1438 1434 struct ring_buffer_event *event,
+1 -3
kernel/trace/trace_branch.c
··· 30 30 static void 31 31 probe_likely_condition(struct ftrace_likely_data *f, int val, int expect) 32 32 { 33 - struct trace_event_call *call = &event_branch; 34 33 struct trace_array *tr = branch_tracer; 35 34 struct trace_buffer *buffer; 36 35 struct trace_array_cpu *data; ··· 79 80 entry->line = f->data.line; 80 81 entry->correct = val == expect; 81 82 82 - if (!call_filter_check_discard(call, entry, buffer, event)) 83 - trace_buffer_unlock_commit_nostack(buffer, event); 83 + trace_buffer_unlock_commit_nostack(buffer, event); 84 84 85 85 out: 86 86 current->trace_recursion &= ~TRACE_BRANCH_BIT;
-2
kernel/trace/trace_events.c
··· 3149 3149 { 3150 3150 event_remove(call); 3151 3151 trace_destroy_fields(call); 3152 - free_event_filter(call->filter); 3153 - call->filter = NULL; 3154 3152 } 3155 3153 3156 3154 static int probe_remove_event_call(struct trace_event_call *call)
+2 -6
kernel/trace/trace_functions_graph.c
··· 102 102 struct ftrace_graph_ent *trace, 103 103 unsigned int trace_ctx) 104 104 { 105 - struct trace_event_call *call = &event_funcgraph_entry; 106 105 struct ring_buffer_event *event; 107 106 struct trace_buffer *buffer = tr->array_buffer.buffer; 108 107 struct ftrace_graph_ent_entry *entry; ··· 112 113 return 0; 113 114 entry = ring_buffer_event_data(event); 114 115 entry->graph_ent = *trace; 115 - if (!call_filter_check_discard(call, entry, buffer, event)) 116 - trace_buffer_unlock_commit_nostack(buffer, event); 116 + trace_buffer_unlock_commit_nostack(buffer, event); 117 117 118 118 return 1; 119 119 } ··· 221 223 struct ftrace_graph_ret *trace, 222 224 unsigned int trace_ctx) 223 225 { 224 - struct trace_event_call *call = &event_funcgraph_exit; 225 226 struct ring_buffer_event *event; 226 227 struct trace_buffer *buffer = tr->array_buffer.buffer; 227 228 struct ftrace_graph_ret_entry *entry; ··· 231 234 return; 232 235 entry = ring_buffer_event_data(event); 233 236 entry->ret = *trace; 234 - if (!call_filter_check_discard(call, entry, buffer, event)) 235 - trace_buffer_unlock_commit_nostack(buffer, event); 237 + trace_buffer_unlock_commit_nostack(buffer, event); 236 238 } 237 239 238 240 void trace_graph_return(struct ftrace_graph_ret *trace,
+1 -3
kernel/trace/trace_hwlat.c
··· 130 130 static void trace_hwlat_sample(struct hwlat_sample *sample) 131 131 { 132 132 struct trace_array *tr = hwlat_trace; 133 - struct trace_event_call *call = &event_hwlat; 134 133 struct trace_buffer *buffer = tr->array_buffer.buffer; 135 134 struct ring_buffer_event *event; 136 135 struct hwlat_entry *entry; ··· 147 148 entry->nmi_count = sample->nmi_count; 148 149 entry->count = sample->count; 149 150 150 - if (!call_filter_check_discard(call, entry, buffer, event)) 151 - trace_buffer_unlock_commit_nostack(buffer, event); 151 + trace_buffer_unlock_commit_nostack(buffer, event); 152 152 } 153 153 154 154 /* Macros to encapsulate the time capturing infrastructure */
+2 -6
kernel/trace/trace_mmiotrace.c
··· 294 294 struct trace_array_cpu *data, 295 295 struct mmiotrace_rw *rw) 296 296 { 297 - struct trace_event_call *call = &event_mmiotrace_rw; 298 297 struct trace_buffer *buffer = tr->array_buffer.buffer; 299 298 struct ring_buffer_event *event; 300 299 struct trace_mmiotrace_rw *entry; ··· 309 310 entry = ring_buffer_event_data(event); 310 311 entry->rw = *rw; 311 312 312 - if (!call_filter_check_discard(call, entry, buffer, event)) 313 - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 313 + trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 314 314 } 315 315 316 316 void mmio_trace_rw(struct mmiotrace_rw *rw) ··· 323 325 struct trace_array_cpu *data, 324 326 struct mmiotrace_map *map) 325 327 { 326 - struct trace_event_call *call = &event_mmiotrace_map; 327 328 struct trace_buffer *buffer = tr->array_buffer.buffer; 328 329 struct ring_buffer_event *event; 329 330 struct trace_mmiotrace_map *entry; ··· 338 341 entry = ring_buffer_event_data(event); 339 342 entry->map = *map; 340 343 341 - if (!call_filter_check_discard(call, entry, buffer, event)) 342 - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 344 + trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 343 345 } 344 346 345 347 void mmio_trace_mapping(struct mmiotrace_map *map)
+3 -9
kernel/trace/trace_osnoise.c
··· 499 499 static void 500 500 __trace_osnoise_sample(struct osnoise_sample *sample, struct trace_buffer *buffer) 501 501 { 502 - struct trace_event_call *call = &event_osnoise; 503 502 struct ring_buffer_event *event; 504 503 struct osnoise_entry *entry; 505 504 ··· 516 517 entry->softirq_count = sample->softirq_count; 517 518 entry->thread_count = sample->thread_count; 518 519 519 - if (!call_filter_check_discard(call, entry, buffer, event)) 520 - trace_buffer_unlock_commit_nostack(buffer, event); 520 + trace_buffer_unlock_commit_nostack(buffer, event); 521 521 } 522 522 523 523 /* ··· 576 578 static void 577 579 __trace_timerlat_sample(struct timerlat_sample *sample, struct trace_buffer *buffer) 578 580 { 579 - struct trace_event_call *call = &event_osnoise; 580 581 struct ring_buffer_event *event; 581 582 struct timerlat_entry *entry; 582 583 ··· 588 591 entry->context = sample->context; 589 592 entry->timer_latency = sample->timer_latency; 590 593 591 - if (!call_filter_check_discard(call, entry, buffer, event)) 592 - trace_buffer_unlock_commit_nostack(buffer, event); 594 + trace_buffer_unlock_commit_nostack(buffer, event); 593 595 } 594 596 595 597 /* ··· 650 654 static void 651 655 __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, unsigned int size) 652 656 { 653 - struct trace_event_call *call = &event_osnoise; 654 657 struct ring_buffer_event *event; 655 658 struct stack_entry *entry; 656 659 ··· 663 668 memcpy(&entry->caller, fstack->calls, size); 664 669 entry->size = fstack->nr_entries; 665 670 666 - if (!call_filter_check_discard(call, entry, buffer, event)) 667 - trace_buffer_unlock_commit_nostack(buffer, event); 671 + trace_buffer_unlock_commit_nostack(buffer, event); 668 672 } 669 673 670 674 /*
+2 -6
kernel/trace/trace_sched_wakeup.c
··· 378 378 struct task_struct *next, 379 379 unsigned int trace_ctx) 380 380 { 381 - struct trace_event_call *call = &event_context_switch; 382 381 struct trace_buffer *buffer = tr->array_buffer.buffer; 383 382 struct ring_buffer_event *event; 384 383 struct ctx_switch_entry *entry; ··· 395 396 entry->next_state = task_state_index(next); 396 397 entry->next_cpu = task_cpu(next); 397 398 398 - if (!call_filter_check_discard(call, entry, buffer, event)) 399 - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 399 + trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 400 400 } 401 401 402 402 static void ··· 404 406 struct task_struct *curr, 405 407 unsigned int trace_ctx) 406 408 { 407 - struct trace_event_call *call = &event_wakeup; 408 409 struct ring_buffer_event *event; 409 410 struct ctx_switch_entry *entry; 410 411 struct trace_buffer *buffer = tr->array_buffer.buffer; ··· 421 424 entry->next_state = task_state_index(wakee); 422 425 entry->next_cpu = task_cpu(wakee); 423 426 424 - if (!call_filter_check_discard(call, entry, buffer, event)) 425 - trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 427 + trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); 426 428 } 427 429 428 430 static void notrace