tracing: Updates for 6.13
Steven Rostedt
maintainercover tracing: Updates for 6.13
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next
Head SHA1: e53244e2c8931f9e80c1841293aea86ef8ad32a3
Josh Poimboeuf (1):
tracepoints: Use new static branch API
Justin Stitt (1):
tracing/branch-profiler: Replace deprecated strncpy with strscpy
Li Chen (1):
ftrace: Use this_cpu_ptr() instead of per_cpu_ptr(smp_processor_id())
Steven Rostedt (2):
tracing: Remove definition of trace_*_rcuidle()
tracepoint: Remove SRCU protection
Zheng Yejian (1):
tracing: Remove TRACE_EVENT_FL_FILTERED logic
----
include/linux/trace_events.h | 4 --- include/linux/tracepoint-defs.h | 4 +-- include/linux/tracepoint.h | 60 +++--------------------------------- include/trace/events/preemptirq.h | 8 ----- kernel/trace/trace.c | 44 ++++++-------------------- kernel/trace/trace.h | 4 --- kernel/trace/trace_branch.c | 10 ++---- kernel/trace/trace_events.c | 2 -- kernel/trace/trace_events_hist.c | 2 +- kernel/trace/trace_events_user.c | 4 +-- kernel/trace/trace_functions.c | 10 ++---- kernel/trace/trace_functions_graph.c | 8 ++--- kernel/trace/trace_hwlat.c | 4 +-- kernel/trace/trace_mmiotrace.c | 8 ++--- kernel/trace/trace_osnoise.c | 12 ++------ kernel/trace/trace_preemptirq.c | 26 ++++------------ kernel/trace/trace_sched_wakeup.c | 8 ++--- kernel/tracepoint.c | 55 ++------------------------------- scripts/tags.sh | 2 -- 19 files changed, 44 insertions(+), 231 deletions(-)
Steven Rostedt
maintainerPATCH 1/6 ftrace: Use this_cpu_ptr() instead of per_cpu_ptr(smp_processor_id())
From: Li Chen <[email protected]>
Use this_cpu_ptr() instead of open coding the equivalent in various ftrace functions.
--- kernel/trace/trace_functions.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
kernel/trace/trace_functions.c +3 -7
@@ -184,7 +184,6 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,struct trace_array_cpu *data;unsigned int trace_ctx;int bit; -int cpu;if (unlikely (!tr->function_enabled))return ;
@@ -195,8 +194,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip, trace_ctx =tracing_gen_ctx (); - cpu =smp_processor_id (); - data =per_cpu_ptr (tr->array_buffer.data, cpu); + data =this_cpu_ptr (tr->array_buffer.data);if (!atomic_read (&data->disabled))trace_function (tr, ip, parent_ip, trace_ctx);
@@ -300,7 +298,6 @@ function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,unsigned int trace_ctx;unsigned long flags;int bit; -int cpu;if (unlikely (!tr->function_enabled))return ;
@@ -309,8 +306,7 @@ function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,if (bit <0 )return ; - cpu =smp_processor_id (); - data =per_cpu_ptr (tr->array_buffer.data, cpu); + data =this_cpu_ptr (tr->array_buffer.data);if (atomic_read (&data->disabled)) goto out;
@@ -321,7 +317,7 @@ function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,* TODO: think about a solution that is better than just hoping to be * lucky. */ - last_info =per_cpu_ptr (tr->last_func_repeats, cpu); + last_info =this_cpu_ptr (tr->last_func_repeats);if (is_repeat_check (tr, last_info, ip, parent_ip)) goto out;
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 2/6 tracing/branch-profiler: Replace deprecated strncpy with strscpy
In reply to Steven RostedtFrom: Justin Stitt <[email protected]>
strncpy() is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string interfaces.
Both of these fields want to be NUL-terminated as per their use in printk:
F_printk("%u:%s:%s (%u)%s",
__entry->line,
__entry->func, __entry->file, __entry->correct,
__entry->constant ? " CONSTANT" : "")Use strscpy() as it NUL-terminates the destination buffer, so it doesn't have to be done manually.
--- kernel/trace/trace_branch.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/trace/trace_branch.c +2 -4
@@ -74,10 +74,8 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect) p--; p++; -strncpy (entry->func, f->data.func,TRACE_FUNC_SIZE ); -strncpy (entry->file, p,TRACE_FILE_SIZE ); - entry->func[TRACE_FUNC_SIZE ] =0 ; - entry->file[TRACE_FILE_SIZE ] =0 ; +strscpy (entry->func, f->data.func); +strscpy (entry->file, p); entry->constant = f->constant; entry->line = f->data.line; entry->correct = val == expect;
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 3/6 tracing: Remove TRACE_EVENT_FL_FILTERED logic
In reply to Steven RostedtFrom: Zheng Yejian <[email protected]>
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 thecall->filter, so remove related logic.
--- include/linux/trace_events.h | 4 --- kernel/trace/trace.c | 44 ++++++---------------------- kernel/trace/trace.h | 4 --- kernel/trace/trace_branch.c | 4 +-- kernel/trace/trace_events.c | 2 -- kernel/trace/trace_functions_graph.c | 8 ++--- kernel/trace/trace_hwlat.c | 4 +-- kernel/trace/trace_mmiotrace.c | 8 ++--- kernel/trace/trace_osnoise.c | 12 ++------ kernel/trace/trace_sched_wakeup.c | 8 ++--- 10 files changed, 20 insertions(+), 78 deletions(-)
include/linux/trace_events.h +0 -4
@@ -326,7 +326,6 @@ void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer,void trace_event_buffer_commit (struct trace_event_buffer *fbuffer);enum { -TRACE_EVENT_FL_FILTERED_BIT ,TRACE_EVENT_FL_CAP_ANY_BIT ,TRACE_EVENT_FL_NO_SET_FILTER_BIT ,TRACE_EVENT_FL_IGNORE_ENABLE_BIT ,
@@ -341,7 +340,6 @@ enum {/* * Event flags: -* FILTERED - The event has a filter attached * CAP_ANY - Any user can enable for perf * NO_SET_FILTER - Set when filter has error and is to be ignored * IGNORE_ENABLE - For trace internal events, do not enable with debugfs file
@@ -356,7 +354,6 @@ enum {* to a tracepoint yet, then it is cleared when it is. */ enum { -TRACE_EVENT_FL_FILTERED = (1 <<TRACE_EVENT_FL_FILTERED_BIT ),TRACE_EVENT_FL_CAP_ANY = (1 <<TRACE_EVENT_FL_CAP_ANY_BIT ),TRACE_EVENT_FL_NO_SET_FILTER = (1 <<TRACE_EVENT_FL_NO_SET_FILTER_BIT ),TRACE_EVENT_FL_IGNORE_ENABLE = (1 <<TRACE_EVENT_FL_IGNORE_ENABLE_BIT ),
@@ -381,7 +378,6 @@ struct trace_event_call { };struct trace_event event;char *print_fmt; -struct event_filter *filter;/* * Static events can disappear with modules, * where as dynamic ones need their own ref count.
kernel/trace/trace.c +9 -35
110 lines not on this page · raw message
kernel/trace/trace.h +0 -4
@@ -1429,10 +1429,6 @@ struct trace_subsystem_dir {int nr_events; }; -extern int call_filter_check_discard (struct trace_event_call *call,void *rec, -struct trace_buffer *buffer, -struct ring_buffer_event *event); - void trace_buffer_unlock_commit_regs(struct trace_array *tr, struct trace_buffer *buffer, struct ring_buffer_event *event,
kernel/trace/trace_branch.c +1 -3
@@ -30,7 +30,6 @@ static struct trace_array *branch_tracer;static void probe_likely_condition (struct ftrace_likely_data *f,int val,int expect) { -struct trace_event_call *call = &event_branch;struct trace_array *tr = branch_tracer;struct trace_buffer *buffer;struct trace_array_cpu *data;
@@ -80,8 +79,7 @@ probe_likely_condition(struct ftrace_likely_data *f, int val, int expect) entry->line = f->data.line; entry->correct = val == expect; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); out: current->trace_recursion &= ~TRACE_BRANCH_BIT ;
kernel/trace/trace_events.c +0 -2
@@ -3149,8 +3149,6 @@ static void __trace_remove_event_call(struct trace_event_call *call) {event_remove (call);trace_destroy_fields (call); -free_event_filter (call->filter); - call->filter =NULL ; }static int probe_remove_event_call (struct trace_event_call *call)
kernel/trace/trace_functions_graph.c +2 -6
@@ -102,7 +102,6 @@ int __trace_graph_entry(struct trace_array *tr,struct ftrace_graph_ent *trace, unsigned int trace_ctx) { - struct trace_event_call *call = &event_funcgraph_entry; struct ring_buffer_event *event;struct trace_buffer *buffer = tr->array_buffer.buffer;struct ftrace_graph_ent_entry *entry;
@@ -113,8 +112,7 @@ int __trace_graph_entry(struct trace_array *tr,return 0 ; entry =ring_buffer_event_data (event); entry->graph_ent = *trace; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event);return 1 ; }
@@ -223,7 +221,6 @@ void __trace_graph_return(struct trace_array *tr,struct ftrace_graph_ret *trace, unsigned int trace_ctx) { - struct trace_event_call *call = &event_funcgraph_exit; struct ring_buffer_event *event;struct trace_buffer *buffer = tr->array_buffer.buffer;struct ftrace_graph_ret_entry *entry;
@@ -234,8 +231,7 @@ void __trace_graph_return(struct trace_array *tr,return ; entry =ring_buffer_event_data (event); entry->ret = *trace; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); } void trace_graph_return(struct ftrace_graph_ret *trace,
kernel/trace/trace_hwlat.c +1 -3
@@ -130,7 +130,6 @@ static bool hwlat_busy;static void trace_hwlat_sample (struct hwlat_sample *sample) {struct trace_array *tr = hwlat_trace; -struct trace_event_call *call = &event_hwlat;struct trace_buffer *buffer = tr->array_buffer.buffer;struct ring_buffer_event *event;struct hwlat_entry *entry;
@@ -148,8 +147,7 @@ static void trace_hwlat_sample(struct hwlat_sample *sample) entry->nmi_count = sample->nmi_count; entry->count = sample->count; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); }/* Macros to encapsulate the time capturing infrastructure */
kernel/trace/trace_mmiotrace.c +2 -6
@@ -294,7 +294,6 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,struct trace_array_cpu *data, struct mmiotrace_rw *rw) { - struct trace_event_call *call = &event_mmiotrace_rw; struct trace_buffer *buffer = tr->array_buffer.buffer;struct ring_buffer_event *event;struct trace_mmiotrace_rw *entry;
@@ -310,8 +309,7 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, entry =ring_buffer_event_data (event); entry->rw = *rw; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); +trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); }void mmio_trace_rw (struct mmiotrace_rw *rw)
@@ -325,7 +323,6 @@ static void __trace_mmiotrace_map(struct trace_array *tr,struct trace_array_cpu *data, struct mmiotrace_map *map) { - struct trace_event_call *call = &event_mmiotrace_map; struct trace_buffer *buffer = tr->array_buffer.buffer;struct ring_buffer_event *event;struct trace_mmiotrace_map *entry;
@@ -341,8 +338,7 @@ static void __trace_mmiotrace_map(struct trace_array *tr, entry =ring_buffer_event_data (event); entry->map = *map; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); +trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); }void mmio_trace_mapping (struct mmiotrace_map *map)
kernel/trace/trace_osnoise.c +3 -9
@@ -499,7 +499,6 @@ static void print_osnoise_headers(struct seq_file *s)static void __trace_osnoise_sample (struct osnoise_sample *sample,struct trace_buffer *buffer) { -struct trace_event_call *call = &event_osnoise;struct ring_buffer_event *event;struct osnoise_entry *entry;
@@ -517,8 +516,7 @@ __trace_osnoise_sample(struct osnoise_sample *sample, struct trace_buffer *buffe entry->softirq_count = sample->softirq_count; entry->thread_count = sample->thread_count; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); }/*
@@ -578,7 +576,6 @@ static void print_timerlat_headers(struct seq_file *s)static void __trace_timerlat_sample (struct timerlat_sample *sample,struct trace_buffer *buffer) { -struct trace_event_call *call = &event_osnoise;struct ring_buffer_event *event;struct timerlat_entry *entry;
@@ -591,8 +588,7 @@ __trace_timerlat_sample(struct timerlat_sample *sample, struct trace_buffer *buf entry->context = sample->context; entry->timer_latency = sample->timer_latency; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); }/*
@@ -654,7 +650,6 @@ static void timerlat_save_stack(int skip)static void __timerlat_dump_stack (struct trace_buffer *buffer,struct trace_stack *fstack,unsigned int size) { -struct trace_event_call *call = &event_osnoise;struct ring_buffer_event *event;struct stack_entry *entry;
@@ -668,8 +663,7 @@ __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, umemcpy (&entry->caller, fstack->calls, size); entry->size = fstack->nr_entries; -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit_nostack (buffer, event); +trace_buffer_unlock_commit_nostack (buffer, event); }/*
kernel/trace/trace_sched_wakeup.c +2 -6
@@ -378,7 +378,6 @@ tracing_sched_switch_trace(struct trace_array *tr,struct task_struct *next, unsigned int trace_ctx) { - struct trace_event_call *call = &event_context_switch; struct trace_buffer *buffer = tr->array_buffer.buffer;struct ring_buffer_event *event;struct ctx_switch_entry *entry;
@@ -396,8 +395,7 @@ tracing_sched_switch_trace(struct trace_array *tr, entry->next_state =task_state_index (next); entry->next_cpu =task_cpu (next); -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); +trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); } static void
@@ -406,7 +404,6 @@ tracing_sched_wakeup_trace(struct trace_array *tr,struct task_struct *curr, unsigned int trace_ctx) { - struct trace_event_call *call = &event_wakeup; struct ring_buffer_event *event;struct ctx_switch_entry *entry;struct trace_buffer *buffer = tr->array_buffer.buffer;
@@ -424,8 +421,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr, entry->next_state =task_state_index (wakee); entry->next_cpu =task_cpu (wakee); -if (!call_filter_check_discard (call, entry, buffer, event)) -trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); +trace_buffer_unlock_commit (tr, buffer, event, trace_ctx); }static void notrace
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 4/6 tracepoints: Use new static branch API
In reply to Steven RostedtFrom: Josh Poimboeuf <[email protected]>
The old static key API is deprecated. Switch to the new one.
--- include/linux/tracepoint-defs.h | 4 ++-- include/linux/tracepoint.h | 8 ++++---- kernel/trace/trace_events_hist.c | 2 +- kernel/trace/trace_events_user.c | 4 ++-- kernel/tracepoint.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-)
include/linux/tracepoint-defs.h +2 -2
@@ -31,7 +31,7 @@ struct tracepoint_func {struct tracepoint {const char *name;/* Tracepoint name */ -struct static_key key; +struct static_key_false key;struct static_call_key *static_call_key;void *static_call_tramp;void *iterator;
@@ -83,7 +83,7 @@ struct bpf_raw_event_map {#ifdef CONFIG_TRACEPOINTS # define tracepoint_enabled (tp) \ - static_key_false(&(__tracepoint_##tp).key) + static_branch_unlikely(&(__tracepoint_##tp).key)#else # define tracepoint_enabled (tracepoint) false#endif
include/linux/tracepoint.h +4 -4
@@ -248,7 +248,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)#define __DECLARE_TRACE_RCU (name, proto, args, cond) \ static inline void trace_##name##_rcuidle(proto) \ { \ - if (static_key_false(&__tracepoint_##name.key)) \ + if (static_branch_unlikely(&__tracepoint_##name.key)) \ __DO_TRACE(name, \ TP_ARGS(args), \ TP_CONDITION(cond), 1); \
@@ -274,7 +274,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) extern struct tracepoint __tracepoint_##name; \ static inline void trace_##name(proto) \ { \ - if (static_key_false(&__tracepoint_##name.key)) \ + if (static_branch_unlikely(&__tracepoint_##name.key)) \ __DO_TRACE(name, \ TP_ARGS(args), \ TP_CONDITION(cond), 0); \
@@ -311,7 +311,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) static inline bool \ trace_##name##_enabled(void) \ { \ - return static_key_false(&__tracepoint_##name.key); \ + return static_branch_unlikely(&__tracepoint_##name.key);\ }/*
@@ -328,7 +328,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) struct tracepoint __tracepoint_##_name __used \ __section("__tracepoints") = { \ .name = __tpstrtab_##_name, \ - .key = STATIC_KEY_INIT_FALSE, \ + .key = STATIC_KEY_FALSE_INIT, \ .static_call_key = &STATIC_CALL_KEY(tp_func_##_name), \ .static_call_tramp = STATIC_CALL_TRAMP_ADDR(tp_func_##_name), \ .iterator = &__traceiter_##_name, \
kernel/trace/trace_events_hist.c +1 -1
@@ -822,7 +822,7 @@ static inline void trace_synth(struct synth_event *event, u64 *var_ref_vals, {struct tracepoint *tp = event->tp; -if (unlikely (atomic_read (&tp->key.enabled) >0 )) { +if (unlikely (static_key_enabled (&tp->key))) {struct tracepoint_func *probe_func_ptr;synth_probe_func_t probe_func;void *__data;
kernel/trace/trace_events_user.c +2 -2
@@ -1676,7 +1676,7 @@ static void update_enable_bit_for(struct user_event *user)struct tracepoint *tp = &user->tracepoint;char status =0 ; -if (atomic_read (&tp->key.enabled) >0 ) { +if (static_key_enabled (&tp->key)) {struct tracepoint_func *probe_func_ptr;user_event_func_t probe_func;
@@ -2280,7 +2280,7 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i)* It's possible key.enabled disables after this check, however * we don't mind if a few events are included in this condition. */ -if (likely (atomic_read (&tp->key.enabled) >0 )) { +if (likely (static_key_enabled (&tp->key))) {struct tracepoint_func *probe_func_ptr;user_event_func_t probe_func;struct iov_iter copy;
kernel/tracepoint.c +2 -2
@@ -358,7 +358,7 @@ static int tracepoint_add_func(struct tracepoint *tp,tracepoint_update_call (tp, tp_funcs);/* Both iterator and static call handle NULL tp->funcs */ rcu_assign_pointer (tp->funcs, tp_funcs); -static_key_enable (&tp->key); +static_branch_enable (&tp->key);break ;case TP_FUNC_2 :/* 1->2 */ /* Set iterator static call */
@@ -414,7 +414,7 @@ static int tracepoint_remove_func(struct tracepoint *tp,if (tp->unregfunc &&static_key_enabled (&tp->key)) tp->unregfunc (); -static_key_disable (&tp->key); +static_branch_disable (&tp->key);/* Set iterator static call */ tracepoint_update_call (tp, tp_funcs);/* Both iterator and static call handle NULL tp->funcs */
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 5/6 tracing: Remove definition of trace_*_rcuidle()
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
The trace_*_rcuidle() variant of a tracepoint was to handle places where a tracepoint was located but RCU was not "watching". All those locations have been removed, and RCU should be watching where all tracepoints are located. We can now remove the trace_*_rcuidle() variant.
--- include/linux/tracepoint.h | 50 ++----------------------------- include/trace/events/preemptirq.h | 8 ----- kernel/trace/trace_preemptirq.c | 26 ++++------------ scripts/tags.sh | 2 -- 4 files changed, 8 insertions(+), 78 deletions(-)
include/linux/tracepoint.h +2 -48
@@ -196,67 +196,25 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)#define __DO_TRACE_CALL (name, args) __traceiter_##name(NULL, args)#endif /* CONFIG_HAVE_STATIC_CALL */ -/* -* ARCH_WANTS_NO_INSTR archs are expected to have sanitized entry and idle -* code that disallow any/all tracing/instrumentation when RCU isn't watching. -*/ -#ifdef CONFIG_ARCH_WANTS_NO_INSTR -#define RCUIDLE_COND (rcuidle) (rcuidle) -#else -/* srcu can't be used from NMI */ -#define RCUIDLE_COND (rcuidle) (rcuidle && in_nmi()) -#endif -/* * it_func[0] is never NULL because there is at least one element in the array * when the array itself is non NULL. */ -#define __DO_TRACE (name, args, cond, rcuidle) \ +#define __DO_TRACE (name, args, cond) \ do { \ int __maybe_unused __idx = 0; \ \ if (!(cond)) \ return; \ \ - if (WARN_ONCE(RCUIDLE_COND(rcuidle), \ - "Bad RCU usage for tracepoint")) \ - return; \ - \/* keep srcu and sched-rcu usage consistent */ \preempt_disable_notrace (); \ \ -/* \ -* For rcuidle callers, use srcu since sched-rcu \ -* doesn't work from the idle path. \ -*/ \ -if (rcuidle) { \ - __idx =srcu_read_lock_notrace (&tracepoint_srcu);\ -ct_irq_enter_irqson (); \ - } \ - \__DO_TRACE_CALL (name,TP_ARGS (args)); \ \ -if (rcuidle) { \ -ct_irq_exit_irqson (); \ -srcu_read_unlock_notrace (&tracepoint_srcu, __idx);\ - } \ - \preempt_enable_notrace (); \ }while (0 ) -#ifndef MODULE -#define __DECLARE_TRACE_RCU (name, proto, args, cond) \ - static inline void trace_##name##_rcuidle(proto) \ - { \ - if (static_branch_unlikely(&__tracepoint_##name.key)) \ - __DO_TRACE(name, \ - TP_ARGS(args), \ - TP_CONDITION(cond), 1); \ - } -#else -#define __DECLARE_TRACE_RCU (name, proto, args, cond) -#endif -/* * Make sure the alignment of the structure in the __tracepoints section will * not add unwanted padding between the beginning of the section and the
@@ -277,14 +235,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) if (static_branch_unlikely(&__tracepoint_##name.key)) \ __DO_TRACE(name, \ TP_ARGS(args), \ - TP_CONDITION(cond), 0); \ + TP_CONDITION(cond)); \ if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ WARN_ONCE(!rcu_is_watching(), \ "RCU not watching for tracepoint"); \ } \ } \ - __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \ - PARAMS(cond)) \ static inline int \ register_trace_##name(void (*probe)(data_proto), void *data) \ { \
@@ -375,8 +331,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)#define __DECLARE_TRACE (name, proto, args, cond, data_proto) \ static inline void trace_##name(proto) \ { } \ - static inline void trace_##name##_rcuidle(proto) \ - { } \ static inline int \ register_trace_##name(void (*probe)(data_proto), \ void *data) \
include/trace/events/preemptirq.h +0 -8
@@ -43,8 +43,6 @@ DEFINE_EVENT(preemptirq_template, irq_enable,#else #define trace_irq_enable (...)#define trace_irq_disable (...) -#define trace_irq_enable_rcuidle (...) -#define trace_irq_disable_rcuidle (...)#endif #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
@@ -58,8 +56,6 @@ DEFINE_EVENT(preemptirq_template, preempt_enable,#else #define trace_preempt_enable (...)#define trace_preempt_disable (...) -#define trace_preempt_enable_rcuidle (...) -#define trace_preempt_disable_rcuidle (...)#endif #endif /* _TRACE_PREEMPTIRQ_H */
@@ -69,10 +65,6 @@ DEFINE_EVENT(preemptirq_template, preempt_enable,#else /* !CONFIG_PREEMPTIRQ_TRACEPOINTS */ #define trace_irq_enable (...)#define trace_irq_disable (...) -#define trace_irq_enable_rcuidle (...) -#define trace_irq_disable_rcuidle (...)#define trace_preempt_enable (...)#define trace_preempt_disable (...) -#define trace_preempt_enable_rcuidle (...) -#define trace_preempt_disable_rcuidle (...)#endif
kernel/trace/trace_preemptirq.c +6 -20
@@ -15,20 +15,6 @@#define CREATE_TRACE_POINTS #include <trace/events/preemptirq.h> -/* -* Use regular trace points on architectures that implement noinstr -* tooling: these calls will only happen with RCU enabled, which can -* use a regular tracepoint. -* -* On older architectures, use the rcuidle tracing methods (which -* aren't NMI-safe - so exclude NMI contexts): -*/ -#ifdef CONFIG_ARCH_WANTS_NO_INSTR -#define trace (point) trace_##point -#else -#define trace (point) if (!in_nmi()) trace_##point##_rcuidle -#endif -#ifdef CONFIG_TRACE_IRQFLAGS /* Per-cpu variable to prevent redundant calls when IRQs already off */ static DEFINE_PER_CPU(int, tracing_irq_cpu);
@@ -42,7 +28,7 @@ static DEFINE_PER_CPU(int, tracing_irq_cpu);void trace_hardirqs_on_prepare (void ) {if (this_cpu_read (tracing_irq_cpu)) { -trace (irq_enable)(CALLER_ADDR0 ,CALLER_ADDR1 ); +trace_irq_enable (CALLER_ADDR0 ,CALLER_ADDR1 );tracer_hardirqs_on (CALLER_ADDR0 ,CALLER_ADDR1 );this_cpu_write (tracing_irq_cpu,0 ); }
@@ -53,7 +39,7 @@ NOKPROBE_SYMBOL(trace_hardirqs_on_prepare);void trace_hardirqs_on (void ) {if (this_cpu_read (tracing_irq_cpu)) { -trace (irq_enable)(CALLER_ADDR0 ,CALLER_ADDR1 ); +trace_irq_enable (CALLER_ADDR0 ,CALLER_ADDR1 );tracer_hardirqs_on (CALLER_ADDR0 ,CALLER_ADDR1 );this_cpu_write (tracing_irq_cpu,0 ); }
@@ -75,7 +61,7 @@ void trace_hardirqs_off_finish(void)if (!this_cpu_read (tracing_irq_cpu)) {this_cpu_write (tracing_irq_cpu,1 );tracer_hardirqs_off (CALLER_ADDR0 ,CALLER_ADDR1 ); -trace (irq_disable)(CALLER_ADDR0 ,CALLER_ADDR1 ); +trace_irq_disable (CALLER_ADDR0 ,CALLER_ADDR1 ); } }
@@ -89,7 +75,7 @@ void trace_hardirqs_off(void)if (!this_cpu_read (tracing_irq_cpu)) {this_cpu_write (tracing_irq_cpu,1 );tracer_hardirqs_off (CALLER_ADDR0 ,CALLER_ADDR1 ); -trace (irq_disable)(CALLER_ADDR0 ,CALLER_ADDR1 ); +trace_irq_disable (CALLER_ADDR0 ,CALLER_ADDR1 ); } }EXPORT_SYMBOL (trace_hardirqs_off);
@@ -100,13 +86,13 @@ NOKPROBE_SYMBOL(trace_hardirqs_off);void trace_preempt_on (unsigned long a0,unsigned long a1) { -trace (preempt_enable)(a0, a1); +trace_preempt_enable (a0, a1);tracer_preempt_on (a0, a1); }void trace_preempt_off (unsigned long a0,unsigned long a1) { -trace (preempt_disable)(a0, a1); +trace_preempt_disable (a0, a1);tracer_preempt_off (a0, a1); }#endif
scripts/tags.sh +0 -2
@@ -152,9 +152,7 @@ regex_c=( '/^BPF_CALL_[0-9]([[:space:]]*\([[:alnum:]_]*\).*/\1/' '/^COMPAT_SYSCALL_DEFINE[0-9]([[:space:]]*\([[:alnum:]_]*\).*/compat_sys_\1/' '/^TRACE_EVENT([[:space:]]*\([[:alnum:]_]*\).*/trace_\1/' - '/^TRACE_EVENT([[:space:]]*\([[:alnum:]_]*\).*/trace_\1_rcuidle/' '/^DEFINE_EVENT([^,)]*,[[:space:]]*\([[:alnum:]_]*\).*/trace_\1/' - '/^DEFINE_EVENT([^,)]*,[[:space:]]*\([[:alnum:]_]*\).*/trace_\1_rcuidle/' '/^DEFINE_INSN_CACHE_OPS([[:space:]]*\([[:alnum:]_]*\).*/get_\1_slot/' '/^DEFINE_INSN_CACHE_OPS([[:space:]]*\([[:alnum:]_]*\).*/free_\1_slot/' '/^PAGEFLAG([[:space:]]*\([[:alnum:]_]*\).*/Page\1/'
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 6/6 tracepoint: Remove SRCU protection
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
With the removal of the trace_*_rcuidle() tracepoints, there is no reason to protect tracepoints with SRCU. The reason the SRCU protection was added, was because it can protect tracepoints when RCU is not "watching". Now that tracepoints are only used when RCU is watching, remove the SRCU protection. It just made things more complex and confusing anyway.
--- include/linux/tracepoint.h | 4 --- kernel/tracepoint.c | 51 +------------------------------------- 2 files changed, 1 insertion(+), 54 deletions(-)
include/linux/tracepoint.h +0 -4
@@ -32,8 +32,6 @@ struct trace_eval_map {#define TRACEPOINT_DEFAULT_PRIO 10 -extern struct srcu_struct tracepoint_srcu; -extern int tracepoint_probe_register (struct tracepoint *tp,void *probe,void *data); extern int
@@ -109,7 +107,6 @@ void for_each_tracepoint_in_module(struct module *mod,#ifdef CONFIG_TRACEPOINTS static inline void tracepoint_synchronize_unregister (void ) { -synchronize_srcu (&tracepoint_srcu);synchronize_rcu (); }#else
@@ -207,7 +204,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)if (!(cond)) \return ; \ \ -/* keep srcu and sched-rcu usage consistent */ \preempt_disable_notrace (); \ \__DO_TRACE_CALL (name,TP_ARGS (args)); \
kernel/tracepoint.c +1 -50
97 lines not on this page · raw message
Signature · 1 line
2.45.2