Commit d1e521ad authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 595a56ac 388d8bdb
Loading
Loading
Loading
Loading
+2115 −0

File added.

Preview size limit exceeded, changes collapsed.

+42 −10
Original line number Diff line number Diff line
@@ -249,15 +249,6 @@ config TRACE_PREEMPT_TOGGLE
	  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 +605,30 @@ config TRACING_MAP
	  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 +824,7 @@ config PREEMPTIRQ_DELAY_TEST

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 +847,29 @@ config KPROBE_EVENT_GEN_TEST

	  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
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ endif
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o
obj-$(CONFIG_SYNTH_EVENTS) += trace_events_synth.o
obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
+4 −4
Original line number Diff line number Diff line
@@ -2016,14 +2016,14 @@ void ftrace_bug(int failed, struct dyn_ftrace *rec)
{
	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(KERN_INFO, ip);
		break;
	case -EINVAL:
		FTRACE_WARN_ON_ONCE(1);
		pr_info("ftrace failed to modify ");
		print_ip_sym(KERN_INFO, ip);
		print_ip_ins(" actual:   ", (unsigned char *)ip);
@@ -2034,12 +2034,10 @@ void ftrace_bug(int failed, struct dyn_ftrace *rec)
		}
		break;
	case -EPERM:
		FTRACE_WARN_ON_ONCE(1);
		pr_info("ftrace faulted on writing ");
		print_ip_sym(KERN_INFO, ip);
		break;
	default:
		FTRACE_WARN_ON_ONCE(1);
		pr_info("ftrace faulted on unknown error ");
		print_ip_sym(KERN_INFO, ip);
	}
@@ -2066,6 +2064,8 @@ void ftrace_bug(int failed, struct dyn_ftrace *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)
+4 −1
Original line number Diff line number Diff line
@@ -1299,9 +1299,12 @@ 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();
	}
}

/**
 * tracer_tracing_is_on - show real state of ring buffer enabled
Loading