Skip to contentSkip to conversation

perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1

PATCH In review Arnaldo Carvalho de Melo 2 participants 4 messages Nov 17, 2021 – Nov 18, 2021 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1

As it is being used in tools/perf/arch/arm64/util/arm-spe.c and the COMPAT_NEED_REALLOCARRAY was only being set when CORESIGHT=1 is set.

Fixes 56c31cdff7c2a640 ("perf arm-spe: Implement find_snapshot callback")
Cc Alexander Shishkin <[email protected]>
Cc German Gomez <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Garry <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Will Deacon <[email protected]>
---
 tools/perf/Makefile.config | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/Makefile.config +3 -0
index 07e65a061fd3a13b..afd144725a0bf766 100644
@@ -1010,6 +1010,9 @@ ifndef NO_AUXTRACE
   ifndef NO_AUXTRACE
     $(call detected,CONFIG_AUXTRACE)
     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
+    ifeq ($(feature-reallocarray), 0)
+      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
+    endif
   endif
 endif
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 2 lines · Arnaldo Carvalho de Melo

As it is being used in tools/perf/arch/arm64/util/arm-spe.c and the COMPAT_NEED_REALLOCARRAY was only being set when CORESIGHT=1 is set.

Thanks for the patch, Arnaldo.

This patch looks good to me. But I cannot reproduce the build failure, if without CORESIGHT=1 I still don't see the build failure.

I think we should apply below code as well, if COMPAT_NEED_REALLOCARRAY is enabled for AUXTRACE, it will be applied for cs-etm as well. For this reason, we can remove the redundant definition for CORESIGHT.

tools/perf/Makefile.config +0 -3
index 07e65a061fd3..2dbf086d1155 100644
@@ -477,9 +477,6 @@ ifdef CORESIGHT
   $(call feature_check,libopencsd)
   ifeq ($(feature-libopencsd), 1)
     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
-    ifeq ($(feature-reallocarray), 0)
-      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
-    endif
     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
     EXTLIBS += $(OPENCSDLIBS)
     $(call detected,CONFIG_LIBOPENCSD)

Thanks,
Leo

Quoted 33 lines
Fixes 56c31cdff7c2a640 ("perf arm-spe: Implement find_snapshot callback")
Cc Alexander Shishkin <[email protected]>
Cc German Gomez <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Garry <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Will Deacon <[email protected]>
---
 tools/perf/Makefile.config | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/Makefile.config +3 -0
index 07e65a061fd3a13b..afd144725a0bf766 100644
@@ -1010,6 +1010,9 @@ ifndef NO_AUXTRACE
   ifndef NO_AUXTRACE
     $(call detected,CONFIG_AUXTRACE)
     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
+    ifeq ($(feature-reallocarray), 0)
+      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
+    endif
   endif
 endif
 
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

Em Wed, Nov 17, 2021 at 10:41:10PM +0800, Leo Yan escreveu:

Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 2 lines

As it is being used in tools/perf/arch/arm64/util/arm-spe.c and the COMPAT_NEED_REALLOCARRAY was only being set when CORESIGHT=1 is set.

Thanks for the patch, Arnaldo.

This patch looks good to me. But I cannot reproduce the build failure, if without CORESIGHT=1 I still don't see the build failure.

Strange, here it broke when building on ubuntu:16.04-x-arm64 and ubuntu:18.04-x-arm64 I.e. cross building from x86-64 to arm64.

Quoted 3 lines

I think we should apply below code as well, if COMPAT_NEED_REALLOCARRAY is enabled for AUXTRACE, it will be applied for cs-etm as well. For this reason, we can remove the redundant definition for CORESIGHT.

Isn't it possible to ask for:

make NO_AUXTRACE=1 CORESIGHT=1

?

Quoted 51 lines
tools/perf/Makefile.config +0 -3
index 07e65a061fd3..2dbf086d1155 100644
@@ -477,9 +477,6 @@ ifdef CORESIGHT
   $(call feature_check,libopencsd)
   ifeq ($(feature-libopencsd), 1)
     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
-    ifeq ($(feature-reallocarray), 0)
-      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
-    endif
     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
     EXTLIBS += $(OPENCSDLIBS)
     $(call detected,CONFIG_LIBOPENCSD)

Thanks,
Leo

Quoted 33 lines
Fixes 56c31cdff7c2a640 ("perf arm-spe: Implement find_snapshot callback")
Cc Alexander Shishkin <[email protected]>
Cc German Gomez <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Garry <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Will Deacon <[email protected]>
---
 tools/perf/Makefile.config | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/Makefile.config +3 -0
index 07e65a061fd3a13b..afd144725a0bf766 100644
@@ -1010,6 +1010,9 @@ ifndef NO_AUXTRACE
   ifndef NO_AUXTRACE
     $(call detected,CONFIG_AUXTRACE)
     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
+    ifeq ($(feature-reallocarray), 0)
+      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
+    endif
   endif
 endif
 
Signature · 1 line
2.31.1
Signature · 1 line
- Arnaldo
#3 lore raw

On Wed, Nov 17, 2021 at 12:35:46PM -0300, Arnaldo Carvalho de Melo wrote:

[...]

Quoted 9 lines
Quoted 3 lines

I think we should apply below code as well, if COMPAT_NEED_REALLOCARRAY is enabled for AUXTRACE, it will be applied for cs-etm as well. For this reason, we can remove the redundant definition for CORESIGHT.

Isn't it possible to ask for:

make NO_AUXTRACE=1 CORESIGHT=1

?

If AUXTRACE is disabled, then it has no chance to build cs-etm code; this is decided by util/Build:

ifdef CONFIG_LIBOPENCSD
perf-$(CONFIG_AUXTRACE) += cs-etm.o
perf-$(CONFIG_AUXTRACE) += cs-etm-decoder/
endif

So we could safely remove the redundant definition for COMPAT_NEED_REALLOCARRAY in CORESIGHT chunk.

Thanks,
Leo

Quoted 14 lines
Quoted 14 lines
tools/perf/Makefile.config +0 -3
index 07e65a061fd3..2dbf086d1155 100644
@@ -477,9 +477,6 @@ ifdef CORESIGHT
   $(call feature_check,libopencsd)
   ifeq ($(feature-libopencsd), 1)
     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
-    ifeq ($(feature-reallocarray), 0)
-      CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
-    endif
     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
     EXTLIBS += $(OPENCSDLIBS)
     $(call detected,CONFIG_LIBOPENCSD)