From: Ingo Molnar <mingo@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH 02/52] tools/perf/build: Add feature check core code
Date: Thu, 10 Oct 2013 09:21:21 +0200 [thread overview]
Message-ID: <20131010072121.GM10246@gmail.com> (raw)
In-Reply-To: <87pprdk7ft.fsf@sejong.aot.lge.com>
* Namhyung Kim <namhyung@kernel.org> wrote:
> Hi Ingo,
>
> On Tue, 8 Oct 2013 12:10:32 +0200, Ingo Molnar wrote:
> > +feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1))
> > +define feature_check_code
> > + feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
> > +endef
> > +
> > +#
> > +# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
> > +#
> > +$(info Testing features:)
> > +$(shell make -i -j -C config/feature-checks >/dev/null 2>&1)
> > +$(info done)
> > +
> > +FEATURE_TESTS = hello
> > +
> > +$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
>
> So as far as I can see, all the feature checking goes twice - once in
> $(shell make ...) and another in $(foreach test,...). They look like
> doing exactly same thing. And the final Makefile in this series still
> has it twice. Is it intentional or did I miss something?
Yes - and this is a performance trick.
The first run is to build them all in parallel:
$(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1)
Note how we build in parallel (-j), ignore errors (-i) and suppress all
output.
This is very fast even if all testcases are rebuilt, but we cannot
possibly recover which feature test failed.
So we run it once more, this time serially, and recover the test results.
The vast majority of testcases will pass, and the repeat build will do, in
essence:
comet:~/tip/tools/perf/config/feature-checks> perf stat --null --repeat 10 make test-libelf >/dev/null
Performance counter stats for 'make test-libelf' (10 runs):
0.014682647 seconds time elapsed ( +- 0.14% )
so it's just 14 msecs to recover each testcase result.
In theory we could optimize this further, by generating an actual test
success/failure file via the initial parallel make attempt, and recovering
those flags via the serial loop. That should be even faster.
Thanks,
Ingo
next prev parent reply other threads:[~2013-10-10 7:21 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 10:10 [PATCH -v2 00/52] tools/perf: Speed up the build system Ingo Molnar
2013-10-08 10:10 ` [PATCH 01/52] tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT Ingo Molnar
2013-10-08 10:10 ` [PATCH 02/52] tools/perf/build: Add feature check core code Ingo Molnar
2013-10-10 5:42 ` Namhyung Kim
2013-10-10 7:21 ` Ingo Molnar [this message]
2013-10-10 8:22 ` Namhyung Kim
2013-10-08 10:10 ` [PATCH 03/52] tools/perf/build: Add 'autodep' functionality, generate feature test dependencies automatically Ingo Molnar
2013-10-10 5:44 ` Namhyung Kim
2013-10-10 7:12 ` Ingo Molnar
2013-10-10 7:12 ` [PATCH] tools/perf/build: Simplify the autodep inclusion rule Ingo Molnar
2013-10-08 10:10 ` [PATCH 04/52] tools/perf/build: Split out feature check: 'libnuma' Ingo Molnar
2013-10-08 10:10 ` [PATCH 05/52] tools/perf/build: Split out feature check: 'stackprotector-all' Ingo Molnar
2013-10-08 10:10 ` [PATCH 06/52] tools/perf/build: Split out feature check: 'stackprotector' Ingo Molnar
2013-10-10 5:50 ` Namhyung Kim
2013-10-10 7:08 ` Ingo Molnar
2013-10-10 7:09 ` [PATCH] tools/perf/build: Improve the 'stackprotector' feature test Ingo Molnar
2013-10-08 10:10 ` [PATCH 07/52] tools/perf/build: Split out feature check: 'volatile-register-var' Ingo Molnar
2013-10-10 5:55 ` Namhyung Kim
2013-10-10 7:03 ` Ingo Molnar
2013-10-10 7:03 ` [PATCH] tools/perf/build: Remove the volatile-register-var feature check Ingo Molnar
2013-10-08 10:10 ` [PATCH 08/52] tools/perf/build: Split out feature check: 'fortify-source' Ingo Molnar
2013-10-08 10:10 ` [PATCH 09/52] tools/perf/build: Split out feature check: 'bionic' Ingo Molnar
2013-10-08 10:10 ` [PATCH 10/52] tools/perf/build: Clean up the libelf logic in config/Makefile Ingo Molnar
2013-10-08 10:10 ` [PATCH 11/52] tools/perf/build: Split out feature check: 'libelf' Ingo Molnar
2013-10-08 10:10 ` [PATCH 12/52] tools/perf/build: Split out feature check: 'glibc' Ingo Molnar
2013-10-08 10:10 ` [PATCH 13/52] tools/perf/build: Split out feature check: 'dwarf' Ingo Molnar
2013-10-08 10:10 ` [PATCH 14/52] tools/perf/build: Clean up the mmap logic in config/Makefile Ingo Molnar
2013-10-08 10:10 ` [PATCH 15/52] tools/perf/build: Split out feature check: 'libelf-mmap' Ingo Molnar
2013-10-10 6:00 ` Namhyung Kim
2013-10-10 6:56 ` Ingo Molnar
2013-10-10 6:57 ` [PATCH] tools/perf/build: Simplify the libelf logic Ingo Molnar
2013-10-08 10:10 ` [PATCH 16/52] tools/perf/build: Split out feature check: 'libelf-getphdrnum' Ingo Molnar
2013-10-08 10:10 ` [PATCH 17/52] tools/perf/build: Clean up the libunwind logic in config/Makefile Ingo Molnar
2013-10-08 10:10 ` [PATCH 18/52] tools/perf/build: Split out feature check: 'libunwind' Ingo Molnar
2013-10-08 15:21 ` David Ahern
2013-10-09 6:45 ` Ingo Molnar
2013-10-08 10:10 ` [PATCH 19/52] tools/perf/build: Split out feature check: 'libaudit' Ingo Molnar
2013-10-08 10:10 ` [PATCH 20/52] tools/perf/build: Split out feature check: 'libslang' Ingo Molnar
2013-10-08 10:10 ` [PATCH 21/52] tools/perf/build: Split out feature check: 'gtk2' Ingo Molnar
2013-10-08 10:10 ` [PATCH 22/52] tools/perf/build: Split out feature check: 'gtk2-infobar' Ingo Molnar
2013-10-08 10:10 ` [PATCH 23/52] tools/perf/build: Split out feature check: 'libperl' Ingo Molnar
2013-10-08 10:10 ` [PATCH 24/52] tools/perf/build: Split out feature check: 'libpython' Ingo Molnar
2013-10-08 10:10 ` [PATCH 25/52] tools/perf/build: Split out feature check: 'libpython-version' Ingo Molnar
2013-10-08 10:10 ` [PATCH 26/52] tools/perf/build: Split out feature check: 'libbfd' Ingo Molnar
2013-10-10 6:07 ` Namhyung Kim
2013-10-10 6:50 ` [PATCH] tools/perf/build: Fix DPACKAGE definitions for the libbfd et al testcases Ingo Molnar
2013-10-10 6:50 ` [PATCH 26/52] tools/perf/build: Split out feature check: 'libbfd' Ingo Molnar
2013-10-08 10:10 ` [PATCH 27/52] tools/perf/build: Split out feature check: 'strlcpy' Ingo Molnar
2013-10-08 10:10 ` [PATCH 28/52] tools/perf/build: Split out feature check: 'on-exit' Ingo Molnar
2013-10-10 6:12 ` Namhyung Kim
2013-10-10 6:43 ` Ingo Molnar
2013-10-08 10:10 ` [PATCH 29/52] tools/perf/build: Split out feature check: 'backtrace' Ingo Molnar
2013-10-08 10:11 ` [PATCH 30/52] tools/perf: Clean up util/include/linux/compiler.h Ingo Molnar
2013-10-08 10:11 ` [PATCH 31/52] tools/perf: Turn strlcpy() into a __weak function Ingo Molnar
2013-10-08 10:11 ` [PATCH 32/52] tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target Ingo Molnar
2013-10-08 15:51 ` Jiri Olsa
2013-10-09 6:47 ` Ingo Molnar
2013-10-10 6:19 ` Namhyung Kim
2013-10-10 7:24 ` Ingo Molnar
2013-10-10 8:28 ` Namhyung Kim
2013-10-08 10:11 ` [PATCH 33/52] tools/perf/build: Speed up git-version test on re-make Ingo Molnar
2013-10-08 10:11 ` [PATCH 34/52] tools/perf/build: Speed up the final link Ingo Molnar
2013-10-08 10:11 ` [PATCH 35/52] tools/perf: Fix double/triple-build of the feature detection logic during 'make install' et al Ingo Molnar
2013-10-08 10:11 ` [PATCH 36/52] tools/perf/build: Invoke feature-checks 'clean' target from the main Makefile Ingo Molnar
2013-10-08 10:11 ` [PATCH 37/52] tools/perf/build: Speed up auto-detection Ingo Molnar
2013-10-08 10:11 ` [PATCH 38/52] tools/perf/build: Improve printout-of auto-detected features Ingo Molnar
2013-10-08 10:11 ` [PATCH 39/52] tools/perf/build: Automatically build in parallel, based on number of CPUs in the system Ingo Molnar
2013-10-08 10:11 ` [PATCH 40/52] tools/perf/build: Flip Makefile.parallel and Makefile.perf Ingo Molnar
2013-10-08 10:11 ` [PATCH 41/52] tools/perf/build: Standardize the various messages output by parallel make Ingo Molnar
2013-10-08 10:11 ` [PATCH 42/52] tools/perf/build: Split out feature checks: 'liberty', 'liberty-z', 'cplus-demangle' Ingo Molnar
2013-10-08 10:11 ` [PATCH 43/52] tools/perf/build: Remove unused config/feature-tests.mak Ingo Molnar
2013-10-08 10:11 ` [PATCH 44/52] tools/perf/build: Clean up various testcases Ingo Molnar
2013-10-10 6:20 ` Namhyung Kim
2013-10-10 6:41 ` Ingo Molnar
2013-10-08 10:11 ` [PATCH 45/52] tools/perf/build: Collapse the test-all.c testcase Ingo Molnar
2013-10-08 10:11 ` [PATCH 46/52] tools/perf/build: Pass through all targets to Makefile.perf Ingo Molnar
2013-10-08 10:11 ` [PATCH 47/52] tools/perf/build: Make sure autodep feature binaries honor the O= setting Ingo Molnar
2013-10-08 10:11 ` [PATCH 48/52] tools/perf/build: Exclude MAKEFLAGS from nested invocation Ingo Molnar
2013-10-10 6:24 ` Namhyung Kim
2013-10-10 6:36 ` Ingo Molnar
2013-10-08 10:11 ` [PATCH 49/52] tools/perf/build: Fix non-canonical directory names in O= Ingo Molnar
2013-10-08 10:11 ` [PATCH 50/52] tools/perf/build: Fix O=/some/dir perf.o type of targets Ingo Molnar
2013-10-10 6:35 ` Namhyung Kim
2013-10-10 6:39 ` Ingo Molnar
2013-10-10 8:43 ` Namhyung Kim
2013-10-08 10:11 ` [PATCH 51/52] tools/perf/build: Harmonize the style of the feature testcases Ingo Molnar
2013-10-08 10:11 ` [PATCH 52/52] tools/perf/build: Pass through LDFLAGS to feature tests Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131010072121.GM10246@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).