drm/rockchip: vop2: Fix the windows switch between different layers
[drm/drm-misc.git] / arch / riscv / kernel / perf_callchain.c
blobb465bc9eb870ec1ab8a638d07f3fd9edcd047bc3
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */
4 #include <linux/perf_event.h>
5 #include <linux/uaccess.h>
7 #include <asm/stacktrace.h>
9 static bool fill_callchain(void *entry, unsigned long pc)
11 return perf_callchain_store(entry, pc) == 0;
15 * This will be called when the target is in user mode
16 * This function will only be called when we use
17 * "PERF_SAMPLE_CALLCHAIN" in
18 * kernel/events/core.c:perf_prepare_sample()
20 * How to trigger perf_callchain_[user/kernel] :
21 * $ perf record -e cpu-clock --call-graph fp ./program
22 * $ perf report --call-graph
24 * On RISC-V platform, the program being sampled and the C library
25 * need to be compiled with -fno-omit-frame-pointer, otherwise
26 * the user stack will not contain function frame.
28 void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
29 struct pt_regs *regs)
31 if (perf_guest_state()) {
32 /* TODO: We don't support guest os callchain now */
33 return;
36 arch_stack_walk_user(fill_callchain, entry, regs);
39 void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
40 struct pt_regs *regs)
42 if (perf_guest_state()) {
43 /* TODO: We don't support guest os callchain now */
44 return;
47 walk_stackframe(NULL, regs, fill_callchain, entry);