Merge tag 'trace-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 6 Jun 2018 23:39:18 +0000 (16:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 6 Jun 2018 23:39:18 +0000 (16:39 -0700)
Pull tracing updates from Steven Rostedt:
 "One new feature was added to ftrace, which is the trace_marker now
  supports triggers. For example:

    # cd /sys/kernel/debug/tracing
    # echo 'snapshot' > events/ftrace/print/trigger
    # echo 'cause snapshot' > trace_marker

  The rest of the changes are various clean ups and also one stable fix
  that was added late in the cycle"

* tag 'trace-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (21 commits)
  tracing: Use match_string() instead of open coding it in trace_set_options()
  branch-check: fix long->int truncation when profiling branches
  ring-buffer: Fix typo in comment
  ring-buffer: Fix a bunch of typos in comments
  tracing/selftest: Add test to test simple snapshot trigger for trace_marker
  tracing/selftest: Add test to test hist trigger between kernel event and trace_marker
  tracing/selftest: Add selftests to test trace_marker histogram triggers
  ftrace/selftest: Fix reset_trigger() to handle triggers with filters
  ftrace/selftest: Have the reset_trigger code be a bit more careful
  tracing: Document trace_marker triggers
  tracing: Allow histogram triggers to access ftrace internal events
  tracing: Prevent further users of zero size static arrays in trace events
  tracing: Have zero size length in filter logic be full string
  tracing: Add trigger file for trace_markers tracefs/ftrace/print
  tracing: Do not show filter file for ftrace internal events
  tracing: Add brackets in ftrace event dynamic arrays
  tracing: Have event_trace_init() called by trace_init_tracefs()
  tracing: Add __find_event_file() to find event files without restrictions
  tracing: Do not reference event data in post call triggers
  tracepoints: Fix the descriptions of tracepoint_probe_register{_prio}
  ...

1  2 
Documentation/trace/ftrace.rst
scripts/Makefile.build

@@@ -224,8 -224,6 +224,8 @@@ of ftrace. Here is a list of some of th
        has a side effect of enabling or disabling specific functions
        to be traced. Echoing names of functions into this file
        will limit the trace to only those functions.
 +      This influences the tracers "function" and "function_graph"
 +      and thus also function profiling (see "function_profile_enabled").
  
        The functions listed in "available_filter_functions" are what
        can be written into this file.
        Functions listed in this file will cause the function graph
        tracer to only trace these functions and the functions that
        they call. (See the section "dynamic ftrace" for more details).
 +      Note, set_ftrace_filter and set_ftrace_notrace still affects
 +      what functions are being traced.
  
    set_graph_notrace:
  
  
        This lists the functions that ftrace has processed and can trace.
        These are the function names that you can pass to
 -      "set_ftrace_filter" or "set_ftrace_notrace".
 +      "set_ftrace_filter", "set_ftrace_notrace",
 +      "set_graph_function", or "set_graph_notrace".
        (See the section "dynamic ftrace" below for more details.)
  
    dyn_ftrace_total_info:
  
                trace_fd = open("trace_marker", WR_ONLY);
  
+       Note: Writing into the trace_marker file can also initiate triggers
+             that are written into /sys/kernel/tracing/events/ftrace/print/trigger
+             See "Event triggers" in Documentation/trace/events.rst and an
+               example in Documentation/trace/histogram.rst (Section 3.)
    trace_marker_raw:
  
        This is similar to trace_marker above, but is meant for for binary data
diff --combined scripts/Makefile.build
@@@ -147,6 -147,7 +147,6 @@@ $(obj)/%.i: $(src)/%.c FORC
  cmd_gensymtypes_c =                                                         \
      $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \
      $(GENKSYMS) $(if $(1), -T $(2))                                         \
 -     $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))             \
       $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS))                             \
       $(if $(KBUILD_PRESERVE),-p)                                            \
       -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@@ -206,6 -207,11 +206,11 @@@ cmd_modversions_c =                                                              
  endif
  
  ifdef CONFIG_FTRACE_MCOUNT_RECORD
+ # gcc 5 supports generating the mcount tables directly
+ ifneq ($(call cc-option,-mrecord-mcount,y),y)
+ KBUILD_CFLAGS += -mrecord-mcount
+ else
+ # else do it all manually
  ifdef BUILD_C_RECORDMCOUNT
  ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
    RECORDMCOUNT_FLAGS = -w
@@@ -258,6 -264,7 +263,7 @@@ ifneq ($(RETPOLINE_CFLAGS),
    objtool_args += --retpoline
  endif
  endif
+ endif
  
  
  ifdef CONFIG_MODVERSIONS
@@@ -354,6 -361,7 +360,6 @@@ cmd_gensymtypes_S 
       sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \
      $(CPP) -D__GENKSYMS__ $(c_flags) -xc - |                                \
      $(GENKSYMS) $(if $(1), -T $(2))                                         \
 -     $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))             \
       $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS))                             \
       $(if $(KBUILD_PRESERVE),-p)                                            \
       -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@@ -485,10 -493,15 +491,10 @@@ targets += $(lib-target
  
  dummy-object = $(obj)/.lib_exports.o
  ksyms-lds = $(dot-target).lds
 -ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
 -ref_prefix = EXTERN(_
 -else
 -ref_prefix = EXTERN(
 -endif
  
  quiet_cmd_export_list = EXPORTS $@
  cmd_export_list = $(OBJDUMP) -h $< | \
 -      sed -ne '/___ksymtab/s/.*+\([^ ]*\).*/$(ref_prefix)\1)/p' >$(ksyms-lds);\
 +      sed -ne '/___ksymtab/s/.*+\([^ ]*\).*/EXTERN(\1)/p' >$(ksyms-lds);\
        rm -f $(dummy-object);\
        echo | $(CC) $(a_flags) -c -o $(dummy-object) -x assembler -;\
        $(LD) $(ld_flags) -r -o $@ -T $(ksyms-lds) $(dummy-object);\