Skip to contentSkip to conversation

Series short description

RFC PATCH In review Masami Hiramatsu 1 participant 2 messages Sep 23, 2021 BPF

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Series short description

Hi Steve,

Here I share my testing patch of the BTF for kprobe events. Currently this only allow user to specify '$$args' for tracing all arguments of the function. This is only avaialbe if
- the probe point is on the function entry
- the kernel is compiled with BTF (CONFIG_DEBUG_INFO_BTF)
- the kernel is enables BPF (CONFIG_BPF_SYSCALL)

And Special thanks to Sven! Most of BTF handling part of this patch comes from his patch [1]

[1] https://stackframe.org/0001-ftrace-arg-hack.patch

What I thought while coding this were;
- kernel/bpf/btf.c can be moved under lib/ so that
the other subsystems can reuse it, independent
from BPF. (Also, this should depends on CONFIG_DEBUG_INFO_BTF)
- some more utility functions can be exposed.
e.g. I copied btf_type_int() from btf.c
- If there are more comments for the BTF APIs, it will be more useful...
- Overall, the BTF is easy to understand for who already understand DWARF. Great work!
- I think I need 'ptr' and 'bool' types for fetcharg types.

Anyway, this is just for testing. I have to add some more cleanup, features and documentations, etc.

Thank you,

---

Masami Hiramatsu (1):
tracing/kprobe: Support $$args for function entry

 kernel/trace/trace_kprobe.c |   60 ++++++++++++++++++++++++-
 kernel/trace/trace_probe.c  |  105 +++++++++++++++++++++++++++++++++++++++++++
 kernel/trace/trace_probe.h  |    5 ++
 3 files changed, 168 insertions(+), 2 deletions(-)

--
Masami Hiramatsu (Linaro) <[email protected]>

#1 lore raw

Oops, ignore this. I forgot to update subjects.

Quoted 45 lines · On Thu, 23 Sep 2021 21:38:55 +0900 Masami Hiramatsu <[email protected]> wrote:

Hi Steve,

Here I share my testing patch of the BTF for kprobe events. Currently this only allow user to specify '$$args' for tracing all arguments of the function. This is only avaialbe if
- the probe point is on the function entry
- the kernel is compiled with BTF (CONFIG_DEBUG_INFO_BTF)
- the kernel is enables BPF (CONFIG_BPF_SYSCALL)

And Special thanks to Sven! Most of BTF handling part of this patch comes from his patch [1]

[1] https://stackframe.org/0001-ftrace-arg-hack.patch

What I thought while coding this were;
- kernel/bpf/btf.c can be moved under lib/ so that
the other subsystems can reuse it, independent
from BPF. (Also, this should depends on CONFIG_DEBUG_INFO_BTF)
- some more utility functions can be exposed.
e.g. I copied btf_type_int() from btf.c
- If there are more comments for the BTF APIs, it will be more useful...
- Overall, the BTF is easy to understand for who already understand DWARF. Great work!
- I think I need 'ptr' and 'bool' types for fetcharg types.

Anyway, this is just for testing. I have to add some more cleanup, features and documentations, etc.

Thank you,

---

Masami Hiramatsu (1):
tracing/kprobe: Support $$args for function entry

 kernel/trace/trace_kprobe.c |   60 ++++++++++++++++++++++++-
 kernel/trace/trace_probe.c  |  105 +++++++++++++++++++++++++++++++++++++++++++
 kernel/trace/trace_probe.h  |    5 ++
 3 files changed, 168 insertions(+), 2 deletions(-)

--
Masami Hiramatsu (Linaro) <[email protected]>

Signature · 1 line
Masami Hiramatsu <[email protected]>