linux-stable/kernel/trace
Steven Rostedt dc1b157b82 tracing: Fix archs that still call tracepoints without RCU watching
Tracepoints require having RCU "watching" as it uses RCU to do updates to
the tracepoints. There are some cases that would call a tracepoint when
RCU was not "watching". This was usually in the idle path where RCU has
"shutdown". For the few locations that had tracepoints without RCU
watching, there was an trace_*_rcuidle() variant that could be used. This
used SRCU for protection.

There are tracepoints that trace when interrupts and preemption are
enabled and disabled. In some architectures, these tracepoints are called
in a path where RCU is not watching. When x86 and arm64 removed these
locations, it was incorrectly assumed that it would be safe to remove the
trace_*_rcuidle() variant and also remove the SRCU logic, as it made the
code more complex and harder to implement new tracepoint features (like
faultable tracepoints and tracepoints in rust).

Instead of bringing back the trace_*_rcuidle(), as it will not be trivial
to do as new code has already been added depending on its removal, add a
workaround to the one file that still requires it (trace_preemptirq.c). If
the architecture does not define CONFIG_ARCH_WANTS_NO_INSTR, then check if
the code is in the idle path, and if so, call ct_irq_enter/exit() which
will enable RCU around the tracepoint.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/20241204100414.4d3e06d0@gandalf.local.home
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 48bcda6848 ("tracing: Remove definition of trace_*_rcuidle()")
Closes: https://lore.kernel.org/all/bddb02de-957a-4df5-8e77-829f55728ea2@roeck-us.net/
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2024-12-05 09:28:58 -05:00
..
rv rv: Fix a typo 2024-10-04 19:09:23 -04:00
blktrace.c blktrace: convert strncpy() to strscpy_pad() 2024-04-25 21:07:08 -07:00
bpf_trace.c Performance events changes for v6.13: 2024-11-19 13:34:06 -08:00
bpf_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
error_report-traces.c tracing: add error_report_end trace point 2021-02-26 09:41:02 -08:00
fgraph.c fgraph: Use guard(mutex)(&ftrace_lock) for unregister_ftrace_graph() 2024-10-29 07:43:02 -04:00
fprobe.c fprobe: Fix to allocate entry_data_size buffer with rethook instances 2024-03-01 09:18:24 +09:00
ftrace_internal.h function_graph: Make fgraph_update_pid_func() a stub for !DYNAMIC_FTRACE 2024-06-10 18:08:23 -04:00
ftrace.c tracing updates for v6.13: 2024-11-22 13:27:01 -08:00
Kconfig function_graph: Support recording and printing the function return address 2024-10-05 10:14:04 -04:00
kprobe_event_gen_test.c tracing: Fix wrong return in kprobe_event_gen_test.c 2023-03-19 12:20:48 -04:00
Makefile tracing/probes: Move finding func-proto API and getting func-param API to trace_btf 2023-08-23 09:39:45 +09:00
pid_list.c trace/pid_list: Change gfp flags in pid_list_fill_irq() 2024-07-15 15:07:14 -04:00
pid_list.h tracing: Create a sparse bitmask for pid filtering 2021-10-05 17:38:45 -04:00
power-traces.c
preemptirq_delay_test.c minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
rethook.c rethook: honor CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING in rethook_try_get() 2024-05-01 23:18:48 +09:00
ring_buffer_benchmark.c ring-buffer: Use str_low_high() helper in ring_buffer_producer() 2024-10-19 11:12:25 -04:00
ring_buffer.c trace ring-buffer updates for v6.13 2024-11-22 13:11:17 -08:00
rpm-traces.c
synth_event_gen_test.c tracing / synthetic: Disable events after testing in synth_event_gen_test_init() 2023-12-21 10:04:45 -05:00
trace_benchmark.c tracing: Improve benchmark test performance by using do_div() 2024-05-13 20:00:57 -04:00
trace_benchmark.h tracing: Add numeric delta time to the trace event benchmark 2022-09-26 13:01:09 -04:00
trace_boot.c tracing: Allow creating instances with specified system events 2023-12-18 23:14:16 -05:00
trace_branch.c tracing: Remove TRACE_EVENT_FL_FILTERED logic 2024-10-08 15:24:49 -04:00
trace_btf.c tracing/probes: Fix to search structure fields correctly 2024-02-17 21:25:42 +09:00
trace_btf.h tracing/probes: Add a function to search a member of a struct/union 2023-08-23 09:40:16 +09:00
trace_clock.c tracing: Use atomic64_inc_return() in trace_clock_counter() 2024-10-09 19:59:49 -04:00
trace_dynevent.c tracing: Free buffers when a used dynamic event is removed 2022-11-23 19:07:12 -05:00
trace_dynevent.h tracing: Add DYNAMIC flag for dynamic events 2021-08-18 18:10:32 -04:00
trace_entries.h function_graph: Support recording and printing the function return address 2024-10-05 10:14:04 -04:00
trace_eprobe.c tracing/probes: Fix MAX_TRACE_ARGS limit handling 2024-10-23 17:24:44 +09:00
trace_event_perf.c trace/trace_event_perf: remove duplicate samples on the first tracepoint event 2024-10-09 19:44:54 -04:00
trace_events_filter_test.h
trace_events_filter.c tracing: Replace multiple deprecated strncpy with memcpy 2024-10-30 19:41:08 -04:00
trace_events_hist.c tracing: Remove redundant check on field->field in histograms 2024-11-12 11:36:57 -05:00
trace_events_inject.c tracing: Have format file honor EVENT_FILE_FL_FREED 2024-08-07 18:12:46 -04:00
trace_events_synth.c tracing/synthetic: Fix trace_string() return value 2024-02-15 11:40:01 -05:00
trace_events_trigger.c tracing: Have format file honor EVENT_FILE_FL_FREED 2024-08-07 18:12:46 -04:00
trace_events_user.c tracepoints: Use new static branch API 2024-10-08 21:17:39 -04:00
trace_events.c tracing: Remove TRACE_EVENT_FL_FILTERED logic 2024-10-08 15:24:49 -04:00
trace_export.c tracing: Add back FORTIFY_SOURCE logic to kernel_stack event structure 2023-07-30 18:11:44 -04:00
trace_fprobe.c tracing/probes: Fix MAX_TRACE_ARGS limit handling 2024-10-23 17:24:44 +09:00
trace_functions_graph.c tracing updates for v6.13: 2024-11-22 13:27:01 -08:00
trace_functions.c ftrace: Get the true parent ip for function tracer 2024-11-18 12:02:43 -05:00
trace_hwlat.c tracing: Remove TRACE_EVENT_FL_FILTERED logic 2024-10-08 15:24:49 -04:00
trace_irqsoff.c fgraph: Simplify return address printing in function graph tracer 2024-10-10 14:06:26 -04:00
trace_kdb.c trace: kdb: Replace simple_strtoul with kstrtoul in kdb_ftdump 2024-11-02 08:33:13 +00:00
trace_kprobe_selftest.c tracing: arm64: Avoid missing-prototype warnings 2023-07-12 12:06:04 -04:00
trace_kprobe_selftest.h
trace_kprobe.c tracing/probes: Fix MAX_TRACE_ARGS limit handling 2024-10-23 17:24:44 +09:00
trace_mmiotrace.c tracing: Remove TRACE_EVENT_FL_FILTERED logic 2024-10-08 15:24:49 -04:00
trace_nop.c
trace_osnoise.c tracing: Remove TRACE_EVENT_FL_FILTERED logic 2024-10-08 15:24:49 -04:00
trace_output.c tracing: Record task flag NEED_RESCHED_LAZY. 2024-11-22 17:49:39 -05:00
trace_output.h tracing: Add "fields" option to show raw trace event fields 2023-03-29 06:52:08 -04:00
trace_preemptirq.c tracing: Fix archs that still call tracepoints without RCU watching 2024-12-05 09:28:58 -05:00
trace_printk.c tracing: Disable "other" permission bits in the tracefs files 2021-10-08 18:08:43 -04:00
trace_probe_kernel.h tracing/probes: Fix to record 0-length data_loc in fetch_store_string*() if fails 2023-07-14 17:04:58 +09:00
trace_probe_tmpl.h tracing/probes: Support $argN in return probe (kprobe and fprobe) 2024-03-07 00:27:34 +09:00
trace_probe.c tracing: Consider the NULL character when validating the event length 2024-10-23 17:24:47 +09:00
trace_probe.h tracing/probes: support '%pd' type for print struct dentry's name 2024-05-01 23:18:47 +09:00
trace_recursion_record.c tracing: Use trace_create_file() to simplify creation of tracefs entries 2022-05-26 21:12:52 -04:00
trace_sched_switch.c tracing: Replace strncpy() with strscpy() when copying comm 2024-11-01 14:37:31 -04:00
trace_sched_wakeup.c fgraph: Simplify return address printing in function graph tracer 2024-10-10 14:06:26 -04:00
trace_selftest_dynamic.c
trace_selftest.c ftrace updates for v6.13: 2024-11-20 11:34:10 -08:00
trace_seq.c trace_seq: Increase the buffer size to almost two pages 2023-12-18 23:14:16 -05:00
trace_stack.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
trace_stat.c tracing: Disable "other" permission bits in the tracefs files 2021-10-08 18:08:43 -04:00
trace_stat.h
trace_synth.h tracing: Allow synthetic events to pass around stacktraces 2023-01-25 10:31:24 -05:00
trace_syscalls.c tracing/perf: Add might_fault check to syscall probes 2024-10-09 17:09:46 -04:00
trace_uprobe.c Performance events changes for v6.13: 2024-11-19 13:34:06 -08:00
trace.c tracing: Record task flag NEED_RESCHED_LAZY. 2024-11-22 17:49:39 -05:00
trace.h tracing updates for v6.13: 2024-11-22 13:27:01 -08:00
tracing_map.c tracing: Fix cmp_entries_dup() to respect sort() comparison rules 2024-12-04 10:38:24 -05:00
tracing_map.h tracing: Remove unused extern declaration tracing_map_set_field_descr() 2023-07-23 11:08:14 -04:00