summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar2009-05-29 11:25:09 +0200
committerIngo Molnar2009-06-14 22:37:15 +0200
commit5a6cec3abbdb74244caab68db100825a8c4ac02d (patch)
tree9384519dc432104ba75cc14565866fa1a6deb051
parentperf record/report: Add call graph / call chain profiling (diff)
downloadkernel-qcow2-linux-5a6cec3abbdb74244caab68db100825a8c4ac02d.tar.gz
kernel-qcow2-linux-5a6cec3abbdb74244caab68db100825a8c4ac02d.tar.xz
kernel-qcow2-linux-5a6cec3abbdb74244caab68db100825a8c4ac02d.zip
perf_counter, x86: Fix call-chain walking
Fix the ptregs variant when we hit user-mode tasks. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/cpu/perf_counter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 77a59a5566a8..09d8cb69c3f3 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1644,7 +1644,9 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
const void __user *fp;
int nr = entry->nr;
- regs = (struct pt_regs *)current->thread.sp0 - 1;
+ if (!user_mode(regs))
+ regs = task_pt_regs(current);
+
fp = (void __user *)regs->bp;
callchain_store(entry, regs->ip);
@@ -1656,7 +1658,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
if (!copy_stack_frame(fp, &frame))
break;
- if ((unsigned long)fp < user_stack_pointer(regs))
+ if ((unsigned long)fp < regs->sp)
break;
callchain_store(entry, frame.return_address);