linux/Documentation/trace
Linus Torvalds 59a02493f3 tracing updates for v7.4:
- Add "within" to filter logic
 
   Add a way to trace events by what function they fall in.
 
   echo 'within == "vfs_read" > events/sched/sched_switch/filter
 
   Will only trigger sched_switch events that happen within the vfs_read
   function. It uses a stacktrace at the event and checks if any entry is
   within the specified function and if so, it prints the event.
 
 - Remove a duplicate definition of ftrace_set_clr_event() from the header
 
 - Do not have ftrace_set_clr_event() modify its input buffer
 
   Have the buffer passed into ftrace_set_clr_event() to be const char * and
   not allow modifications to it that might cause side effects.
 
 - Add kunit tests for ftrace_parse_event_string()
 
 - Add filter argument to __ftrace_set_clr_event()
 
   Make it possible to set a filter on an event at the same time it is
   enabled.
 
 - Add event filtering logic to the kernel command line
 
   To allow filtering events on boot, allow filtering to be specified on the
   kernel command line when enabling events.
 
 - Rename "ring_buffer_size()" to "ring_buffer_capacity()"
 
   "size" refers to how much is allocated whereas the actual return value is
   the amount of available data in the ring buffer minus its meta data.
 
 - Rename "trace_array_entries" to "trace_array_capacity"
 
   There's several functions that use "entries" and returns the amount of
   data that that is usable. "entries" should be only for the number of
   events, not the amount of data.
 
 - Print the histogram "bucket" size as unsigned.
 
   If a bucket size is LONG_MAX, then it shows up as a negative number.
 
 - Show bucket size in output of histograms
 
   The output of what the histogram is shown doesn't show the size of the
   buckets when buckets are used. The output should be the same as the input
   and since specifying buckets without a size is an invalid command, the
   output to display what was entered should also show the size.
 
 - Fix stacktrace modifier output
 
   Only show the stacktrace modifier when it was specified in creation.
 
 - Unregister filed variable histograms when the command fails
 
   If one histogram references a variable of another histogram it registers
   that other histogram. But if the first histogram fails in setup after it
   registered the other histogram it doesn't unregister it. Have the first
   histogram add the reference to the other histogram so the failure clean up
   will unregister the second histogram too.
 
 - Fix 64-bit signed histogram fields on 32-bit kernels
 
   A fix to convert char * to u64 with added casting also incorrectly added
   an intermediate cast to convert a long value to u64 which ended up
   truncating the upper 32 bits for 32-bit kernels. Remove the intermediate
   typecast.
 
 - Print signed histogram keys as signed
 
   Histogram keys were being printed as unsigned and with signed keys it was
   giving the wrong output.
 
 - Use copy_from_user() and not __copy_from_user() in syscall tracing
 
   The syscall tracing incorrectly was using __copy_from_user() which could
   be an issue if the system trusts perf doing the trace.
 
 - Take trace_types_lock when recording a new module in persistent buffer
 
   When a new module is loaded, the persistent ring buffer saves it in its
   persistent memory. All the trace_arrays are iterated looking for any
   persistent buffer to add the module to. But it did not hold the
   trace_types_lock meaning a trace_array could be added or removed while
   iterating the list.
 
 - Only create tracepoint guest_halt_poll_ns when it is used
 
   The tracepoint guest_halt_poll_ns is defined in the power management code
   but it is only used when CONFIG_CPU_IDLE_GOV_HALTPOLL is enabled. This
   wastes memory when that config isn't enabled so wrap the tracepoint around
   that as well.
 
 - Handle empty fields for events in trace_event_get_offsets()
 
   The user events could have empty fields and this causes
   trace_event_get_offsets() to crash as it expects events to always have
   fields. Make the function handle events with no fields.
 
 - Reject incomplete event filter expressions
 
   If a filter has an incomplete expression (common_pid == 1111 || ), it will
   cause a out-of-bounds bug. Have the predicate_parse() only process the
   expression if it is complete.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCatwDfRQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qk8TAP9buI4fQRvXGetyth9F/j8qGgTAEv19
 sL5B48A/HDx2wgD+O6FcFAwwNKTjJHfHPArJUcQMp/D17rNDFSoF4T0kFQU=
 =F2J6
 -----END PGP SIGNATURE-----

Merge tag 'trace-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing updates from Steven Rostedt:

 - Add "within" to filter logic

   Add a way to trace events by what function they fall in.

	echo 'within == "vfs_read" > events/sched/sched_switch/filter

   Will only trigger sched_switch events that happen within the vfs_read
   function. It uses a stacktrace at the event and checks if any entry
   is within the specified function and if so, it prints the event.

 - Remove a duplicate definition of ftrace_set_clr_event() from the
   header

 - Do not have ftrace_set_clr_event() modify its input buffer

   Have the buffer passed into ftrace_set_clr_event() to be const char *
   and not allow modifications to it that might cause side effects.

 - Add kunit tests for ftrace_parse_event_string()

 - Add filter argument to __ftrace_set_clr_event()

   Make it possible to set a filter on an event at the same time it is
   enabled.

 - Add event filtering logic to the kernel command line

   To allow filtering events on boot, allow filtering to be specified on
   the kernel command line when enabling events.

 - Rename "ring_buffer_size()" to "ring_buffer_capacity()"

   "size" refers to how much is allocated whereas the actual return
   value is the amount of available data in the ring buffer minus its
   meta data.

 - Rename "trace_array_entries" to "trace_array_capacity"

   There's several functions that use "entries" and returns the amount
   of data that that is usable. "entries" should be only for the number
   of events, not the amount of data.

 - Print the histogram "bucket" size as unsigned.

   If a bucket size is LONG_MAX, then it shows up as a negative number.

 - Show bucket size in output of histograms

   The output of what the histogram is shown doesn't show the size of
   the buckets when buckets are used. The output should be the same as
   the input and since specifying buckets without a size is an invalid
   command, the output to display what was entered should also show the
   size.

 - Fix stacktrace modifier output

   Only show the stacktrace modifier when it was specified in creation.

 - Unregister filed variable histograms when the command fails

   If one histogram references a variable of another histogram it
   registers that other histogram. But if the first histogram fails in
   setup after it registered the other histogram it doesn't unregister
   it. Have the first histogram add the reference to the other histogram
   so the failure clean up will unregister the second histogram too.

 - Fix 64-bit signed histogram fields on 32-bit kernels

   A fix to convert char * to u64 with added casting also incorrectly
   added an intermediate cast to convert a long value to u64 which ended
   up truncating the upper 32 bits for 32-bit kernels. Remove the
   intermediate typecast.

 - Print signed histogram keys as signed

   Histogram keys were being printed as unsigned and with signed keys it
   was giving the wrong output.

 - Use copy_from_user() and not __copy_from_user() in syscall tracing

   The syscall tracing incorrectly was using __copy_from_user() which
   could be an issue if the system trusts perf doing the trace.

 - Take trace_types_lock when recording a new module in persistent
   buffer

   When a new module is loaded, the persistent ring buffer saves it in
   its persistent memory. All the trace_arrays are iterated looking for
   any persistent buffer to add the module to. But it did not hold the
   trace_types_lock meaning a trace_array could be added or removed
   while iterating the list.

 - Only create tracepoint guest_halt_poll_ns when it is used

   The tracepoint guest_halt_poll_ns is defined in the power management
   code but it is only used when CONFIG_CPU_IDLE_GOV_HALTPOLL is
   enabled. This wastes memory when that config isn't enabled so wrap
   the tracepoint around that as well.

 - Handle empty fields for events in trace_event_get_offsets()

   The user events could have empty fields and this causes
   trace_event_get_offsets() to crash as it expects events to always
   have fields. Make the function handle events with no fields.

 - Reject incomplete event filter expressions

   If a filter has an incomplete expression (common_pid == 1111 || ), it
   will cause a out-of-bounds bug. Have the predicate_parse() only
   process the expression if it is complete.

* tag 'trace-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (27 commits)
  tracing: Reject incomplete event filter expressions
  tracing: Guard trace_event_get_offsets() against an empty fields list
  cpuidle: haltpoll: Only define guest_halt_poll_ns tracepoint when used
  tracing/osnoise: Add __printf attribute to osnoise_print()
  tracing/histograms: Verify event_call identity when updating synth_event refcount
  tracing: Save the event file instead of the compatible histogram
  tracing: Hold trace_types_lock when resetting last boot data from readers
  tracing: Hold trace_types_lock when updating modules in persistent instances
  tracing/syscalls: Use copy_from_user for the faultable syscall buffer
  tracing: Print a signed histogram key as signed
  tracing: Fix 64-bit and signed histogram fields on 32-bit kernels
  tracing: Clamp the printed end of a histogram bucket at U64_MAX
  tracing: Unregister field variable histograms when the command fails
  tracing: Only report the stacktrace modifier on a real field
  tracing: Add the bucket size to expr_field_str()
  tracing: Print the bucket size as unsigned
  tracing: Rename tracing_entries_fops to tracing_capacity_fops
  tracing: Rename trace_array::entries to capacity
  ring-buffer: Rename ring_buffer_size() to ring_buffer_capacity()
  tracing: Parse filter from boot event string
  ...
2026-10-27 15:01:12 -10:00
..
coresight perf test cs-etm: Remove unused Coresight workloads 2026-06-10 18:55:49 -03:00
postprocess
rv Documentation/rv: Explain epoll and aborted sleeps 2026-08-04 16:11:28 +02:00
boottime-trace.rst tracing/boot: Add support for eprobe, fprobe, and tprobe events 2026-08-08 21:20:55 +09:00
debugging.rst tracing/Documentation: Add a section about backup instance 2026-04-02 13:27:21 -04:00
eprobetrace.rst tracing/probes: Support field specifier option for typecast 2026-07-14 22:43:16 +09:00
events-kmem.rst
events-landlock.rst landlock: Add documentation for capability and namespace restrictions 2026-10-20 16:47:22 +02:00
events-msr.rst
events-nmi.rst
events-pci-controller.rst Documentation: tracing: Add PCI controller event documentation 2026-04-07 20:13:12 +05:30
events-pci.rst Documentation: tracing: Add PCI tracepoint documentation 2026-01-08 10:06:19 -06:00
events-power.rst
events.rst tracing: Parse filter from boot event string 2026-10-15 18:23:35 -04:00
fprobe.rst docs: trace: fprobe: fix 'thos' spelling 2026-07-28 23:54:59 +09:00
fprobetrace.rst tracing/probes: Add this_cpu_read() and this_cpu_ptr() dereference method to fetcharg 2026-07-14 22:43:16 +09:00
ftrace-design.rst tracing: Remove redundant config HAVE_FTRACE_MCOUNT_RECORD 2025-07-22 20:15:56 -04:00
ftrace-uses.rst Documentation/trace: Fix links to other documents 2026-01-12 09:31:19 -07:00
ftrace.rst tracing: Update funcgraph-retval documentation 2026-10-15 18:54:49 -04:00
function-graph-fold.vim
hisi-ptt.rst perf hisi-ptt: Fix PTT trace TLP header parsing 2026-07-31 15:48:12 -07:00
histogram-design.rst Documentation: fix spelling mistake "stucture" -> "structure" 2026-04-27 03:56:14 -06:00
histogram.rst tracing: Clamp the printed end of a histogram bucket at U64_MAX 2026-10-15 18:44:16 -04:00
hwlat_detector.rst
index.rst landlock: Document tracepoints 2026-08-17 10:17:19 +02:00
intel_th.rst
kprobes.rst
kprobetrace.rst tracing/probes: Add this_cpu_read() and this_cpu_ptr() dereference method to fetcharg 2026-07-14 22:43:16 +09:00
mmiotrace.rst
osnoise-tracer.rst
remotes.rst Documentation: tracing: Add tracing remotes 2026-03-09 12:33:55 -04:00
ring-buffer-design.rst
ring-buffer-map.rst
stm.rst
sys-t.rst
timerlat-tracer.rst Documentation/trace: Specify exact priority for timerlat 2025-11-05 11:19:20 -07:00
tracepoint-analysis.rst
tracepoints.rst tracepoint: Have tracepoints created with DECLARE_TRACE() have _tp suffix 2025-05-14 11:19:32 -04:00
uprobetracer.rst
user_events.rst