* [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types
@ 2026-10-05 6:34 Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 1/7] perf tools: Remove redundant dso data init Namhyung Kim
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
Hello,
Currently we have 3 types for a DSO.
* binary type: determines where to read binary instruction or data of the
DSO. Basically used by annotate. Some (special) DSOs like kallsyms or
JIT may not have the data though.
* symtab type: determines where to read symbol tables. Set when symbols
in the DSO are loaded.
* debug info type: determines where to read debug info. Used by srcline,
DWARF unwinding, data type profiling and so on. Often debug info is
saved in a separate file.
Some DSOs may have the same type for 3 and others can have all different.
Previously it generally assumed binary type would be same as symtab type
but now I think we should not and only set the binary type as it's used.
Also it should make sure that symtab type is set properly after loading
symbols in the DSO.
Probably this patchset won't make any practical difference in runtime
behaviors but I think it's good to track them accurately.
Thanks,
Namhyung
Namhyung Kim (7):
perf tools: Remove redundant dso data init
perf tools: Try linked debug files for DSO debug info
perf symbol: Update symtab type of vmlinux from build-id cache
perf symbol: Set binary/symtab type for split kallsyms
perf symbol: Set dso symtab type for libbfd
perf symbol: Set binary type for JIT map DSOs
perf symbol: Do not set binary type from symtab type
tools/perf/util/dso.c | 3 +--
tools/perf/util/symbol.c | 23 ++++++++---------------
2 files changed, 9 insertions(+), 17 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/7] perf tools: Remove redundant dso data init
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 2/7] perf tools: Try linked debug files for DSO debug info Namhyung Kim
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
The fd and status are initialized later with cache.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/dso.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 563a8f854c13bc21..7f389b913edb5ec7 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1722,8 +1722,6 @@ struct dso *dso__new_id(const char *name, const struct dso_id *id)
dso->srclines = RB_ROOT_CACHED;
dso->data_types = RB_ROOT;
dso->global_vars = RB_ROOT;
- dso->data.fd = -1;
- dso->data.status = DSO_DATA_STATUS_UNKNOWN;
dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND;
dso->dbginfo_type = DSO_BINARY_TYPE__NOT_FOUND;
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 2/7] perf tools: Try linked debug files for DSO debug info
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 1/7] perf tools: Remove redundant dso data init Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 3/7] perf symbol: Update symtab type of vmlinux from build-id cache Namhyung Kim
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
The dso__find_dbginfo_type() should try DSO_BINARY_TYPE__DEBUGLINK so it
can follow the .gnu_debuglink and find the debug information in the
separate file.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/dso.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 7f389b913edb5ec7..732c49c8fc3dc1a5 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -2111,6 +2111,7 @@ void dso__find_dbginfo_type(struct dso *dso)
DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
DSO_BINARY_TYPE__BUILDID_DEBUGINFO,
DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
+ DSO_BINARY_TYPE__DEBUGLINK,
DSO_BINARY_TYPE__NOT_FOUND,
};
const enum dso_binary_type *type;
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 3/7] perf symbol: Update symtab type of vmlinux from build-id cache
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 1/7] perf tools: Remove redundant dso data init Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 2/7] perf tools: Try linked debug files for DSO debug info Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 4/7] perf symbol: Set binary/symtab type for split kallsyms Namhyung Kim
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
Currently dso__load_vmlinux() sets both binary type and symtab type to
VMLINUX. To precisely track the symtab type of the kernel dso, update
the type to build-id cache if it's loaded from there. It won't have
any functional difference though.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 5d98888d068c741a..cf099cbd29f268ec 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2079,7 +2079,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map)
if (filename != NULL) {
err = dso__load_vmlinux(dso, map, filename, true);
if (err > 0)
- goto out;
+ dso__set_symtab_type(dso, DSO_BINARY_TYPE__BUILD_ID_CACHE);
}
out:
return err;
@@ -2235,8 +2235,10 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map)
filename = __dso__build_id_filename(dso, NULL, 0, false, false);
if (filename != NULL) {
err = dso__load_vmlinux(dso, map, filename, true);
- if (err > 0)
+ if (err > 0) {
+ dso__set_symtab_type(dso, DSO_BINARY_TYPE__BUILD_ID_CACHE);
return err;
+ }
}
if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) {
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 4/7] perf symbol: Set binary/symtab type for split kallsyms
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
` (2 preceding siblings ...)
2026-10-05 6:34 ` [PATCH v1 3/7] perf symbol: Update symtab type of vmlinux from build-id cache Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 5/7] perf symbol: Set dso symtab type for libbfd Namhyung Kim
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
When it creates new DSOs for split kallsyms, set the binary and symtab
type to KALLSYMS properly.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index cf099cbd29f268ec..fc6e4dff282bc2dc 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1099,6 +1099,8 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
return -1;
dso__set_kernel(ndso, dso__kernel(dso));
+ dso__set_binary_type(ndso, dso__binary_type(dso));
+ dso__set_symtab_type(ndso, dso__symtab_type(dso));
dso__set_loaded(ndso);
curr_map = map__new2(pos->start, ndso);
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 5/7] perf symbol: Set dso symtab type for libbfd
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
` (3 preceding siblings ...)
2026-10-05 6:34 ` [PATCH v1 4/7] perf symbol: Set binary/symtab type for split kallsyms Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type Namhyung Kim
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
It missed to set the dso symtab type when the symbols are loaded by
libbfd. When it happens both syms_ss and runtime_ss may not be set
and won't call dso__load_sym().
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index fc6e4dff282bc2dc..02b096ccbc60ac2a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1933,6 +1933,7 @@ int dso__load(struct dso *dso, struct map *map)
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (bfdrc == 0) {
+ dso__set_symtab_type(dso, symtab_type);
ret = 0;
break;
}
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
` (4 preceding siblings ...)
2026-10-05 6:34 ` [PATCH v1 5/7] perf symbol: Set dso symtab type for libbfd Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type Namhyung Kim
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
The perf-<pid>.map files contain symbol name of JIT functions.
As they don't have the binary data (instructions) no need to try
for dso_data. Let's set the binary type regardless of the result
of symbol loading so that it can be ignored.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 02b096ccbc60ac2a..389dbd7e5192f4f2 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1859,6 +1859,7 @@ int dso__load(struct dso *dso, struct map *map)
if (perfmap) {
ret = dso__load_perf_map(map_path, dso);
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__JAVA_JIT);
dso__set_symtab_type(dso, ret > 0
? DSO_BINARY_TYPE__JAVA_JIT
: DSO_BINARY_TYPE__NOT_FOUND);
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
` (5 preceding siblings ...)
2026-10-05 6:34 ` [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs Namhyung Kim
@ 2026-10-05 6:34 ` Namhyung Kim
6 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2026-10-05 6:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
The DSO binary type is to access the binary (e.g. instruction) data
while symtab type is for the symbol table. They may or may not be in
the same file. We should track them separately and correctly.
As special binaries already set their type before loading symbols, leave
the binary type info and only update it when actually opening the DSO.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 389dbd7e5192f4f2..1175cb60f8206757 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1956,19 +1956,6 @@ int dso__load(struct dso *dso, struct map *map)
if (next_slot) {
ss_pos++;
-
- /*
- * The binary type is used to find the file containing
- * the executed instructions, so prefer the types that
- * refer to the actual object over debug-only files such
- * as DSO_BINARY_TYPE__DEBUGLINK.
- */
- if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND ||
- symtab_type == DSO_BINARY_TYPE__BUILD_ID_CACHE ||
- (symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_DSO &&
- dso__binary_type(dso) != DSO_BINARY_TYPE__BUILD_ID_CACHE))
- dso__set_binary_type(dso, symtab_type);
-
if (syms_ss && runtime_ss)
break;
} else {
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-10-05 6:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 1/7] perf tools: Remove redundant dso data init Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 2/7] perf tools: Try linked debug files for DSO debug info Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 3/7] perf symbol: Update symtab type of vmlinux from build-id cache Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 4/7] perf symbol: Set binary/symtab type for split kallsyms Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 5/7] perf symbol: Set dso symtab type for libbfd Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®