* [PATCH v2 0/9] perf build: Make build-test faster
@ 2016-01-14 13:13 Wang Nan
2016-01-14 13:13 ` [PATCH v2 1/9] perf build: Set parallel making options build-test Wang Nan
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa; +Cc: linux-kernel, pi3orama, lizefan, Wang Nan
Utilize Jiri's feature-dump make target to avoid make build-test check
features too many times.
v1 -> v2: Add more comment in makefile, fix 'test' commands for
kernel build test cases (add lost 'perf'), rename make
vars, remove feature dumps after all tests finished.
Jiri Olsa (2):
perf build: Add feature-dump target
perf build: Introduce FEATURES_DUMP make variable
Wang Nan (7):
perf build: Set parallel making options build-test
perf build: Pass O option to Makefile.perf in build-test
perf build: Test correct path of perf in build-test
perf build: Pass O option to kernel makefile in build-test
tools build: Allow subprojects select all feature checkers
perf build: Select all feature checkers for feature-dump
perf build: Use feature dump file for build-test
tools/build/Makefile.feature | 21 ++++++++++-
tools/perf/Makefile.perf | 34 +++++++++++++++++-
tools/perf/config/Makefile | 4 +++
tools/perf/tests/make | 86 ++++++++++++++++++++++++++++++++++++--------
4 files changed, 128 insertions(+), 17 deletions(-)
--
1.8.3.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 1/9] perf build: Set parallel making options build-test
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
@ 2016-01-14 13:13 ` Wang Nan
2016-01-14 13:13 ` [PATCH v2 2/9] perf build: Pass O option to Makefile.perf in build-test Wang Nan
` (7 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan,
Arnaldo Carvalho de Melo, Namhyung Kim
'make build-test' is painful because of time consuming. In a full test,
all test cases are built twice with tools/perf/Makefile and
tools/perf/Makefile.perf. 'Makefile' automatically computes parallel
options for make, but 'Makefile.perf' not, so all test cases is built
with one job. It is very slow.
This patch adds '-j' options to Makefile.perf testing. It computes
parallel building options like what tools/perf/Makefile does, and pass
'-j' option to Makefile.perf test.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/make | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index df38dec..c0ee679 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
# no target specified, trigger the whole suite
all:
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
- @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf
+ @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
else
# run only specific test over 'Makefile'
%:
@@ -14,6 +14,15 @@ endif
else
PERF := .
+PARALLEL_OPT=
+ifeq ($(SET_PARALLEL),1)
+ cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
+ ifeq ($(cores),0)
+ cores := 1
+ endif
+ PARALLEL_OPT="-j$(cores)"
+endif
+
# As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL
LC_COLLATE=C
@@ -252,7 +261,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
$(run):
$(call clean)
@TMP_DEST=$$(mktemp -d); \
- cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \
+ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -263,7 +272,7 @@ $(run_O):
$(call clean)
@TMP_O=$$(mktemp -d); \
TMP_DEST=$$(mktemp -d); \
- cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
+ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1 && \
echo " test: $(call test_O,$@)" >> $@ 2>&1; \
@@ -277,15 +286,15 @@ tarpkg:
rm -f $@
make_kernelsrc:
- @echo "- make -C <kernelsrc> tools/perf"
+ @echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
$(call clean); \
- (make -C ../.. tools/perf) > $@ 2>&1 && \
+ (make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
test -x perf && rm -f $@ || (cat $@ ; false)
make_kernelsrc_tools:
- @echo "- make -C <kernelsrc>/tools perf"
+ @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
$(call clean); \
- (make -C ../../tools perf) > $@ 2>&1 && \
+ (make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
test -x perf && rm -f $@ || (cat $@ ; false)
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 2/9] perf build: Pass O option to Makefile.perf in build-test
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
2016-01-14 13:13 ` [PATCH v2 1/9] perf build: Set parallel making options build-test Wang Nan
@ 2016-01-14 13:13 ` Wang Nan
2016-01-14 13:13 ` [PATCH v2 3/9] perf build: Test correct path of perf " Wang Nan
` (6 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan,
Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim
Doesn't like tools/perf/Makefile, tools/perf/Makefile.perf obey 'O'
option when it is passed through cmdline only, because of code in
tools/scripts/Makefile.include:
ifneq ($(O),)
ifeq ($(origin O), command line)
...
ABSOLUTE_O := $(shell cd $(O) ; pwd)
OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
endif
endif
This patch passes 'O' to Makefile.perf through cmdline explicitly
to make it follow O variable during build-test.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/make | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index c0ee679..14d7b8d 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
# no target specified, trigger the whole suite
all:
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
- @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
+ @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
else
# run only specific test over 'Makefile'
%:
@@ -13,6 +13,14 @@ else
endif
else
PERF := .
+O_OPT :=
+
+ifneq ($(O),)
+ FULL_O := $(shell readlink -f $(O) || echo $(O))
+ ifeq ($(SET_O),1)
+ O_OPT := 'O=$(FULL_O)'
+ endif
+endif
PARALLEL_OPT=
ifeq ($(SET_PARALLEL),1)
@@ -261,7 +269,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
$(run):
$(call clean)
@TMP_DEST=$$(mktemp -d); \
- cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \
+ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
2016-01-14 13:13 ` [PATCH v2 1/9] perf build: Set parallel making options build-test Wang Nan
2016-01-14 13:13 ` [PATCH v2 2/9] perf build: Pass O option to Makefile.perf in build-test Wang Nan
@ 2016-01-14 13:13 ` Wang Nan
2016-01-14 14:50 ` Arnaldo Carvalho de Melo
2016-01-14 13:13 ` [PATCH v2 4/9] perf build: Pass O option to kernel makefile " Wang Nan
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan,
Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim
If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
will fail because perf resides in a different directory. Fix this by
computing PERF_OUT according to 'O' and test correct output files.
For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/make | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 14d7b8d..e74c86b 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -13,10 +13,12 @@ else
endif
else
PERF := .
+PERF_O := $(PERF)
O_OPT :=
ifneq ($(O),)
FULL_O := $(shell readlink -f $(O) || echo $(O))
+ PERF_O := $(FULL_O)
ifeq ($(SET_O),1)
O_OPT := 'O=$(FULL_O)'
endif
@@ -173,11 +175,11 @@ test_make_doc := $(test_ok)
test_make_help_O := $(test_ok)
test_make_doc_O := $(test_ok)
-test_make_python_perf_so := test -f $(PERF)/python/perf.so
+test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
-test_make_perf_o := test -f $(PERF)/perf.o
-test_make_util_map_o := test -f $(PERF)/util/map.o
-test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o
+test_make_perf_o := test -f $(PERF_O)/perf.o
+test_make_util_map_o := test -f $(PERF_O)/util/map.o
+test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
define test_dest_files
for file in $(1); do \
@@ -244,7 +246,7 @@ test_make_perf_o_O := test -f $$TMP_O/perf.o
test_make_util_map_o_O := test -f $$TMP_O/util/map.o
test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
-test_default = test -x $(PERF)/perf
+test_default = test -x $(PERF_O)/perf
test = $(if $(test_$1),$(test_$1),$(test_default))
test_default_O = test -x $$TMP_O/perf
@@ -264,7 +266,7 @@ endif
MAKEFLAGS := --no-print-directory
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
$(run):
$(call clean)
@@ -293,17 +295,22 @@ tarpkg:
( eval $$cmd ) >> $@ 2>&1 && \
rm -f $@
+KERNEL_O := ../..
+ifneq ($(O),)
+ KERNEL_O := $(O)
+endif
+
make_kernelsrc:
@echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
$(call clean); \
(make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
- test -x perf && rm -f $@ || (cat $@ ; false)
+ test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
make_kernelsrc_tools:
@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
$(call clean); \
(make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
- test -x perf && rm -f $@ || (cat $@ ; false)
+ test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
@echo OK
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 4/9] perf build: Pass O option to kernel makefile in build-test
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (2 preceding siblings ...)
2016-01-14 13:13 ` [PATCH v2 3/9] perf build: Test correct path of perf " Wang Nan
@ 2016-01-14 13:13 ` Wang Nan
2016-01-14 13:13 ` [PATCH v2 5/9] perf build: Add feature-dump target Wang Nan
` (4 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan,
Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim
Kernel makefile only follow 'O' option passed from command line
explicitely. In build-test with 'O' option set, kernel makefile
contaminate kernel source directory. Build test also fail if we
don't create output directory manually.
K_O_OPT is added and passed to kernel makefile if 'O' is passed
to build-test.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/make | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index e74c86b..f8d3162 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -22,6 +22,7 @@ ifneq ($(O),)
ifeq ($(SET_O),1)
O_OPT := 'O=$(FULL_O)'
endif
+ K_O_OPT := 'O=$(FULL_O)'
endif
PARALLEL_OPT=
@@ -301,15 +302,15 @@ ifneq ($(O),)
endif
make_kernelsrc:
- @echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
+ @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
$(call clean); \
- (make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
+ (make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
make_kernelsrc_tools:
- @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
+ @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
$(call clean); \
- (make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
+ (make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 5/9] perf build: Add feature-dump target
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (3 preceding siblings ...)
2016-01-14 13:13 ` [PATCH v2 4/9] perf build: Pass O option to kernel makefile " Wang Nan
@ 2016-01-14 13:13 ` Wang Nan
2016-01-14 13:14 ` [PATCH v2 6/9] perf build: Introduce FEATURES_DUMP make variable Wang Nan
` (3 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:13 UTC (permalink / raw)
To: acme, jolsa; +Cc: linux-kernel, pi3orama, lizefan, Jiri Olsa, Wang Nan
From: Jiri Olsa <jolsa@kernel.org>
To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
if defined, with no further action.
Get feature dump of the current build:
$ make feature-dump
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
FEATURE-DUMP file available in FEATURE-DUMP
Get feature dump static build into /tmp/fd file:
$ make feature-dump FEATURE_DUMP_COPY=/tmp/fd LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
SNIP
FEATURE-DUMP file copied into /tmp/fd
Suggested-by: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xzqhfxw3euqmls3cve0ruuol@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
tools/perf/Makefile.perf | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0a22407..f758a72 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -611,6 +611,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean
$(python-clean)
#
+# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
+# file if defined, with no further action.
+feature-dump:
+ifdef FEATURE_DUMP_COPY
+ @cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
+ @echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
+else
+ @echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
+endif
+
+#
# Trick: if ../../.git does not exist - we are building out of tree for example,
# then force version regeneration:
#
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 6/9] perf build: Introduce FEATURES_DUMP make variable
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (4 preceding siblings ...)
2016-01-14 13:13 ` [PATCH v2 5/9] perf build: Add feature-dump target Wang Nan
@ 2016-01-14 13:14 ` Wang Nan
2016-01-14 13:14 ` [PATCH v2 7/9] tools build: Allow subprojects select all feature checkers Wang Nan
` (2 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:14 UTC (permalink / raw)
To: acme, jolsa; +Cc: linux-kernel, pi3orama, lizefan, Jiri Olsa
From: Jiri Olsa <jolsa@kernel.org>
Introducing FEATURES_DUMP make variable to provide features
detection dump file and bypass the feature detection.
The intention is to use this during build tests to skip
repeated features detection, like:
Get feature dump static build into /tmp/fd file:
$ make feature-dump FEATURE_DUMP_COPY=/tmp/fd LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
SNIP
FEATURE-DUMP file copied into /tmp/fd
Use /tmp/fd to build perf:
$ make FEATURES_DUMP=/tmp/fd LDFLAGS=-static
$ file perf
perf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for ...
Suggested-by: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-fhb47m6t18txuwrzu33is2bo@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/Makefile.perf | 14 +++++++++++++-
tools/perf/config/Makefile | 4 ++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f758a72..5d34815 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -77,6 +77,9 @@ include config/utilities.mak
# Define NO_AUXTRACE if you do not want AUX area tracing support
#
# Define NO_LIBBPF if you do not want BPF support
+#
+# Define FEATURES_DUMP to provide features detection dump file
+# and bypass the feature detection
# As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL
@@ -166,6 +169,15 @@ ifeq ($(config),1)
include config/Makefile
endif
+# The FEATURE_DUMP_EXPORT holds location of the actual
+# FEATURE_DUMP file to be used to bypass feature detection
+# (for bpf or any other subproject)
+ifeq ($(FEATURES_DUMP),)
+FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
+else
+FEATURE_DUMP_EXPORT := $(FEATURES_DUMP)
+endif
+
export prefix bindir sharedir sysconfdir DESTDIR
# sparse is architecture-neutral, which means that we need to tell it
@@ -436,7 +448,7 @@ $(LIBAPI)-clean:
$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
$(LIBBPF): fixdep FORCE
- $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(realpath $(OUTPUT)FEATURE-DUMP)
+ $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index e5959c1..511141b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -181,7 +181,11 @@ LDFLAGS += -Wl,-z,noexecstack
EXTLIBS = -lpthread -lrt -lm -ldl
+ifeq ($(FEATURES_DUMP),)
include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES_DUMP)
+endif
ifeq ($(feature-stackprotector-all), 1)
CFLAGS += -fstack-protector-all
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 7/9] tools build: Allow subprojects select all feature checkers
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (5 preceding siblings ...)
2016-01-14 13:14 ` [PATCH v2 6/9] perf build: Introduce FEATURES_DUMP make variable Wang Nan
@ 2016-01-14 13:14 ` Wang Nan
2016-01-14 13:14 ` [PATCH v2 8/9] perf build: Select all feature checkers for feature-dump Wang Nan
2016-01-14 13:14 ` [PATCH v2 9/9] perf build: Use feature dump file for build-test Wang Nan
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:14 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan, Jiri Olsa,
Arnaldo Carvalho de Melo, Namhyung Kim
Put feature checkers not in original FEATURE_TESTS to a new list
and allow subproject select all feature checkers by setting
FEATURE_TESTS to 'all'.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/build/Makefile.feature | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 02db3cd..674c47d 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -27,7 +27,7 @@ endef
# the rule that uses them - an example for that is the 'bionic'
# feature check. ]
#
-FEATURE_TESTS ?= \
+FEATURE_TESTS_BASIC := \
backtrace \
dwarf \
fortify-source \
@@ -56,6 +56,25 @@ FEATURE_TESTS ?= \
get_cpuid \
bpf
+# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
+# of all feature tests
+FEATURE_TESTS_EXTRA := \
+ bionic \
+ compile-32 \
+ compile-x32 \
+ cplus-demangle \
+ hello \
+ libbabeltrace \
+ liberty \
+ liberty-z \
+ libunwind-debug-frame
+
+FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC)
+
+ifeq ($(FEATURE_TESTS),all)
+ FEATURE_TESTS := $(FEATURE_TESTS_BASIC) $(FEATURE_TESTS_EXTRA)
+endif
+
FEATURE_DISPLAY ?= \
dwarf \
glibc \
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 8/9] perf build: Select all feature checkers for feature-dump
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (6 preceding siblings ...)
2016-01-14 13:14 ` [PATCH v2 7/9] tools build: Allow subprojects select all feature checkers Wang Nan
@ 2016-01-14 13:14 ` Wang Nan
2016-01-14 13:14 ` [PATCH v2 9/9] perf build: Use feature dump file for build-test Wang Nan
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:14 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan, Jiri Olsa,
Arnaldo Carvalho de Melo, Namhyung Kim
Set FEATURE_TESTS to 'all' so all possible feature checkers are
executed. Without this setting the output feature dump file miss
some feature, for example, liberity. Select all checker so we won't
get an incomplete feature dump file.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Makefile.perf | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5d34815..283775b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -165,7 +165,16 @@ ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
endif
endif
+# Set FEATURE_TESTS to 'all' so all possible feature checkers are
+# executed. Without this setting the output feature dump file miss
+# some feature, for example, liberity. Select all checker so we won't
+# get an incomplete feature dump file.
ifeq ($(config),1)
+ifdef MAKECMDGOALS
+ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)
+FEATURE_TESTS := all
+endif
+endif
include config/Makefile
endif
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 9/9] perf build: Use feature dump file for build-test
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
` (7 preceding siblings ...)
2016-01-14 13:14 ` [PATCH v2 8/9] perf build: Select all feature checkers for feature-dump Wang Nan
@ 2016-01-14 13:14 ` Wang Nan
8 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-01-14 13:14 UTC (permalink / raw)
To: acme, jolsa
Cc: linux-kernel, pi3orama, lizefan, Wang Nan, Jiri Olsa,
Arnaldo Carvalho de Melo, Namhyung Kim
To prevent feature check run too many times, this patch utilizes
previous introduced feature-dump make target and FEATURES_DUMP
variable, makes sure the feature checkers run only once when doing
build-test for normal test cases.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/make | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index f8d3162..012b84b 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -15,6 +15,7 @@ else
PERF := .
PERF_O := $(PERF)
O_OPT :=
+FULL_O := $(shell readlink -f $(PERF_OUT) || echo $(PERF_OUT))
ifneq ($(O),)
FULL_O := $(shell readlink -f $(O) || echo $(O))
@@ -313,11 +314,41 @@ make_kernelsrc_tools:
(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
+FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
+FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
+
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
@echo OK
+ @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
out: $(run_O)
@echo OK
+ @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
+
+$(FEATURES_DUMP_FILE):
+ $(call clean)
+ @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
+ echo "- $@: $$cmd" && echo $$cmd && \
+ ( eval $$cmd ) > /dev/null 2>&1
+
+$(FEATURES_DUMP_FILE_STATIC):
+ $(call clean)
+ @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \
+ echo "- $@: $$cmd" && echo $$cmd && \
+ ( eval $$cmd ) > /dev/null 2>&1
+
+# Add feature dump dependency for run/run_O targets
+$(foreach t,$(run) $(run_O),$(eval \
+ $(t): $(if $(findstring make_static,$(t)),\
+ $(FEATURES_DUMP_FILE_STATIC),\
+ $(FEATURES_DUMP_FILE))))
+
+# Append 'FEATURES_DUMP=' option to all test cases. For example:
+# make_no_libbpf: NO_LIBBPF=1 --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP
+# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC
+$(foreach t,$(run),$(if $(findstring make_static,$(t)),\
+ $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\
+ $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
endif # ifndef MK
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 13:13 ` [PATCH v2 3/9] perf build: Test correct path of perf " Wang Nan
@ 2016-01-14 14:50 ` Arnaldo Carvalho de Melo
2016-01-14 14:58 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-14 14:50 UTC (permalink / raw)
To: Wang Nan; +Cc: jolsa, linux-kernel, pi3orama, lizefan, Jiri Olsa, Namhyung Kim
Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
> If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
> will fail because perf resides in a different directory. Fix this by
> computing PERF_OUT according to 'O' and test correct output files.
> For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
> instead because the path is different from others ($(O)/perf vs
> $(O)/tools/perf).
So, before this patch:
[acme@felicio linux]$ make -C tools/perf -f tests/make make_static
make: Entering directory `/home/acme/git/linux/tools/perf'
Testing Makefile
make[1]: Entering directory `/home/acme/git/linux/tools/perf'
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.aCtpIoMBDZ LDFLAGS=-static
make[1]: Leaving directory `/home/acme/git/linux/tools/perf'
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@felicio linux]$
after I applied it it was failing, but now, running just the 'make_static'
target, it works, oops, trying to run it as plain 'build-test', i.e. randomly
picking the targets and running them all...
Also note that I'm not using O= at all, trying to check first if it works
without it, to avoid introducing a regression.
Ok, failed again, I was lucky and it was the second test to run, it seems some
cleanup is not being done wrt the python binding...
$ make -C tools/perf build-test
make: Entering directory `/home/acme/git/linux/tools/perf'
Testing Makefile
- make_no_demangle: cd . && make -f Makefile DESTDIR=/tmp/tmp.OO1OfcvkFQ NO_DEMANGLE=1
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.jSd2VoICTE LDFLAGS=-static
cd . && make -f Makefile DESTDIR=/tmp/tmp.jSd2VoICTE LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
GEN common-cmds.h
PERF_VERSION = 4.4.ge0a5e17c
CC plugin_hrtimer.o
CC plugin_jbd2.o
CC plugin_kmem.o
LD plugin_jbd2-in.o
<SNIP>
CC tests/llvm.o
AR libperf.a
CC tests/bpf.o
CC tests/topology.o
CC tests/cpumap.o
CC tests/stat.o
CC tests/event_update.o
CC tests/dwarf-unwind.o
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
CC tests/llvm-src-base.o
cp: cannot stat ‘python_ext_build/lib/perf.so’: No such file or directory
make[4]: *** [python/perf.so] Error 1
make[4]: *** Waiting for unfinished jobs....
CC tests/llvm-src-kbuild.o
CC tests/llvm-src-prologue.o
CC perf.o
LD tests/perf-in.o
LD perf-in.o
make[4]: *** wait: No child processes. Stop.
make[3]: *** [all] Error 2
test: test -x ./perf
make[2]: *** [make_static] Error 1
make[1]: *** [all] Error 2
make: *** [build-test] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@felicio linux]$
- Arnaldo
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/tests/make | 23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 14d7b8d..e74c86b 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -13,10 +13,12 @@ else
> endif
> else
> PERF := .
> +PERF_O := $(PERF)
> O_OPT :=
>
> ifneq ($(O),)
> FULL_O := $(shell readlink -f $(O) || echo $(O))
> + PERF_O := $(FULL_O)
> ifeq ($(SET_O),1)
> O_OPT := 'O=$(FULL_O)'
> endif
> @@ -173,11 +175,11 @@ test_make_doc := $(test_ok)
> test_make_help_O := $(test_ok)
> test_make_doc_O := $(test_ok)
>
> -test_make_python_perf_so := test -f $(PERF)/python/perf.so
> +test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
>
> -test_make_perf_o := test -f $(PERF)/perf.o
> -test_make_util_map_o := test -f $(PERF)/util/map.o
> -test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o
> +test_make_perf_o := test -f $(PERF_O)/perf.o
> +test_make_util_map_o := test -f $(PERF_O)/util/map.o
> +test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
>
> define test_dest_files
> for file in $(1); do \
> @@ -244,7 +246,7 @@ test_make_perf_o_O := test -f $$TMP_O/perf.o
> test_make_util_map_o_O := test -f $$TMP_O/util/map.o
> test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
>
> -test_default = test -x $(PERF)/perf
> +test_default = test -x $(PERF_O)/perf
> test = $(if $(test_$1),$(test_$1),$(test_default))
>
> test_default_O = test -x $$TMP_O/perf
> @@ -264,7 +266,7 @@ endif
>
> MAKEFLAGS := --no-print-directory
>
> -clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
> +clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
>
> $(run):
> $(call clean)
> @@ -293,17 +295,22 @@ tarpkg:
> ( eval $$cmd ) >> $@ 2>&1 && \
> rm -f $@
>
> +KERNEL_O := ../..
> +ifneq ($(O),)
> + KERNEL_O := $(O)
> +endif
> +
> make_kernelsrc:
> @echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
> $(call clean); \
> (make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
> - test -x perf && rm -f $@ || (cat $@ ; false)
> + test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
>
> make_kernelsrc_tools:
> @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
> $(call clean); \
> (make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
> - test -x perf && rm -f $@ || (cat $@ ; false)
> + test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
>
> all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
> @echo OK
> --
> 1.8.3.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 14:50 ` Arnaldo Carvalho de Melo
@ 2016-01-14 14:58 ` Arnaldo Carvalho de Melo
2016-01-14 15:08 ` pi3orama
2016-01-15 2:22 ` Wangnan (F)
0 siblings, 2 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-14 14:58 UTC (permalink / raw)
To: Wang Nan; +Cc: jolsa, linux-kernel, pi3orama, lizefan, Jiri Olsa, Namhyung Kim
Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
> > If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
> > will fail because perf resides in a different directory. Fix this by
> > computing PERF_OUT according to 'O' and test correct output files.
> > For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
> > instead because the path is different from others ($(O)/perf vs
> > $(O)/tools/perf).
>
> So, before this patch:
Also, while trying to get this to work, I found these places lacking the
O= prefixing, right?
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index e74c86b00c31..67842900482e 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
# standard single make variable specified
make_clean_all := clean all
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
make_debug := DEBUG=1
make_no_libperl := NO_LIBPERL=1
make_no_libpython := NO_LIBPYTHON=1
@@ -82,9 +82,9 @@ make_tags := tags
make_cscope := cscope
make_help := help
make_doc := doc
-make_perf_o := perf.o
-make_util_map_o := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o := $(PERF_O)/perf.o
+make_util_map_o := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
make_install := install
make_install_bin := install-bin
make_install_doc := install-doc
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 14:58 ` Arnaldo Carvalho de Melo
@ 2016-01-14 15:08 ` pi3orama
2016-01-14 15:44 ` Arnaldo Carvalho de Melo
2016-01-15 2:22 ` Wangnan (F)
1 sibling, 1 reply; 19+ messages in thread
From: pi3orama @ 2016-01-14 15:08 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Wang Nan, jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
发自我的 iPhone
> 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <acme@kernel.org> 写道:
>
> Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
>>> If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
>>> will fail because perf resides in a different directory. Fix this by
>>> computing PERF_OUT according to 'O' and test correct output files.
>>> For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
>>> instead because the path is different from others ($(O)/perf vs
>>> $(O)/tools/perf).
>>
>> So, before this patch:
>
> Also, while trying to get this to work, I found these places lacking the
> O= prefixing, right?
>
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index e74c86b00c31..67842900482e 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
>
> # standard single make variable specified
> make_clean_all := clean all
> -make_python_perf_so := python/perf.so
> +make_python_perf_so := $(PERF_O)/python/perf.so
> make_debug := DEBUG=1
> make_no_libperl := NO_LIBPERL=1
> make_no_libpython := NO_LIBPYTHON=1
> @@ -82,9 +82,9 @@ make_tags := tags
> make_cscope := cscope
> make_help := help
> make_doc := doc
> -make_perf_o := perf.o
> -make_util_map_o := util/map.o
> -make_util_pmu_bison_o := util/pmu-bison.o
> +make_perf_o := $(PERF_O)/perf.o
> +make_util_map_o := $(PERF_O)/util/map.o
> +make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
> make_install := install
> make_install_bin := install-bin
> make_install_doc := install-doc
I have throughly tested this patch set, both
with and without O, many times, and see no
error related to this part of code, so I think
we don't really need this prefix.
But maybe there's error I never noticed.
Let me check it tomorrow.
Thank you.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 15:08 ` pi3orama
@ 2016-01-14 15:44 ` Arnaldo Carvalho de Melo
2016-01-14 16:02 ` Arnaldo Carvalho de Melo
2016-01-15 2:57 ` Wangnan (F)
0 siblings, 2 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-14 15:44 UTC (permalink / raw)
To: pi3orama; +Cc: Wang Nan, jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
Em Thu, Jan 14, 2016 at 11:08:11PM +0800, pi3orama escreveu:
>
>
> 发自我的 iPhone
>
> > 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <acme@kernel.org> 写道:
> >
> > Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
> >> Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
> >>> If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
> >>> will fail because perf resides in a different directory. Fix this by
> >>> computing PERF_OUT according to 'O' and test correct output files.
> >>> For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
> >>> instead because the path is different from others ($(O)/perf vs
> >>> $(O)/tools/perf).
> >>
> >> So, before this patch:
> >
> > Also, while trying to get this to work, I found these places lacking the
> > O= prefixing, right?
> >
> >
> > diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> > index e74c86b00c31..67842900482e 100644
> > --- a/tools/perf/tests/make
> > +++ b/tools/perf/tests/make
> > @@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
> >
> > # standard single make variable specified
> > make_clean_all := clean all
> > -make_python_perf_so := python/perf.so
> > +make_python_perf_so := $(PERF_O)/python/perf.so
> > make_debug := DEBUG=1
> > make_no_libperl := NO_LIBPERL=1
> > make_no_libpython := NO_LIBPYTHON=1
> > @@ -82,9 +82,9 @@ make_tags := tags
> > make_cscope := cscope
> > make_help := help
> > make_doc := doc
> > -make_perf_o := perf.o
> > -make_util_map_o := util/map.o
> > -make_util_pmu_bison_o := util/pmu-bison.o
> > +make_perf_o := $(PERF_O)/perf.o
> > +make_util_map_o := $(PERF_O)/util/map.o
> > +make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
> > make_install := install
> > make_install_bin := install-bin
> > make_install_doc := install-doc
>
> I have throughly tested this patch set, both
> with and without O, many times, and see no
> error related to this part of code, so I think
> we don't really need this prefix.
>
> But maybe there's error I never noticed.
> Let me check it tomorrow.
Ok, but are you testing it patch after patch or just after all the
patches in this series are applied?
Here, with up to:
I am getting 'make clean' related errors after some tests on a RHEL7.1
test machine:
- make_no_libunwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.CKrCzt1X85 NO_LIBUNWIND=1
find: ‘/home/acme/git/linux/tools/perf/tests/dso-data.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.dso-data.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/pmu.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/sw-clock.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.sample-parsing.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/attr.o’: No such file or directory
- make_help: cd . && make -f Makefile DESTDIR=/tmp/tmp.9Gcw1OfooR help
- make_no_slang: cd . && make -f Makefile DESTDIR=/tmp/tmp.Ce5PSg2snH NO_SLANG=1
And 'build-test' fails when it tries to run the 'make_static' target and that
is not the first one to be run:
- make_no_libelf: cd . && make -f Makefile DESTDIR=/tmp/tmp.tEwrxaQPOB NO_LIBELF=1
- make_no_libdw_dwarf_unwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.4r7zlxeeAA NO_LIBDW_DWARF_UNWIND=1
- make_no_libnuma: cd . && make -f Makefile DESTDIR=/tmp/tmp.XuaZ3SACwX NO_LIBNUMA=1
- make_perf_o: cd . && make -f Makefile DESTDIR=/tmp/tmp.LXh3STdaiO perf.o
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
GEN common-cmds.h
PERF_VERSION = 4.4.gbe874d2
CC plugin_hrtimer.o
<SNIP>
CC util/zlib.o
CC util/lzma.o
FLEX util/parse-events-flex.c
FLEX util/pmu-flex.c
CC util/pmu-bison.o
CC util/parse-events.o
CC util/parse-events-flex.o
CC util/pmu.o
CC util/pmu-flex.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
cp: cannot stat ‘python_ext_build/lib/perf.so’: No such file or directory
make[4]: *** [python/perf.so] Error 1
make[3]: *** [all] Error 2
test: test -x ./perf
make[2]: *** [make_static] Error 1
make[1]: *** [all] Error 2
make: *** [build-test] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
-------------------
If I try it manually, in the source tree:
[acme@felicio linux]$ cd tools/perf
[acme@felicio perf]$ make LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
GEN libtraceevent-dynamic-list
LINK libperf-gtk.so
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libperf-gtk.so] Error 1
make: *** [all] Error 2
[acme@felicio perf]$
And if I do a make clean and try again, it works:
[acme@felicio perf]$ make clean
CLEAN libtraceevent
CLEAN libapi
CLEAN libbpf
CLEAN libsubcmd
CLEAN libsubcmd
CLEAN config
CLEAN core-objs
CLEAN core-progs
CLEAN core-gen
SUBDIR Documentation
CLEAN Documentation
CLEAN python
[acme@felicio perf]$ make LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
config/Makefile:268: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
config/Makefile:272: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
config/Makefile:328: DWARF support is off, BPF prologue is disabled
config/Makefile:342: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:360: Disabling post unwind, no support found.
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:458: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
config/Makefile:501: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev
config/Makefile:562: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:591: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev
config/Makefile:604: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
GEN common-cmds.h
CC util/abspath.o
CC fd/array.o
CC fs/fs.o
CC util/alias.o
CC fs/tracing_path.o
PERF_VERSION = 4.4.gbe874d2
CC event-parse.o
CC util/annotate.o
<SNIP>
CC tests/llvm-src-prologue.o
LD tests/perf-in.o
LD perf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
/home/acme/git/linux/tools/lib/traceevent/libtraceevent.a(libtraceevent-in.o): In function `load_plugin':
/home/acme/git/linux/tools/lib/traceevent/event-plugin.c:304: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libperf.a(libperf-in.o): In function `target__parse_uid':
/home/acme/git/linux/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/acme/git/linux/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x682b): warning: the use of `mktemp' is dangerous, better use `mkstemp'
[acme@felicio perf]$
Running it again I don't see those warnings, that are for things we should fix
eventually for static builds but that are not problems related to what we're
trying to fix here:
[acme@felicio perf]$ make LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
config/Makefile:268: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
config/Makefile:272: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
config/Makefile:328: DWARF support is off, BPF prologue is disabled
config/Makefile:342: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:360: Disabling post unwind, no support found.
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:458: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
config/Makefile:501: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev
config/Makefile:562: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:591: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev
config/Makefile:604: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
[acme@felicio perf]$
- Arnaldo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 15:44 ` Arnaldo Carvalho de Melo
@ 2016-01-14 16:02 ` Arnaldo Carvalho de Melo
2016-01-14 17:32 ` Arnaldo Carvalho de Melo
2016-01-15 2:57 ` Wangnan (F)
1 sibling, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-14 16:02 UTC (permalink / raw)
To: pi3orama; +Cc: Wang Nan, jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
Em Thu, Jan 14, 2016 at 12:44:36PM -0300, Arnaldo Carvalho de Melo escreveu:
> If I try it manually, in the source tree:
>
> [acme@felicio linux]$ cd tools/perf
> [acme@felicio perf]$ make LDFLAGS=-static
> BUILD: Doing 'make -j4' parallel build
> GEN libtraceevent-dynamic-list
> LINK libperf-gtk.so
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
> collect2: error: ld returned 1 exit status
> make[1]: *** [libperf-gtk.so] Error 1
> make: *** [all] Error 2
> [acme@felicio perf]$
>
> And if I do a make clean and try again, it works:
[acme@felicio linux]$ git log --oneline -5
be874d2f8baa perf build: Test correct path of perf in build-test
dab97c905927 perf build: Pass O option to Makefile.perf in build-test
7d66631ea112 perf build: Set parallel making options build-test
69d5f8e92f05 perf symbols: Fix reading of build-id from vDSO
8bf78e69a277 perf kvm record/report: 'unprocessable sample' error while
recording/reporting guest data
[acme@felicio linux]$
So, with that hunch, I tried with the patch below and it finishes a
'make -C tools/perf build-test' run with no find .cmd errors not
'make_static' failures, investigating what is the problem with the
'clean' target when it gets a O= passed...
[acme@felicio linux]$ git diff
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index e74c86b00c31..baf8f0099507 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -266,7 +266,8 @@ endif
MAKEFLAGS := --no-print-directory
-clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+#clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
$(run):
$(call clean)
[acme@felicio linux]$
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 16:02 ` Arnaldo Carvalho de Melo
@ 2016-01-14 17:32 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-14 17:32 UTC (permalink / raw)
To: pi3orama; +Cc: Wang Nan, jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
Em Thu, Jan 14, 2016 at 01:02:02PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jan 14, 2016 at 12:44:36PM -0300, Arnaldo Carvalho de Melo escreveu:
> > If I try it manually, in the source tree:
> >
> > [acme@felicio linux]$ cd tools/perf
> > [acme@felicio perf]$ make LDFLAGS=-static
> > BUILD: Doing 'make -j4' parallel build
> > GEN libtraceevent-dynamic-list
> > LINK libperf-gtk.so
> > /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
> > /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
> > collect2: error: ld returned 1 exit status
> > make[1]: *** [libperf-gtk.so] Error 1
> > make: *** [all] Error 2
> > [acme@felicio perf]$
> >
> > And if I do a make clean and try again, it works:
>
> [acme@felicio linux]$ git log --oneline -5
> be874d2f8baa perf build: Test correct path of perf in build-test
> dab97c905927 perf build: Pass O option to Makefile.perf in build-test
> 7d66631ea112 perf build: Set parallel making options build-test
> 69d5f8e92f05 perf symbols: Fix reading of build-id from vDSO
> 8bf78e69a277 perf kvm record/report: 'unprocessable sample' error while
> recording/reporting guest data
> [acme@felicio linux]$
>
> So, with that hunch, I tried with the patch below and it finishes a
> 'make -C tools/perf build-test' run with no find .cmd errors not
> 'make_static' failures, investigating what is the problem with the
> 'clean' target when it gets a O= passed...
So, this seems to do the trick, is it right?
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index e74c86b00c31..29810cf2c117 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -266,7 +266,7 @@ endif
MAKEFLAGS := --no-print-directory
-clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) $(O_OPT) clean >/dev/null)
$(run):
$(call clean)
> [acme@felicio linux]$ git diff
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index e74c86b00c31..baf8f0099507 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -266,7 +266,8 @@ endif
>
> MAKEFLAGS := --no-print-directory
>
> -clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
> +#clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
> +clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
>
> $(run):
> $(call clean)
> [acme@felicio linux]$
>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 14:58 ` Arnaldo Carvalho de Melo
2016-01-14 15:08 ` pi3orama
@ 2016-01-15 2:22 ` Wangnan (F)
1 sibling, 0 replies; 19+ messages in thread
From: Wangnan (F) @ 2016-01-15 2:22 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: jolsa, linux-kernel, pi3orama, lizefan, Jiri Olsa, Namhyung Kim
On 2016/1/14 22:58, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
>>> If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
>>> will fail because perf resides in a different directory. Fix this by
>>> computing PERF_OUT according to 'O' and test correct output files.
>>> For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
>>> instead because the path is different from others ($(O)/perf vs
>>> $(O)/tools/perf).
>> So, before this patch:
> Also, while trying to get this to work, I found these places lacking the
> O= prefixing, right?
>
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index e74c86b00c31..67842900482e 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
>
> # standard single make variable specified
> make_clean_all := clean all
> -make_python_perf_so := python/perf.so
> +make_python_perf_so := $(PERF_O)/python/perf.so
> make_debug := DEBUG=1
> make_no_libperl := NO_LIBPERL=1
> make_no_libpython := NO_LIBPYTHON=1
> @@ -82,9 +82,9 @@ make_tags := tags
> make_cscope := cscope
> make_help := help
> make_doc := doc
> -make_perf_o := perf.o
> -make_util_map_o := util/map.o
> -make_util_pmu_bison_o := util/pmu-bison.o
> +make_perf_o := $(PERF_O)/perf.o
> +make_util_map_o := $(PERF_O)/util/map.o
> +make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
> make_install := install
> make_install_bin := install-bin
> make_install_doc := install-doc
Rechecked. As a make target we don't need this prefix:
Don't allow writing at every directories:
$ find -type d -exec chmod 555 {} \;
$ touch ddd
touch: cannot touch ‘ddd’: Permission denied
$ make -C perf python/perf.so
make: Entering directory `/home/wangnan/kernel-hydrogen/tools/perf'
BUILD: Doing 'make -j24' parallel build
/bin/sh: .config-detected: Permission denied
...
config/Makefile:261: *** No gnu/libc-version.h found, please install
glibc-dev[el]. Stop.
make: *** [python/perf.so] Error 2
make: Leaving directory `/home/wangnan/kernel-hydrogen/tools/perf'
Then use python/perf.so as make target:
$ make -C perf python/perf.so O=/tmp/xxxxx
make: Entering directory `/home/w00229757/kernel-hydrogen/tools/perf'
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
...
LD /tmp/xxxxx/fd/libapi-in.o
GEN /tmp/xxxxx/libtraceevent-dynamic-list
LD /tmp/xxxxx/fs/libapi-in.o
LD /tmp/xxxxx/libapi-in.o
AR /tmp/xxxxx/libapi.a
LD /tmp/xxxxx/libtraceevent-in.o
LINK /tmp/xxxxx/libtraceevent.a
GEN /tmp/xxxxx/python/perf.so
make: Leaving directory `/home/wangnan/kernel-hydrogen/tools/perf'
Adding the prefix also works it.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-14 15:44 ` Arnaldo Carvalho de Melo
2016-01-14 16:02 ` Arnaldo Carvalho de Melo
@ 2016-01-15 2:57 ` Wangnan (F)
2016-01-15 3:32 ` Wangnan (F)
1 sibling, 1 reply; 19+ messages in thread
From: Wangnan (F) @ 2016-01-15 2:57 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, pi3orama
Cc: jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
On 2016/1/14 23:44, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jan 14, 2016 at 11:08:11PM +0800, pi3orama escreveu:
>>
>> 发自我的 iPhone
>>
>>> 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <acme@kernel.org> 写道:
>>>
>>> Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
>>>> Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
>>>>> If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
>>>>> will fail because perf resides in a different directory. Fix this by
>>>>> computing PERF_OUT according to 'O' and test correct output files.
>>>>> For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
>>>>> instead because the path is different from others ($(O)/perf vs
>>>>> $(O)/tools/perf).
>>>> So, before this patch:
>>> Also, while trying to get this to work, I found these places lacking the
>>> O= prefixing, right?
>>>
>>>
>>> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
>>> index e74c86b00c31..67842900482e 100644
>>> --- a/tools/perf/tests/make
>>> +++ b/tools/perf/tests/make
>>> @@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
>>>
>>> # standard single make variable specified
>>> make_clean_all := clean all
>>> -make_python_perf_so := python/perf.so
>>> +make_python_perf_so := $(PERF_O)/python/perf.so
>>> make_debug := DEBUG=1
>>> make_no_libperl := NO_LIBPERL=1
>>> make_no_libpython := NO_LIBPYTHON=1
>>> @@ -82,9 +82,9 @@ make_tags := tags
>>> make_cscope := cscope
>>> make_help := help
>>> make_doc := doc
>>> -make_perf_o := perf.o
>>> -make_util_map_o := util/map.o
>>> -make_util_pmu_bison_o := util/pmu-bison.o
>>> +make_perf_o := $(PERF_O)/perf.o
>>> +make_util_map_o := $(PERF_O)/util/map.o
>>> +make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
>>> make_install := install
>>> make_install_bin := install-bin
>>> make_install_doc := install-doc
>> I have throughly tested this patch set, both
>> with and without O, many times, and see no
>> error related to this part of code, so I think
>> we don't really need this prefix.
>>
>> But maybe there's error I never noticed.
>> Let me check it tomorrow.
> Ok, but are you testing it patch after patch or just after all the
> patches in this series are applied?
>
> Here, with up to:
>
>
> I am getting 'make clean' related errors after some tests on a RHEL7.1
> test machine:
>
> - make_no_libunwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.CKrCzt1X85 NO_LIBUNWIND=1
> find: ‘/home/acme/git/linux/tools/perf/tests/dso-data.o’: No such file or directory
> find: ‘/home/acme/git/linux/tools/perf/tests/.dso-data.o.cmd’: No such file or directory
> find: ‘/home/acme/git/linux/tools/perf/tests/pmu.o’: No such file or directory
> find: ‘/home/acme/git/linux/tools/perf/tests/sw-clock.o’: No such file or directory
> find: ‘/home/acme/git/linux/tools/perf/tests/.sample-parsing.o.cmd’: No such file or directory
> find: ‘/home/acme/git/linux/tools/perf/tests/attr.o’: No such file or directory
> - make_help: cd . && make -f Makefile DESTDIR=/tmp/tmp.9Gcw1OfooR help
> - make_no_slang: cd . && make -f Makefile DESTDIR=/tmp/tmp.Ce5PSg2snH NO_SLANG=1
>
> And 'build-test' fails when it tries to run the 'make_static' target and that
> is not the first one to be run:
>
> - make_no_libelf: cd . && make -f Makefile DESTDIR=/tmp/tmp.tEwrxaQPOB NO_LIBELF=1
> - make_no_libdw_dwarf_unwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.4r7zlxeeAA NO_LIBDW_DWARF_UNWIND=1
> - make_no_libnuma: cd . && make -f Makefile DESTDIR=/tmp/tmp.XuaZ3SACwX NO_LIBNUMA=1
> - make_perf_o: cd . && make -f Makefile DESTDIR=/tmp/tmp.LXh3STdaiO perf.o
> - make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
> cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
> BUILD: Doing 'make -j4' parallel build
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... glibc: [ on ]
> ... gtk2: [ on ]
> ... libaudit: [ on ]
> ... libbfd: [ on ]
> ... libelf: [ on ]
> ... libnuma: [ on ]
> ... numa_num_possible_cpus: [ on ]
> ... libperl: [ on ]
> ... libpython: [ on ]
> ... libslang: [ on ]
> ... libunwind: [ on ]
> ... libdw-dwarf-unwind: [ on ]
> ... zlib: [ on ]
> ... lzma: [ on ]
> ... get_cpuid: [ on ]
> ... bpf: [ on ]
Look at this feature detection result.
> Auto-detecting system features:
> ... dwarf: [ OFF ]
> ... glibc: [ on ]
> ... gtk2: [ OFF ]
> ... libaudit: [ OFF ]
> ... libbfd: [ OFF ]
> ... libelf: [ on ]
> ... libnuma: [ OFF ]
> ... numa_num_possible_cpus: [ OFF ]
> ... libperl: [ OFF ]
> ... libpython: [ OFF ]
> ... libslang: [ OFF ]
> ... libunwind: [ OFF ]
> ... libdw-dwarf-unwind: [ OFF ]
> ... zlib: [ OFF ]
> ... lzma: [ OFF ]
> ... get_cpuid: [ on ]
> ... bpf: [ on ]
And this one.
They are different.
I reproduced this error in my environment. The reason is: if we use
'make clean O=something', the 'bin' files created by feature testing
won't be removed. Not related to my work. Here I give an example:
tools/perf> make clean
tools/perf> make
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
<SNIP>
tools/perf> make clean O=.
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
config/Makefile:342: No libunwind found. Please install
libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please
install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please
install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please
install gtk2-devel or libgtk2.0-dev
config/Makefile:562: No bfd.h/libbfd found, please install
binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:604: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
...
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/libtraceevent.a(libtraceevent-in.o):
In function `load_plugin':
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/event-plugin.c:304:
warning: Using 'dlopen' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -llzma
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -lperl
libperf.a(libperf-in.o): In function `target__parse_uid':
/home/w00229757/kernel-hydrogen/tools/perf/util/target.c:79: warning:
Using 'getpwnam_r' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/home/w00229757/kernel-hydrogen/tools/perf/util/target.c:91: warning:
Using 'getpwuid_r' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -llzma
collect2: error: ld returned 1 exit status
...
Result of feature testing is similar.
tools/perf> make clean
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
...
Good result.
Look at [1]. Here's a similar problem I reported to Jiri.
Concultion: the reason of the problem you met is because 'make clean
O=.' doesn't clean
feature test results. In v1 I have:
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_OUT) clean >/dev/null;
make -s -f $(MK) clean >/dev/null)
(two 'make clean' here for safety)
But removes them in v2. The second 'make clean' would remove any feature
testing
results and return good testing result for you. This also explain why I
never met failure
like this: if patch 4 - 9 are applied, make static would use feature dump.
Let me see how to remove feature testing results.
[1] http://lkml.kernel.org/g/5694C73C.3070007@huawei.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
2016-01-15 2:57 ` Wangnan (F)
@ 2016-01-15 3:32 ` Wangnan (F)
0 siblings, 0 replies; 19+ messages in thread
From: Wangnan (F) @ 2016-01-15 3:32 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, pi3orama
Cc: jolsa, linux-kernel, lizefan, Jiri Olsa, Namhyung Kim
On 2016/1/15 10:57, Wangnan (F) wrote:
>
>
[SNIP]
>
> Concultion: the reason of the problem you met is because 'make clean
> O=.' doesn't clean
> feature test results. In v1 I have:
>
> -clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
> +clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_OUT) clean
> >/dev/null; make -s -f $(MK) clean >/dev/null)
>
> (two 'make clean' here for safety)
>
> But removes them in v2. The second 'make clean' would remove any
> feature testing
> results and return good testing result for you. This also explain why
> I never met failure
> like this: if patch 4 - 9 are applied, make static would use feature
> dump.
>
> Let me see how to remove feature testing results.
Here:
config-clean:
$(call QUIET_CLEAN, config)
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if
$(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
If we build with 'O', feature test directory would reside in
$(OUTPUT)/feature. Then when
we 'make clean', the resuling .bin files are removed from
$(OUTPUT)/feature. However, if we
build without 'O' but clean with 'O=.', make clean tries to remove
./feature, but should be
../build/feature.
Thank you.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-01-15 3:33 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-14 13:13 [PATCH v2 0/9] perf build: Make build-test faster Wang Nan
2016-01-14 13:13 ` [PATCH v2 1/9] perf build: Set parallel making options build-test Wang Nan
2016-01-14 13:13 ` [PATCH v2 2/9] perf build: Pass O option to Makefile.perf in build-test Wang Nan
2016-01-14 13:13 ` [PATCH v2 3/9] perf build: Test correct path of perf " Wang Nan
2016-01-14 14:50 ` Arnaldo Carvalho de Melo
2016-01-14 14:58 ` Arnaldo Carvalho de Melo
2016-01-14 15:08 ` pi3orama
2016-01-14 15:44 ` Arnaldo Carvalho de Melo
2016-01-14 16:02 ` Arnaldo Carvalho de Melo
2016-01-14 17:32 ` Arnaldo Carvalho de Melo
2016-01-15 2:57 ` Wangnan (F)
2016-01-15 3:32 ` Wangnan (F)
2016-01-15 2:22 ` Wangnan (F)
2016-01-14 13:13 ` [PATCH v2 4/9] perf build: Pass O option to kernel makefile " Wang Nan
2016-01-14 13:13 ` [PATCH v2 5/9] perf build: Add feature-dump target Wang Nan
2016-01-14 13:14 ` [PATCH v2 6/9] perf build: Introduce FEATURES_DUMP make variable Wang Nan
2016-01-14 13:14 ` [PATCH v2 7/9] tools build: Allow subprojects select all feature checkers Wang Nan
2016-01-14 13:14 ` [PATCH v2 8/9] perf build: Select all feature checkers for feature-dump Wang Nan
2016-01-14 13:14 ` [PATCH v2 9/9] perf build: Use feature dump file for build-test Wang Nan
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).