From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: 9erthalion6@gmail.com, adrian.hunter@intel.com,
alexandre.chartre@oracle.com, blakejones@google.com,
bpf@vger.kernel.org, costa.shul@redhat.com, dsterba@suse.com,
james.clark@linaro.org, jolsa@kernel.org, leo.yan@arm.com,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mark@klomp.org, mingo@redhat.com, mjeanson@efficios.com,
nathan@kernel.org, peterz@infradead.org, rong.bao@csmantle.top,
serhei@serhei.io, terrelln@fb.com, tglozar@redhat.com,
tianyou.li@intel.com, yuzhuo@google.com, zecheng@google.com
Subject: [PATCH v3 0/7] perf annotate: Add elfutils libasm disassembler and BPF JIT disassembly support
Date: Tue, 9 Jun 2026 11:21:01 -0700 [thread overview]
Message-ID: <20260609182108.975586-1-irogers@google.com> (raw)
In-Reply-To: <20260609070732.545416-1-irogers@google.com>
This patch series introduces support for using the elfutils `libasm` library
as a disassembler backend in `perf annotate`. This provides a lightweight,
library-based alternative to LLVM and Capstone for in-process disassembly.
Additionally, this series implements disassembly support for in-memory BPF
JITted programs by writing the JITted instruction buffer to a temporary ELF
file on the fly and disassembling it using the ELF-based backends (`objdump`
and `libasm`).
Changes in v3:
- Address review comments on v2 series.
- Explicitly link against `-lasm -ldw -lelf` in the feature check.
- Document that older versions of elfutils that require explicitly linking
`-lebl` statically are unsupported.
- Fix instruction-by-instruction disassembly loop logic in `libasm.c` by
returning 1 from output callback and checking for `ret != 1`.
- Pass the correct ELF machine (`e_machine`) to `jit_write_elf` instead of
hardcoding host architecture.
- Update `annotate.sh` tests to use `perf test -w` workload instead of `free`
to avoid CI environment issues.
- Expand test coverage to test all disassemblers (including libasm) on BPF
JIT symbols when run with root privileges.
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 | 20 ++++
tools/perf/Makefile.config | 22 ++++
tools/perf/builtin-annotate.c | 10 ++
tools/perf/builtin-check.c | 1 +
tools/perf/tests/genelf.c | 2 +-
tools/perf/tests/shell/annotate.sh | 153 ++++++++++++++++++++++++
tools/perf/util/Build | 1 +
tools/perf/util/annotate.c | 8 +-
tools/perf/util/annotate.h | 3 +
tools/perf/util/disasm.c | 114 +++++++++++++++++-
tools/perf/util/disasm.h | 1 +
tools/perf/util/genelf.c | 16 +--
tools/perf/util/genelf.h | 2 +-
tools/perf/util/jitdump.c | 3 +-
tools/perf/util/libasm.c | 184 +++++++++++++++++++++++++++++
tools/perf/util/libasm.h | 27 +++++
18 files changed, 559 insertions(+), 19 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.1099.g489fc7bff1-goog
next prev parent reply other threads:[~2026-06-09 18:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 7:07 [PATCH v2 0/7] perf annotate: Add elfutils libasm disassembler support Ian Rogers
2026-06-09 7:07 ` [PATCH v2 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09 7:21 ` sashiko-bot
2026-06-09 7:07 ` [PATCH v2 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09 7:19 ` sashiko-bot
2026-06-09 7:07 ` [PATCH v2 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09 7:07 ` [PATCH v2 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09 7:07 ` [PATCH v2 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09 7:15 ` sashiko-bot
2026-06-09 7:07 ` [PATCH v2 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09 7:22 ` sashiko-bot
2026-06-09 7:07 ` [PATCH v2 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
2026-06-09 7:18 ` sashiko-bot
2026-06-09 18:21 ` Ian Rogers [this message]
2026-06-09 18:21 ` [PATCH v3 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09 18:46 ` sashiko-bot
2026-06-09 18:21 ` [PATCH v3 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09 18:21 ` [PATCH v3 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09 18:52 ` sashiko-bot
2026-06-09 18:21 ` [PATCH v3 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09 18:21 ` [PATCH v3 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09 18:46 ` sashiko-bot
2026-06-09 18:21 ` [PATCH v3 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09 18:49 ` sashiko-bot
2026-06-09 18:21 ` [PATCH v3 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
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=20260609182108.975586-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=mark@klomp.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=serhei@serhei.io \
--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