Re: [GIT PULL 0/7] perf/core improvements and fixes

From: Jiri Olsa
Date: Tue Nov 24 2015 - 05:29:15 EST


On Tue, Nov 24, 2015 at 09:10:42AM +0100, Ingo Molnar wrote:

SNIP

> > tools/perf/util/unwind-libdw.c | 53 +++++++++++-----
> > tools/perf/util/unwind-libdw.h | 2 +
> > tools/perf/util/unwind-libunwind.c | 60 +++++++++++-------
> > 11 files changed, 272 insertions(+), 39 deletions(-)
> > create mode 100644 tools/perf/Documentation/perf-config.txt
> > create mode 100644 tools/perf/builtin-config.c
>
> Hm, I noticed something weird - I think it started with this pull request - the
> feature detection build messages come mixed with the regular build:
>
> triton:~/tip/tools/perf> make
> BUILD: Doing 'make -j12' parallel build
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... glibc: [ on ]
> ... gtk2: [ on ]
> ... libaudit: [ on ]
> ... libbfd: [ on ]
> ... libelf: [ on ]
> ... libnuma: [ on ]
> ... numa_num_possible_cpus: [ on ]
> ... libperl: [ on ]
> ... libpython: [ on ]
> ... libslang: [ on ]
> ... libunwind: [ on ]
> ... libdw-dwarf-unwind: [ on ]
> ... zlib: [ on ]
> ... lzma: [ on ]
> ... get_cpuid: [ on ]
> ... bpf: [ on ]
>
> GEN common-cmds.h
> CC perf-read-vdso32
> CC perf-read-vdsox32
> CC ui/gtk/browser.o
> CC ui/gtk/hists.o
> CC ui/gtk/setup.o
> CC ui/gtk/util.o
> CC ui/gtk/helpline.o
> CC ui/gtk/progress.o
> CC ui/gtk/annotate.o
> CC util/abspath.o
> CC fd/array.o
>
> Auto-detecting system features:
> CC event-parse.o
> ... libelf: [ on ]
> PERF_VERSION = 4.4.rc2.g9327ca
> ... bpf: [ on ]
>
> CC util/alias.o
> CC libbpf.o


so how about we let perf do the overall checking and propagate
that via include file that will setup feature-$(feature) variables

if bpf is built by perf, perf passes this makefile include path
and bpf includes it.. otherwise it runs the standard detection

please test attached patch (bpf guys mainly ;-) )

if that works for you, I'll clean it up a bit and post

thanks,
jirka


---
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 37ff4c9f92f1..a8a65ff010a4 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -131,6 +131,8 @@ ifeq ($(dwarf-post-unwind),1)
FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
endif

+FEATURE_INCLUDE_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER).include
+
# The $(feature_display) controls the default detection message
# output. It's set if:
# - detected features differes from stored features from
@@ -140,6 +142,8 @@ endif

ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
$(shell echo "$(FEATURE_DUMP)" > $(FEATURE_DUMP_FILENAME))
+ $(shell rm -f $(FEATURE_INCLUDE_FILENAME))
+ $(foreach feat,$(FEATURE_TESTS),$(shell echo "feature-$(feat)=$(feature-$(feat))" >> $(FEATURE_INCLUDE_FILENAME)))
feature_display := 1
endif

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index a3caaf3eafbd..0177bf81f826 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -71,7 +71,11 @@ FEATURE_DISPLAY = libelf bpf
INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

+ifeq ($(FEATURES),)
include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES)
+endif

export prefix libdir src obj

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 929a32ba15f5..4f18c1210509 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -431,7 +431,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
+ $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES=$(realpath $(OUTPUT)FEATURE-DUMP.include)

$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/