public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: dwarves@vger.kernel.org
Cc: acme@kernel.org, yonghong.song@linux.dev, ast@kernel.org,
	 andrii@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net,
	song@kernel.org,  eddyz87@gmail.com, olsajiri@gmail.com,
	stephen.s.brennan@oracle.com,  laura.nao@collabora.com,
	ubizjak@gmail.com, alan.maguire@oracle.com,
	 xiyou.wangcong@gmail.com,
	Sami Tolvanen <samitolvanen@google.com>
Subject: [PATCH dwarves] btf_encoder: Filter out __gendwarfksyms_ptr_
Date: Mon, 17 Mar 2025 22:24:24 +0000	[thread overview]
Message-ID: <20250317222424.3837495-1-samitolvanen@google.com> (raw)

With CONFIG_GENDWARFKSYMS, __gendwarfksyms_ptr_<symbol>
variables are added to the kernel in EXPORT_SYMBOL() to ensure
DWARF type information is available for exported symbols in the
TUs where they're actually exported. These symbols are dropped
when linking vmlinux, but dangling references to them remain
in DWARF, which results in thousands of 0 address variables
that pahole needs to validate (since commit 9810758003ce
("btf_encoder: Verify 0 address DWARF variables are in ELF
section")).

Filter out symbols with the __gendwarfksyms_ptr_ name prefix in
filter_variable_name() instead of calling variable_in_sec()
for all of them. This reduces the time it takes to process
.tmp_vmlinux1 by ~77% on my test system:

Before: 35.775 +- 0.121  seconds time elapsed  ( +-  0.34% )
 After: 8.3516 +- 0.0407 seconds time elapsed  ( +-  0.49% )

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
 btf_encoder.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/btf_encoder.c b/btf_encoder.c
index 1bde310..2bf7c59 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -2239,6 +2239,7 @@ static bool filter_variable_name(const char *name)
 		X("__UNIQUE_ID"),
 		X("__tpstrtab_"),
 		X("__exitcall_"),
+		X("__gendwarfksyms_ptr_"),
 		X("__func_stack_frame_non_standard_")
 		#undef X
 	};

base-commit: a0be596ae76c720d21eef257dec1cf2462130da1
-- 
2.49.0.rc1.451.g8f38331e32-goog


             reply	other threads:[~2025-03-17 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 22:24 Sami Tolvanen [this message]
2025-03-18  9:52 ` [PATCH dwarves] btf_encoder: Filter out __gendwarfksyms_ptr_ Jiri Olsa
2025-03-18 16:14   ` Sami Tolvanen
2025-03-20  9:54     ` Alan Maguire
2025-03-20 11:59       ` Jiri Olsa
2025-03-24  8:16 ` Alan Maguire

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=20250317222424.3837495-1-samitolvanen@google.com \
    --to=samitolvanen@google.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=laura.nao@collabora.com \
    --cc=olsajiri@gmail.com \
    --cc=song@kernel.org \
    --cc=stephen.s.brennan@oracle.com \
    --cc=ubizjak@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yonghong.song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox