public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <song@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] perf bpf: Move BPF disassembly routines to separate file to avoid clash with capstone bpf headers
Date: Wed, 31 Jul 2024 15:51:10 -0300	[thread overview]
Message-ID: <ZqqHnlgG0YS4DRAt@x1> (raw)
In-Reply-To: <CAM9d7cgTrDEdAn=dv9ciRZfpMdYwdmDrAAvsYEYE=GssPS_aWw@mail.gmail.com>

On Wed, Jul 31, 2024 at 10:07:50AM -0700, Namhyung Kim wrote:
> On Wed, Jul 31, 2024 at 8:12 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > There is a clash of the libbpf and capstone libraries, that ends up
> > with:
> >
> >   In file included from /usr/include/capstone/capstone.h:325,
> >                    from util/disasm.c:1513:
> >   /usr/include/capstone/bpf.h:94:14: error: ‘bpf_insn’ defined as wrong kind of tag
> >      94 | typedef enum bpf_insn {
> >
> > So far we're just trying to avoid this by not having both headers
> > included in the same .c or .h file, do it one more time by moving the
> > BPF diassembly routines from util/disasm.c to util/disasm_bpf.c.
> >
> > This is only being hit when building with BUILD_NONDISTRO=1, i.e.
> > building with binutils-devel, that isn't the in the default build due to
> > a licencing clash. We need to reimplement what is now isolated in
> > util/disasm_bpf.c using some other library to have BPF annotation
> > feature that now only is available with BUILD_NONDISTRO=1.
> >
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Kan Liang <kan.liang@linux.intel.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Song Liu <song@kernel.org>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >  tools/perf/util/Build        |   1 +
> >  tools/perf/util/disasm.c     | 187 +--------------------------------
> >  tools/perf/util/disasm_bpf.c | 193 +++++++++++++++++++++++++++++++++++
> >  tools/perf/util/disasm_bpf.h |  12 +++
> >  4 files changed, 207 insertions(+), 186 deletions(-)
> >  create mode 100644 tools/perf/util/disasm_bpf.c
> >  create mode 100644 tools/perf/util/disasm_bpf.h
> >
> > +++ b/tools/perf/util/Build
> > @@ -13,6 +13,7 @@ perf-util-y += copyfile.o
> >  perf-util-y += ctype.o
> >  perf-util-y += db-export.o
> >  perf-util-y += disasm.o
> > +perf-util-y += disasm_bpf.o
> 
> I think this can be gated by LIBBFD and LIBBPF config, but not sure
> it can express the both requirements easily.

It is possible, but as discussed with Ian in another message, the
cheapest way to do it was, I think, like I did, in the end it is just a
stub returning an error when those libraries are not linked with perf.

When we manage to implement the disassembly of BPF using something other
than libbfd we can spend more time in this area, I think.

- Arnaldo

  parent reply	other threads:[~2024-07-31 18:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 15:12 [PATCH 1/1] perf bpf: Move BPF disassembly routines to separate file to avoid clash with capstone bpf headers Arnaldo Carvalho de Melo
2024-07-31 15:45 ` Arnaldo Carvalho de Melo
2024-07-31 17:07 ` Namhyung Kim
2024-07-31 17:35   ` Ian Rogers
2024-07-31 18:49     ` Arnaldo Carvalho de Melo
2024-07-31 18:51   ` Arnaldo Carvalho de Melo [this message]
2024-08-01 15:18     ` Ian Rogers
2024-08-01 17:38       ` Arnaldo Carvalho de Melo

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=ZqqHnlgG0YS4DRAt@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=song@kernel.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