Peter Collingbourne
b1718b0367
perf annotate: Specify llvm features="+all" for aarch64
...
This is consistent with what llvm-objdump does (see [1]) and allows
the LLVM disassembler to disassemble instructions not in the base
instruction set.
[1] https://reviews.llvm.org/D127741
Link: https://linux-review.googlesource.com/id/I52e4fef18d2e12b45f875231fa9d3efff2538fd4
Signed-off-by: Peter Collingbourne <[email protected] >
Reviewed-by: Ian Rogers <[email protected] >
Acked-by: Arnaldo Carvalho de Melo <[email protected] >
Signed-off-by: Namhyung Kim <[email protected] >
2026-03-04 18:05:18 -08:00
Ian Rogers
9273085273
perf disasm: Rework the string arch__is to use the ELF machine
...
Add new arch__is_x86 and arch__is_powerpc functions that avoid string
comparisons and use the ELF machine.
Remove arch__is() that is no longer used.
Reviewed-by: James Clark <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Cc: Aditya Bodkhe <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Albert Ou <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Howard Chu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Julia Lawall <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Krzysztof Łopatowski <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Sergei Trofimovich <[email protected] >
Cc: Shimin Guo <[email protected] >
Cc: Suchit Karunakaran <[email protected] >
Cc: Thomas Falcon <[email protected] >
Cc: Tianyou Li <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Zecheng Li <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2026-01-23 16:58:38 -03:00
Ian Rogers
00419892ba
perf annotate: Fix args leak of map_symbol
...
map_symbol__exit() needs calling on an annotate_args.ms, however, rather
than introduce proper reference count handling to symbol__annotate()
just switch to passing the map_symbol pointer parameter around, making
the puts the caller's responsibility.
Fix a number of cases to ensure the map in a map_symbol has a
reference count increment and add the then necessary map_symbol_exits.
Fixes: 56e144fe98 ("perf mem_info: Add and use map_symbol__exit and addr_map_symbol__exit")
Reviewed-by: James Clark <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Cc: Aditya Bodkhe <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Albert Ou <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Howard Chu <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Julia Lawall <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Krzysztof Łopatowski <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Sergei Trofimovich <[email protected] >
Cc: Shimin Guo <[email protected] >
Cc: Suchit Karunakaran <[email protected] >
Cc: Thomas Falcon <[email protected] >
Cc: Tianyou Li <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Zecheng Li <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2026-01-23 16:58:38 -03:00
Ian Rogers
257046a367
perf srcline: Fallback between addr2line implementations
...
Factor the addr2line function implementation into separate source files
(addr2line.[ch]) and rename the addr2line function cmd__addr2line. In
srcline replace the ifdef-ed addr2line implementations with one that
first tries the llvm__addr2line implementation, then the deprecated
libbfd__addr2line function and on failure uses cmd__addr2line.
If HAVE_LIBLLVM_SUPPORT is enabled the llvm__addr2line will execute
against the libLLVM.so it is linked against.
If HAVE_LIBLLVM_DYNAMIC is enabled then libperf-llvm.so (that links
against libLLVM.so) will be dlopened. If the dlopen succeeds then the
behavior should match HAVE_LIBLLVM_SUPPORT. On failure cmd__addr2line is
used. The dlopen is only tried once.
If HAVE_LIBLLVM_DYNAMIC isn't enabled then llvm__addr2line immediately
fails and cmd__addr2line is used.
Clean up the dso__free_a2l logic, which is only needed in the non-LLVM
version and moved to addr2line.c.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Charlie Jenkins <[email protected] >
Cc: Collin Funk <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Eric Biggers <[email protected] >
Cc: Haibo Xu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Li Huafei <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephen Brennan <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2025-10-06 16:47:49 -03:00
Ian Rogers
bca753204e
perf dso: Clean up read_symbol() error handling
...
Ensure errno is set and return to caller for error handling.
Unusually for perf the value isn't negated as expected by
symbol__strerror_disassemble().
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Charlie Jenkins <[email protected] >
Cc: Collin Funk <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Eric Biggers <[email protected] >
Cc: Haibo Xu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Li Huafei <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephen Brennan <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2025-10-06 16:35:28 -03:00
Ian Rogers
9518e10c2b
perf dso: Move read_symbol() from llvm/capstone to dso
...
Move the read_symbol function to dso.h, make the return type const and
add a mutable out_buf out parameter.
In future changes this will allow a code pointer to be returned without
necessary allocating memory.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Charlie Jenkins <[email protected] >
Cc: Collin Funk <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Eric Biggers <[email protected] >
Cc: Haibo Xu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Li Huafei <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephen Brennan <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2025-10-06 16:35:25 -03:00
Ian Rogers
0e52f3f9f1
perf llvm: Reduce LLVM initialization
...
Move the 3 LLVM initialization routines to be called in a single
init_llvm function that has its own bool to avoid repeated
initialization.
Reduce the scope of triplet and avoid copying strings for x86.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Charlie Jenkins <[email protected] >
Cc: Collin Funk <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Eric Biggers <[email protected] >
Cc: Haibo Xu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Li Huafei <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephen Brennan <[email protected] >
[ Move init_llvm() under HAVE_LIBLLVM_SUPPORT to fix the build ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2025-10-06 16:27:07 -03:00
Ian Rogers
d9007afca0
perf llvm: Move llvm functionality into its own file
...
LLVM disassembly support was in disasm.c and addr2line support in
srcline.c. Move support out of these files into llvm.[ch] and remove
LLVM includes from those files. As disassembly routines can fail, make
failure the only option without HAVE_LIBLLVM_SUPPORT. For simplicity's
sake, duplicate the read_symbol utility function.
The intent with moving LLVM support into a single file is that dynamic
support, using dlopen for libllvm, can be added in later patches. This
can potentially always succeed or fail, so relying on ifdefs isn't
sufficient. Using dlopen is a useful option to minimize the perf tools
dependencies and potentially size.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Athira Rajeev <[email protected] >
Cc: Bill Wendling <[email protected] >
Cc: Charlie Jenkins <[email protected] >
Cc: Collin Funk <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Dr. David Alan Gilbert <[email protected] >
Cc: Eric Biggers <[email protected] >
Cc: Haibo Xu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Justin Stitt <[email protected] >
Cc: Li Huafei <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephen Brennan <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2025-10-02 15:38:23 -03:00