aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Poimboeuf <[email protected]>2016-08-24 11:50:15 -0500
committerIngo Molnar <[email protected]>2016-09-08 08:58:40 +0200
commit3e344a0db900757caaf0beeb749de4c7b59bfd60 (patch)
treed53bf905033476c95200743d93c74532439f8a91
parent019e579d395733d14097c2d29c8c43226dad1617 (diff)
oprofile/x86: Add regs->ip to oprofile trace
dump_trace() doesn't add the interrupted instruction's address to the trace, so add it manually. This makes the profile more useful, and also makes it more consistent with what perf profiling does. Signed-off-by: Josh Poimboeuf <[email protected]> Acked-by: Robert Richter <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Byungchul Park <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Nilay Vaish <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/6c745a83dbd69fc6857ef9b2f8be0f011d775936.1472057064.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <[email protected]>
-rw-r--r--arch/x86/oprofile/backtrace.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index cb31a4440e58..2ef6c8b56311 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -114,9 +114,16 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
if (!user_mode(regs)) {
unsigned long stack = kernel_stack_pointer(regs);
- if (depth)
- dump_trace(NULL, regs, (unsigned long *)stack, 0,
- &backtrace_ops, &depth);
+
+ if (!depth)
+ return;
+
+ oprofile_add_trace(regs->ip);
+ if (!--depth)
+ return;
+
+ dump_trace(NULL, regs, (unsigned long *)stack, 0,
+ &backtrace_ops, &depth);
return;
}