tracing: Expose tracepoint BTF ids via tracefs#12122
Open
kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
Open
tracing: Expose tracepoint BTF ids via tracefs#12122kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
Conversation
Author
|
Upstream branch: 576482b |
8668cd4 to
ceeb3aa
Compare
Author
|
Upstream branch: 523d2f4 |
541548d to
aef120c
Compare
ceeb3aa to
ec31e3e
Compare
Author
|
Upstream branch: 3db0419 |
aef120c to
55df02d
Compare
ec31e3e to
b3beebb
Compare
Drop the static qualifier and add prototypes to <linux/btf.h> so the tracing core can look up module BTF and translate ids stored by resolve_btfids (which are local to a module's split BTF) into the runtime ids used by the kernel. Used by the upcoming events/<sys>/<event>/btf_ids tracefs interface. Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Author
|
Upstream branch: b1fcdf9 |
Add events/<sys>/<event>/btf_ids, a per-template file that exposes
the BTF ids resolve_btfids fills in for each tracepoint:
btf_obj_id BTF object owning the ids below
raw_btf_id FUNC_PROTO of __bpf_trace_<call> (named args), consumed
by raw_tp / tp_btf BPF programs
tp_btf_id trace_event_raw_<call> ring-buffer record, consumed by
classic BPF_PROG_TYPE_TRACEPOINT programs
DECLARE_EVENT_CLASS now emits a 2-entry BTF_ID_LIST (FUNC __bpf_trace_*
and STRUCT trace_event_raw_*) and stores the pointer in
trace_event_class.
Per-syscall events under syscalls/ share the handcrafted classes
event_class_syscall_{enter,exit} instead of going through
DECLARE_EVENT_CLASS. Wire those classes to the BTF id lists
generated for sys_enter / sys_exit so all ~700 per-syscall
events expose the shared dispatcher prototype and record.
The per-syscall events do not own their own tracepoint
(they share sys_enter/sys_exit), so raw_btf_id is reported as 0
on those events; the meaningful raw_btf_id is exposed on
raw_syscalls/sys_{enter,exit}/btf_ids where raw_tp / tp_btf
programs can actually attach.
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Read events/bpf_testmod/bpf_testmod_test_read/btf_ids and verify the exported FUNC_PROTO matches the testmod tracepoint signature (__data, struct task_struct *task, struct bpf_testmod_test_read_ctx *ctx) and the record struct trace_event_raw_bpf_testmod_test_read carries the fields declared by TP_STRUCT__entry. Use the testmod tracepoint so the test exercises the module/split-BTF path (btf_relocate_id) rather than vmlinux only, and falls back from /sys/kernel/tracing to /sys/kernel/debug/tracing when tracefs is not mounted at the new location. Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
55df02d to
842c4b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: tracing: Expose tracepoint BTF ids via tracefs
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1096695