[PATCH] perf llvm: Specify features="+all" for aarch64

Peter Collingbourne posted 1 patch 1 month, 1 week ago
tools/perf/util/llvm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
[PATCH] perf llvm: Specify features="+all" for aarch64
Posted by Peter Collingbourne 1 month, 1 week ago
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 <pcc@google.com>
---
 tools/perf/util/llvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/llvm.c b/tools/perf/util/llvm.c
index 87fceae8488a7..44eff99970fe2 100644
--- a/tools/perf/util/llvm.c
+++ b/tools/perf/util/llvm.c
@@ -153,11 +153,17 @@ int symbol__disassemble_llvm(const char *filename, struct symbol *sym,
 					  /*get_op_info=*/NULL, symbol_lookup_callback);
 	} else {
 		char triplet[64];
+		const char *features = NULL;
 
 		scnprintf(triplet, sizeof(triplet), "%s-linux-gnu",
 			  args->arch->name);
-		disasm = LLVMCreateDisasm(triplet, &storage, /*tag_type=*/0,
-					  /*get_op_info=*/NULL, symbol_lookup_callback);
+		if (args->arch->id.e_machine == EM_AARCH64)
+			features = "+all";
+		disasm = LLVMCreateDisasmCPUFeatures(triplet, /*cpu=*/"",
+						     features, &storage,
+						     /*tag_type=*/0,
+						     /*get_op_info=*/NULL,
+						     symbol_lookup_callback);
 	}
 
 	if (disasm == NULL)
-- 
2.53.0.473.g4a7958ca14-goog
Re: [PATCH] perf llvm: Specify features="+all" for aarch64
Posted by Namhyung Kim 1 month, 1 week ago
On Tue, 03 Mar 2026 15:00:54 -0800, Peter Collingbourne wrote:
> 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
> 
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung
Re: [PATCH] perf llvm: Specify features="+all" for aarch64
Posted by Ian Rogers 1 month, 1 week ago
On Tue, Mar 3, 2026 at 3:01 PM Peter Collingbourne <pcc@google.com> wrote:
>
> 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 <pcc@google.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/llvm.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/llvm.c b/tools/perf/util/llvm.c
> index 87fceae8488a7..44eff99970fe2 100644
> --- a/tools/perf/util/llvm.c
> +++ b/tools/perf/util/llvm.c
> @@ -153,11 +153,17 @@ int symbol__disassemble_llvm(const char *filename, struct symbol *sym,
>                                           /*get_op_info=*/NULL, symbol_lookup_callback);
>         } else {
>                 char triplet[64];
> +               const char *features = NULL;
>
>                 scnprintf(triplet, sizeof(triplet), "%s-linux-gnu",
>                           args->arch->name);
> -               disasm = LLVMCreateDisasm(triplet, &storage, /*tag_type=*/0,
> -                                         /*get_op_info=*/NULL, symbol_lookup_callback);
> +               if (args->arch->id.e_machine == EM_AARCH64)
> +                       features = "+all";
> +               disasm = LLVMCreateDisasmCPUFeatures(triplet, /*cpu=*/"",
> +                                                    features, &storage,
> +                                                    /*tag_type=*/0,
> +                                                    /*get_op_info=*/NULL,
> +                                                    symbol_lookup_callback);
>         }
>
>         if (disasm == NULL)
> --
> 2.53.0.473.g4a7958ca14-goog
>
Re: [PATCH] perf llvm: Specify features="+all" for aarch64
Posted by Arnaldo Carvalho de Melo 1 month, 1 week ago
On Tue, Mar 03, 2026 at 03:31:42PM -0800, Ian Rogers wrote:
> On Tue, Mar 3, 2026 at 3:01 PM Peter Collingbourne <pcc@google.com> wrote:
> >
> > 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 <pcc@google.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Namhyung, this should go to 7.1 (perf-tools-next),

Regards,

- Arnaldo