public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Charlie Jenkins <charlie@rivosinc.com>,
	"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	James Clark <james.clark@linaro.org>,
	Collin Funk <collin.funk1@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH v8 0/3] Capstone/llvm dlopen support
Date: Tue, 27 Jan 2026 01:41:20 -0300	[thread overview]
Message-ID: <aXhB8B7jdTAoZ_Qe@x1> (raw)
In-Reply-To: <CAP-5=fW7YViusbdr9uZ_wSg5cwAPcdnysGbfuytKyYw6cbQa4g@mail.gmail.com>

On Thu, Jan 08, 2026 at 01:32:47PM -0800, Ian Rogers wrote:
> On Tue, Oct 7, 2025 at 9:38 AM Ian Rogers <irogers@google.com> wrote:
> >
> > Linking against libcapstone and libLLVM can be a significant increase
> > in dependencies and file size if building statically. The dependencies
> > are also quite cumbersome if bringing perf into a distribution. For
> > something like `perf record` the disassembler and addr2line
> > functionality of libcapstone and libLLVM won't be used. These patches
> > support dynamically loading these libraries using dlopen and then
> > calling the appropriate functions found using dlsym. Using dlopen
> > allows libcapstone and libLLVM to be installed separately to perf and
> > when that's done the performance will improve as separate commands for
> > objdump and addr2line won't be invoked.
> >
> > The patch series adds perf_ variants of the capstone/llvm functions
> > that will either directly call the function or (NO_CAPSTONE=1 and
> > NO_LIBLLVM=1 cases) use dlopen/dlsym to discover and then call the
> > function. To support the function signatures when
> > HAVE_LIBCAPSTONE_SUPPORT and HAVE_LIBLLVM_SUPPORT aren't defined
> > prototypes generated using pahole are given. This avoids requiring
> > libcapstone or libLLVM for the sake of the header files. It also
> > avoids having a build where neither dlopen or dynamic linking against
> > libcapstone or libLLVM is supported. There are other possibilities in
> > how to organize this, but the chosen approach was done so for the
> > simplicity and cleanliness of the code.
> >
> > The addr2line LLVM functionality is written in C++. To avoid linking
> > against libLLVM for this, a new LIBLLVM_DYNAMIC option is added where
> > the C++ code with the libLLVM dependency will be built into a
> > libperf-llvm.so and that dlsym-ed and called against. Ideally LLVM
> > would extend their C API to avoid this.
> >
> > v8: Rebase down to 3 patches. Update commit and cover messages.
> > v7: Refactor now the first 5 patches, that largely moved code around,
> >     have landed. Move the dlopen code to the end of the series so that
> >     the first 8 patches can be picked improving capstone/LLVM support
> >     without adding the dlopen code. Rename the cover letter and
> >     disassembler cleanup patches.
> > v6: Refactor the libbfd along with capstone and LLVM, previous patch
> >     series had tried to avoid this by just removing the deprecated
> >     BUILD_NONDISTRO code. Remove the libtracefs removal into its own
> >     patch.
> > v5: Rebase and comment typo fix.
> > v4: Rebase and addition of a patch removing an unused struct variable.
> > v3: Add srcline addr2line fallback trying LLVM first then forking a
> >     process. This came up in conversation with Steinar Gunderson
> >     <sesse@google.com>.
> >     Tweak the cover letter message to try to address Andi Kleen's
> >     <ak@linux.intel.com> feedback that the series doesn't really
> >     achieve anything.
> > v2: Add mangling of the function names in libperf-llvm.so to avoid
> >     potential infinite recursion. Add BPF JIT disassembly support to
> >     LLVM and capstone. Add/rebase the BUILD_NONDISTRO cleanup onto the
> >     series from:
> >     https://lore.kernel.org/lkml/20250111202851.1075338-1-irogers@google.com/
> >     Some other minor additional clean up.
> >
> > Ian Rogers (3):
> >   perf capstone: Support for dlopen-ing libcapstone.so
> >   perf llvm: Support for dlopen-ing libLLVM.so
> >   perf llvm: Mangle libperf-llvm.so function names
> 
> Ping.

The first two patches apply with a bit of fuzz, the last one fails
harder, can you take a stab at refreshing it so that I can try to test
it?

Thanks,

- Arnaldo

      reply	other threads:[~2026-01-27  4:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07 16:38 [PATCH v8 0/3] Capstone/llvm dlopen support Ian Rogers
2025-10-07 16:38 ` [PATCH v8 1/3] perf capstone: Support for dlopen-ing libcapstone.so Ian Rogers
2025-10-07 16:38 ` [PATCH v8 2/3] perf llvm: Support for dlopen-ing libLLVM.so Ian Rogers
2025-10-07 16:38 ` [PATCH v8 3/3] perf llvm: Mangle libperf-llvm.so function names Ian Rogers
2026-01-08 21:32 ` [PATCH v8 0/3] Capstone/llvm dlopen support Ian Rogers
2026-01-27  4:41   ` Arnaldo Carvalho de Melo [this message]

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=aXhB8B7jdTAoZ_Qe@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=charlie@rivosinc.com \
    --cc=collin.funk1@gmail.com \
    --cc=dvyukov@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=peterz@infradead.org \
    /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