hi,
Changing the contents of the FEATURE-DUMP file,
so it looks like:
feature-backtrace=1
feature-dwarf=0
feature-fortify-source=1
feature-sync-compare-and-swap=0
This way it could get included in sub projects,
so they won't be forced to redo features detection.
changing bpf library to use that, so it's not forced
to rerun feature detection if compiled within perf.
Also available in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
thanks,
jirka
---
Jiri Olsa (5):
tools build feature: Fix feature_check_display_code typo
tools build feature: Move dwarf post unwind choice output into perf
tools build feature: Introduce feature_ass macro
tools build feature: Use value assignment form for FEATURE-DUMP file
perf build: Use FEATURE-DUMP in bpf subproject
tools/build/Makefile.feature | 41 +++++++++++++++++++++++++++--------------
tools/lib/bpf/Makefile | 4 ++++
tools/perf/Makefile.perf | 2 +-
tools/perf/config/Makefile | 4 ++++
4 files changed, 36 insertions(+), 15 deletions(-)
This function is cursed.. ;-)
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/build/Makefile.feature | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 6c0519de765d..a8b4befdef7e 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -143,7 +143,7 @@ ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
endif
feature_display_check = $(eval $(feature_check_display_code))
-define feature_display_check_code
+define feature_check_display_code
ifneq ($(feature-$(1)), 1)
feature_display := 1
endif
--
2.4.3
We decide what dwarf unwind to choose way after Makefile.feature
makefile is included. The $(dwarf-post-unwind) is not even set at
that time. For the same reason it was never included in FEATURE-DUMP
file.
Moving it into perf VF=1 verbose display.
$ make VF=1
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
...
... LIBUNWIND_DIR:
... LIBDW_DIR:
... DWARF post unwind library: libunwind
...
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/build/Makefile.feature | 9 ---------
tools/perf/config/Makefile | 4 ++++
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index a8b4befdef7e..20753124c8f4 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -126,10 +126,6 @@ FEATURE_DUMP_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER)
FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
FEATURE_DUMP_FILE := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
-ifeq ($(dwarf-post-unwind),1)
- FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
-endif
-
# The $(feature_display) controls the default detection message
# output. It's set if:
# - detected features differes from stored features from
@@ -160,11 +156,6 @@ ifeq ($(feature_display),1)
$(info )
$(info Auto-detecting system features:)
$(foreach feat,$(FEATURE_DISPLAY),$(call feature_print_status,$(feat),))
-
- ifeq ($(dwarf-post-unwind),1)
- $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
- endif
-
ifneq ($(feature_verbose),1)
$(info )
endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index a5524179d26e..18b2f96d0941 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -751,6 +751,10 @@ ifeq ($(VF),1)
$(call print_var,sysconfdir)
$(call print_var,LIBUNWIND_DIR)
$(call print_var,LIBDW_DIR)
+
+ ifeq ($(dwarf-post-unwind),1)
+ $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
+ endif
$(info )
endif
--
2.4.3
The feature_ass macro generates feature value
assignment for name, like:
$(call feature_ass,dwarf) == feature-dwarf=1
This will be used more in following patches.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/build/Makefile.feature | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 20753124c8f4..bd6eff14c8f9 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -122,8 +122,14 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef
+#
+# generates feature value assignment for name, like:
+# $(call feature_ass,dwarf) == feature-dwarf=1
+#
+feature_ass = feature-$(1)=$(feature-$(1))
+
FEATURE_DUMP_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER)
-FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
+FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),$(call feature_ass,$(feat)))
FEATURE_DUMP_FILE := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
# The $(feature_display) controls the default detection message
--
2.4.3
Changing the contents of the FEATURE-DUMP file,
so it looks like:
feature-backtrace=1
feature-dwarf=0
feature-fortify-source=1
feature-sync-compare-and-swap=0
This way it could get included in sub projects,
so they won't be forced to redo features detection.
Also now storing the complete set of features.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/build/Makefile.feature | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index bd6eff14c8f9..7796313e5ab8 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -129,8 +129,24 @@ endef
feature_ass = feature-$(1)=$(feature-$(1))
FEATURE_DUMP_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER)
-FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),$(call feature_ass,$(feat)))
-FEATURE_DUMP_FILE := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
+FEATURE_DUMP := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
+
+feature_dump_check = $(eval $(feature_dump_check_code))
+define feature_dump_check_code
+ ifeq ($(findstring $(1),$(FEATURE_DUMP)),)
+ $(2) := 1
+ endif
+endef
+
+#
+# First check if any test from FEATURE_DISPLAY
+# and set feature_display := 1 if it does
+$(foreach feat,$(FEATURE_DISPLAY),$(call feature_dump_check,$(call feature_ass,$(feat)),feature_display))
+
+#
+# Now also check if any other test changed,
+# so we force FEATURE-DUMP generation
+$(foreach feat,$(FEATURE_TESTS),$(call feature_dump_check,$(call feature_ass,$(feat)),feature_dump_changed))
# The $(feature_display) controls the default detection message
# output. It's set if:
@@ -139,9 +155,9 @@ FEATURE_DUMP_FILE := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_
# - one of the $(FEATURE_DISPLAY) is not detected
# - VF is enabled
-ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
- $(shell echo "$(FEATURE_DUMP)" > $(FEATURE_DUMP_FILENAME))
- feature_display := 1
+ifeq ($(feature_dump_changed),1)
+ $(shell rm -f $(FEATURE_DUMP_FILENAME))
+ $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_ass,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
endif
feature_display_check = $(eval $(feature_check_display_code))
--
2.4.3
Using FEATURE-DUMP in bpf subproject for features detection
in case bpf is built via perf. Keeping the current features
detection otherwise.
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/lib/bpf/Makefile | 4 ++++
tools/perf/Makefile.perf | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 636e3ddb93a1..919b71780710 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,7 +80,11 @@ endif
endif
ifeq ($(check_feat),1)
+ifeq ($(FEATURES_DUMP),)
include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES_DUMP)
+endif
endif
export prefix libdir src obj
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 569fcf022531..404e3b1c4e31 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -436,7 +436,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_DUMP=$(realpath $(OUTPUT)FEATURE-DUMP)
$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
--
2.4.3
On 2015/12/24 1:58, Jiri Olsa wrote:
> hi,
> Changing the contents of the FEATURE-DUMP file,
> so it looks like:
>
> feature-backtrace=1
> feature-dwarf=0
> feature-fortify-source=1
> feature-sync-compare-and-swap=0
>
> This way it could get included in sub projects,
> so they won't be forced to redo features detection.
>
> changing bpf library to use that, so it's not forced
> to rerun feature detection if compiled within perf.
>
> Also available in:
> git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>
> thanks,
> jirka
Tested-by: Wang Nan <[email protected]>
For the whole patch set.
Thank you.
>
> ---
> Jiri Olsa (5):
> tools build feature: Fix feature_check_display_code typo
> tools build feature: Move dwarf post unwind choice output into perf
> tools build feature: Introduce feature_ass macro
> tools build feature: Use value assignment form for FEATURE-DUMP file
> perf build: Use FEATURE-DUMP in bpf subproject
>
> tools/build/Makefile.feature | 41 +++++++++++++++++++++++++++--------------
> tools/lib/bpf/Makefile | 4 ++++
> tools/perf/Makefile.perf | 2 +-
> tools/perf/config/Makefile | 4 ++++
> 4 files changed, 36 insertions(+), 15 deletions(-)
On Thu, Dec 24, 2015 at 10:52:18AM +0800, Wangnan (F) wrote:
>
>
> On 2015/12/24 1:58, Jiri Olsa wrote:
> >hi,
> >Changing the contents of the FEATURE-DUMP file,
> >so it looks like:
> > feature-backtrace=1
> > feature-dwarf=0
> > feature-fortify-source=1
> > feature-sync-compare-and-swap=0
> >This way it could get included in sub projects,
> >so they won't be forced to redo features detection.
> >
> >changing bpf library to use that, so it's not forced
> >to rerun feature detection if compiled within perf.
> >
> >Also available in:
> > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >
> >thanks,
> >jirka
>
> Tested-by: Wang Nan <[email protected]>
>
> For the whole patch set.
I updated perf/fixes branch with Wang's tag
thanks,
jirka