1. 01 10月, 2015 3 次提交
    • S
      tracing: Add a method to pass in trace_array descriptor to option files · 9a38a885
      Steven Rostedt (Red Hat) 提交于
      In preparation of having the multi buffer instances having their own trace
      option flags, the trace option files needs a way to not only pass in the
      flag they represent, but also the trace_array descriptor.
      
      A new field is added to the trace_array descriptor called trace_flags_index,
      which is a 32 byte character array representing a bit. This array is simply
      filled with the index of the array, where
      
        index_array[n] = n;
      
      Then the address of this array is passed to the file callbacks instead of
      the index of the flag index. Then to retrieve both the flag index and the
      trace_array descriptor:
      
        data is the passed in argument.
      
        index = *(unsigned char *)data;
      
        data -= index;
      
        /* Now data points to the address of the array in the trace_array */
      
        tr = container_of(data, struct trace_array, trace_flags_index);
      Suggested-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      9a38a885
    • S
      tracing: Move trace_flags from global to a trace_array field · 983f938a
      Steven Rostedt (Red Hat) 提交于
      In preparation to make trace options per instance, the global trace_flags
      needs to be moved from being a global variable to a field within the trace
      instance trace_array structure.
      
      There's still more work to do, as there's some functions that use
      trace_flags without passing in a way to get to the current_trace array. For
      those, the global_trace is used directly (from trace.c). This includes
      setting and clearing the trace_flags. This means that when a new instance is
      created, it just gets the trace_flags of the global_trace and will not be
      able to modify them. Depending on the functions that have access to the
      trace_array, the flags of an instance may not affect parts of its trace,
      where the global_trace is used. These will be fixed in future changes.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      983f938a
    • S
      tracing: Move sleep-time and graph-time options out of the core trace_flags · 55577204
      Steven Rostedt (Red Hat) 提交于
      The sleep-time and graph-time options are only for the function graph tracer
      and are not used by anything else. As tracer options are now visible when
      the tracer is not activated, its better to move the function graph specific
      tracer options into the function graph tracer.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      55577204
  2. 30 9月, 2015 9 次提交
    • S
      tracing: Remove access to trace_flags in trace_printk.c · b9f9108c
      Steven Rostedt (Red Hat) 提交于
      In the effort to move the global trace_flags to the tracing instances, the
      direct access to trace_flags must be removed from trace_printk.c
      
      Instead, add a new trace_printk_enabled boolean that is set by a new access
      function trace_printk_control(), that will enable or disable trace_printk.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b9f9108c
    • S
      tracing: Add build bug if we have more trace_flags than bits · b5e87c05
      Steven Rostedt (Red Hat) 提交于
      Add a enum that denotes the last bit of the trace_flags and have a
      BUILD_BUG_ON(last_bit > 32).
      
      If we add more bits than we have in trace_flags, the kernel wont build.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b5e87c05
    • S
      tracing: Always show all tracer options in the options directory · 41d9c0be
      Steven Rostedt (Red Hat) 提交于
      There are options that are unique to a specific tracer (like function and
      function graph). Currently, these options are only visible in the options
      directory when the tracer is enabled.
      
      This has been a pain, especially for something like the func_stack_trace
      option that if used inappropriately, could bring the system to a crawl. But
      the only way to see it, is to enable the function tracer.
      
      For example, if one had done:
      
       # cd /sys/kernel/tracing
       # echo __schedule > set_ftrace_filter
       # echo 1 > options/func_stack_trace
       # echo function > current_tracer
      
      The __schedule call will be traced and a stack trace will also be recorded
      there. Now when you were done, you may do...
      
       # echo nop > current_tracer
       # echo > set_ftrace_filter
      
      But you forgot to disable the func_stack_trace. The only way to disable it
      is to re-enable function tracing first. If you do not add a filter to
      set_ftrace_filter and just do:
      
       # echo function > current_tracer
      
      Now you would be performing a stack trace on *every* function! On some
      systems, that causes a live lock. Others may take a few minutes to fix your
      mistake.
      
      Having the func_stack_trace option visible allows you to check it and
      disable it before enabling the funtion tracer.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      41d9c0be
    • S
      tracing: Only create stacktrace option when STACKTRACE is configured · 73dddbb5
      Steven Rostedt (Red Hat) 提交于
      Only create the stacktrace trace option when CONFIG_STACKTRACE is
      configured.
      
      Cleaned up the ftrace_trace_stack() function call a little to allow better
      encapsulation of the stacktrace trace flag.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      73dddbb5
    • S
      tracing: Do not create function tracer options when not compiled in · 8179e8a1
      Steven Rostedt (Red Hat) 提交于
      When the function tracer is not compiled in, do not create the option files
      for it.
      
      Fix up both the sched_wakeup and irqsoff tracers to handle the change.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8179e8a1
    • S
      tracing: Only create function graph options when it is compiled in · 729358da
      Steven Rostedt (Red Hat) 提交于
      Do not create fuction graph tracer options when function graph tracer is not
      even compiled in.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      729358da
    • S
      tracing: Use TRACE_FLAGS macro to keep enums and strings matched · a3418a36
      Steven Rostedt (Red Hat) 提交于
      Use a cute little macro trick to keep the names of the trace flags file
      guaranteed to match the corresponding masks.
      
      The macro TRACE_FLAGS is defined as a serious of enum names followed by
      the string name of the file that matches it. For example:
      
       #define TRACE_FLAGS						\
      		C(PRINT_PARENT,		"print-parent"),	\
      		C(SYM_OFFSET,		"sym-offset"),		\
      		C(SYM_ADDR,		"sym-addr"),		\
      		C(VERBOSE,		"verbose"),
      
      Now we can define the following:
      
       #undef C
       #define C(a, b) TRACE_ITER_##a##_BIT
       enum trace_iterator_bits { TRACE_FLAGS };
      
      The above creates:
      
       enum trace_iterator_bits {
      	TRACE_ITER_PRINT_PARENT_BIT,
      	TRACE_ITER_SYM_OFFSET_BIT,
      	TRACE_ITER_SYM_ADDR_BIT,
      	TRACE_ITER_VERBOSE_BIT,
       };
      
      Then we can redefine C as:
      
       #undef C
       #define C(a, b) TRACE_ITER_##a = (1 << TRACE_ITER_##a##_BIT)
       enum trace_iterator_flags { TRACE_FLAGS };
      
      Which creates:
      
       enum trace_iterator_flags {
      	TRACE_ITER_PRINT_PARENT	= (1 << TRACE_ITER_PRINT_PARENT_BIT),
      	TRACE_ITER_SYM_OFFSET	= (1 << TRACE_ITER_SYM_OFFSET_BIT),
      	TRACE_ITER_SYM_ADDR	= (1 << TRACE_ITER_SYM_ADDR_BIT),
      	TRACE_ITER_VERBOSE	= (1 << TRACE_ITER_VERBOSE_BIT),
       };
      
      Then finally we can create the list of file names:
      
       #undef C
       #define C(a, b) b
       static const char *trace_options[] = {
      	TRACE_FLAGS
      	NULL
       };
      
      Which creates:
       static const char *trace_options[] = {
      	"print-parent",
      	"sym-offset",
      	"sym-addr",
      	"verbose",
      	NULL
       };
      
      The importance of this is that the strings match the bit index.
      
      	trace_options[TRACE_ITER_SYM_ADDR_BIT] == "sym-addr"
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a3418a36
    • S
      tracing: Remove unused tracing option "ftrace_preempt" · 938db5f5
      Steven Rostedt (Red Hat) 提交于
      There was a time where the function tracing would disable interrupts unless
      specifically told not to, where it would only disable preemption. With the
      new lockless code, the function tracing never disalbes interrupts and just
      uses disabling of preemption. Remove the option "ftrace_preempt" as it does
      nothing anyway.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      938db5f5
    • S
      tracing: Move "display-graph" option to main options · 03905582
      Steven Rostedt (Red Hat) 提交于
      In order to facilitate making all tracer options visible even when the
      tracer is not active, we need to get rid of duplicate options. Any option
      that is shared between multiple tracers really should be a main option.
      
      As the wakeup and irqsoff tracers both use the "display-graph" option, and
      use it exactly the same way, move that option from the tracer options to the
      main options and consolidate them.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      03905582
  3. 28 9月, 2015 1 次提交
  4. 26 9月, 2015 3 次提交
  5. 21 7月, 2015 3 次提交
  6. 14 5月, 2015 3 次提交
  7. 13 5月, 2015 1 次提交
  8. 16 4月, 2015 1 次提交
  9. 08 4月, 2015 3 次提交
  10. 14 2月, 2015 1 次提交
  11. 10 2月, 2015 1 次提交
  12. 04 2月, 2015 5 次提交
    • S
      tracing: Have mkdir and rmdir be part of tracefs · eae47358
      Steven Rostedt (Red Hat) 提交于
      The tracing "instances" directory can create sub tracing buffers
      with mkdir, and remove them with rmdir. As a mkdir will also create
      all the files and directories that control the sub buffer the inode
      mutexes need to be released before this is done, to avoid deadlocks.
      It is better to let the tracing system unlock the inode mutexes before
      calling the functions that create the files within the new directory
      (or deletes the files from the one being destroyed).
      
      Now that tracing has been converted over to tracefs, the tracefs file
      system can be modified to accommodate this feature. It still releases
      the locks, but the filesystem itself can take care of the ugly
      business and let the user just do what it needs.
      
      The tracing system now attaches a descriptor to the directory dentry
      that can have userspace create or remove sub directories. If this
      descriptor does not exist for a dentry, then that dentry can not be
      used to create other directories. This descriptor holds a mkdir and
      rmdir method that only takes a character string as an argument.
      
      The tracefs file system will first make a copy of the dentry name
      before releasing the locks. Then it will pass the copied name to the
      methods. It is up to the tracing system that supplied the methods to
      handle races with duplicate names and such as all the inode mutexes
      would be released when the functions are called.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      eae47358
    • S
      tracing: Automatically mount tracefs on debugfs/tracing · f76180bc
      Steven Rostedt (Red Hat) 提交于
      As tools currently rely on the tracing directory in debugfs, we can not
      just created a tracefs infrastructure and expect sysadmins to mount
      the new tracefs to have their old tools work.
      
      Instead, the debugfs tracing directory is still created and the tracefs
      file system is mounted there when the debugfs filesystem is mounted.
      
      No longer does the tracing infrastructure update the debugfs file system,
      but instead interacts with the tracefs file system. But now, it still
      appears to the user like nothing changed, except you also have the feature
      of mounting just the tracing system without needing all of debugfs!
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      f76180bc
    • S
      tracing: Convert the tracing facility over to use tracefs · 8434dc93
      Steven Rostedt (Red Hat) 提交于
      debugfs was fine for the tracing facility as a quick way to get
      an interface. Now that tracing has matured, it should separate itself
      from debugfs such that it can be mounted separately without needing
      to mount all of debugfs with it. That is, users resist using tracing
      because it requires mounting debugfs. Having tracing have its own file
      system lets users get the features of tracing without needing to bring
      in the rest of the kernel's debug infrastructure.
      
      Another reason for tracefs is that debubfs does not support mkdir.
      Currently, to create instances, one does a mkdir in the tracing/instance
      directory. This is implemented via a hack that forces debugfs to do
      something it is not intended on doing. By converting over to tracefs, this
      hack can be removed and mkdir can be properly implemented. This patch does
      not address this yet, but it lays the ground work for that to be done.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8434dc93
    • S
      tracing: Create cmdline tracer options on tracing fs init · 09d23a1d
      Steven Rostedt (Red Hat) 提交于
      The options for cmdline tracers are not created if the debugfs system
      is not ready yet. If tracing has started before debugfs is up, then the
      option files for the tracer are not created. Create them when creating
      the tracing directory if the current tracer requires option files.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      09d23a1d
    • S
      tracing: Only create tracer options files if directory exists · 0f67f04f
      Steven Rostedt (Red Hat) 提交于
      Do not bother creating tracer options if no tracing directory
      exists. If a tracer is enabled via the command line, and is
      started before the tracing directory is created, then it wont have
      its tracer specific options created.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      0f67f04f
  13. 02 2月, 2015 2 次提交
  14. 28 1月, 2015 1 次提交
  15. 23 1月, 2015 1 次提交
  16. 15 1月, 2015 1 次提交
  17. 23 12月, 2014 1 次提交
    • S
      tracing: Remove taking of trace_types_lock in pipe files · d716ff71
      Steven Rostedt (Red Hat) 提交于
      Taking the global mutex "trace_types_lock" in the trace_pipe files
      causes a bottle neck as most the pipe files can be read per cpu
      and there's no reason to serialize them.
      
      The current_trace variable was given a ref count and it can not
      change when the ref count is not zero. Opening the trace_pipe
      files will up the ref count (and decremented on close), so that
      the lock no longer needs to be taken when accessing the
      current_trace variable.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      d716ff71