Re: [PATCH v2] tracing: Make per-template BTF id lists file-local
Andrii Nakryiko <[email protected]> Mon, 3 Aug 2026 13:10:27 -0700
| Newsgroups | org.kernel.vger.linux-trace-kernel,org.kernel.vger.bpf,org.kernel.vger.linux-next |
|---|---|
| Message-ID | <CAEf4BzasGK651xFBzSXgqzkiqrui-U0a+pGkO6E=Mim9zAyviA@mail.gmail.com> |
On Thu, Jul 30, 2026 at 5:18=E2=80=AFPM Mykyta Yatsenko <[email protected]> wrote: > > From: Mykyta Yatsenko <[email protected]> > > DECLARE_EVENT_CLASS emitted __bpf_trace_btf_ids_<call> through > BTF_ID_LIST_GLOBAL, i.e. a global symbol named after the event class. > The class name is not unique across the kernel, so the symbol > multiply-defines whenever two translation units instantiate the same > class. > > Switch to the file-local BTF_ID_LIST: the list is reached > only through the event_class_<call>.btf_ids pointer, initialised in the > same unit, so tracefs readers never reference the symbol by name and > resolve_btfids still fills the now-local .BTF_ids entries. > > The handcrafted syscall classes are the one cross-unit consumer: give > them their own local BTF_ID_LIST rather than importing the generated > sys_{enter,exit} lists. > > Fixes: eadc0725ab8d3 ("tracing: Expose tracepoint BTF ids via tracefs") > Reported-by: Mark Brown <[email protected]> > Closes: https://lore.kernel.org/all/ff58b01c-3f5e-4d55-be82-609d2faaf12e@= sirena.org.uk/ > Signed-off-by: Mykyta Yatsenko <[email protected]> > --- > Changes in v2: > - Emit the per-class BTF id list only under CONFIG_DEBUG_INFO_BTF; > without BTF the ids are unresolved and BTF_ID_LIST falls back to a > 128-entry (512-byte) per-class stub, adding hundreds of KB of BSS > across the ~1000 event classes (reported in review of v1). > - Link to v1: https://patch.msgid.link/20260730-b4-fix_btf_tracefs-v1-1-5= [email protected] > --- > Changes in v2: > - Emit the per-class BTF id list only under CONFIG_DEBUG_INFO_BTF; > without BTF the ids are unresolved and BTF_ID_LIST falls back to a > 128-entry stub. > - Remove verbose comments (Andrii) > - Link to v1: https://patch.msgid.link/20260730-b4-fix_btf_tracefs-v1-1-5= [email protected] > --- > include/trace/trace_events.h | 7 +++---- > kernel/trace/trace_syscalls.c | 27 ++++++++++++++------------- > 2 files changed, 17 insertions(+), 17 deletions(-) > LGTM Acked-by: Andrii Nakryiko <[email protected]> [...]