Skip to content

Commit 3e4de4e

Browse files
committed
perf core: Add perf_callchain_store_context() helper
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 <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3b1fff0 commit 3e4de4e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

arch/powerpc/perf/callchain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
7676
next_ip = regs->nip;
7777
lr = regs->link;
7878
level = 0;
79-
perf_callchain_store(entry, PERF_CONTEXT_KERNEL);
79+
perf_callchain_store_context(entry, PERF_CONTEXT_KERNEL);
8080

8181
} else {
8282
if (level == 0)
@@ -274,7 +274,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
274274
read_user_stack_64(&uregs[PT_R1], &sp))
275275
return;
276276
level = 0;
277-
perf_callchain_store(entry, PERF_CONTEXT_USER);
277+
perf_callchain_store_context(entry, PERF_CONTEXT_USER);
278278
perf_callchain_store(entry, next_ip);
279279
continue;
280280
}
@@ -473,7 +473,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
473473
read_user_stack_32(&uregs[PT_R1], &sp))
474474
return;
475475
level = 0;
476-
perf_callchain_store(entry, PERF_CONTEXT_USER);
476+
perf_callchain_store_context(entry, PERF_CONTEXT_USER);
477477
perf_callchain_store(entry, next_ip);
478478
continue;
479479
}

include/linux/perf_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,8 @@ extern void put_callchain_buffers(void);
10791079

10801080
extern int sysctl_perf_event_max_stack;
10811081

1082+
#define perf_callchain_store_context(ctx, context) perf_callchain_store(ctx, context)
1083+
10821084
static inline int perf_callchain_store(struct perf_callchain_entry_ctx *ctx, u64 ip)
10831085
{
10841086
if (ctx->nr < ctx->max_stack) {

kernel/events/callchain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
200200

201201
if (kernel && !user_mode(regs)) {
202202
if (add_mark)
203-
perf_callchain_store(&ctx, PERF_CONTEXT_KERNEL);
203+
perf_callchain_store_context(&ctx, PERF_CONTEXT_KERNEL);
204204
perf_callchain_kernel(&ctx, regs);
205205
}
206206

@@ -217,7 +217,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
217217
goto exit_put;
218218

219219
if (add_mark)
220-
perf_callchain_store(&ctx, PERF_CONTEXT_USER);
220+
perf_callchain_store_context(&ctx, PERF_CONTEXT_USER);
221221
perf_callchain_user(&ctx, regs);
222222
}
223223
}

0 commit comments

Comments
 (0)