linux/arch/riscv
Guo Ren 829adda597
riscv: Add KPROBES_ON_FTRACE supported
This patch adds support for kprobes on ftrace call sites to avoids
much of the overhead with regular kprobes. Try it with simple
steps:

 echo 'p:myprobe sys_clone a0=%a0 a1=%a1 stack_val=+4($stack)' > /sys/kernel/de
bug/tracing/kprobe_events
 echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable
 cat /sys/kernel/debug/tracing/trace
 tracer: nop

 entries-in-buffer/entries-written: 1/1   #P:1

                                _-----=> irqs-off
                               / _----=> need-resched
                              | / _---=> hardirq/softirq
                              || / _--=> preempt-depth
                              ||| /     delay
           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
              | |         |   ||||      |         |
              sh-92      [000] ....   369.899962: myprobe: (sys_clone+0x0/0x28) a0=0x1200011 a1=0x0 stack_val=0x201c20ffffffe0
 cat /sys/kernel/debug/kprobes/list
ffffffe00020b584  k  sys_clone+0x0    [FTRACE]
                                       ^^^^^^

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-01-14 15:09:07 -08:00
..
boot riscv: Fix Canaan Kendryte K210 device tree 2021-01-14 15:08:47 -08:00
configs riscv: Use vendor name for K210 SoC support 2021-01-14 15:08:46 -08:00
include riscv: Add kprobes supported 2021-01-14 15:09:06 -08:00
kernel riscv: Add KPROBES_ON_FTRACE supported 2021-01-14 15:09:07 -08:00
lib riscv: provide memmove implementation 2020-12-10 17:27:54 -08:00
mm riscv: Add kprobes supported 2021-01-14 15:09:06 -08:00
net treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
Kbuild riscv: Allow device trees to be built into the kernel 2020-05-18 11:38:05 -07:00
Kconfig riscv: Add KPROBES_ON_FTRACE supported 2021-01-14 15:09:07 -08:00
Kconfig.debug RISC-V: Remove EARLY_PRINTK support 2018-12-17 10:23:46 -08:00
Kconfig.socs riscv: Add Canaan Kendryte K210 reset controller 2021-01-14 15:08:53 -08:00
Makefile riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT 2021-01-14 15:09:05 -08:00