Re: [PATCH 2/3] perf build: Use libtraceevent from the system

Arnaldo Carvalho de Melo
2022-12-12T14:45:24Z

Em Thu, Dec 08, 2022 at 03:05:29PM -0800, Ian Rogers escreveu:
> On Thu, Dec 8, 2022 at 3:00 PM Ian Rogers <irogers@google.com> wrote:
> > On Thu, Dec 8, 2022 at 2:32 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > commit a0ec3ef4590e7e82339b6f318e671a6b69fd94e8
> > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Date: Thu Dec 8 19:28:58 2022 -0300

> > > perf tools: Add test to check if libtracevent has TEP_FIELD_IS_RELATIVE

> > Could HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE be a version rather
> > than feature check, something like:

> > #define MAKE_LIBTRACEEVENT_VERSION(maj, mid, min) (maj * 255 *255 +
> > mid * 255 + min)
> > #define HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
> > (LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)

> > Note, we have LIBTRACEEVENT_VERSION computed in Makefile.config by way
> > of pkg-config.

> LIBTRACEEVENT_VERSION had a workaround if pkg-config wasn't present to
> default to 1.1.0 for its use in:
> https://lore.kernel.org/linux-perf-users/20210923001024.550263-4-irogers@google.com/
> We should un-revert that change now the -Itools/lib issue is resolved
> (1.1 traceevent headers compiled against newer system libtraceevent
> library).

Can you please send that un-revert as a proper patch?

Meanwhile, I came up with this quick hack on top of what I had, seems to
be enough, will test it with systems with libtraceevent <= 1.5.0, where
TEP_FIELD_IS_RELATIVE was introduced.

Will do it after removing the tools/build/feature/ TEP_FIELD_IS_RELATIVE
big hammer check.

- Arnaldo

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index e29975664f06bd61..52a4dc029111c1e2 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1197,8 +1197,8 @@ ifneq ($(NO_LIBTRACEEVENT),1)
LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3))
CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP)
$(call detected,CONFIG_LIBTRACEEVENT)
- $(call feature_check,libtraceevent-tep_field_is_relative)
- ifeq ($(feature-libtraceevent-tep_field_is_relative), 1)
+ LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE := $(shell expr 1 \* 255 \* 255 + 5 \* 255 + 0) # 1.5.0
+ ifeq ($(shell test $(LIBTRACEEVENT_VERSION_CPP) -gt $(LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE); echo $$?),0)
CFLAGS += -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE
endif
else