Skip to content

Commit

Permalink
ppc: Implement save_stack_trace_regs()
Browse files Browse the repository at this point in the history
It has come to my attention that kprobe event stack tracing does not
work on powerpc. You can see with the following:

 # cd /sys/kernel/debug/tracing
 # echo stacktrace > trace_options
 # echo 'p kfree' > kprobe_events
 # echo 'r exit_mmap' >> kprobe_events
 # echo 1 > events/kprobes/enable

Gives the following splat:

save_stack_trace_regs() not implemented yet.
------------[ cut here ]------------
WARNING: at kernel/stacktrace.c:74
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.3.0-test torvalds#89
task: c000000000a98660 ti: c00000003efe8000 task.ti: c000000000b98000
NIP: c0000000000fa72c LR: c0000000000fa728 CTR: c0000000004a8b80
REGS: c00000003efeaf40 TRAP: 0700   Not tainted  (4.3.0-test)
MSR: 9000000000021032 <SF,HV,ME,IR,DR,RI>  CR: 28002042  XER: 20000000
SOFTE: 0
GPR00: c0000000000fa728 c00000003efeb1c0 c000000000b9e400 000000000000002c
GPR04: 0000000000000000 000000000000013b c000000000b5e790 6e6f7420696d706c
GPR08: 656d656e00000000 c000000000aad148 c000000000ba3878 00000000000001ef
GPR12: 0000000022002044 c00000000ffff000 0000000000000100 0000000000000000
GPR16: c00000003800f01c c00000003800f02c 000000010000a849 c000000038008100
GPR20: c00000003800f010 c00000003efe8000 0000000000000000 0000000000000000
GPR24: 0000000000000100 c0000000389ad120 c0000000389ad1b0 0000000000000000
GPR28: 0000000000000100 c00000003efeb920 c000000000a1d88c c000000000a93529
NIP [c0000000000fa72c] .save_stack_trace_regs+0x3c/0x70
LR [c0000000000fa728] .save_stack_trace_regs+0x38/0x70
Call Trace:
[c00000003efeb1c0] [c0000000000fa728] .save_stack_trace_regs+0x38/0x70 (unreliable)
[c00000003efeb240] [c000000000145b2c] .__ftrace_trace_stack+0x15c/0x210
[c00000003efeb310] [c000000000145cc4] .ftrace_trace_stack_regs+0x24/0x40
[c00000003efeb380] [c0000000001467c4] .trace_buffer_unlock_commit_regs+0x44/0x70
[c00000003efeb420] [c000000000165b38] .kprobe_trace_func+0x278/0x400
[c00000003efeb530] [c000000000165d38] .kprobe_dispatcher+0x78/0xa0
[c00000003efeb5c0] [c0000000007b0ca0] .kprobe_exceptions_notify+0x2e0/0x520
[c00000003efeb670] [c0000000000b4934] .notifier_call_chain+0x94/0xf0
[c00000003efeb710] [c0000000000b4a2c] .atomic_notifier_call_chain+0x3c/0x50
[c00000003efeb7a0] [c0000000000b4c48] .notify_die+0x38/0x50
[c00000003efeb830] [c0000000007aff90] .program_check_exception+0x1a0/0x260
[c00000003efeb8b0] [c00000000000621c] program_check_common+0x11c/0x180
  • Loading branch information
rostedt authored and 0day robot committed Dec 8, 2015
1 parent d1e1cf2 commit 122ece4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/powerpc/kernel/stacktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
save_context_stack(trace, tsk->thread.ksp, tsk, 0);
}
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);

void
save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
{
save_context_stack(trace, regs->gpr[PT_R1], current, 0);
}
EXPORT_SYMBOL_GPL(save_stack_trace_regs);

0 comments on commit 122ece4

Please sign in to comment.