Skip to content

RFC tracing/kprobes: Get ready for -mfentry

Steven Rostedt lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6ftrace: Sort all function addresses, not just per pageinclude/asm-generic/vmlinux.lds.h kernel/trace/ftrace.c+23 -130 replies
2/6ftrace: Remove extra helper functionskernel/trace/ftrace.c+24 -370 replies
3/6ftrace: Speed up search by skipping pages by addresskernel/trace/ftrace.c+16 -60 replies
4/6ftrace: Consolidate ftrace_location() and ftrace_text_reserved()kernel/trace/ftrace.c+40 -400 replies
5/6ftrace: Return record ip addr for ftrace_location()include/linux/ftrace.h kernel/trace/ftrace.c+11 -70 replies
6/6kprobes: Allow probe on ftrace reserved text (but move it)kernel/kprobes.c+10 -13 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6][RFC] tracing/kprobes: Get ready for -mfentry

As I want to add the -mfentry to allow for function tracing without frame pointers (as some distros are now disabling function tracing :-(

I have to handle the case that a kprobe is placed on a ftrace nop. As ftrace nops with -mfentry will be the first instruction of a function, it being the location of a kprobe is a likely occurrence.

Ideally, kprobes would just use the function tracing infrastructure to make an automatic optimized jump. But that is for another day as it requires a bit of work in the function tracer to handle regs and such.

So the quick fix for now is to simply move the probe to the next instruction after the ftrace nop. As the nop shouldn't be doing anything anyway (and tracing should return to the function in the same state) moving the location of the probe should not cause any harm.

The first 5 patches are non controversial, and could probably just be pushed for 3.5 inclusion. The last patch makes the change to move the probe to the next instruction after the ftrace nop.

Anyone see any problem with this?

-- Steve

Steven Rostedt (6):
ftrace: Sort all function addresses, not just per page
ftrace: Remove extra helper functions
ftrace: Speed up search by skipping pages by address
ftrace: Consolidate ftrace_location() and ftrace_text_reserved()
ftrace: Return record ip addr for ftrace_location()
kprobes: Allow probe on ftrace reserved text (but move it)

----

 include/asm-generic/vmlinux.lds.h |    2 +-
 include/linux/ftrace.h            |    2 +-
 kernel/kprobes.c                  |   11 ++-
 kernel/trace/ftrace.c             |  173 ++++++++++++++++++++-----------------
 4 files changed, 104 insertions(+), 84 deletions(-)