Linux Perf Users
 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>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Blake Jones <blakejones@google.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v1 1/2] perf bpf-event: Use libbpf version rather than feature check
Date: Fri, 3 Oct 2025 16:21:54 -0300	[thread overview]
Message-ID: <aOAiUgWjbdwBZTzO@x1> (raw)
In-Reply-To: <20251003012349.2396685-1-irogers@google.com>

On Thu, Oct 02, 2025 at 06:23:48PM -0700, Ian Rogers wrote:
> The feature check guarded the -DHAVE_LIBBPF_STRINGS_SUPPORT is
> unnecessary as it is sufficient and easier to use the
> LIBBPF_CURRENT_VERSION_GEQ macro.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/Makefile.config  | 7 -------
>  tools/perf/builtin-check.c  | 1 +
>  tools/perf/util/bpf-event.c | 2 --
>  tools/perf/util/bpf-utils.h | 5 +++++
>  4 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 6cdb96576cb8..b0e15721c5a5 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -596,13 +596,6 @@ ifndef NO_LIBELF
>  	  LIBBPF_INCLUDE = $(LIBBPF_DIR)/..
>          endif
>        endif
> -
> -      FEATURE_CHECK_CFLAGS-libbpf-strings="-I$(LIBBPF_INCLUDE)"
> -      $(call feature_check,libbpf-strings)
> -      ifeq ($(feature-libbpf-strings), 1)
> -        $(call detected,CONFIG_LIBBPF_STRINGS)
> -        CFLAGS += -DHAVE_LIBBPF_STRINGS_SUPPORT
> -      endif
>      endif
>    endif # NO_LIBBPF
>  endif # NO_LIBELF
> diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
> index 7fd054760e47..8c0668911fb1 100644
> --- a/tools/perf/builtin-check.c
> +++ b/tools/perf/builtin-check.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include "builtin.h"
>  #include "color.h"
> +#include "util/bpf-utils.h"
>  #include "util/debug.h"
>  #include "util/header.h"
>  #include <tools/config.h>
> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> index 59f84aef91b4..2298cd396c42 100644
> --- a/tools/perf/util/bpf-event.c
> +++ b/tools/perf/util/bpf-event.c
> @@ -288,9 +288,7 @@ static void format_btf_variable(struct btf *btf, char *buf, size_t buf_size,
>  		.sz = sizeof(struct btf_dump_type_data_opts),
>  		.skip_names = 1,
>  		.compact = 1,
> -#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
>  		.emit_strings = 1,
> -#endif

I see, this is already under HAVE_LIBBPF_STRINGS_SUPPORT

Applying,

- Arnaldo

>  	};
>  	struct btf_dump *d;
>  	size_t btf_size;
> diff --git a/tools/perf/util/bpf-utils.h b/tools/perf/util/bpf-utils.h
> index eafc43b8731f..a8bc1a232968 100644
> --- a/tools/perf/util/bpf-utils.h
> +++ b/tools/perf/util/bpf-utils.h
> @@ -14,6 +14,11 @@
>         (LIBBPF_MAJOR_VERSION > (major) ||                              \
>          (LIBBPF_MAJOR_VERSION == (major) && LIBBPF_MINOR_VERSION >= (minor)))
>  
> +#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
> +// libbpf 1.7+ support the btf_dump_type_data_opts.emit_strings option.
> +#define HAVE_LIBBPF_STRINGS_SUPPORT 1
> +#endif
> +
>  /*
>   * Get bpf_prog_info in continuous memory
>   *
> -- 
> 2.51.0.618.g983fd99d29-goog

      parent reply	other threads:[~2025-10-03 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03  1:23 [PATCH v1 1/2] perf bpf-event: Use libbpf version rather than feature check Ian Rogers
2025-10-03  1:23 ` [PATCH v1 2/2] tools build: Remove libbpf-strings feature test Ian Rogers
2025-10-03 19:21 ` 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=aOAiUgWjbdwBZTzO@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=blakejones@google.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