1. 14 Mar, 2018 3 commits
    • Steven Rostedt (VMware)'s avatar
      tracing: Rewrite filter logic to be simpler and faster · 80765597
      Steven Rostedt (VMware) authored
      Al Viro reviewed the filter logic of ftrace trace events and found it to be
      very troubling. It creates a binary tree based on the logic operators and
      walks it during tracing. He sent myself and Tom Zanussi a long explanation
      (and formal proof) of how to do the string parsing better and end up with a
      program array that can be simply iterated to come up with the correct
      results.
      
      I took his ideas and his pseudo code and rewrote the filter logic based on
      them. In doing so, I was able to remove a lot of code, and have a much more
      condensed filter logic in the process. I wrote a very long comment
      describing the methadology that Al proposed in my own words. For more info
      on how this works, read the comment above predicate_parse().
      Suggested-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      80765597
    • Steven Rostedt (VMware)'s avatar
      tracing: Clean up and document pred_funcs_##type creation and use · 478325f1
      Steven Rostedt (VMware) authored
      The pred_funcs_##type arrays consist of five functions that are assigned
      based on the ops. The array must be in the same order of the ops each
      function represents. The PRED_FUNC_START macro denotes the op enum that
      starts the op that maps to the pred_funcs_##type arrays. This is all very
      subtle and prone to bugs if the code is changed.
      
      Add comments describing how PRED_FUNC_START and pred_funcs_##type array is
      used, and also a PRED_FUNC_MAX that is the maximum number of functions in
      the arrays.
      
      Clean up select_comparison_fn() that assigns the predicates to the
      pred_funcs_##type array function as well as add protection in case an op is
      passed in that does not map correctly to the array.
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      478325f1
    • Steven Rostedt (VMware)'s avatar
      tracing: Combine enum and arrays into single macro in filter code · e9baef0d
      Steven Rostedt (VMware) authored
      Instead of having a separate enum that is the index into another array, like
      a string array, make a single macro that combines them into a single list,
      and then the two can not get out of sync. This makes it easier to add and
      remove items.
      
      The macro trick is:
      
       #define DOGS				\
        C( JACK,     "Jack Russell")		\
        C( ITALIAN,  "Italian Greyhound")	\
        C( GERMAN,   "German Shepherd")
      
       #undef C
       #define C(a, b) a
      
       enum { DOGS };
      
       #undef C
       #define C(a, b) b
      
       static char dogs[] = { DOGS };
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      e9baef0d
  2. 10 Mar, 2018 37 commits