• Lin Yongting's avatar
    ARM: 8049/1: ftrace/add save_stack_trace_regs() implementation · 9c986661
    Lin Yongting authored
    When configure kprobe events of ftrace with "stacktrace" option enabled
    in arm, there is no stacktrace was recorded after the kprobe event was
    triggered. The root cause is no save_stack_trace_regs() function implemented.
    
    Implement the save_stack_trace_regs() function in arm, then ftrace will
    call this architecture-related function to record the stacktrace into
    ring buffer.
    
    After this fix, stacktrace can be recorded, for example:
    
     # mount -t debugfs nodev /sys/kernel/debug
     # echo "p:netrx net_rx_action" >> /sys/kernel/debug/tracing/kprobe_events
     # echo 1 > /sys/kernel/debug/tracing/events/kprobes/netrx/enable
     # echo 1 > /sys/kernel/debug/tracing/options/stacktrace
     # echo 1 > /sys/kernel/debug/tracing/tracing_on
     # ping 127.0.0.1 -c 1
     # echo 0 > /sys/kernel/debug/tracing/tracing_on
    
     # cat /sys/kernel/debug/tracing/trace
     # tracer: nop
     #
     # entries-in-buffer/entries-written: 12/12   #P:1
     #
     #                              _-----=> irqs-off
     #                             / _----=> need-resched
     #                            | / _---=> hardirq/softirq
     #                            || / _--=> preempt-depth
     #                            ||| /     delay
     #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
     #              | |       |   ||||       |         |
                 <------ missing some entries ---------------->
                 ping-1200  [000] dNs1   667.603250: netrx: (net_rx_action+0x0/0x1f8)
                 ping-1200  [000] dNs1   667.604738: <stack trace>
      => net_rx_action
      => do_softirq
      => local_bh_enable
      => ip_finish_output
      => ip_output
      => ip_local_out
      => ip_send_skb
      => ip_push_pending_frames
      => raw_sendmsg
      => inet_sendmsg
      => sock_sendmsg
      => SyS_sendto
      => ret_fast_syscall
    Signed-off-by: default avatarLin Yongting <linyongting@gmail.com>
    Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    9c986661
stacktrace.c 4.61 KB