linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Leach <mike.leach@linaro.org>
To: Ian Rogers <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, acme@kernel.org, peterz@infradead.org,
	mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org
Subject: Re: [PATCH v3 1/2] perf build: Properly guard libbpf includes
Date: Fri, 6 Jan 2023 15:28:03 +0000	[thread overview]
Message-ID: <CAJ9a7ViGE3UJX02oA42A9TSTKsOozPzdHjyL+OSP4J-9dZFqrg@mail.gmail.com> (raw)
In-Reply-To: <20230106151320.619514-1-irogers@google.com>

On Fri, 6 Jan 2023 at 15:13, Ian Rogers <irogers@google.com> wrote:
>
> Including libbpf header files should be guarded by
> HAVE_LIBBPF_SUPPORT. In bpf_counter.h, move the skeleton utilities
> under HAVE_BPF_SKEL.
>
> Fixes: d6a735ef3277 ("perf bpf_counter: Move common functions to bpf_counter.h")
> Reported-by: Mike Leach <mike.leach@linaro.org>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/builtin-trace.c    | 2 ++
>  tools/perf/util/bpf_counter.h | 6 ++++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 86e06f136f40..d21fe0f32a6d 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -16,7 +16,9 @@
>
>  #include "util/record.h"
>  #include <api/fs/tracing_path.h>
> +#ifdef HAVE_LIBBPF_SUPPORT
>  #include <bpf/bpf.h>
> +#endif
>  #include "util/bpf_map.h"
>  #include "util/rlimit.h"
>  #include "builtin.h"
> diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h
> index 4dbf26408b69..c6d21c07b14c 100644
> --- a/tools/perf/util/bpf_counter.h
> +++ b/tools/perf/util/bpf_counter.h
> @@ -4,9 +4,12 @@
>
>  #include <linux/list.h>
>  #include <sys/resource.h>
> +
> +#ifdef HAVE_LIBBPF_SUPPORT
>  #include <bpf/bpf.h>
>  #include <bpf/btf.h>
>  #include <bpf/libbpf.h>
> +#endif
>
>  struct evsel;
>  struct target;
> @@ -87,6 +90,8 @@ static inline void set_max_rlimit(void)
>         setrlimit(RLIMIT_MEMLOCK, &rinf);
>  }
>
> +#ifdef HAVE_BPF_SKEL
> +
>  static inline __u32 bpf_link_get_id(int fd)
>  {
>         struct bpf_link_info link_info = { .id = 0, };
> @@ -127,5 +132,6 @@ static inline int bperf_trigger_reading(int prog_fd, int cpu)
>
>         return bpf_prog_test_run_opts(prog_fd, &opts);
>  }
> +#endif /* HAVE_BPF_SKEL */
>
>  #endif /* __PERF_BPF_COUNTER_H */
> --
> 2.39.0.314.g84b9a713c41-goog
>


This version builds fine too.

Mike
-- 
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

  parent reply	other threads:[~2023-01-06 15:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 15:13 [PATCH v3 1/2] perf build: Properly guard libbpf includes Ian Rogers
2023-01-06 15:13 ` [PATCH v3 2/2] perf build: Fix build error when NO_LIBBPF=1 Ian Rogers
2023-01-06 15:28 ` Mike Leach [this message]
2023-01-06 17:25   ` [PATCH v3 1/2] perf build: Properly guard libbpf includes Arnaldo Carvalho de Melo
2023-01-06 17:53     ` Arnaldo Carvalho de Melo
2023-01-06 17:55       ` Arnaldo Carvalho de Melo
2023-01-06 19:06         ` Ian Rogers
2023-01-09 15:12           ` Arnaldo Carvalho de Melo
2023-01-09 18:10             ` Jiri Olsa
2023-01-09 18:37               ` Ian Rogers
2023-01-09 19:29                 ` Ian Rogers
2023-01-09 19:34                   ` Ian Rogers
2023-01-09 20:40                     ` Ian Rogers
2023-01-10 11:19                     ` Jiri Olsa
2023-01-10 13:35                       ` Arnaldo Carvalho de Melo
2023-01-10 13:39                         ` Jiri Olsa
2023-01-10 14:31                   ` Arnaldo Carvalho de Melo
2023-01-10 14:46                     ` Arnaldo Carvalho de Melo
2023-01-10 15:04                       ` [PATCH 1/1] perf bpf: Avoid build breakage with libbpf < 0.8.0 + LIBBPF_DYNAMIC=1 Arnaldo Carvalho de Melo
2023-01-10 20:00                       ` [PATCH v3 1/2] perf build: Properly guard libbpf includes Ian Rogers
2023-01-06 17:57       ` 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=CAJ9a7ViGE3UJX02oA42A9TSTKsOozPzdHjyL+OSP4J-9dZFqrg@mail.gmail.com \
    --to=mike.leach@linaro.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).