Skip to contentSkip to conversation

tools/perf: Add includes for detected configs in Makefile.perf

PATCH Superseded Athira Rajeev 2 participants 3 messages Sep 7, 2023 – Sep 8, 2023 perf events

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/perf: Add includes for detected configs in Makefile.perf

Makefile.perf uses "CONFIG_*" checks in the code. Example the config for libtraceevent is used to set PYTHON_EXT_SRCS

	ifeq ($(CONFIG_LIBTRACEEVENT),y)
	  PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
	else
	  PYTHON_EXT_SRCS := $(shell grep -v '^\#\|util/trace-event.c' util/python-ext-sources)
	endif

But this is not picking the value for CONFIG_LIBTRACEEVENT that is set using the settings in Makefile.config. Include the file ".config-detected" so that make will use the system detected configuration in the CONFIG checks. This will fix isues that could arise when other "CONFIG_*" checks are added to Makefile.perf in future as well.

---
 tools/perf/Makefile.perf | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/Makefile.perf +3 -0
index 37af6df7b978..6764b0e156f4 100644
@@ -351,6 +351,9 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
 
+# Use the detected configuration
+include .config-detected
+
 ifeq ($(CONFIG_LIBTRACEEVENT),y)
   PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 else
Signature · 1 line
2.31.1
reviewer
#1 lore raw
Quoted 27 lines · Athira Rajeev

Makefile.perf uses "CONFIG_*" checks in the code. Example the config for libtraceevent is used to set PYTHON_EXT_SRCS

        ifeq ($(CONFIG_LIBTRACEEVENT),y)
          PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
        else
          PYTHON_EXT_SRCS := $(shell grep -v '^\#\|util/trace-event.c' util/python-ext-sources)
        endif

But this is not picking the value for CONFIG_LIBTRACEEVENT that is set using the settings in Makefile.config. Include the file ".config-detected" so that make will use the system detected configuration in the CONFIG checks. This will fix isues that could arise when other "CONFIG_*" checks are added to Makefile.perf in future as well.

---
 tools/perf/Makefile.perf | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/Makefile.perf +0 -0
index 37af6df7b978..6764b0e156f4 100644

tools/perf/Makefile.perf export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP · line 355

Quoted 5 lines
tools/perf/Makefile.perf +2 -0
@@ -351,6 +351,9 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
 
+# Use the detected configuration
+include .config-detected

Good catch! I think it should look like:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/build/Makefile.build?h=perf-tools-next#n40

Thanks,
Ian

Quoted 7 lines
tools/perf/Makefile.perf +1 -1
+
 ifeq ($(CONFIG_LIBTRACEEVENT),y)
   PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 else
--

2.31.1

#2 lore raw
Quoted 36 lines · Ian Rogers
Quoted 30 lines · Athira Rajeev

Makefile.perf uses "CONFIG_*" checks in the code. Example the config for libtraceevent is used to set PYTHON_EXT_SRCS

       ifeq ($(CONFIG_LIBTRACEEVENT),y)
         PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
       else
         PYTHON_EXT_SRCS := $(shell grep -v '^\#\|util/trace-event.c' util/python-ext-sources)
       endif

But this is not picking the value for CONFIG_LIBTRACEEVENT that is set using the settings in Makefile.config. Include the file ".config-detected" so that make will use the system detected configuration in the CONFIG checks. This will fix isues that could arise when other "CONFIG_*" checks are added to Makefile.perf in future as well.

---
tools/perf/Makefile.perf | 3 +++

1 file changed, 3 insertions(+)
tools/perf/Makefile.perf +0 -0
index 37af6df7b978..6764b0e156f4 100644
@@ -351,6 +351,9 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 

python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so

Quoted 8 lines

tools/perf/Makefile.perf export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP · line 355

Quoted 2 lines
tools/perf/Makefile.perf +2 -0
+# Use the detected configuration
+include .config-detected

Good catch! I think it should look like:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/build/Makefile.build?h=perf-tools-next#n40

Thanks,
Ian

Thanks for the review Ian.

Yes, missed the $(OUTPUT) . Will send a V2 with this change

Athira

Quoted 7 lines
Quoted 7 lines

+
ifeq ($(CONFIG_LIBTRACEEVENT),y)
PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
else
--
2.31.1