1 // SPDX-License-Identifier: GPL-2.0 1 2 /* Copyright (C) 2019 Hangzhou C-SKY Microsyst 3 4 #include <linux/perf_event.h> 5 #include <linux/uaccess.h> 6 7 #include <asm/stacktrace.h> 8 9 static bool fill_callchain(void *entry, unsign 10 { 11 return perf_callchain_store(entry, pc) 12 } 13 14 /* 15 * This will be called when the target is in u 16 * This function will only be called when we u 17 * "PERF_SAMPLE_CALLCHAIN" in 18 * kernel/events/core.c:perf_prepare_sample() 19 * 20 * How to trigger perf_callchain_[user/kernel] 21 * $ perf record -e cpu-clock --call-graph fp 22 * $ perf report --call-graph 23 * 24 * On RISC-V platform, the program being sampl 25 * need to be compiled with -fno-omit-frame-po 26 * the user stack will not contain function fr 27 */ 28 void perf_callchain_user(struct perf_callchain 29 struct pt_regs *regs) 30 { 31 arch_stack_walk_user(fill_callchain, e 32 } 33 34 void perf_callchain_kernel(struct perf_callcha 35 struct pt_regs *reg 36 { 37 walk_stackframe(NULL, regs, fill_callc 38 } 39
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.