perf symbol: Set binary_type of dso when loading
Namhyung Kim
maintainerPATCH 1/2 perf symbol: Set binary_type of dso when loading
For the kernel dso, it sets the binary type of dso when loading the symbol table. But it seems not to do that for user DSOs. Actually it sets the symtab type only. It's not clear why we want to maintain the two separately but it uses the binary type info before getting the disassembly.
Let's use the symtab type as binary type too if it's not set. I think it's ok to set the binary type when it founds a symsrc whether or not it has actual symbols.
--- tools/perf/util/symbol.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/symbol.c +3 -0
@@ -1927,6 +1927,9 @@ int dso__load(struct dso *dso, struct map *map)if (next_slot) { ss_pos++; +if (dso__binary_type (dso) ==DSO_BINARY_TYPE__NOT_FOUND ) +dso__set_binary_type (dso, symtab_type); +if (syms_ss && runtime_ss)break ; }else {
Signature · 1 line
2.44.0.769.g3c40516874-goog
Namhyung Kim
maintainerPATCH 2/2 perf symbol: Simplify kernel module checking
In dso__load(), it checks if the dso is a kernel module by looking the symtab type. Actually dso has 'is_kmod' field to check that easily and dso__set_module_info() set the symtab type and the is_kmod bit. So it should have the same result to check the is_kmod bit.
--- tools/perf/util/symbol.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/symbol.c +1 -4
@@ -1811,10 +1811,7 @@ int dso__load(struct dso *dso, struct map *map) goto out; } - kmod =dso__symtab_type (dso) ==DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE || -dso__symtab_type (dso) ==DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP || -dso__symtab_type (dso) ==DSO_BINARY_TYPE__GUEST_KMODULE || -dso__symtab_type (dso) ==DSO_BINARY_TYPE__GUEST_KMODULE_COMP ; + kmod =dso__is_kmod (dso);if (dso__kernel (dso) && !kmod) {if (dso__kernel (dso) ==DSO_SPACE__KERNEL )
Signature · 1 line
2.44.0.769.g3c40516874-goog
Hi,
Quoted 11 lines · Namhyung Kim
For the kernel dso, it sets the binary type of dso when loading the symbol table. But it seems not to do that for user DSOs. Actually it sets the symtab type only. It's not clear why we want to maintain the two separately but it uses the binary type info before getting the disassembly.
Let's use the symtab type as binary type too if it's not set. I think it's ok to set the binary type when it founds a symsrc whether or not it has actual symbols.
Signed-off-by Namhyung Kim <[email protected]>
Any chance this can be applied and propagated to stable? Annotating functions outside of the main executable is broken otherwise (regressed since 873a83731f1c ("perf annotate: Skip DSOs not found")).
Quoted 19 lines
--- tools/perf/util/symbol.c | 3 +++ 1 file changed, 3 insertions(+)tools/perf/util/symbol.c +3
-0@@ -1927,6 +1927,9 @@ int dso__load(struct dso *dso, struct map *map)if (next_slot) { ss_pos++; +if (dso__binary_type (dso) ==DSO_BINARY_TYPE__NOT_FOUND ) +dso__set_binary_type (dso, symtab_type); +if (syms_ss && runtime_ss)break ; }else {
Namhyung Kim
maintainerHello,
Quoted 14 lines · Alexander Monakov
Hi,
Quoted 10 lines · Namhyung Kim
For the kernel dso, it sets the binary type of dso when loading the symbol table. But it seems not to do that for user DSOs. Actually it sets the symtab type only. It's not clear why we want to maintain the two separately but it uses the binary type info before getting the disassembly.
Let's use the symtab type as binary type too if it's not set. I think it's ok to set the binary type when it founds a symsrc whether or not it has actual symbols.
Quoted 7 lines
Quoted 1 line
Signed-off-by Namhyung Kim <[email protected]>Any chance this can be applied and propagated to stable? Annotating functions outside of the main executable is broken otherwise (regressed since
873a83731f1c("perf annotate: Skip DSOs not found")).Tested-by Alexander Monakov <[email protected]>
Thanks for the test. For some reason, it doesn't seem to be merged while patch 2/2 is. I'll add this with above information.
Thanks,
Namhyung
Quoted 20 lines
Quoted 20 lines
--- tools/perf/util/symbol.c | 3 +++ 1 file changed, 3 insertions(+)tools/perf/util/symbol.c +3
-0@@ -1927,6 +1927,9 @@ int dso__load(struct dso *dso, struct map *map)if (next_slot) { ss_pos++; +if (dso__binary_type (dso) ==DSO_BINARY_TYPE__NOT_FOUND ) +dso__set_binary_type (dso, symtab_type); +if (syms_ss && runtime_ss)break ; }else {
Namhyung Kim
maintainerQuoted 19 lines · Namhyung Kim
Hello,
Quoted 16 lines · Alexander Monakov
Hi,
Quoted 11 lines · Namhyung Kim
For the kernel dso, it sets the binary type of dso when loading the symbol table. But it seems not to do that for user DSOs. Actually it sets the symtab type only. It's not clear why we want to maintain the two separately but it uses the binary type info before getting the disassembly.
Let's use the symtab type as binary type too if it's not set. I think it's ok to set the binary type when it founds a symsrc whether or not it has actual symbols.
Signed-off-by Namhyung Kim <[email protected]>
Quoted 8 lines
Quoted 5 lines
Any chance this can be applied and propagated to stable? Annotating functions outside of the main executable is broken otherwise (regressed since
873a83731f1c("perf annotate: Skip DSOs not found")).Tested-by Alexander Monakov <[email protected]>Thanks for the test. For some reason, it doesn't seem to be merged while patch 2/2 is. I'll add this with above information.
Well, it actually needs to go to perf-tools tree. Arnaldo, can you please pick this up? It should have this too.
Thanks,
Namhyung
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
--- tools/perf/util/symbol.c | 3 +++ 1 file changed, 3 insertions(+)tools/perf/util/symbol.c +3
-0@@ -1927,6 +1927,9 @@ int dso__load(struct dso *dso, struct map *map)if (next_slot) { ss_pos++; +if (dso__binary_type (dso) ==DSO_BINARY_TYPE__NOT_FOUND ) +dso__set_binary_type (dso, symtab_type); +if (syms_ss && runtime_ss)break ; }else {