Skip to contentSkip to conversation

tools build: Introduce features dump include makefile

PATCH Applied Jiri Olsa 4 participants 12 messages Nov 26, 2015 – Nov 27, 2015

Subsystems (3)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/3 tools build: Introduce features dump include makefile

Creating the FEATURE-INCLUDE file, that contains all features status dumped in make's variable format:
...
feature-backtrace=1
feature-dwarf=1
...

It's purpose is to be included in sub-project makefiles to get features detection state. This way we can run the detection only in top level project and propagate it down.

---
 tools/build/Makefile.feature | 12 ++++++++++++
 tools/perf/.gitignore        |  1 +
 tools/perf/Makefile.perf     |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)
tools/build/Makefile.feature +12 -0
index 37ff4c9f92f1..51f8d5928f98 100644
@@ -131,6 +131,16 @@ ifeq ($(dwarf-post-unwind),1)
   FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
 endif
 
+# The FEATURE-INCLUDE file contains all features status
+# dumped in make's variable format:
+#   ...
+#   feature-backtrace=1
+#   feature-dwarf=1
+#   ...
+# It's to be included in sub-project makefiles to get
+# features detection state.
+FEATURE_INCLUDE_FILENAME = $(OUTPUT)FEATURE-INCLUDE$(FEATURE_USER)
+
 # The $(feature_display) controls the default detection message
 # output. It's set if:
 # - detected features differes from stored features from
@@ -140,6 +150,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
 
tools/perf/.gitignore +1 -0
index 3d1bb802dbf4..4a3eb8dedc54 100644
@@ -2,6 +2,7 @@ PERF-CFLAGS
 PERF-GUI-VARS
 PERF-VERSION-FILE
 FEATURE-DUMP
+FEATURE-INCLUDE
 perf
 perf-read-vdso32
 perf-read-vdsox32
tools/perf/Makefile.perf +1 -1
index 0d19d5447d6c..97badfa2a195 100644
@@ -589,7 +589,7 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean config-clean
 	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT).config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)FEATURE-INCLUDE $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
 		$(OUTPUT)util/intel-pt-decoder/inat-tables.c
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
Signature · 1 line
2.4.3
author reviewer
#1 lore raw

PATCH 2/3 perf build: Use FEATURE-INCLUDE in bpf subproject

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

---
 tools/lib/bpf/Makefile   | 4 ++++
 tools/perf/Makefile.perf | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
tools/lib/bpf/Makefile +4 -0
index a3caaf3eafbd..f0818f3b0d40 100644
@@ -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),)
 include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES_INCLUDE)
+endif
 
 export prefix libdir src obj
 
tools/perf/Makefile.perf +1 -1
index 97badfa2a195..d2b20a1f4a21 100644
@@ -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_INCLUDE=$(realpath $(OUTPUT)FEATURE-INCLUDE)
 
 $(LIBBPF)-clean:
 	$(call QUIET_CLEAN, libbpf)
Signature · 1 line
2.4.3
#2 lore raw

Re: [PATCH 2/3] perf build: Use FEATURE-INCLUDE in bpf subproject

Em Thu, Nov 26, 2015 at 02:54:03PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

Clashes with:

d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning")

That has, at that point:

+check_feat := 1
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help +ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+ check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
include $(srctree)/tools/build/Makefile.feature
+endif

On a related note:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

Can we get away with that "make[2]: Nothing to be done for 'fixdep'." line?

- Arnaldo

Quoted 36 lines
---
 tools/lib/bpf/Makefile   | 4 ++++
 tools/perf/Makefile.perf | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
tools/lib/bpf/Makefile +4 -0
index a3caaf3eafbd..f0818f3b0d40 100644
@@ -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),)
 include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES_INCLUDE)
+endif
 
 export prefix libdir src obj
 
tools/perf/Makefile.perf +1 -1
index 97badfa2a195..d2b20a1f4a21 100644
@@ -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_INCLUDE=$(realpath $(OUTPUT)FEATURE-INCLUDE)
 
 $(LIBBPF)-clean:
 	$(call QUIET_CLEAN, libbpf)
Signature · 1 line
2.4.3
#3 lore raw

Re: [PATCH 2/3] perf build: Use FEATURE-INCLUDE in bpf subproject

Quoted 15 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 26, 2015 at 02:54:03PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

Clashes with:

d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning")

That has, at that point:

(quoted diff) +1 -0
+check_feat := 1

Review

Quoted 10 lines
(quoted diff) +9 -0
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help
+ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+  check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
 include $(srctree)/tools/build/Makefile.feature
+endif

I see, please take that one, I'll rebase my changes over that

we still need more comments/feedback on that anyway ;-)

jirka

#4 lore raw

Re: [PATCH 2/3] perf build: Use FEATURE-INCLUDE in bpf subproject

In reply to Arnaldo Carvalho de Melo
Quoted 28 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 26, 2015 at 02:54:03PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

Clashes with:

d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning")

That has, at that point:

(quoted diff) +10 -0
+check_feat := 1
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help
+ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+  check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
 include $(srctree)/tools/build/Makefile.feature
+endif

On a related note:

Quoted 8 lines

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

Can we get away with that "make[2]: Nothing to be done for 'fixdep'." line?

I'll check on that

jirka

#5 lore raw

PATCH 1/1 tools build: Use fixdep with OUTPUT path prefix

Quoted 35 lines · Jiri Olsa
Quoted 34 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 26, 2015 at 02:54:03PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

Clashes with:

d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning")

That has, at that point:

(quoted diff) +10 -0
+check_feat := 1
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help
+ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+  check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
 include $(srctree)/tools/build/Makefile.feature
+endif

On a related note:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

Quoted 4 lines
Quoted 2 lines

Can we get away with that "make[2]: Nothing to be done for 'fixdep'." line?

I'll check on that

good we don't supress all make's output, sometimes it finds a bug ;-) please check with attached patch..

thanks,
jirka

---
Adding OUTPUT path prefix for fixdep target so we use it properly in out of tree builds.

If the fixdep already existed in the tree, the out of tree build would see it already exist and did not build the out of tree version, as reported by Arnaldo:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

---
 tools/build/Makefile         | 2 +-
 tools/build/Makefile.include | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/build/Makefile +1 -1
index a93036272d43..0d5a0e3a8fa9 100644
@@ -25,7 +25,7 @@ export Q srctree CC LD
 MAKEFLAGS := --no-print-directory
 build     := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
-all: fixdep
+all: $(OUTPUT)fixdep
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
tools/build/Makefile.include +1 -1
index 4e09ad617a60..6d5edd275bef 100644
@@ -4,7 +4,7 @@ ifdef CROSS_COMPILE
 fixdep:
 else
 fixdep:
-	$(Q)$(MAKE) -C $(srctree)/tools/build fixdep
+	$(Q)$(MAKE) -C $(srctree)/tools/build $(OUTPUT)fixdep
 endif
 
 .PHONY: fixdep
Signature · 1 line
2.4.3
#6 lore raw

Re: [PATCH] tools build: Use fixdep with OUTPUT path prefix

Em Thu, Nov 26, 2015 at 07:50:55PM +0100, Jiri Olsa escreveu:

Quoted 41 lines · Jiri Olsa
Quoted 35 lines · Arnaldo Carvalho de Melo
Quoted 34 lines

Em Thu, Nov 26, 2015 at 02:54:03PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

Using FEATURE-INCLUDE in bpf subproject in case bpf is built via perf. Keep the current features detection for other cases.

Clashes with:

d8ad6a15cc3a ("tools lib bpf: Don't do a feature check when cleaning")

That has, at that point:

(quoted diff) +10 -0
+check_feat := 1
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help
+ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+  check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
 include $(srctree)/tools/build/Makefile.feature
+endif

On a related note:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

Quoted 4 lines
Quoted 2 lines

Can we get away with that "make[2]: Nothing to be done for 'fixdep'." line?

I'll check on that

Quoted 5 lines

good we don't supress all make's output, sometimes it finds a bug ;-) please check with attached patch..

thanks,
jirka

Clashes with:

commit 5725dd8fa888b4dcdff58241f9d3d3ac42a048e2

Author: Wang Nan <[email protected]>
Date:   Tue Nov 24 13:36:06 2015 +0000

tools build: Clean CFLAGS and LDFLAGS for fixdep

And this should even be already in tip, let me see, yes:

https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=5725dd8fa888b4dcdff58241f9d3d3ac42a048e2

I'm fixing this up, as this one is easy.

- Arnaldo

Quoted 51 lines

---
Adding OUTPUT path prefix for fixdep target so we use it properly in out of tree builds.

If the fixdep already existed in the tree, the out of tree build would see it already exist and did not build the out of tree version, as reported by Arnaldo:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

---
 tools/build/Makefile         | 2 +-
 tools/build/Makefile.include | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/build/Makefile +1 -1
index a93036272d43..0d5a0e3a8fa9 100644
@@ -25,7 +25,7 @@ export Q srctree CC LD
 MAKEFLAGS := --no-print-directory
 build     := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
-all: fixdep
+all: $(OUTPUT)fixdep
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
tools/build/Makefile.include +1 -1
index 4e09ad617a60..6d5edd275bef 100644
@@ -4,7 +4,7 @@ ifdef CROSS_COMPILE
 fixdep:
 else
 fixdep:
-	$(Q)$(MAKE) -C $(srctree)/tools/build fixdep
+	$(Q)$(MAKE) -C $(srctree)/tools/build $(OUTPUT)fixdep
 endif
 
 .PHONY: fixdep
Signature · 1 line
2.4.3
#7 lore raw

[tip:perf/core] tools build: Use fixdep with OUTPUT path prefix

In reply to Jiri Olsa
tools build: Use fixdep with OUTPUT path prefix
Commit-ID:  5e50426d5d9049dfdb8b2b18e761717e7e80a6ad
Gitweb:     http://git.kernel.org/tip/5e50426d5d9049dfdb8b2b18e761717e7e80a6ad
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 26 Nov 2015 19:50:55 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 26 Nov 2015 16:32:24 -0300

tools build: Use fixdep with OUTPUT path prefix

Adding OUTPUT path prefix for fixdep target so we use it properly in out of tree builds.

If the fixdep already existed in the tree, the out of tree build would see it already exist and did not build the out of tree version, as reported by Arnaldo:

[acme@zoo linux]$ make O=/tmp/build/perf -C tools/perf
make: Entering directory '/home/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
make[2]: Nothing to be done for 'fixdep'.
make: Leaving directory '/home/git/linux/tools/perf'

Cc David Ahern <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Wang Nan <[email protected]>
[ Fixed conflict with 5725dd8fa888 ("tools build: Clean CFLAGS and LDFLAGS for fixdep") ]
---
 tools/build/Makefile         | 2 +-
 tools/build/Makefile.include | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/build/Makefile +1 -1
index a930362..0d5a0e3 100644
@@ -25,7 +25,7 @@ export Q srctree CC LD
 MAKEFLAGS := --no-print-directory
 build     := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
-all: fixdep
+all: $(OUTPUT)fixdep
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
tools/build/Makefile.include +1 -1
index 6254760..be630be 100644
@@ -4,7 +4,7 @@ ifdef CROSS_COMPILE
 fixdep:
 else
 fixdep:
-	$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= fixdep
+	$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep
 endif
 
 .PHONY: fixdep
author reviewer
#8 lore raw

PATCH 3/3 perf build: Fix traceevent plugins build race

In reply to Jiri Olsa

Ingo reported following build failure:

  $ make clean install
  ...
    CC       plugin_kmem.o
  fixdep: error opening depfile: ./.plugin_hrtimer.o.d: No such file or directory
  /home/mingo/tip/tools/build/Makefile.build:77: recipe for target
  'plugin_hrtimer.o' failed
  make[3]: *** [plugin_hrtimer.o] Error 2
  Makefile:189: recipe for target 'plugin_hrtimer-in.o' failed
  make[2]: *** [plugin_hrtimer-in.o] Error 2
  Makefile.perf:414: recipe for target 'libtraceevent_plugins' failed
  make[1]: *** [libtraceevent_plugins] Error 2
  make[1]: *** Waiting for unfinished jobs....

Currently we have the install-traceevent-plugins target being dependent on $(LIBTRACEEVENT), which will actualy not build any plugin. So the install-traceevent-plugins target itself will try to build plugins, but..

Plugins built is also triggered by perf build itself via libtraceevent_plugins target.

This might cause a race having one make thread removing temp files from another and result in above error. Fixing this by having proper plugins build dependency before installing plugins.

---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
index d2b20a1f4a21..7338a7e62fcd 100644
@@ -420,7 +420,7 @@ $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
 
-install-traceevent-plugins: $(LIBTRACEEVENT)
+install-traceevent-plugins: libtraceevent_plugins
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
 
 $(LIBAPI): fixdep FORCE
Signature · 1 line
2.4.3
maintainer Applied
#9 lore raw

Re: [PATCH 3/3] perf build: Fix traceevent plugins build race

Em Thu, Nov 26, 2015 at 02:54:04PM +0100, Jiri Olsa escreveu:

Quoted 9 lines

Plugins built is also triggered by perf build itself via libtraceevent_plugins target.

This might cause a race having one make thread removing temp files from another and result in above error. Fixing this by having proper plugins build dependency before installing plugins.

Reported-and-Tested-by : Ingo Molnar <[email protected]>

Thanks, applied.

- Arnaldo

#10 lore raw

[tip:perf/core] perf build: Fix traceevent plugins build race

In reply to Jiri Olsa
perf build: Fix traceevent plugins build race
Commit-ID:  67befc652845c8ffbefc8d173a6e6ced14d472f1
Gitweb:     http://git.kernel.org/tip/67befc652845c8ffbefc8d173a6e6ced14d472f1
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 26 Nov 2015 14:54:04 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 26 Nov 2015 13:35:38 -0300

perf build: Fix traceevent plugins build race

Ingo reported following build failure:

  $ make clean install
  ...
    CC       plugin_kmem.o
  fixdep: error opening depfile: ./.plugin_hrtimer.o.d: No such file or directory
  /home/mingo/tip/tools/build/Makefile.build:77: recipe for target
  'plugin_hrtimer.o' failed
  make[3]: *** [plugin_hrtimer.o] Error 2
  Makefile:189: recipe for target 'plugin_hrtimer-in.o' failed
  make[2]: *** [plugin_hrtimer-in.o] Error 2
  Makefile.perf:414: recipe for target 'libtraceevent_plugins' failed
  make[1]: *** [libtraceevent_plugins] Error 2
  make[1]: *** Waiting for unfinished jobs....

Currently we have the install-traceevent-plugins target being dependent on $(LIBTRACEEVENT), which will actualy not build any plugin. So the install-traceevent-plugins target itself will try to build plugins, but..

Plugins built is also triggered by perf build itself via libtraceevent_plugins target.

This might cause a race having one make thread removing temp files from another and result in above error. Fixing this by having proper plugins build dependency before installing plugins.

---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
index 0d19d54..929a32b 100644
@@ -420,7 +420,7 @@ $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
 
-install-traceevent-plugins: $(LIBTRACEEVENT)
+install-traceevent-plugins: libtraceevent_plugins
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
 
 $(LIBAPI): fixdep FORCE
#11 lore raw
In reply to Jiri Olsa

Em Thu, Nov 26, 2015 at 02:54:02PM +0100, Jiri Olsa escreveu:

Quoted 10 lines

Creating the FEATURE-INCLUDE file, that contains all features status dumped in make's variable format:

   ...
   feature-backtrace=1
   feature-dwarf=1
   ...

It's purpose is to be included in sub-project makefiles to get features detection state. This way we can run the detection only in top level project and propagate it down.

See, you can do it, nice explanation! :-)

- Arnaldo

Quoted 66 lines
---
 tools/build/Makefile.feature | 12 ++++++++++++
 tools/perf/.gitignore        |  1 +
 tools/perf/Makefile.perf     |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)
tools/build/Makefile.feature +12 -0
index 37ff4c9f92f1..51f8d5928f98 100644
@@ -131,6 +131,16 @@ ifeq ($(dwarf-post-unwind),1)
   FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
 endif
 
+# The FEATURE-INCLUDE file contains all features status
+# dumped in make's variable format:
+#   ...
+#   feature-backtrace=1
+#   feature-dwarf=1
+#   ...
+# It's to be included in sub-project makefiles to get
+# features detection state.
+FEATURE_INCLUDE_FILENAME = $(OUTPUT)FEATURE-INCLUDE$(FEATURE_USER)
+
 # The $(feature_display) controls the default detection message
 # output. It's set if:
 # - detected features differes from stored features from
@@ -140,6 +150,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
 
tools/perf/.gitignore +1 -0
index 3d1bb802dbf4..4a3eb8dedc54 100644
@@ -2,6 +2,7 @@ PERF-CFLAGS
 PERF-GUI-VARS
 PERF-VERSION-FILE
 FEATURE-DUMP
+FEATURE-INCLUDE
 perf
 perf-read-vdso32
 perf-read-vdsox32
tools/perf/Makefile.perf +1 -1
index 0d19d5447d6c..97badfa2a195 100644
@@ -589,7 +589,7 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean config-clean
 	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT).config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)FEATURE-INCLUDE $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
 		$(OUTPUT)util/intel-pt-decoder/inat-tables.c
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
Signature · 1 line
2.4.3