Skip to content

ftrace: Add register_ftrace_direct()

Steven Rostedt lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10ftrace: Separate out the copying of a ftrace_hash from __ftrace_hash_move()kernel/trace/ftrace.c+17 -120 replies
2/10ftrace: Separate out functionality from ftrace_location_range()kernel/trace/ftrace.c+23 -150 replies
3/10ftrace: Add register_ftrace_direct()include/linux/ftrace.h kernel/trace/Kconfig kernel/trace/ftrace.c+309 -78 replies
4/10ftrace: Add ftrace_find_direct_func()include/linux/ftrace.h kernel/trace/ftrace.c+84 -10 replies
5/10ftrace: Add sample module that uses register_ftrace_direct()samples/Kconfig samples/Makefile samples/ftrace/Makefile +1 more+56 -00 replies
6/10ftrace/selftest: Add tests to test register_ftrace_direct()tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc+124 -00 replies
7/10ftrace: Add another example of register_ftrace_direct() use casesamples/ftrace/Makefile samples/ftrace/ftrace-direct-too.c+52 -00 replies
8/10ftrace/selftests: Update the direct call selftests to test two direct callstools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc+52 -230 replies
9/10ftrace/x86: Add register_ftrace_direct() for custom trampolinesarch/x86/Kconfig arch/x86/include/asm/ftrace.h arch/x86/kernel/ftrace.c +2 more+58 -73 replies
10/10ftrace/x86: Add a counter to test function_graph with directarch/x86/kernel/ftrace.c include/linux/ftrace.h kernel/trace/ftrace.c+11 -30 replies

Reviews trailers per patch

None of the 10 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMiroslav Benes
SeriesT-b R-b
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/10] ftrace: Add register_ftrace_direct()

Alexei mentioned that he would like a way to access the ftrace fentry code to jump directly to a custom eBPF trampoline instead of using ftrace regs caller, as he said it would be faster.

I proposed a new register_ftrace_direct() function that would allow this to happen and still work with the ftrace infrastructure. I posted a proof of concept patch here:

https://lore.kernel.org/r/[email protected]

This patch series is a more complete version, and the start of the actual implementation. I haven't run it through my full test suite but it passes my smoke tests and some other custom tests I built.

I also realized that I need to make the sample modules depend on X86_64 as it has inlined assembly in it that requires that dependency.

This is based on 5.4-rc6 plus the permanent patches that prevent a ftrace_ops from being disabled by /proc/sys/kernel/ftrace_enabled

Below is the tree that contains this code.

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
ftrace/direct

Head SHA1: 9492654d091cb90a487ca669c58f802fa99bcd6f

Enjoy,

-- Steve

Steven Rostedt (VMware) (10):
ftrace: Separate out the copying of a ftrace_hash from __ftrace_hash_move()
ftrace: Separate out functionality from ftrace_location_range()
ftrace: Add register_ftrace_direct()
ftrace: Add ftrace_find_direct_func()
ftrace: Add sample module that uses register_ftrace_direct() ftrace/selftest: Add tests to test register_ftrace_direct()
ftrace: Add another example of register_ftrace_direct() use case ftrace/selftests: Update the direct call selftests to test two direct calls ftrace/x86: Add register_ftrace_direct() for custom trampolines ftrace/x86: Add a counter to test function_graph with direct

----

 arch/x86/Kconfig                                   |   1 +
 arch/x86/include/asm/ftrace.h                      |  13 +
 arch/x86/kernel/ftrace.c                           |  14 +
 arch/x86/kernel/ftrace_64.S                        |  33 +-
 include/linux/ftrace.h                             |  50 ++-
 kernel/trace/Kconfig                               |   8 +
 kernel/trace/ftrace.c                              | 420 +++++++++++++++++++--
 samples/Kconfig                                    |   7 +
 samples/Makefile                                   |   1 +
 samples/ftrace/Makefile                            |   4 +
 samples/ftrace/ftrace-direct-too.c                 |  51 +++
 samples/ftrace/ftrace-direct.c                     |  45 +++
 .../ftrace/test.d/direct/ftrace-direct.tc          |  69 ++++
 .../ftrace/test.d/direct/kprobe-direct.tc          |  84 +++++
 14 files changed, 759 insertions(+), 41 deletions(-)
 create mode 100644 samples/ftrace/Makefile
 create mode 100644 samples/ftrace/ftrace-direct-too.c
 create mode 100644 samples/ftrace/ftrace-direct.c
 create mode 100644 tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
 create mode 100644 tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc