Skip to content
  • Steven Rostedt (Red Hat)'s avatar
    tracing: Add function probe to trigger stack traces · dd42cd3e
    Steven Rostedt (Red Hat) authored
    
    
    Add a function probe that will cause a stack trace to be traced in
    the ring buffer when the given function(s) are called.
    
    format is:
    
     <function>:stacktrace[:<count>]
    
     echo 'schedule:stacktrace' > /debug/tracing/set_ftrace_filter
     cat /debug/tracing/trace_pipe
         kworker/2:0-4329  [002] ...2  2933.558007: <stack trace>
     => kthread
     => ret_from_fork
              <idle>-0     [000] .N.2  2933.558019: <stack trace>
     => rest_init
     => start_kernel
     => x86_64_start_reservations
     => x86_64_start_kernel
         kworker/2:0-4329  [002] ...2  2933.558109: <stack trace>
     => kthread
     => ret_from_fork
    [...]
    
    This can be set to only trace a specific amount of times:
    
     echo 'schedule:stacktrace:3' > /debug/tracing/set_ftrace_filter
     cat /debug/tracing/trace_pipe
               <...>-58    [003] ...2   841.801694: <stack trace>
     => kthread
     => ret_from_fork
              <idle>-0     [001] .N.2   841.801697: <stack trace>
     => start_secondary
               <...>-2059  [001] ...2   841.801736: <stack trace>
     => wait_for_common
     => wait_for_completion
     => flush_work
     => tty_flush_to_ldisc
     => input_available_p
     => n_tty_poll
     => tty_poll
     => do_select
     => core_sys_select
     => sys_select
     => system_call_fastpath
    
    To remove these:
    
     echo '!schedule:stacktrace' > /debug/tracing/set_ftrace_filter
     echo '!schedule:stacktrace:0' > /debug/tracing/set_ftrace_filter
    
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    dd42cd3e