diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-06-29 13:34:05 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-08-18 19:30:11 -0400 |
commit | 70791ce9ba68a5921c9905ef05d23f62a90bc10c (patch) | |
tree | 9711ff02cb910e1d8709c09512dbe7e94224bdd8 /arch/arm/kernel/perf_event.c | |
parent | c1a65932fd7216fdc9a0db8bbffe1d47842f862c (diff) |
perf: Generalize callchain_store()
callchain_store() is the same on every archs, inline it in
perf_event.h and rename it to perf_callchain_store() to avoid
any collision.
This removes repetitive code.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: David Miller <davem@davemloft.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Borislav Petkov <bp@amd64.org>
Diffstat (limited to 'arch/arm/kernel/perf_event.c')
-rw-r--r-- | arch/arm/kernel/perf_event.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index fdcb0be47df1..a07c3b1955f0 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -3001,13 +3001,6 @@ arch_initcall(init_hw_perf_events); | |||
3001 | /* | 3001 | /* |
3002 | * Callchain handling code. | 3002 | * Callchain handling code. |
3003 | */ | 3003 | */ |
3004 | static inline void | ||
3005 | callchain_store(struct perf_callchain_entry *entry, | ||
3006 | u64 ip) | ||
3007 | { | ||
3008 | if (entry->nr < PERF_MAX_STACK_DEPTH) | ||
3009 | entry->ip[entry->nr++] = ip; | ||
3010 | } | ||
3011 | 3004 | ||
3012 | /* | 3005 | /* |
3013 | * The registers we're interested in are at the end of the variable | 3006 | * The registers we're interested in are at the end of the variable |
@@ -3039,7 +3032,7 @@ user_backtrace(struct frame_tail *tail, | |||
3039 | if (__copy_from_user_inatomic(&buftail, tail, sizeof(buftail))) | 3032 | if (__copy_from_user_inatomic(&buftail, tail, sizeof(buftail))) |
3040 | return NULL; | 3033 | return NULL; |
3041 | 3034 | ||
3042 | callchain_store(entry, buftail.lr); | 3035 | perf_callchain_store(entry, buftail.lr); |
3043 | 3036 | ||
3044 | /* | 3037 | /* |
3045 | * Frame pointers should strictly progress back up the stack | 3038 | * Frame pointers should strictly progress back up the stack |
@@ -3057,7 +3050,7 @@ perf_callchain_user(struct pt_regs *regs, | |||
3057 | { | 3050 | { |
3058 | struct frame_tail *tail; | 3051 | struct frame_tail *tail; |
3059 | 3052 | ||
3060 | callchain_store(entry, PERF_CONTEXT_USER); | 3053 | perf_callchain_store(entry, PERF_CONTEXT_USER); |
3061 | 3054 | ||
3062 | if (!user_mode(regs)) | 3055 | if (!user_mode(regs)) |
3063 | regs = task_pt_regs(current); | 3056 | regs = task_pt_regs(current); |
@@ -3078,7 +3071,7 @@ callchain_trace(struct stackframe *fr, | |||
3078 | void *data) | 3071 | void *data) |
3079 | { | 3072 | { |
3080 | struct perf_callchain_entry *entry = data; | 3073 | struct perf_callchain_entry *entry = data; |
3081 | callchain_store(entry, fr->pc); | 3074 | perf_callchain_store(entry, fr->pc); |
3082 | return 0; | 3075 | return 0; |
3083 | } | 3076 | } |
3084 | 3077 | ||
@@ -3088,7 +3081,7 @@ perf_callchain_kernel(struct pt_regs *regs, | |||
3088 | { | 3081 | { |
3089 | struct stackframe fr; | 3082 | struct stackframe fr; |
3090 | 3083 | ||
3091 | callchain_store(entry, PERF_CONTEXT_KERNEL); | 3084 | perf_callchain_store(entry, PERF_CONTEXT_KERNEL); |
3092 | fr.fp = regs->ARM_fp; | 3085 | fr.fp = regs->ARM_fp; |
3093 | fr.sp = regs->ARM_sp; | 3086 | fr.sp = regs->ARM_sp; |
3094 | fr.lr = regs->ARM_lr; | 3087 | fr.lr = regs->ARM_lr; |