From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Nick Terrell <terrelln@fb.com>, David Sterba <dsterba@suse.com>,
Nathan Chancellor <nathan@kernel.org>,
Tomas Glozar <tglozar@redhat.com>,
Blake Jones <blakejones@google.com>,
Dmitrii Dolgov <9erthalion6@gmail.com>,
Alexandre Chartre <alexandre.chartre@oracle.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Yuzhuo Jing <yuzhuo@google.com>,
Michael Jeanson <mjeanson@efficios.com>,
Leo Yan <leo.yan@arm.com>, Tianyou Li <tianyou.li@intel.com>,
Zecheng Li <zecheng@google.com>,
Rong Bao <rong.bao@csmantle.top>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
bpf@vger.kernel.org
Subject: [PATCH v1 0/7] perf annotate: Add elfutils libasm disassembler backend
Date: Mon, 8 Jun 2026 22:17:52 -0700 [thread overview]
Message-ID: <20260609051759.405027-1-irogers@google.com> (raw)
This series implements a new native disassembler backend for `perf annotate`
using elfutils' libasm.
Currently, `perf annotate` defaults to invoking an external `objdump`
process when native disassemblers like Capstone or LLVM are either
not compiled in or unable to handle the target binary. This fallback
incurs significant overhead due to process forking, output parsing,
and external process management. It is also inherently fragile and
complicates environments where `objdump` might not be readily available.
This series integrates `libasm` directly into the perf tools to parse
instructions natively without any external process dependencies,
providing a robust native alternative to `objdump` using elfutils.
It adds:
- Build checks and detection for the `libasm` elfutils library.
- A comprehensive `symbol__disassemble_libasm` implementation.
- A `--disassembler=<name>` flag to explicitly choose between backends
(e.g., `libasm`, `objdump`, `capstone`, `llvm`).
- Temporary ELF file generation for JITted BPF programs to allow
`objdump` and `libasm` to decode them gracefully.
- Full system-wide test coverage in `perf test` that validates normal
ELF execution and BPF JIT output across all supported backends.
`perf annotate` will continue to seamlessly prioritize the available
disassembler backends, but `libasm` now provides a robust, native fallback
for standard environments using elfutils.
Ian Rogers (7):
tools build: Add feature check for elfutils libasm
perf build: Add build support and capability for elfutils libasm
perf annotate: Implement elfutils libasm disassembler backend
perf annotate: Add --disassembler command-line option
perf test: Enhance annotate test coverage and isolate config
perf annotate: Support BPF JIT disassembly via genelf
perf test: Add BPF JIT annotation test coverage for all disassemblers
tools/build/Makefile.feature | 2 +
tools/build/feature/Makefile | 9 ++
tools/build/feature/test-libasm.c | 19 +++
tools/perf/Makefile.config | 23 ++++
tools/perf/builtin-annotate.c | 10 ++
tools/perf/builtin-check.c | 1 +
tools/perf/tests/shell/annotate.sh | 125 ++++++++++++++++++++
tools/perf/util/Build | 1 +
tools/perf/util/annotate.c | 8 +-
tools/perf/util/annotate.h | 3 +
tools/perf/util/disasm.c | 110 ++++++++++++++++-
tools/perf/util/disasm.h | 1 +
tools/perf/util/libasm.c | 182 +++++++++++++++++++++++++++++
tools/perf/util/libasm.h | 27 +++++
14 files changed, 513 insertions(+), 8 deletions(-)
create mode 100644 tools/build/feature/test-libasm.c
create mode 100644 tools/perf/util/libasm.c
create mode 100644 tools/perf/util/libasm.h
--
2.54.0.1064.gd145956f57-goog
next reply other threads:[~2026-06-09 5:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 5:17 Ian Rogers [this message]
2026-06-09 5:17 ` [PATCH v1 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09 5:28 ` sashiko-bot
2026-06-09 5:17 ` [PATCH v1 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09 5:28 ` sashiko-bot
2026-06-09 5:17 ` [PATCH v1 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09 5:30 ` sashiko-bot
2026-06-09 5:17 ` [PATCH v1 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09 5:17 ` [PATCH v1 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09 5:28 ` sashiko-bot
2026-06-09 5:17 ` [PATCH v1 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09 5:33 ` sashiko-bot
2026-06-09 5:17 ` [PATCH v1 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
2026-06-09 5:36 ` sashiko-bot
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=20260609051759.405027-1-irogers@google.com \
--to=irogers@google.com \
--cc=9erthalion6@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexandre.chartre@oracle.com \
--cc=blakejones@google.com \
--cc=bpf@vger.kernel.org \
--cc=costa.shul@redhat.com \
--cc=dsterba@suse.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mjeanson@efficios.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=peterz@infradead.org \
--cc=rong.bao@csmantle.top \
--cc=terrelln@fb.com \
--cc=tglozar@redhat.com \
--cc=tianyou.li@intel.com \
--cc=yuzhuo@google.com \
--cc=zecheng@google.com \
/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