perf tools: Improve 'make build-test'
cover perf tools: Improve 'make build-test'
There are some bugs and inconveniences in 'make build-test', causes people with strong motivation to avoid writing to source directory and people don't have plenty of time skip build-test before sending patches.
Patch 1 - 3 fixes some existing bug. Patch 4 speedup the test. Patch 5 and 6 makes build-test obey 'O' option passes from cmdline of the first 'make'.
With these 6 patches I make build-test success in my environment fully success the first time.
Wang Nan (6):
perf tools: Add -lutil in python lib list for broken python-config perf tools: Add missing headers in perf's MANIFEST
perf tools: Fix phony build target for build-test
perf tools: Set parallel making options build-test
perf tools: Pass O option to Makefile.perf in build-test perf tools: Test correct path of perf in build-test
tools/perf/MANIFEST | 2 ++ tools/perf/config/Makefile | 2 +- tools/perf/tests/make | 56 +++++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.4
PATCH 1/6 perf tools: Add -lutil in python lib list for broken python-config
On some system the perf-config is broken, causes link failure like this:
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to forkpty' /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function posix_openpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
make: *** [all] Error 2
$ python-config --libs -lpthread -ldl -lpthread -lutil -lm -lpython2.7
In this case a '-lutil' should be appended to -lpython2.7.
(I know we have --start-group and --end-group. I can see them in command line of collect2 by strace. However it doesn't work. Seems I have a broken environment?)
--- tools/perf/config/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/Makefile +1 -1
@@ -493,7 +493,7 @@ else PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) + PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
Signature · 1 line
1.8.3.4
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config
Quoted 10 lines · Wang Nan
On some system the perf-config is broken, causes link failure like this:
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference toforkpty' /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In functionposix_openpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
make: *** [all] Error 2
Quoted 2 lines
$ python-config --libs -lpthread -ldl -lpthread -lutil -lm -lpython2.7
so your 'python-config --libs' shows -lutil and you still get the build failure?
after your fix I can see double -lutil in PYTHON_EMBED_LIBADD, which is probably not a problem but could be ommited I think
Quoted 6 lines
In this case a '-lutil' should be appended to -lpython2.7.
(I know we have --start-group and --end-group. I can see them in command line of collect2 by strace. However it doesn't work. Seems I have a broken environment?)
hum, how is this related to start/end -group options?
thanks,
jirka
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config
Quoted 11 lines · Jiri Olsa
Quoted 10 lines · Wang Nan
On some system the perf-config is broken, causes link failure like this:
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference toforkpty' /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In functionposix_openpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
make: *** [all] Error 2
Quoted 6 lines
Quoted 2 lines
$ python-config --libs -lpthread -ldl -lpthread -lutil -lm -lpython2.7so your 'python-config --libs' shows -lutil and you still get the build failure?
after your fix I can see double -lutil in
PYTHON_EMBED_LIBADD, which is probably not a problem but could be ommited I think
In my python-config:
# python-config -lpthread -ldl -lpthread -lutil -lm -lpython2.7
There are multiple -lpthread already. In fact multiple '-l' options is not a problem at all. Please see below.
Quoted 6 lines
Quoted 5 lines
In this case a '-lutil' should be appended to -lpython2.7.
(I know we have --start-group and --end-group. I can see them in command line of collect2 by strace. However it doesn't work. Seems I have a broken environment?)
hum, how is this related to start/end -group options?
Please check man page of ld:
<quote>
--start-group archives --end-group
The archives should be a list of archive files. They may be either
explicit file names, or -l options.
The specified archives are searched repeatedly until no new
undefined references are created. Normally, an archive is searched only once in the order that it is specified on the command line. If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference. By grouping the archives, they all be searched repeatedly until all possible references are resolved.
Using this option has a significant performance cost. It is best to
use it only when there are unavoidable circular references between two or more archives. </quote>
Without --start/end-group, if we provide -l in this order:
... -la -lb -lc ...
and libb.a requires a symbol in liba.a, link would fail. The simplest way to avoid this is to add another -la after -lb:
... -la -lb -la -lc ...
In my environment it works as if we don't provide -Wl--start-group and -Wl,--end-group. I don't know why.
Thank you.
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config
Quoted 56 lines · Wangnan (F)
Quoted 13 lines · Jiri Olsa
Quoted 12 lines · Wang Nan
On some system the perf-config is broken, causes link failure like this:
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In
function `posix_forkpty':/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty'
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In
function `posix_openpty':/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
make: *** [all] Error 2Quoted 6 lines
Quoted 2 lines
$ python-config --libs -lpthread -ldl -lpthread -lutil -lm -lpython2.7so your 'python-config --libs' shows -lutil and you still get the build failure?
after your fix I can see double -lutil in
PYTHON_EMBED_LIBADD, which is probably not a problem but could be ommited I thinkIn my python-config:
# python-config -lpthread -ldl -lpthread -lutil -lm -lpython2.7There are multiple -lpthread already. In fact multiple '-l' options is not a problem at all. Please see below.
Quoted 6 lines
Quoted 5 lines
In this case a '-lutil' should be appended to -lpython2.7.
(I know we have --start-group and --end-group. I can see them in command line of collect2 by strace. However it doesn't work. Seems I have a broken environment?)
hum, how is this related to start/end -group options?
Please check man page of ld:
<quote>
--start-group archives --end-group
The archives should be a list of archive files. They may be either
explicit file names, or -l options.The specified archives are searched repeatedly until no new
undefined references are created. Normally, an archive is searched only once in the order that it is specified on the command line. If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference. By grouping the archives, they all be searched repeatedly until all possible references are resolved.Using this option has a significant performance cost. It is best
to use it only when there are unavoidable circular references between two or more archives. </quote>Without --start/end-group, if we provide -l in this order:
... -la -lb -lc ...
Quoted 8 lines
and libb.a requires a symbol in liba.a, link would fail. The simplest way to avoid this is to add another -la after -lb:
... -la -lb -la -lc ...
In my environment it works as if we don't provide -Wl,--start-group and -Wl,--end-group. I don't know why.
I mean the python case before I add -lutil after python libs. -Wl,--start-group and -Wl,--end-group seems not work for me. They are issued, I confirm this in strace output.
Thank you.
Quoted 1 line
Thank you.
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config
On Mon, Jan 11, 2016 at 05:50:21PM +0800, Wangnan (F) wrote:
SNIP
Quoted 15 lines
Quoted 15 lines
Using this option has a significant performance cost. It is best to
use it only when there are unavoidable circular references between two or more archives.
</quote>Without --start/end-group, if we provide -l in this order:
... -la -lb -lc ...
and libb.a requires a symbol in liba.a, link would fail. The simplest way to avoid this is to add another -la after -lb:
... -la -lb -la -lc ...
Quoted 8 lines
Quoted 4 lines
In my environment it works as if we don't provide -Wl,--start-group and -Wl,--end-group.
I don't know why.I mean the python case before I add -lutil after python libs. -Wl,--start-group and -Wl,--end-group
seems not work for me. They are issued, I confirm this in strace output.
ok, got it.. I'm ok with the patch, there's no harm with extra lib, however I think you should report this to gcc folks
also please resubmit the patch with the above comment, to make it clear why it's there
thanks,
jirka
PATCH 2/6 perf tools: Add missing headers in perf's MANIFEST
In reply to Wang NanThese losted headers are found in arm64 cross building:
failed to build perf using tarball generated using
$ make perf-targz-src-pkg
--- tools/perf/MANIFEST | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/MANIFEST +2 -0
@@ -1,6 +1,7 @@ tools/perf tools/arch/alpha/include/asm/barrier.h tools/arch/arm/include/asm/barrier.h +tools/arch/arm64/include/asm/barrier.h tools/arch/ia64/include/asm/barrier.h tools/arch/mips/include/asm/barrier.h tools/arch/powerpc/include/asm/barrier.h
@@ -30,6 +31,7 @@ tools/lib/util/find_next_bit.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h +tools/include/asm-generic/atomic-gcc.h tools/include/asm-generic/barrier.h tools/include/asm-generic/bitops/arch_hweight.h tools/include/asm-generic/bitops/atomic.h
Signature · 1 line
1.8.3.4
tip-bot for Wang Nan
merge bot[tip:perf/core] perf tools: Add missing headers in perf' s MANIFEST
perf tools: Add missing headers in perf's MANIFEST
Commit-ID: 2d7c03e6b0c604decae33b0ce03e69b79b2a39a1 Gitweb: http://git.kernel.org/tip/2d7c03e6b0c604decae33b0ce03e69b79b2a39a1 Author: Wang Nan <[email protected]> AuthorDate: Fri, 8 Jan 2016 14:23:57 +0000 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 8 Jan 2016 12:48:40 -0300
perf tools: Add missing headers in perf's MANIFEST
These lost headers are found in arm64 cross buildings, failing to build perf using tarballs generated using:
$ make perf-targz-src-pkg
--- tools/perf/MANIFEST | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/MANIFEST +2 -0
@@ -1,6 +1,7 @@ tools/perf tools/arch/alpha/include/asm/barrier.h tools/arch/arm/include/asm/barrier.h +tools/arch/arm64/include/asm/barrier.h tools/arch/ia64/include/asm/barrier.h tools/arch/mips/include/asm/barrier.h tools/arch/powerpc/include/asm/barrier.h
@@ -30,6 +31,7 @@ tools/lib/find_bit.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h +tools/include/asm-generic/atomic-gcc.h tools/include/asm-generic/barrier.h tools/include/asm-generic/bitops/arch_hweight.h tools/include/asm-generic/bitops/atomic.h
PATCH 1/1 perf tools: Add missing sources in perf's MANIFEST
In reply to Wang NanQuoted 26 lines · Wang Nan
These losted headers are found in arm64 cross building:
failed to build perf using tarball generated using$ make perf-targz-src-pkgSigned-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/MANIFEST | 2 ++ 1 file changed, 2 insertions(+)tools/perf/MANIFEST +1
-0@@ -1,6 +1,7 @@ tools/perf tools/arch/alpha/include/asm/barrier.h tools/arch/arm/include/asm/barrier.h +tools/arch/arm64/include/asm/barrier.h tools/arch/ia64/include/asm/barrier.h tools/arch/mips/include/asm/barrier.h tools/arch/powerpc/include/asm/barrier.h
tools/perf/MANIFEST tools/lib/util/find_next_bit.c · line 37
Quoted 7 lines
tools/perf/MANIFEST +1
-0@@ -30,6 +31,7 @@ tools/lib/util/find_next_bit.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h +tools/include/asm-generic/atomic-gcc.h tools/include/asm-generic/barrier.h tools/include/asm-generic/bitops/arch_hweight.h tools/include/asm-generic/bitops/atomic.h
tarpkg test just failed for me due to missing bitmap sources
I needed to add.. seems related to:
915b0882c310 tools lib: Move bitmap.[ch] from tools/perf/ to tools/{lib,include}/
thanks,
jirka
---
Adding missing bitmap.[ch] sources to the MINIFEST file.
---
tools/perf/MANIFEST +2 -0
@@ -28,6 +28,7 @@ tools/lib/string.c tools/lib/symbol/kallsyms.c tools/lib/symbol/kallsyms.h tools/lib/find_bit.c +tools/lib/bitmap.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h
@@ -57,6 +58,7 @@ tools/include/linux/rbtree_augmented.h tools/include/linux/string.h tools/include/linux/types.h tools/include/linux/err.h +tools/include/linux/bitmap.h include/asm-generic/bitops/arch_hweight.h include/asm-generic/bitops/const_hweight.h include/asm-generic/bitops/fls64.h
Re: [PATCH] perf tools: Add missing sources in perf's MANIFEST
Quoted 36 lines · Jiri Olsa
Quoted 26 lines · Wang Nan
These losted headers are found in arm64 cross building:
failed to build perf using tarball generated using$ make perf-targz-src-pkgSigned-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/MANIFEST | 2 ++ 1 file changed, 2 insertions(+)tools/perf/MANIFEST +1
-0@@ -1,6 +1,7 @@ tools/perf tools/arch/alpha/include/asm/barrier.h tools/arch/arm/include/asm/barrier.h +tools/arch/arm64/include/asm/barrier.h tools/arch/ia64/include/asm/barrier.h tools/arch/mips/include/asm/barrier.h tools/arch/powerpc/include/asm/barrier.htools/perf/MANIFEST tools/lib/util/find_next_bit.c · line 37
Quoted 7 lines
tools/perf/MANIFEST +1
-0@@ -30,6 +31,7 @@ tools/lib/util/find_next_bit.c tools/include/asm/atomic.h tools/include/asm/barrier.h tools/include/asm/bug.h +tools/include/asm-generic/atomic-gcc.h tools/include/asm-generic/barrier.h tools/include/asm-generic/bitops/arch_hweight.h tools/include/asm-generic/bitops/atomic.htarpkg test just failed for me due to missing bitmap sources I needed to add.. seems related to:
Quoted 2 lines
915b0882c310 tools lib: Move bitmap.[ch] from tools/perf/ to tools/{lib,include}/I also saw this:
http://lkml.kernel.org/g/[email protected]
tarpkg works for me when I posted this patchset at Friday, but fail after I return back today...
Thank you.
Arnaldo Carvalho de Melo
maintainerRe: [PATCH] perf tools: Add missing sources in perf's MANIFEST
Em Mon, Jan 11, 2016 at 05:46:10PM +0800, Wangnan (F) escreveu:
Quoted 39 lines · Jiri Olsa
Quoted 29 lines · Wang Nan
Quoted 28 lines
These losted headers are found in arm64 cross building:
failed to build perf using tarball generated using$ make perf-targz-src-pkgSigned-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/MANIFEST | 2 ++ 1 file changed, 2 insertions(+)tools/perf/MANIFEST +1
-0@@ -1,6 +1,7 @@ tools/perf tools/arch/alpha/include/asm/barrier.h tools/arch/arm/include/asm/barrier.h +tools/arch/arm64/include/asm/barrier.h tools/arch/ia64/include/asm/barrier.h tools/arch/mips/include/asm/barrier.h tools/arch/powerpc/include/asm/barrier.h@@ -30,6 +31,7 @@ tools/lib/util/find_next_bit.c tools/include/asm/atomic.h tools/include/asm/barrier.hQuoted 8 lines
tools/perf/MANIFEST tools/lib/util/find_next_bit.c · line 37
Quoted 5 lines
tools/perf/MANIFEST +1
-0tools/include/asm/bug.h +tools/include/asm-generic/atomic-gcc.h tools/include/asm-generic/barrier.h tools/include/asm-generic/bitops/arch_hweight.h tools/include/asm-generic/bitops/atomic.htarpkg test just failed for me due to missing bitmap sources
I needed to add.. seems related to:
915b0882c310tools lib: Move bitmap.[ch] fromtools/perf/totools/{lib,include}/
Quoted 6 lines
I also saw this:
http://lkml.kernel.org/g/[email protected]
tarpkg works for me when I posted this patchset at Friday, but fail after I return back today...
Right, my turn, we all make mistakes ;-\
Anyway, I'm looking at git commit hooks to try and get this checked automatically for future renames or when new files gets added that are not listed in the MANIFEST file...
Thank you guys for spotting this! :-)
- Arnaldo
PATCH 3/6 perf tools: Fix phony build target for build-test
In reply to Wang Nanmake_kernelsrc and make_kernelsrc_tools are skiped if a previous build-test is done, because 'make build-test' creates two files with same names. To avoid this, they should be included in .PHONY list.
--- tools/perf/tests/make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/make +1 -1
@@ -280,5 +280,5 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools out: $(run_O) @echo OK -.PHONY: all $(run) $(run_O) tarpkg clean +.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools endif # ifndef MK
Signature · 1 line
1.8.3.4
Re: [PATCH 3/6] perf tools: Fix phony build target for build-test
Quoted 8 lines · Wang Nan
make_kernelsrcandmake_kernelsrc_toolsare skiped if a previous build-test is done, because 'make build-test' creates two files with same names. To avoid this, they should be included in .PHONY list.Signed-off-by Wang Nan <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>
thanks,
jirka
Quoted 18 lines
--- tools/perf/tests/make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/make +1
-1@@ -280,5 +280,5 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools out: $(run_O) @echo OK -.PHONY: all $(run) $(run_O) tarpkg clean +.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools endif # ifndef MKSignature · 1 line
1.8.3.4
PATCH 4/6 perf tools: Set parallel making options build-test
In reply to Wang Nan'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
@@ -3,7 +3,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' %:
@@ -12,6 +12,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 + include config/Makefile.arch # FIXME looks like x86 is the only arch running tests ;-)
@@ -238,7 +247,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; \
@@ -249,7 +258,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; \
@@ -263,15 +272,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
Re: [PATCH 4/6] perf tools: Set parallel making options build-test
Quoted 33 lines · Wang Nan
'make build-test' is painful because of time consuming. In a full test, all test cases are built twice with
tools/perf/Makefileandtools/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/Makefiledoes, and pass '-j' option to Makefile.perf 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 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)tools/perf/tests/make +1
-1@@ -3,7 +3,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' %:@@ -12,6 +12,15 @@ endif else
tools/perf/tests/make endif · line 22
Quoted 10 lines
tools/perf/tests/make +8
-0PERF := . +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
we could share this with Makefile, but there's probably no point to librarize single line ATM
thanks,
jirka
PATCH 5/6 perf tools: 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
@@ -3,7 +3,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' %:
@@ -11,6 +11,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)
@@ -247,7 +255,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
PATCH 6/6 perf tools: 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
@@ -11,10 +11,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
@@ -159,11 +161,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 \
@@ -230,7 +232,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
@@ -250,7 +252,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)
@@ -279,17 +281,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
Arnaldo Carvalho de Melo
maintainerEm Fri, Jan 08, 2016 at 02:23:55PM +0000, Wang Nan escreveu:
Quoted 11 lines
There are some bugs and inconveniences in 'make build-test', causes people with strong motivation to avoid writing to source directory and people don't have plenty of time skip build-test before sending patches.
Patch 1 - 3 fixes some existing bug. Patch 4 speedup the test. Patch 5 and 6 makes build-test obey 'O' option passes from cmdline of the first 'make'.
With these 6 patches I make build-test success in my environment fully success the first time.
Hey, I owe you some beer or other stuff you like first time we meet, now waiting for Jiri to chime in...
Thanks!
- Arnaldo
Quoted 15 lines
Wang Nan (6):
perf tools: Add -lutil in python lib list for broken python-config perf tools: Add missing headers in perf's MANIFEST
perf tools: Fix phony build target for build-test
perf tools: Set parallel making options build-test
perf tools: Pass O option to Makefile.perf in build-test perf tools: Test correct path of perf in build-testtools/perf/MANIFEST | 2 ++ tools/perf/config/Makefile | 2 +- tools/perf/tests/make | 56 +++++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 17 deletions(-)Signature · 1 line
1.8.3.4
Hi Jiri,
I think if we can fold the feature checking in build-test then it can be even faster. We need only 2 feature check result (for normal building and static building), but in a full build-test we run 138 rounds feature checking. Would you please give some help on it?
Now I have a 160 cores server for building perf, currently busy time and idle time are 5:3 (result from top. I use 1s interval. Each test case takes about 8s, in about 5 seconds I can see full of 'cc1' in perf top result). A full test-build still require more than 0.3 hours (8s * 34 cases * 2 (with and without O) * 2 (Makefile and Makefile.perf) = 1088 seconds).
Thank you.
Quoted 34 lines · Arnaldo Carvalho de Melo
Em Fri, Jan 08, 2016 at 02:23:55PM +0000, Wang Nan escreveu:
Quoted 11 lines
There are some bugs and inconveniences in 'make build-test', causes people with strong motivation to avoid writing to source directory and people don't have plenty of time skip build-test before sending patches.
Patch 1 - 3 fixes some existing bug. Patch 4 speedup the test. Patch 5 and 6 makes build-test obey 'O' option passes from cmdline of the first 'make'.
With these 6 patches I make build-test success in my environment fully success the first time.
Hey, I owe you some beer or other stuff you like first time we meet, now waiting for Jiri to chime in...
Thanks!
- Arnaldo
Quoted 15 lines
Wang Nan (6):
perf tools: Add -lutil in python lib list for broken python-config perf tools: Add missing headers in perf's MANIFEST
perf tools: Fix phony build target for build-test
perf tools: Set parallel making options build-test
perf tools: Pass O option to Makefile.perf in build-test perf tools: Test correct path of perf in build-testtools/perf/MANIFEST | 2 ++ tools/perf/config/Makefile | 2 +- tools/perf/tests/make | 56 +++++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 17 deletions(-)Signature · 1 line
1.8.3.4
Quoted 7 lines · Wangnan (F)
Hi Jiri,
I think if we can fold the feature checking in build-test then it can be even faster. We need only 2 feature check result (for normal building and static building), but in a full build-test we run 138 rounds feature checking. Would you please give some help on it?
I think we can add separate target that will skip the feature detection, given that there's extra call before generating FEATURE-DUMP file.. I'll check on this
Quoted 7 lines
Now I have a 160 cores server for building perf, currently busy time and idle time are 5:3 (result from top. I use 1s interval. Each test case takes about 8s, in about 5 seconds I can see full of 'cc1' in perf top result). A full test-build still require more than 0.3 hours (8s * 34 cases * 2 (with and without O) * 2 (
Makefileand Makefile.perf) = 1088 seconds).
nice
thanks,
jirka