1. 20 4月, 2016 6 次提交
  2. 19 4月, 2016 1 次提交
    • S
      tracing: Add infrastructure to allow set_event_pid to follow children · c37775d5
      Steven Rostedt 提交于
      Add the infrastructure needed to have the PIDs in set_event_pid to
      automatically add PIDs of the children of the tasks that have their PIDs in
      set_event_pid. This will also remove PIDs from set_event_pid when a task
      exits
      
      This is implemented by adding hooks into the fork and exit tracepoints. On
      fork, the PIDs are added to the list, and on exit, they are removed.
      
      Add a new option called event_fork that when set, PIDs in set_event_pid will
      automatically get their children PIDs added when they fork, as well as any
      task that exits will have its PID removed from set_event_pid.
      
      This works for instances as well.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      c37775d5
  3. 23 3月, 2016 2 次提交
  4. 19 3月, 2016 1 次提交
  5. 18 3月, 2016 1 次提交
  6. 09 3月, 2016 1 次提交
    • C
      tracing: Make tracer_flags use the right set_flag callback · d39cdd20
      Chunyu Hu 提交于
      When I was updating the ftrace_stress test of ltp. I encountered
      a strange phenomemon, excute following steps:
      
      echo nop > /sys/kernel/debug/tracing/current_tracer
      echo 0 > /sys/kernel/debug/tracing/options/funcgraph-cpu
      bash: echo: write error: Invalid argument
      
      check dmesg:
      [ 1024.903855] nop_test_refuse flag set to 0: we refuse.Now cat trace_options to see the result
      
      The reason is that the trace option test will randomly setup trace
      option under tracing/options no matter what the current_tracer is.
      but the set_tracer_option is always using the set_flag callback
      from the current_tracer. This patch adds a pointer to tracer_flags
      and make it point to the tracer it belongs to. When the option is
      setup, the set_flag of the right tracer will be used no matter
      what the the current_tracer is.
      
      And the old dummy_tracer_flags is used for all the tracers which
      doesn't have a tracer_flags, having issue to use it to save the
      pointer of a tracer. So remove it and use dynamic dummy tracer_flags
      for tracers needing a dummy tracer_flags, as a result, there are no
      tracers sharing tracer_flags, so remove the check code.
      
      And save the current tracer to trace_option_dentry seems not good as
      it may waste mem space when mount the debug/trace fs more than one time.
      
      Link: http://lkml.kernel.org/r/1457444222-8654-1-git-send-email-chuhu@redhat.comSigned-off-by: NChunyu Hu <chuhu@redhat.com>
      [ Fixed up function tracer options to work with the change ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      d39cdd20
  7. 14 1月, 2016 1 次提交
    • S
      tracing: Fix stacktrace skip depth in trace_buffer_unlock_commit_regs() · 7717c6be
      Steven Rostedt (Red Hat) 提交于
      While cleaning the stacktrace code I unintentially changed the skip depth of
      trace_buffer_unlock_commit_regs() from 0 to 6. kprobes uses this function,
      and with skipping 6 call backs, it can easily produce no stack.
      
      Here's how I tested it:
      
       # echo 'p:ext4_sync_fs ext4_sync_fs ' > /sys/kernel/debug/tracing/kprobe_events
       # echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable
       # cat /sys/kernel/debug/trace
                  sync-2394  [005]   502.457060: ext4_sync_fs: (ffffffff81317650)
                  sync-2394  [005]   502.457063: kernel_stack:         <stack trace>
                  sync-2394  [005]   502.457086: ext4_sync_fs: (ffffffff81317650)
                  sync-2394  [005]   502.457087: kernel_stack:         <stack trace>
                  sync-2394  [005]   502.457091: ext4_sync_fs: (ffffffff81317650)
      
      After putting back the skip stack to zero, we have:
      
                  sync-2270  [000]   748.052693: ext4_sync_fs: (ffffffff81317650)
                  sync-2270  [000]   748.052695: kernel_stack:         <stack trace>
       => iterate_supers (ffffffff8126412e)
       => sys_sync (ffffffff8129c4b6)
       => entry_SYSCALL_64_fastpath (ffffffff8181f0b2)
                  sync-2270  [000]   748.053017: ext4_sync_fs: (ffffffff81317650)
                  sync-2270  [000]   748.053019: kernel_stack:         <stack trace>
       => iterate_supers (ffffffff8126412e)
       => sys_sync (ffffffff8129c4b6)
       => entry_SYSCALL_64_fastpath (ffffffff8181f0b2)
                  sync-2270  [000]   748.053381: ext4_sync_fs: (ffffffff81317650)
                  sync-2270  [000]   748.053383: kernel_stack:         <stack trace>
       => iterate_supers (ffffffff8126412e)
       => sys_sync (ffffffff8129c4b6)
       => entry_SYSCALL_64_fastpath (ffffffff8181f0b2)
      
      Cc: stable@vger.kernel.org # v4.4+
      Fixes: 73dddbb5 "tracing: Only create stacktrace option when STACKTRACE is configured"
      Reported-by: NBrendan Gregg <brendan.d.gregg@gmail.com>
      Tested-by: NBrendan Gregg <brendan.d.gregg@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      7717c6be
  8. 10 11月, 2015 1 次提交
  9. 08 11月, 2015 1 次提交
  10. 06 11月, 2015 1 次提交
  11. 04 11月, 2015 3 次提交
  12. 03 11月, 2015 1 次提交
  13. 01 10月, 2015 6 次提交
  14. 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
  15. 28 9月, 2015 1 次提交
  16. 26 9月, 2015 3 次提交
  17. 21 7月, 2015 1 次提交