]> Git Repo - linux.git/commitdiff
Merge tag 'trace-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux...
authorLinus Torvalds <[email protected]>
Tue, 9 Jun 2020 17:06:18 +0000 (10:06 -0700)
committerLinus Torvalds <[email protected]>
Tue, 9 Jun 2020 17:06:18 +0000 (10:06 -0700)
Pull tracing updates from Steven Rostedt:
 "No new features this release. Mostly clean ups, restructuring and
  documentation.

   - Have ftrace_bug() show ftrace errors before the WARN, as the WARN
     will reboot the box before the error messages are printed if
     panic_on_warn is set.

   - Have traceoff_on_warn disable tracing sooner (before prints)

   - Write a message to the trace buffer that its being disabled when
     disable_trace_on_warning() is set.

   - Separate out synthetic events from histogram code to let it be used
     by other parts of the kernel.

   - More documentation on histogram design.

   - Other small fixes and clean ups"

* tag 'trace-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Remove obsolete PREEMPTIRQ_EVENTS kconfig option
  tracing/doc: Fix ascii-art in histogram-design.rst
  tracing: Add a trace print when traceoff_on_warning is triggered
  ftrace,bug: Improve traceoff_on_warn
  selftests/ftrace: Distinguish between hist and synthetic event checks
  tracing: Move synthetic events to a separate file
  tracing: Fix events.rst section numbering
  tracing/doc: Fix typos in histogram-design.rst
  tracing: Add hist_debug trace event files for histogram debugging
  tracing: Add histogram-design document
  tracing: Check state.disabled in synth event trace functions
  tracing/probe: reverse arguments to list_add
  tools/bootconfig: Add a summary of test cases and return error
  ftrace: show debugging information when panic_on_warn set

1  2 
kernel/trace/Kconfig
kernel/trace/ftrace.c
kernel/trace/trace.c

diff --combined kernel/trace/Kconfig
index 24876faac753244060b9e3a44a2a97594dde5896,0c82ac2c5688c09df4e9d403e3744cd9e494be9f..a4020c0b4508c9977702dd71823a1c9756217872
@@@ -10,6 -10,11 +10,6 @@@ config USER_STACKTRACE_SUPPOR
  config NOP_TRACER
        bool
  
 -config HAVE_FTRACE_NMI_ENTER
 -      bool
 -      help
 -        See Documentation/trace/ftrace-design.rst
 -
  config HAVE_FUNCTION_TRACER
        bool
        help
@@@ -67,6 -72,11 +67,6 @@@ config RING_BUFFE
        select TRACE_CLOCK
        select IRQ_WORK
  
 -config FTRACE_NMI_ENTER
 -       bool
 -       depends on HAVE_FTRACE_NMI_ENTER
 -       default y
 -
  config EVENT_TRACING
        select CONTEXT_SWITCH_TRACER
        select GLOB
@@@ -148,7 -158,6 +148,7 @@@ config FUNCTION_TRACE
        select CONTEXT_SWITCH_TRACER
        select GLOB
        select TASKS_RCU if PREEMPTION
 +      select TASKS_RUDE_RCU
        help
          Enable the kernel to trace every kernel function. This is done
          by using a compiler feature to insert a small, 5-byte No-Operation
@@@ -249,15 -258,6 +249,6 @@@ config TRACE_PREEMPT_TOGGL
          Enables hooks which will be called when preemption is first disabled,
          and last enabled.
  
- config PREEMPTIRQ_EVENTS
-       bool "Enable trace events for preempt and irq disable/enable"
-       select TRACE_IRQFLAGS
-       select TRACE_PREEMPT_TOGGLE if PREEMPTION
-       select GENERIC_TRACER
-       default n
-       help
-         Enable tracing of disable and enable events for preemption and irqs.
  config IRQSOFF_TRACER
        bool "Interrupts-off Latency Tracer"
        default n
@@@ -614,12 -614,30 +605,30 @@@ config TRACING_MA
          generally used outside of that context, and is normally
          selected by tracers that use it.
  
+ config SYNTH_EVENTS
+       bool "Synthetic trace events"
+       select TRACING
+       select DYNAMIC_EVENTS
+       default n
+       help
+         Synthetic events are user-defined trace events that can be
+         used to combine data from other trace events or in fact any
+         data source.  Synthetic events can be generated indirectly
+         via the trace() action of histogram triggers or directly
+         by way of an in-kernel API.
+         See Documentation/trace/events.rst or
+         Documentation/trace/histogram.rst for details and examples.
+         If in doubt, say N.
  config HIST_TRIGGERS
        bool "Histogram triggers"
        depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
        select TRACING_MAP
        select TRACING
        select DYNAMIC_EVENTS
+       select SYNTH_EVENTS
        default n
        help
          Hist triggers allow one or more arbitrary trace event fields
@@@ -815,7 -833,7 +824,7 @@@ config PREEMPTIRQ_DELAY_TES
  
  config SYNTH_EVENT_GEN_TEST
        tristate "Test module for in-kernel synthetic event generation"
-       depends on HIST_TRIGGERS
+       depends on SYNTH_EVENTS
        help
            This option creates a test module to check the base
            functionality of in-kernel synthetic event definition and
@@@ -838,6 -856,29 +847,29 @@@ config KPROBE_EVENT_GEN_TES
  
          If unsure, say N.
  
+ config HIST_TRIGGERS_DEBUG
+       bool "Hist trigger debug support"
+       depends on HIST_TRIGGERS
+       help
+           Add "hist_debug" file for each event, which when read will
+           dump out a bunch of internal details about the hist triggers
+           defined on that event.
+           The hist_debug file serves a couple of purposes:
+             - Helps developers verify that nothing is broken.
+             - Provides educational information to support the details
+               of the hist trigger internals as described by
+               Documentation/trace/histogram-design.rst.
+           The hist_debug output only covers the data structures
+           related to the histogram definitions themselves and doesn't
+           display the internals of map buckets or variable values of
+           running histograms.
+           If unsure, say N.
  endif # FTRACE
  
  endif # TRACING_SUPPORT
diff --combined kernel/trace/ftrace.c
index 7d0ebd1047069551fa666482a1297fc54ab3ebe7,cd39cbf3631a5023dc70432edabef143819e3c2f..c163c3531fafc4d9227e0607b9408852287c3c5f
@@@ -160,6 -160,17 +160,6 @@@ static void ftrace_pid_func(unsigned lo
        op->saved_func(ip, parent_ip, op, regs);
  }
  
 -static void ftrace_sync(struct work_struct *work)
 -{
 -      /*
 -       * This function is just a stub to implement a hard force
 -       * of synchronize_rcu(). This requires synchronizing
 -       * tasks even in userspace and idle.
 -       *
 -       * Yes, function tracing is rude.
 -       */
 -}
 -
  static void ftrace_sync_ipi(void *data)
  {
        /* Probably not needed, but do it anyway */
@@@ -245,7 -256,7 +245,7 @@@ static void update_ftrace_function(void
         * Make sure all CPUs see this. Yes this is slow, but static
         * tracing is slow and nasty to have enabled.
         */
 -      schedule_on_each_cpu(ftrace_sync);
 +      synchronize_rcu_tasks_rude();
        /* Now all cpus are using the list ops. */
        function_trace_op = set_function_trace_op;
        /* Make sure the function_trace_op is visible on all CPUs */
@@@ -2016,16 -2027,16 +2016,16 @@@ void ftrace_bug(int failed, struct dyn_
  {
        unsigned long ip = rec ? rec->ip : 0;
  
+       pr_info("------------[ ftrace bug ]------------\n");
        switch (failed) {
        case -EFAULT:
-               FTRACE_WARN_ON_ONCE(1);
                pr_info("ftrace faulted on modifying ");
 -              print_ip_sym(ip);
 +              print_ip_sym(KERN_INFO, ip);
                break;
        case -EINVAL:
-               FTRACE_WARN_ON_ONCE(1);
                pr_info("ftrace failed to modify ");
 -              print_ip_sym(ip);
 +              print_ip_sym(KERN_INFO, ip);
                print_ip_ins(" actual:   ", (unsigned char *)ip);
                pr_cont("\n");
                if (ftrace_expected) {
                }
                break;
        case -EPERM:
-               FTRACE_WARN_ON_ONCE(1);
                pr_info("ftrace faulted on writing ");
 -              print_ip_sym(ip);
 +              print_ip_sym(KERN_INFO, ip);
                break;
        default:
-               FTRACE_WARN_ON_ONCE(1);
                pr_info("ftrace faulted on unknown error ");
 -              print_ip_sym(ip);
 +              print_ip_sym(KERN_INFO, ip);
        }
        print_bug_type();
        if (rec) {
                ip = ftrace_get_addr_curr(rec);
                pr_cont("\n expected tramp: %lx\n", ip);
        }
+       FTRACE_WARN_ON_ONCE(1);
  }
  
  static int ftrace_check_record(struct dyn_ftrace *rec, bool enable, bool update)
@@@ -2921,7 -2932,7 +2921,7 @@@ int ftrace_shutdown(struct ftrace_ops *
                 * infrastructure to do the synchronization, thus we must do it
                 * ourselves.
                 */
 -              schedule_on_each_cpu(ftrace_sync);
 +              synchronize_rcu_tasks_rude();
  
                /*
                 * When the kernel is preeptive, tasks can be preempted
@@@ -5877,7 -5888,7 +5877,7 @@@ ftrace_graph_release(struct inode *inod
                 * infrastructure to do the synchronization, thus we must do it
                 * ourselves.
                 */
 -              schedule_on_each_cpu(ftrace_sync);
 +              synchronize_rcu_tasks_rude();
  
                free_ftrace_hash(old_hash);
        }
diff --combined kernel/trace/trace.c
index 3ab27022c20f08efa105665caae4827fd0ab7330,760fd102dbe245582c543db4e5cd44b64471eb6c..ec44b0e2a19c3bf2f9fa274b7e0c63022005a82d
@@@ -1299,8 -1299,11 +1299,11 @@@ EXPORT_SYMBOL_GPL(tracing_off)
  
  void disable_trace_on_warning(void)
  {
-       if (__disable_trace_on_warning)
+       if (__disable_trace_on_warning) {
+               trace_array_printk_buf(global_trace.array_buffer.buffer, _THIS_IP_,
+                       "Disabling tracing due to warning\n");
                tracing_off();
+       }
  }
  
  /**
@@@ -2662,7 -2665,7 +2665,7 @@@ static void output_printk(struct trace_
  }
  
  int tracepoint_printk_sysctl(struct ctl_table *table, int write,
 -                           void __user *buffer, size_t *lenp,
 +                           void *buffer, size_t *lenp,
                             loff_t *ppos)
  {
        int save_tracepoint_printk;
@@@ -6305,6 -6308,13 +6308,6 @@@ static void tracing_spd_release_pipe(st
        __free_page(spd->pages[idx]);
  }
  
 -static const struct pipe_buf_operations tracing_pipe_buf_ops = {
 -      .confirm                = generic_pipe_buf_confirm,
 -      .release                = generic_pipe_buf_release,
 -      .steal                  = generic_pipe_buf_steal,
 -      .get                    = generic_pipe_buf_get,
 -};
 -
  static size_t
  tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)
  {
@@@ -6366,7 -6376,7 +6369,7 @@@ static ssize_t tracing_splice_read_pipe
                .partial        = partial_def,
                .nr_pages       = 0, /* This gets updated below. */
                .nr_pages_max   = PIPE_DEF_BUFFERS,
 -              .ops            = &tracing_pipe_buf_ops,
 +              .ops            = &default_pipe_buf_ops,
                .spd_release    = tracing_spd_release_pipe,
        };
        ssize_t ret;
@@@ -7575,7 -7585,9 +7578,7 @@@ static bool buffer_pipe_buf_get(struct 
  
  /* Pipe buffer operations for a buffer. */
  static const struct pipe_buf_operations buffer_pipe_buf_ops = {
 -      .confirm                = generic_pipe_buf_confirm,
        .release                = buffer_pipe_buf_release,
 -      .steal                  = generic_pipe_buf_nosteal,
        .get                    = buffer_pipe_buf_get,
  };
  
@@@ -8518,6 -8530,18 +8521,6 @@@ static int allocate_trace_buffers(struc
        allocate_snapshot = false;
  #endif
  
 -      /*
 -       * Because of some magic with the way alloc_percpu() works on
 -       * x86_64, we need to synchronize the pgd of all the tables,
 -       * otherwise the trace events that happen in x86_64 page fault
 -       * handlers can't cope with accessing the chance that a
 -       * alloc_percpu()'d memory might be touched in the page fault trace
 -       * event. Oh, and we need to audit all other alloc_percpu() and vmalloc()
 -       * calls in tracing, because something might get triggered within a
 -       * page fault trace event!
 -       */
 -      vmalloc_sync_mappings();
 -
        return 0;
  }
  
This page took 0.105825 seconds and 4 git commands to generate.