perf core: Add perf_callchain_store_context() helper
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 12 May 2016 16:01:50 +0000 (13:01 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 17 May 2016 02:11:52 +0000 (23:11 -0300)
We need have different helpers to account how many contexts we have in
the sample and for real addresses, so do it now as a prep patch, to
ease review.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-q964tnyuqrxw5gld18vizs3c@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
arch/powerpc/perf/callchain.c
include/linux/perf_event.h
kernel/events/callchain.c

index f68f213dc36c28aabd1e4193f0972b0f5fd6d7be..f62597dbd757db75ad3e95e574a0aad9f52adc9d 100644 (file)
@@ -76,7 +76,7 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
                        next_ip = regs->nip;
                        lr = regs->link;
                        level = 0;
-                       perf_callchain_store(entry, PERF_CONTEXT_KERNEL);
+                       perf_callchain_store_context(entry, PERF_CONTEXT_KERNEL);
 
                } else {
                        if (level == 0)
@@ -274,7 +274,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
                            read_user_stack_64(&uregs[PT_R1], &sp))
                                return;
                        level = 0;
-                       perf_callchain_store(entry, PERF_CONTEXT_USER);
+                       perf_callchain_store_context(entry, PERF_CONTEXT_USER);
                        perf_callchain_store(entry, next_ip);
                        continue;
                }
@@ -473,7 +473,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
                            read_user_stack_32(&uregs[PT_R1], &sp))
                                return;
                        level = 0;
-                       perf_callchain_store(entry, PERF_CONTEXT_USER);
+                       perf_callchain_store_context(entry, PERF_CONTEXT_USER);
                        perf_callchain_store(entry, next_ip);
                        continue;
                }
index 3803bb1a862b079f4bacccf21dd6d7ab32b50191..2024b14cc2b1ac4d8abf55fc703edd336ed7f566 100644 (file)
@@ -1079,6 +1079,8 @@ extern void put_callchain_buffers(void);
 
 extern int sysctl_perf_event_max_stack;
 
+#define perf_callchain_store_context(ctx, context) perf_callchain_store(ctx, context)
+
 static inline int perf_callchain_store(struct perf_callchain_entry_ctx *ctx, u64 ip)
 {
        if (ctx->nr < ctx->max_stack) {
index 8774ff86debb0295511eac77f68534c58309f872..ca645736a9833189b6f73da3941a96f326737e2b 100644 (file)
@@ -200,7 +200,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
 
        if (kernel && !user_mode(regs)) {
                if (add_mark)
-                       perf_callchain_store(&ctx, PERF_CONTEXT_KERNEL);
+                       perf_callchain_store_context(&ctx, PERF_CONTEXT_KERNEL);
                perf_callchain_kernel(&ctx, regs);
        }
 
@@ -217,7 +217,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
                                goto exit_put;
 
                        if (add_mark)
-                               perf_callchain_store(&ctx, PERF_CONTEXT_USER);
+                               perf_callchain_store_context(&ctx, PERF_CONTEXT_USER);
                        perf_callchain_user(&ctx, regs);
                }
        }