Merge tag 'trace-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2023 18:20:49 +0000 (10:20 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2023 18:20:49 +0000 (10:20 -0800)
Pull tracing updates from Steven Rostedt:

 - Add function names as a way to filter function addresses

 - Add sample module to test ftrace ops and dynamic trampolines

 - Allow stack traces to be passed from beginning event to end event for
   synthetic events. This will allow seeing the stack trace of when a
   task is scheduled out and recorded when it gets scheduled back in.

 - Add trace event helper __get_buf() to use as a temporary buffer when
   printing out trace event output.

 - Add kernel command line to create trace instances on boot up.

 - Add enabling of events to instances created at boot up.

 - Add trace_array_puts() to write into instances.

 - Allow boot instances to take a snapshot at the end of boot up.

 - Allow live patch modules to include trace events

 - Minor fixes and clean ups

* tag 'trace-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (31 commits)
  tracing: Remove unnecessary NULL assignment
  tracepoint: Allow livepatch module add trace event
  tracing: Always use canonical ftrace path
  tracing/histogram: Fix stacktrace histogram Documententation
  tracing/histogram: Fix stacktrace key
  tracing/histogram: Fix a few problems with stacktrace variable printing
  tracing: Add BUILD_BUG() to make sure stacktrace fits in strings
  tracing/histogram: Don't use strlen to find length of stacktrace variables
  tracing: Allow boot instances to have snapshot buffers
  tracing: Add trace_array_puts() to write into instance
  tracing: Add enabling of events to boot instances
  tracing: Add creation of instances at boot command line
  tracing: Fix trace_event_raw_event_synth() if else statement
  samples: ftrace: Make some global variables static
  ftrace: sample: avoid open-coded 64-bit division
  samples: ftrace: Include the nospec-branch.h only for x86
  tracing: Acquire buffer from temparary trace sequence
  tracing/histogram: Wrap remaining shell snippets in code blocks
  tracing/osnoise: No need for schedule_hrtimeout range
  bpf/tracing: Use stage6 of tracing to not duplicate macros
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
Documentation/trace/events.rst
Documentation/trace/histogram.rst
include/linux/tracepoint.h
kernel/trace/Kconfig
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events.c

Simple merge
index 7b7e4893b8f617948b6a85fcc32f88f574258ba5,c5cfc6e7baeaee59cb9e287357cdf326e31b34bb..479c9eac63352207d51859a65cc229f36022d361
@@@ -1861,9 -1864,9 +1864,9 @@@ A histogram can now be defined for the 
  The above shows the latency "lat" in a power of 2 grouping.
  
  Like any other event, once a histogram is enabled for the event, the
- output can be displayed by reading the event's 'hist' file.
+ output can be displayed by reading the event's 'hist' file::
  
 -  # cat /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/hist
 +  # cat /sys/kernel/tracing/events/synthetic/wakeup_latency/hist
  
    # event histogram
    #
  
  
  The latency values can also be grouped linearly by a given size with
- the ".buckets" modifier and specify a size (in this case groups of 10).
+ the ".buckets" modifier and specify a size (in this case groups of 10)::
  
    # echo 'hist:keys=pid,prio,lat.buckets=10:sort=lat' >> \
 -        /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger
 +        /sys/kernel/tracing/events/synthetic/wakeup_latency/trigger
  
    # event histogram
    #
@@@ -2052,13 -2206,13 +2206,13 @@@ The following commonly-used handler.act
  
        # echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\
                wakeup_new_test($testpid) if comm=="cyclictest"' >> \
 -              /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/trigger
 +              /sys/kernel/tracing/events/sched/sched_wakeup_new/trigger
  
-     Or, equivalently, using the 'trace' keyword syntax:
+     Or, equivalently, using the 'trace' keyword syntax::
  
-     # echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\
-             trace(wakeup_new_test,$testpid) if comm=="cyclictest"' >> \
-             /sys/kernel/tracing/events/sched/sched_wakeup_new/trigger
+       # echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\
+               trace(wakeup_new_test,$testpid) if comm=="cyclictest"' >> \
 -              /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/trigger
++              /sys/kernel/tracing/events/sched/sched_wakeup_new/trigger
  
      Creating and displaying a histogram based on those events is now
      just a matter of using the fields and new synthetic event in the
      resulting latency, stored in wakeup_lat, exceeds the current
      maximum latency, a snapshot is taken.  As part of the setup, all
      the scheduler events are also enabled, which are the events that
-     will show up in the snapshot when it is taken at some point:
+     will show up in the snapshot when it is taken at some point::
  
-     # echo 1 > /sys/kernel/tracing/events/sched/enable
 -      # echo 1 > /sys/kernel/debug/tracing/events/sched/enable
++      # echo 1 > /sys/kernel/tracing/events/sched/enable
  
-     # echo 'hist:keys=pid:ts0=common_timestamp.usecs \
-             if comm=="cyclictest"' >> \
-             /sys/kernel/tracing/events/sched/sched_waking/trigger
+       # echo 'hist:keys=pid:ts0=common_timestamp.usecs \
+               if comm=="cyclictest"' >> \
 -              /sys/kernel/debug/tracing/events/sched/sched_waking/trigger
++              /sys/kernel/tracing/events/sched/sched_waking/trigger
  
-     # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
-             onmax($wakeup_lat).save(next_prio,next_comm,prev_pid,prev_prio, \
-           prev_comm):onmax($wakeup_lat).snapshot() \
-           if next_comm=="cyclictest"' >> \
-           /sys/kernel/tracing/events/sched/sched_switch/trigger
+       # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
+               onmax($wakeup_lat).save(next_prio,next_comm,prev_pid,prev_prio, \
+             prev_comm):onmax($wakeup_lat).snapshot() \
+             if next_comm=="cyclictest"' >> \
 -            /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
++            /sys/kernel/tracing/events/sched/sched_switch/trigger
  
      When the histogram is displayed, for each bucket the max value
      and the saved values corresponding to the max are displayed
      following the rest of the fields.
  
      If a snapshot was taken, there is also a message indicating that,
-     along with the value and event that triggered the global maximum:
+     along with the value and event that triggered the global maximum::
  
-     # cat /sys/kernel/tracing/events/sched/sched_switch/hist
-       { next_pid:       2101 } hitcount:        200
-       max:         52  next_prio:        120  next_comm: cyclictest \
-         prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
 -      # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
++      # cat /sys/kernel/tracing/events/sched/sched_switch/hist
+         { next_pid:       2101 } hitcount:        200
+         max:         52  next_prio:        120  next_comm: cyclictest \
+           prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
  
-       { next_pid:       2103 } hitcount:       1326
-       max:        572  next_prio:         19  next_comm: cyclictest \
-         prev_pid:          0  prev_prio:        120  prev_comm: swapper/1
+         { next_pid:       2103 } hitcount:       1326
+         max:        572  next_prio:         19  next_comm: cyclictest \
+           prev_pid:          0  prev_prio:        120  prev_comm: swapper/1
  
-       { next_pid:       2102 } hitcount:       1982 \
-       max:         74  next_prio:         19  next_comm: cyclictest \
-         prev_pid:          0  prev_prio:        120  prev_comm: swapper/5
+         { next_pid:       2102 } hitcount:       1982 \
+         max:         74  next_prio:         19  next_comm: cyclictest \
+           prev_pid:          0  prev_prio:        120  prev_comm: swapper/5
  
-     Snapshot taken (see tracing/snapshot).  Details:
-       triggering value { onmax($wakeup_lat) }:        572     \
-       triggered by event with key: { next_pid:       2103 }
+       Snapshot taken (see tracing/snapshot).  Details:
+         triggering value { onmax($wakeup_lat) }:        572   \
+         triggered by event with key: { next_pid:       2103 }
  
-     Totals:
-         Hits: 3508
-         Entries: 3
-         Dropped: 0
+       Totals:
+           Hits: 3508
+           Entries: 3
+           Dropped: 0
  
      In the above case, the event that triggered the global maximum has
      the key with next_pid == 2103.  If you look at the bucket that has
      $cwnd variable.  If the value has changed, a snapshot is taken.
      As part of the setup, all the scheduler and tcp events are also
      enabled, which are the events that will show up in the snapshot
-     when it is taken at some point:
+     when it is taken at some point::
  
-     # echo 1 > /sys/kernel/tracing/events/sched/enable
-     # echo 1 > /sys/kernel/tracing/events/tcp/enable
 -      # echo 1 > /sys/kernel/debug/tracing/events/sched/enable
 -      # echo 1 > /sys/kernel/debug/tracing/events/tcp/enable
++      # echo 1 > /sys/kernel/tracing/events/sched/enable
++      # echo 1 > /sys/kernel/tracing/events/tcp/enable
  
-     # echo 'hist:keys=dport:cwnd=snd_cwnd: \
-             onchange($cwnd).save(snd_wnd,srtt,rcv_wnd): \
-           onchange($cwnd).snapshot()' >> \
-           /sys/kernel/tracing/events/tcp/tcp_probe/trigger
+       # echo 'hist:keys=dport:cwnd=snd_cwnd: \
+               onchange($cwnd).save(snd_wnd,srtt,rcv_wnd): \
+             onchange($cwnd).snapshot()' >> \
 -            /sys/kernel/debug/tracing/events/tcp/tcp_probe/trigger
++            /sys/kernel/tracing/events/tcp/tcp_probe/trigger
  
      When the histogram is displayed, for each bucket the tracked value
      and the saved values corresponding to that value are displayed
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge