mirror-linux/kernel/trace
Linus Torvalds c94d59a126 tracing fixes for 6.15:
- Fix sample code that uses trace_array_printk()
 
   The sample code for in kernel use of trace_array (that creates an instance
   for use within the kernel) and shows how to use trace_array_printk() that
   writes into the created instance, used trace_printk_init_buffers(). But
   that function is used to initialize normal trace_printk() and produces the
   NOTICE banner which is not needed for use of trace_array_printk(). The
   function to initialize that is trace_array_init_printk() that takes the
   created trace array instance as a parameter.
 
   Update the sample code to reflect the proper usage.
 
 - Fix preemption count output for stacktrace event
 
   The tracing buffer shows the preempt count level when an event executes.
   Because writing the event itself disables preemption, this needs to be
   accounted for when recording. The stacktrace event did not account for
   this so the output of the stacktrace event showed preemption was disabled
   while the event that triggered the stacktrace shows preemption is enabled
   and this leads to confusion. Account for preemption being disabled for the
   stacktrace event.
 
   The same happened for stack traces triggered by function tracer.
 
 - Fix persistent ring buffer when trace_pipe is used
 
   The ring buffer swaps the reader page with the next page to read from the
   write buffer when trace_pipe is used. If there's only a page of data in
   the ring buffer, this swap will cause the "commit" pointer (last data
   written) to be on the reader page. If more data is written to the buffer,
   it is added to the reader page until it falls off back into the write
   buffer.
 
   If the system reboots and the commit pointer is still on the reader page,
   even if new data was written, the persistent buffer validator will miss
   finding the commit pointer because it only checks the write buffer and
   does not check the reader page. This causes the validator to fail the
   validation and clear the buffer, where the new data is lost.
 
   There was a check for this, but it checked the "head pointer", which was
   incorrect, because the "head pointer" always stays on the write buffer and
   is the next page to swap out for the reader page. Fix the logic to catch
   this case and allow the user to still read the data after reboot.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCaCTZHBQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qu04AQDjOS46Y8d58MuwjLrQAotOUnANZADz
 7d+5snlcMjhqkAEAo+zc2z9LgqBAnv1VG3GEPgac0JmyPeOnqSJRWRpRXAM=
 =UveQ
 -----END PGP SIGNATURE-----

Merge tag 'trace-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Fix sample code that uses trace_array_printk()

   The sample code for in kernel use of trace_array (that creates an
   instance for use within the kernel) and shows how to use
   trace_array_printk() that writes into the created instance, used
   trace_printk_init_buffers(). But that function is used to initialize
   normal trace_printk() and produces the NOTICE banner which is not
   needed for use of trace_array_printk(). The function to initialize
   that is trace_array_init_printk() that takes the created trace array
   instance as a parameter.

   Update the sample code to reflect the proper usage.

 - Fix preemption count output for stacktrace event

   The tracing buffer shows the preempt count level when an event
   executes. Because writing the event itself disables preemption, this
   needs to be accounted for when recording. The stacktrace event did
   not account for this so the output of the stacktrace event showed
   preemption was disabled while the event that triggered the stacktrace
   shows preemption is enabled and this leads to confusion. Account for
   preemption being disabled for the stacktrace event.

   The same happened for stack traces triggered by function tracer.

 - Fix persistent ring buffer when trace_pipe is used

   The ring buffer swaps the reader page with the next page to read from
   the write buffer when trace_pipe is used. If there's only a page of
   data in the ring buffer, this swap will cause the "commit" pointer
   (last data written) to be on the reader page. If more data is written
   to the buffer, it is added to the reader page until it falls off back
   into the write buffer.

   If the system reboots and the commit pointer is still on the reader
   page, even if new data was written, the persistent buffer validator
   will miss finding the commit pointer because it only checks the write
   buffer and does not check the reader page. This causes the validator
   to fail the validation and clear the buffer, where the new data is
   lost.

   There was a check for this, but it checked the "head pointer", which
   was incorrect, because the "head pointer" always stays on the write
   buffer and is the next page to swap out for the reader page. Fix the
   logic to catch this case and allow the user to still read the data
   after reboot.

* tag 'trace-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  ring-buffer: Fix persistent buffer when commit page is the reader page
  ftrace: Fix preemption accounting for stacktrace filter command
  ftrace: Fix preemption accounting for stacktrace trigger command
  tracing: samples: Initialize trace_array_printk() with the correct function
2025-05-14 11:24:19 -07:00
..
rv rv: Fix out-of-bound memory access in rv_is_container_monitor() 2025-04-12 12:13:30 -04:00
Kconfig ftrace: Have tracing function args depend on PROBE_EVENTS_BTF_ARGS 2025-04-02 09:50:56 -04:00
Makefile
blktrace.c blktrace: remove redundant return at end of function 2024-12-23 08:17:23 -07:00
bpf_trace.c Modules changes for 6.15-rc1 2025-03-30 15:44:36 -07:00
bpf_trace.h
error_report-traces.c
fgraph.c fgraph: Correct typo in ftrace_return_to_handler comment 2025-03-04 11:15:50 -05:00
fprobe.c tracing: fprobe: Fix RCU warning message in list traversal 2025-05-10 08:28:02 +09:00
ftrace.c ftrace: Fix NULL memory allocation check 2025-05-01 15:46:19 -04:00
ftrace_internal.h
kprobe_event_gen_test.c
pid_list.c pid: allow pid_max to be set per pid namespace 2024-12-02 11:25:25 +01:00
pid_list.h
power-traces.c
preemptirq_delay_test.c
rethook.c
ring_buffer.c ring-buffer: Fix persistent buffer when commit page is the reader page 2025-05-14 13:53:23 -04:00
ring_buffer_benchmark.c ring-buffer: Use str_low_high() helper in ring_buffer_producer() 2024-10-19 11:12:25 -04:00
rpm-traces.c
synth_event_gen_test.c
trace.c tracing: Fix trace_adjust_address() when there is no modules in scratch area 2025-05-01 16:06:55 -04:00
trace.h Persistent buffer cleanups and simplifications for v6.15: 2025-04-03 16:09:29 -07:00
trace_benchmark.c
trace_benchmark.h
trace_boot.c
trace_branch.c
trace_btf.c
trace_btf.h
trace_clock.c tracing: Use atomic64_inc_return() in trace_clock_counter() 2024-10-09 19:59:49 -04:00
trace_dynevent.c tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_dynevent.h tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_entries.h ftrace: Fix type of ftrace_graph_ent_entry.depth 2025-04-17 15:19:15 -04:00
trace_eprobe.c tracing: add missing trace_probe_log_clear for eprobes 2025-05-10 08:44:50 +09:00
trace_event_perf.c perf: Remove unnecessary parameter of security check 2025-02-26 14:13:58 -05:00
trace_events.c tracing: Verify event formats that have "%*p.." 2025-04-02 09:51:26 -04:00
trace_events_filter.c tracing: Fix filter string testing 2025-04-17 22:16:56 -04:00
trace_events_filter_test.h
trace_events_hist.c tracing updates for v6.15: 2025-03-27 16:22:12 -07:00
trace_events_inject.c
trace_events_synth.c tracing: Do not add length to print format in synthetic events 2025-04-09 11:34:21 -04:00
trace_events_trigger.c ftrace: Fix preemption accounting for stacktrace trigger command 2025-05-14 13:53:09 -04:00
trace_events_user.c tracing/user_events: Slightly simplify user_seq_show() 2025-03-06 13:35:27 -05:00
trace_export.c
trace_fprobe.c Probes fixes for v6.14: 2025-04-08 12:51:34 -07:00
trace_functions.c ftrace: Fix preemption accounting for stacktrace filter command 2025-05-14 13:53:23 -04:00
trace_functions_graph.c ftrace: Do not have print_graph_retval() add a newline 2025-04-12 12:13:30 -04:00
trace_hwlat.c
trace_irqsoff.c tracing: Fix use-after-free in print_graph_function_flags during tracer switching 2025-03-22 05:42:42 -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.c tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_osnoise.c tracing updates for v6.15: 2025-03-27 16:22:12 -07:00
trace_output.c tracing: Do not take trace_event_sem in print_event_fields() 2025-05-01 22:44:52 -04:00
trace_output.h ftrace: Add print_function_args() 2025-03-04 11:27:23 -05: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
trace_probe.c tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09:00
trace_probe.h tracing: probe-events: Log error for exceeding the number of arguments 2025-03-27 21:19:54 +09:00
trace_probe_kernel.h
trace_probe_tmpl.h tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS 2024-12-26 10:50:04 -05:00
trace_recursion_record.c
trace_sched_switch.c pid: allow pid_max to be set per pid namespace 2024-12-02 11:25:25 +01:00
trace_sched_wakeup.c tracing: Fix use-after-free in print_graph_function_flags during tracer switching 2025-03-22 05:42:42 -04:00
trace_selftest.c fgraph: Pass ftrace_regs to retfunc 2024-12-26 10:50:03 -05:00
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c tracing: Switch trace_stack.c code over to use guard() 2024-12-26 10:38:37 -05:00
trace_stat.c tracing: Switch trace_stat.c code over to use guard() 2024-12-26 10:38:37 -05:00
trace_stat.h
trace_synth.h
trace_syscalls.c tracing/perf: Add might_fault check to syscall probes 2024-10-09 17:09:46 -04:00
trace_uprobe.c tracing: probes: Fix a possible race in trace_probe_log APIs 2025-05-13 22:23:34 +09: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