perf build: Make build-test faster
cover perf build: Make build-test faster
Utilize Jiri's two RFCs to make build-test faster.
Before his RFC on a 24 core machine:
real 21m16.579s
user 176m12.989s
sys 20m54.950s
After his RFC:
real 16m0.619s
user 172m53.896s
sys 19m22.777s
Speedup: 24.75%.
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 | 30 ++++++++++++++++- tools/perf/config/Makefile | 4 +++ tools/perf/tests/make | 80 +++++++++++++++++++++++++++++++++++--------- 4 files changed, 118 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.4
PATCH 1/9 perf build: Set parallel making options build-test
'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.
--- tools/perf/tests/make | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
tools/perf/tests/make +16 -7
@@ -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
Signature · 1 line
1.8.3.4
tip-bot for Wang Nan
merge bot[tip:perf/urgent] perf build: Set parallel making options build-test
perf build: Set parallel making options build-test
Commit-ID: 7be43dfb1e617b87bf2d936d82c026be39b43910 Gitweb: http://git.kernel.org/tip/7be43dfb1e617b87bf2d936d82c026be39b43910 Author: Wang Nan <[email protected]> AuthorDate: Wed, 13 Jan 2016 12:17:14 +0000 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 15 Jan 2016 16:31:59 -0300
perf build: Set parallel making options build-test
'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.
--- tools/perf/tests/make | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
tools/perf/tests/make +16 -7
@@ -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
PATCH 2/9 perf build: Pass O option to Makefile.perf in build-test
In reply to Wang NanDoesn'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.
--- tools/perf/tests/make | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
tools/perf/tests/make +10 -2
@@ -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; \
Signature · 1 line
1.8.3.4
Re: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
Quoted 52 lines · Wang Nan
Doesn't like
tools/perf/Makefile,tools/perf/Makefile.perfobey 'O' option when it is passed through cmdline only, because of code intools/scripts/Makefile.include:ifneq ($(O),)
ifeq ($(origin O), command line)(quoted diff) +0
-0ABSOLUTE_O := $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) endif endifThis patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.
Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)tools/perf/tests/make +9
-1@@ -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)
tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 5 lines
tools/perf/tests/make +1
-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 $($@)"; \
hum, but this set is to test make without O=... so why would you set it? run_O is the target for O=... tests
thanks,
jirka
Re: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
Quoted 50 lines · Jiri Olsa
Quoted 49 lines · Wang Nan
Doesn't like
tools/perf/Makefile,tools/perf/Makefile.perfobey 'O' option when it is passed through cmdline only, because of code intools/scripts/Makefile.include:ifneq ($(O),) ifeq ($(origin O), command line) ... ABSOLUTE_O := $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) endif endifThis patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.
Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)tools/perf/tests/make +9
-1@@ -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
Quoted 10 lines
tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 8 lines
tools/perf/tests/make +1
-1PARALLEL_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 $($@)"; \hum, but this set is to test make without O=... so why would you set it?
run_Ois the target for O=... tests
I have strong motivation to avoid polluting source directory.
I have different platforms and sometime I want to build them (cross-compile) parallelly. I use yocto for this. Yocto appends 'O' automatically. This is good for building, but when I use the framework for build-test I have to manually adjust the generated scripts (and it would be regenerated again in next run) to make it work, and also I'm unable to test them in parallel.
For people who don't care about this, $(O_OPT) is empty so he/she still tests without 'O=...' case.
Thank you.
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
Em Thu, Jan 14, 2016 at 05:56:06PM +0800, Wangnan (F) escreveu:
Quoted 63 lines · Jiri Olsa
Quoted 51 lines · Wang Nan
Quoted 50 lines
Doesn't like
tools/perf/Makefile,tools/perf/Makefile.perfobey 'O' option when it is passed through cmdline only, because of code intools/scripts/Makefile.include:ifneq ($(O),)
ifeq ($(origin O), command line)(quoted diff) +0
-0ABSOLUTE_O := $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) endif endifThis patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.
Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)tools/perf/tests/make +9
-1@@ -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)Quoted 8 lines
tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 6 lines
tools/perf/tests/make +1
-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 $($@)"; \hum, but this set is to test make without O=... so why would you set it?
run_Ois the target for O=... tests
Quoted 1 line
I have strong motivation to avoid polluting source directory.
yeah!
Quoted 11 lines
I have different platforms and sometime I want to build them (cross-compile) parallelly. I use yocto for this. Yocto appends 'O' automatically. This is good for building, but when I use the framework for build-test I have to manually adjust the generated scripts (and it would be regenerated again in next run) to make it work, and also I'm unable to test them in parallel.
For people who don't care about this, $(O_OPT) is empty so he/she still tests without 'O=...' case.
Thank you.
Re: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
Quoted 64 lines · Arnaldo Carvalho de Melo
Em Thu, Jan 14, 2016 at 05:56:06PM +0800, Wangnan (F) escreveu:
Quoted 63 lines · Jiri Olsa
Quoted 59 lines · Wang Nan
Quoted 51 lines
Doesn't like
tools/perf/Makefile,tools/perf/Makefile.perfobey 'O' option when it is passed through cmdline only, because of code intools/scripts/Makefile.include:ifneq ($(O),)
ifeq ($(origin O), command line)(quoted diff) +0
-0ABSOLUTE_O := $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) endif endifThis patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.
Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)tools/perf/tests/make +9
-1@@ -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)tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 5 lines
tools/perf/tests/make +1
-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 $($@)"; \hum, but this set is to test make without O=... so why would you set it?
run_Ois the target for O=... tests
Quoted 3 lines
Quoted 1 line
I have strong motivation to avoid polluting source directory.
yeah!
heh, I knew you'd be excited ;-) but does that actually mean that build-test will never run tests in source directory?
jirka
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
Em Thu, Jan 14, 2016 at 03:37:28PM +0100, Jiri Olsa escreveu:
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 5 lines
Em Thu, Jan 14, 2016 at 05:56:06PM +0800, Wangnan (F) escreveu:
Quoted 4 lines
Quoted 3 lines
tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 1 line
tools/perf/tests/make +1
-0+ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \hum, but this set is to test make without O=... so why would you set it?
run_Ois the target for O=... tests
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I have strong motivation to avoid polluting source directory.
yeah!
heh, I knew you'd be excited ;-) but does that actually mean that build-test will never run tests in source directory?
Humm, I think this is something to be supported, but source code repository polution is really bad and a pet peeve I have with build-test, so the fact that Wang is working to remove that limitation is indeed exciting :-)
- Arnaldo
Re: [PATCH 2/9] perf build: Pass O option to Makefile.perf in build-test
In reply to Jiri Olsa发自我的 iPhone
Quoted 67 lines · 在 2016年1月14日,下午10:37,Jiri Olsa <[email protected]> 写道:
Quoted 66 lines · Arnaldo Carvalho de Melo
Em Thu, Jan 14, 2016 at 05:56:06PM +0800, Wangnan (F) escreveu:
Quoted 63 lines
Quoted 62 lines · Jiri Olsa
Quoted 55 lines · Wang Nan
Doesn't like
tools/perf/Makefile,tools/perf/Makefile.perfobey 'O' option when it is passed through cmdline only, because of code intools/scripts/Makefile.include:ifneq ($(O),)
ifeq ($(origin O), command line)
...
ABSOLUTE_O:= $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
endif
endifThis patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.
Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>---
tools/perf/tests/make| 12 ++++++++++--1 file changed, 10 insertions(+), 2 deletions(-)tools/perf/tests/make +0
-0@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),) # no target specified, trigger the whole suiteall:
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefiletools/perf/tests/make +1
-1- @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=1else
# run only specific test over 'Makefile' %:tools/perf/tests/make +0
-0@@ -13,6 +13,14 @@ elseendif
else
PERF := .tools/perf/tests/make +8
-0+O_OPT := + +ifneq ($(O),) + FULL_O := $(shell readlink -f $(O) || echo $(O)) + ifeq ($(SET_O),1) + O_OPT := 'O=$(FULL_O)' + endif +endifPARALLEL_OPT=
ifeq ($(SET_PARALLEL),1)tools/perf/tests/make +0
-0@@ -261,7 +269,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)$(run):
$(call clean) @TMP_DEST=$$(mktemp -d); \tools/perf/tests/make clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) · line 272
Quoted 2 lines
tools/perf/tests/make +1
-1- cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \ + cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \hum, but this set is to test make without O=... so why would you set it?
run_Ois the target for O=... tests
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
I have strong motivation to avoid polluting source directory.
yeah!
heh, I knew you'd be excited ;-) but does that actually mean that build-test will never run tests in source directory?
build-test should be able to run at source directory, and I try to not passing extra O option to make in this situation. This is the reason why I choose to use O_OPT instead of directly adding O=xxx to make command.
I tested all cases (with and without -O), in and out of source directory (for v1. For v2 I remove some test cases). It should work.
Thank you.
PATCH 3/9 perf build: Test correct path of perf in build-test
In reply to Wang NanIf 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).
--- tools/perf/tests/make | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
tools/perf/tests/make +15 -8
@@ -13,10 +13,12 @@ else endif else PERF := . +PERF_OUT := $(PERF) O_OPT := ifneq ($(O),) FULL_O := $(shell readlink -f $(O) || echo $(O)) + PERF_OUT := $(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_OUT)/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_OUT)/perf.o +test_make_util_map_o := test -f $(PERF_OUT)/util/map.o +test_make_util_pmu_bison_o := test -f $(PERF_OUT)/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_OUT)/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_OUT) clean >/dev/null; make -s -f $(MK) clean >/dev/null) $(run): $(call clean)
@@ -293,17 +295,22 @@ tarpkg: ( eval $$cmd ) >> $@ 2>&1 && \ rm -f $@ +KBUILD_OUTPUT_DIR := ../.. +ifneq ($(O),) + KBUILD_OUTPUT_DIR := $(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 $(KBUILD_OUTPUT_DIR)/tools/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 $(KBUILD_OUTPUT_DIR)/tools/perf && rm -f $@ || (cat $@ ; false) all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools @echo OK
Signature · 1 line
1.8.3.4
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
Quoted 20 lines · Wang Nan
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_OUTaccording to 'O' and test correct output files. Formake_kernelsrcandmake_kernelsrc_tools, setKBUILD_OUTPUT_DIRinstead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)tools/perf/tests/make +0
-0
tools/perf/tests/make else · line 17
Quoted 5 lines
tools/perf/tests/make +1
-0@@ -13,10 +13,12 @@ else endif else PERF := . +PERF_OUT := $(PERF) O_OPT :=
given that we use _O suffix everywhere in here, would PERF_O suit better?
thanks,
jirka
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
In reply to Wang NanOn Wed, Jan 13, 2016 at 12:17:16PM +0000, Wang Nan wrote:
SNIP
Quoted 21 lines
tools/perf/tests/make +5
-4+test_make_python_perf_so := test -f $(PERF_OUT)/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_OUT)/perf.o +test_make_util_map_o := test -f $(PERF_OUT)/util/map.o +test_make_util_pmu_bison_o := test -f $(PERF_OUT)/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_OUT)/perf test = $(if $(test_$1),$(test_$1),$(test_default)) test_default_O = test -x $$TMP_O/perf
tools/perf/tests/make endif · line 269
Quoted 5 lines
tools/perf/tests/make +1
-1@@ -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_OUT) clean >/dev/null; make -s -f $(MK) clean >/dev/null)
what's the second make clean for?
thanks,
jirka
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
Quoted 23 lines · Jiri Olsa
On Wed, Jan 13, 2016 at 12:17:16PM +0000, Wang Nan wrote:
SNIP
Quoted 19 lines
tools/perf/tests/make +5
-4+test_make_python_perf_so := test -f $(PERF_OUT)/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_OUT)/perf.o +test_make_util_map_o := test -f $(PERF_OUT)/util/map.o +test_make_util_pmu_bison_o := test -f $(PERF_OUT)/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_OUT)/perf test = $(if $(test_$1),$(test_$1),$(test_default))
Quoted 8 lines
tools/perf/tests/make endif · line 269
Quoted 7 lines
tools/perf/tests/make +1
-1test_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_OUT) clean >/dev/null; make -s -f $(MK) clean >/dev/null)what's the second make clean for?
I want to ensure the source directory is also clean.
Looks like I forget 'O' would be passed to the second make also...
Quoted 2 lines
thanks,
jirka
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
In reply to Wang NanQuoted 67 lines · Wang Nan
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_OUTaccording to 'O' and test correct output files. Formake_kernelsrcandmake_kernelsrc_tools, setKBUILD_OUTPUT_DIRinstead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)tools/perf/tests/make +8
-6@@ -13,10 +13,12 @@ else endif else PERF := . +PERF_OUT := $(PERF) O_OPT := ifneq ($(O),) FULL_O := $(shell readlink -f $(O) || echo $(O)) + PERF_OUT := $(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_OUT)/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_OUT)/perf.o +test_make_util_map_o := test -f $(PERF_OUT)/util/map.o +test_make_util_pmu_bison_o := test -f $(PERF_OUT)/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_OUT)/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_OUT) clean >/dev/null; make -s -f $(MK) clean >/dev/null) $(run): $(call clean)
tools/perf/tests/make tarpkg: · line 301
Quoted 7 lines
tools/perf/tests/make +4
-0@@ -293,17 +295,22 @@ tarpkg: ( eval $$cmd ) >> $@ 2>&1 && \ rm -f $@ +KBUILD_OUTPUT_DIR := ../.. +ifneq ($(O),) + KBUILD_OUTPUT_DIR := $(O) +endif
hum, why kbuild? BUILD_O, KERNELSRC_O ... ?
thanks,
jirka
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
In reply to Wang NanOn Wed, Jan 13, 2016 at 12:17:16PM +0000, Wang Nan wrote:
SNIP
Quoted 4 lines
tools/perf/tests/make +1
-0( eval $$cmd ) >> $@ 2>&1 && \ rm -f $@ +KBUILD_OUTPUT_DIR := ../..
tools/perf/tests/make tarpkg: · line 307
Quoted 10 lines
tools/perf/tests/make +5
-1+ifneq ($(O),) + KBUILD_OUTPUT_DIR := $(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 $(KBUILD_OUTPUT_DIR)/tools/perf && rm -f $@ || (cat $@ ; false)
do you miss one extra /perf in here? like it should be
test -x $(KBUILD_OUTPUT_DIR)/tools/perf/perf
tools/perf/tests/make tarpkg: · line 313
Quoted 7 lines
make_kernelsrc_tools:tools/perf/tests/make +1
-1@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 $(KBUILD_OUTPUT_DIR)/tools/perf && rm -f $@ || (cat $@ ; false)
ditto
thanks,
jirka
Quoted 6 lines
all: $(run) $(run_O) tarpkg
make_kernelsrcmake_kernelsrc_tools
@echo OKSignature · 1 line
1.8.3.4
Re: [PATCH 3/9] perf build: Test correct path of perf in build-test
Quoted 20 lines · Jiri Olsa
On Wed, Jan 13, 2016 at 12:17:16PM +0000, Wang Nan wrote:
SNIP
Quoted 4 lines
( eval $$cmd ) >> $@ 2>&1 && \ rm -f $@tools/perf/tests/make +1
-0+KBUILD_OUTPUT_DIR := ../..tools/perf/tests/make tarpkg: · line 307
Quoted 10 lines
tools/perf/tests/make +5
-1+ifneq ($(O),) + KBUILD_OUTPUT_DIR := $(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 $(KBUILD_OUTPUT_DIR)/tools/perf && rm -f $@ || (cat $@ ; false)do you miss one extra /perf in here? like it should be
Quoted 1 line
test -x $(KBUILD_OUTPUT_DIR)/tools/perf/perf
Right. Will fix.
Thank you.
PATCH 4/9 perf build: Pass O option to kernel makefile in build-test
In reply to Wang NanKernel 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.
--- tools/perf/tests/make | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/tests/make +5 -4
@@ -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 $(KBUILD_OUTPUT_DIR)/tools/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 $(KBUILD_OUTPUT_DIR)/tools/perf && rm -f $@ || (cat $@ ; false) all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
Signature · 1 line
1.8.3.4
PATCH 5/9 perf build: Add feature-dump target
In reply to Wang NanFrom: Jiri Olsa <[email protected]>
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
--- tools/perf/Makefile.perf | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/perf/Makefile.perf +11 -0
@@ -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: #
Signature · 1 line
1.8.3.4
PATCH 6/9 perf build: Introduce FEATURES_DUMP make variable
In reply to Wang NanFrom: Jiri Olsa <[email protected]>
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 ...
--- tools/perf/Makefile.perf | 14 +++++++++++++- tools/perf/config/Makefile | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-)
tools/perf/Makefile.perf +13 -1
@@ -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)
tools/perf/config/Makefile +4 -0
@@ -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
Signature · 1 line
1.8.3.4
PATCH 7/9 tools build: Allow subprojects select all feature checkers
In reply to Wang NanPut feature checkers not in original FEATURE_TESTS to a new list and allow subproject select all feature checkers by setting FEATURE_TESTS to 'all'.
--- tools/build/Makefile.feature | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
tools/build/Makefile.feature +20 -1
@@ -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 \
Signature · 1 line
1.8.3.4
PATCH 8/9 perf build: Select all feature checkers for feature-dump
In reply to Wang NanSet 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 use a incomplete feature dump file.
--- tools/perf/Makefile.perf | 5 +++++ 1 file changed, 5 insertions(+)
tools/perf/Makefile.perf +5 -0
@@ -166,6 +166,11 @@ endif endif ifeq ($(config),1) +ifdef MAKECMDGOALS +ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump) +FEATURE_TESTS := all +endif +endif include config/Makefile endif
Signature · 1 line
1.8.3.4
Re: [PATCH 8/9] perf build: Select all feature checkers for feature-dump
Quoted 18 lines · Wang Nan
Set
FEATURE_TESTSto '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 use a incomplete feature dump file.Signed-off-by Wang Nan <[email protected]>Cc Jiri Olsa <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/Makefile.perf | 5 +++++ 1 file changed, 5 insertions(+)tools/perf/Makefile.perf +0
-0
tools/perf/Makefile.perf endif · line 173
Quoted 8 lines
tools/perf/Makefile.perf +5
-0@@ -166,6 +166,11 @@ endif endif ifeq ($(config),1) +ifdef MAKECMDGOALS +ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump) +FEATURE_TESTS := all +endif +endif
please put the changelog comment in here as well
thanks,
jirka
PATCH 9/9 perf build: Use feature dump file for build-test
In reply to Wang NanTo 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.
--- tools/perf/tests/make | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
tools/perf/tests/make +25 -0
@@ -15,6 +15,7 @@ else PERF := . PERF_OUT := $(PERF) O_OPT := +FULL_O := $(shell readlink -f $(PERF_OUT) || echo $(PERF_OUT)) ifneq ($(O),) FULL_O := $(shell readlink -f $(O) || echo $(O))
@@ -319,5 +320,29 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools out: $(run_O) @echo OK +FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP +FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC + +$(FEATURES_DUMP_FILE): + $(call clean) + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \ + echo "- $@: $$cmd" && echo $$cmd && \ + ( eval $$cmd ) 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 ) 2>&1 + +$(foreach t,$(run) $(run_O),$(eval \ + $(t): $(if $(findstring make_static,$(t)),\ + $(FEATURES_DUMP_FILE_STATIC),\ + $(FEATURES_DUMP_FILE)))) + +$(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
Signature · 1 line
1.8.3.4
Re: [PATCH 9/9] perf build: Use feature dump file for build-test
On Wed, Jan 13, 2016 at 12:17:22PM +0000, Wang Nan wrote:
SNIP
Quoted 5 lines
+$(FEATURES_DUMP_FILE_STATIC):
tools/perf/tests/make +4
-0+ $(call clean) + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \ + echo "- $@: $$cmd" && echo $$cmd && \ + ( eval $$cmd ) 2>&1
tools/perf/tests/make all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools · line 346
Quoted 10 lines
tools/perf/tests/make +10
-0+ +$(foreach t,$(run) $(run_O),$(eval \ + $(t): $(if $(findstring make_static,$(t)),\ + $(FEATURES_DUMP_FILE_STATIC),\ + $(FEATURES_DUMP_FILE)))) + +$(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)))) +
the BUILD_TEST_FEATURE_DUMP rebuild is not silent:
[jolsa@krava perf]$ rm BUILD_TEST_FEATURE_DUMP
[jolsa@krava perf]$ make -f tests/make
Testing Makefile
- /home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
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 ]
...
also should 'make clean' remove BUILD_TEST_FEATURE_DUMP?
thanks,
jirka
Re: [PATCH 9/9] perf build: Use feature dump file for build-test
Quoted 47 lines · Jiri Olsa
On Wed, Jan 13, 2016 at 12:17:22PM +0000, Wang Nan wrote:
SNIP
Quoted 5 lines
+$(FEATURES_DUMP_FILE_STATIC):
tools/perf/tests/make +4
-0+ $(call clean) + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \ + echo "- $@: $$cmd" && echo $$cmd && \ + ( eval $$cmd ) 2>&1tools/perf/tests/make all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools · line 346
Quoted 10 lines
tools/perf/tests/make +10
-0+ +$(foreach t,$(run) $(run_O),$(eval \ + $(t): $(if $(findstring make_static,$(t)),\ + $(FEATURES_DUMP_FILE_STATIC),\ + $(FEATURES_DUMP_FILE)))) + +$(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)))) +the
BUILD_TEST_FEATURE_DUMPrebuild is not silent:[jolsa@krava perf]$ rm
BUILD_TEST_FEATURE_DUMP
[jolsa@krava perf]$ make -f tests/make
TestingMakefile
-/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
BUILD: Doing 'make -j4' parallel buildAuto-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 ]
Quoted 4 lines
...
also should 'make clean' remove
BUILD_TEST_FEATURE_DUMP?
If a simple 'make clean' removes these two feature dump file then they are unable to reused by multiple test cases. During build-test 'make clean' is called many times.
What about force removing these two files here:
ifeq ($(MAKECMDGOALS),)
# no target specified, trigger the whole suite
all:
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) <---
*HERE*
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make
MK=Makefile.perf SET_PARALLEL=1 SET_O=1
else
# run only specific test over 'Makefile'
%:
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) <---
*and HERE*
@echo "Testing Makefile"; $(MAKE) -sf tests/make
MK=Makefile $@
endifQuoted 2 lines
thanks,
jirka
Re: [PATCH 9/9] perf build: Use feature dump file for build-test
Quoted 62 lines · Wangnan (F)
Quoted 47 lines · Jiri Olsa
On Wed, Jan 13, 2016 at 12:17:22PM +0000, Wang Nan wrote:
SNIP
Quoted 5 lines
+$(FEATURES_DUMP_FILE_STATIC):
tools/perf/tests/make +4
-0+ $(call clean) + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \ + echo "- $@: $$cmd" && echo $$cmd && \ + ( eval $$cmd ) 2>&1tools/perf/tests/make all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools · line 346
Quoted 10 lines
tools/perf/tests/make +10
-0+ +$(foreach t,$(run) $(run_O),$(eval \ + $(t): $(if $(findstring make_static,$(t)),\ + $(FEATURES_DUMP_FILE_STATIC),\ + $(FEATURES_DUMP_FILE)))) + +$(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)))) +the
BUILD_TEST_FEATURE_DUMPrebuild is not silent:[jolsa@krava perf]$ rm
BUILD_TEST_FEATURE_DUMP
[jolsa@krava perf]$ make -f tests/make
TestingMakefile
-/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump cd . && make FEATURE_DUMP_COPY=/home/jolsa/kernel/linux-perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
BUILD: Doing 'make -j4' parallel buildAuto-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 ]Quoted 4 lines
...
also should 'make clean' remove
BUILD_TEST_FEATURE_DUMP?If a simple 'make clean' removes these two feature dump file then they are unable to reused by multiple test cases. During build-test 'make clean' is called many times.
What about force removing these two files here:
ifeq ($(MAKECMDGOALS),)
Quoted 14 lines
# no target specified, trigger the whole suite
all:
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) <---
*HERE*
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make
MK=Makefile.perf SET_PARALLEL=1 SET_O=1
else
# run only specific test over 'Makefile'
%:
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) <--- *and
HERE*
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile $@
endifwouldn't they be rebuilt right away?
I think it'd be ok just to remove them right after the test
jirka
Re: [PATCH 9/9] perf build: Use feature dump file for build-test
In reply to Wang NanQuoted 38 lines · Wang Nan
To prevent feature check run too many times, this patch utilizes previous introduced feature-dump make target and
FEATURES_DUMPvariable, makes sure the feature checkers run only once when doing build-test for normal test cases.Signed-off-by Wang Nan <[email protected]>Cc Jiri Olsa <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>--- tools/perf/tests/make | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)tools/perf/tests/make +10
-0@@ -15,6 +15,7 @@ else PERF := . PERF_OUT := $(PERF) O_OPT := +FULL_O := $(shell readlink -f $(PERF_OUT) || echo $(PERF_OUT)) ifneq ($(O),) FULL_O := $(shell readlink -f $(O) || echo $(O))@@ -319,5 +320,29 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools out: $(run_O) @echo OK +FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP +FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC + +$(FEATURES_DUMP_FILE): + $(call clean) + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \ + echo "- $@: $$cmd" && echo $$cmd && \ + ( eval $$cmd ) 2>&1 +
tools/perf/tests/make all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools · line 341
Quoted 10 lines
tools/perf/tests/make +10
-0+$(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 ) 2>&1 + +$(foreach t,$(run) $(run_O),$(eval \ + $(t): $(if $(findstring make_static,$(t)),\ + $(FEATURES_DUMP_FILE_STATIC),\ + $(FEATURES_DUMP_FILE))))
could you please put comment in here.. it's not too obvious ;-)
like saying it's just adding proper feature dump dependency for run/run_O targets.. or something like that
tools/perf/tests/make all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools · line 346
Quoted 5 lines
tools/perf/tests/make +5
-0+ +$(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)))) +
ditto
thanks,
jirka
Hi, Jiri and Arnaldo,
You can find this series on git-tree:
git://git.kernel.org/pub/scm/linux/kernel/git/pi3orama/linux.git perf/build-test
Other patches I sent these days can be found in perf/ebpf and perf/overwrite.
Thank you.
Quoted 33 lines · Wang Nan
Utilize Jiri's two RFCs to make build-test faster.
Before his RFC on a 24 core machine:
real 21m16.579s
user 176m12.989s
sys 20m54.950sAfter his RFC:
real 16m0.619s
user 172m53.896s
sys 19m22.777sSpeedup: 24.75%.
Jiri Olsa (2):
perf build: Add feature-dump target
perf build: IntroduceFEATURES_DUMPmake variableWang 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-testtools/build/Makefile.feature | 21 +++++++++++- tools/perf/Makefile.perf | 30 ++++++++++++++++- tools/perf/config/Makefile | 4 +++ tools/perf/tests/make | 80 +++++++++++++++++++++++++++++++++++--------- 4 files changed, 118 insertions(+), 17 deletions(-)