All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] tracing: Make per-template BTF id lists file-local
Date: Thu, 30 Jul 2026 14:48:25 +0100	[thread overview]
Message-ID: <e248c9d5-862e-4783-a984-ab29cb8f16f8@gmail.com> (raw)
In-Reply-To: <20260730130352.476D51F00A3A@smtp.kernel.org>



On 7/30/26 2:03 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Using `BTF_ID_LIST()` instead of `BTF_ID_LIST_GLOBAL()` for tracepoint classes introduces significant BSS memory bloat when `CONFIG_DEBUG_INFO_BTF` is disabled.
> --
> 
> --- Patch [1]: [PATCH bpf-next] tracing: Make per-template BTF id lists file-local ---
> commit 49d7faf72ef8695ae45768a193f5a09e2cfe872d
> Author: Mykyta Yatsenko <yatsenko@meta.com>
> 
> tracing: Make per-template BTF id lists file-local
> 
> This commit converts trace event BTF id lists from global to file-local to
> avoid symbol clashes when multiple translation units instantiate the same
> class. It also explicitly provides local BTF id lists for handcrafted syscall
> events.
> 
> Link: https://lore.kernel.org/all/ff58b01c-3f5e-4d55-be82-609d2faaf12e@sirena.org.uk/
> 
>> diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
>> index 09ad57ac4b73e..45ffbe04b5805 100644
>> --- a/include/trace/trace_events.h
>> +++ b/include/trace/trace_events.h
>> @@ -404,10 +404,12 @@ static inline notrace int trace_event_get_offsets_##call(		\
>>   *   [0] FUNC   __bpf_trace_<call>     (the BPF dispatcher)
>>   *   [1] STRUCT trace_event_raw_<call> (the ring-buffer record)
>>   * Exposed via the events/<sys>/<name>/btf_ids tracefs file.
>> + *
>> + * File-local: the class name is not unique, so a global symbol would
>> + * clash across translation units.
>>   */
>>  #define _TRACE_BTF_IDS_DECLARE(call)					\
>> -	extern u32 __bpf_trace_btf_ids_##call[];			\
>> -	BTF_ID_LIST_GLOBAL(__bpf_trace_btf_ids_##call, 2)		\
>> +	BTF_ID_LIST(__bpf_trace_btf_ids_##call)				\
>>  	BTF_ID(func,   __bpf_trace_##call)				\
>>  	BTF_ID(struct, trace_event_raw_##call)
> 
> [Severity: Medium]
> Does changing this to BTF_ID_LIST() introduce significant BSS memory bloat
> when CONFIG_DEBUG_INFO_BTF is disabled?
> 
> When CONFIG_DEBUG_INFO_BTF is disabled, the fallback for BTF_ID_LIST is
> defined as:
> 
> include/linux/btf_ids.h:
> #define BTF_ID_LIST(name) static u32 __maybe_unused name[128];
> 
> BTF_ID_LIST_GLOBAL(..., 2) only allocated 2 elements (8 bytes), but this
> fallback statically allocates a 128-element u32 array (512 bytes) per
> instance.
> 
> Because _TRACE_BTF_IDS_DECLARE is instantiated via DECLARE_EVENT_CLASS for
> over a thousand trace event classes across the kernel, this seems to silently
> add roughly 750 KB of wasted BSS memory.
> 
I'll follow up on this


  reply	other threads:[~2026-07-30 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 12:51 [PATCH bpf-next] tracing: Make per-template BTF id lists file-local Mykyta Yatsenko
2026-07-30 13:03 ` sashiko-bot
2026-07-30 13:48   ` Mykyta Yatsenko [this message]
2026-07-30 23:55 ` Andrii Nakryiko
2026-07-31  0:05   ` Mykyta Yatsenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e248c9d5-862e-4783-a984-ab29cb8f16f8@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.