Skip to contentSkip to conversation

perf tools: libperf related fixes

PATCH Applied Jiri Olsa 4 participants 13 messages Sep 1, 2019 – Sep 20, 2019 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

cover perf tools: libperf related fixes

hi,
sending some libperf related fixes.

thanks,
jirka

---
Jiri Olsa (4):
perf tools: Fix python/perf.so compilation perf tests: Fix static build test
perf tests: Add libperf automated test
libperf: Add missing event.h into install rule

 tools/perf/Makefile.perf | 2 +-
 tools/perf/lib/Makefile  | 1 +
 tools/perf/tests/make    | 8 ++++++--
 3 files changed, 8 insertions(+), 3 deletions(-)
author reviewer
#1 lore raw

PATCH 1/4 perf tools: Fix python/perf.so compilation

The python/perf.so compilation needs libperf ready, otherwise it fails:

  $ make python/perf.so JOBS=1
    BUILD:   Doing 'make -j1' parallel build
    GEN      python/perf.so
  gcc: error: /home/jolsa/kernel/linux-perf/tools/perf/lib/libperf.a: No such file or directory

Fixing this with by adding libperf dependency.

---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
index f9807d8c005b..2ccc12f3730b 100644
@@ -567,7 +567,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 # Create python binding output directory if not already present
 _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
 
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
+$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) $(LIBPERF)
 	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
Signature · 1 line
2.21.0
#2 lore raw

Re: [PATCH 1/4] perf tools: Fix python/perf.so compilation

Em Sun, Sep 01, 2019 at 02:48:19PM +0200, Jiri Olsa escreveu:

Quoted 9 lines

The python/perf.so compilation needs libperf ready, otherwise it fails:

  $ make python/perf.so JOBS=1
    BUILD:   Doing 'make -j1' parallel build
    GEN      python/perf.so
  gcc: error: /home/jolsa/kernel/linux-perf/tools/perf/lib/libperf.a: No such file or directory

Fixing this with by adding libperf dependency.

Thanks, tested, applied.

- Arnaldo

Quoted 21 lines
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
index f9807d8c005b..2ccc12f3730b 100644
@@ -567,7 +567,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 # Create python binding output directory if not already present
 _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
 
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
+$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) $(LIBPERF)
 	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
merge bot Applied
#3 lore raw

[tip: perf/urgent] perf python: Add missing python/perf.so dependency for libperf

In reply to Jiri Olsa
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     5079bde790304959bf744c548efdd5be660ea8e2
Gitweb:        https://git.kernel.org/tip/5079bde790304959bf744c548efdd5be660ea8e2
Author:        Jiri Olsa <[email protected]>
AuthorDate:    Sun, 01 Sep 2019 14:48:19 +02:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 10 Sep 2019 14:33:32 +01:00

perf python: Add missing python/perf.so dependency for libperf

The python/perf.so compilation needs libperf ready, otherwise it fails:

  $ make python/perf.so JOBS=1
    BUILD:   Doing 'make -j1' parallel build
    GEN      python/perf.so
  gcc: error: /home/jolsa/kernel/linux-perf/tools/perf/lib/libperf.a: No such file or directory

Fixing this with by adding libperf dependency.

---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
index f9807d8..2ccc12f 100644
@@ -567,7 +567,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 # Create python binding output directory if not already present
 _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
 
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
+$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) $(LIBPERF)
 	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
author reviewer
#4 lore raw

PATCH 2/4 perf tests: Fix static build test

In reply to Jiri Olsa
---
 tools/perf/tests/make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/make +1 -1
index 70c48475896d..17ee3facfd4d 100644
@@ -100,7 +100,7 @@ make_install_info   := install-info
 make_install_pdf    := install-pdf
 make_install_prefix       := install prefix=/tmp/krava
 make_install_prefix_slash := install prefix=/tmp/krava/
-make_static         := LDFLAGS=-static
+make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_JVMTI=1
 
 # all the NO_* variable combined
 make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
Signature · 1 line
2.21.0
#5 lore raw

Re: [PATCH 2/4] perf tests: Fix static build test

Em Sun, Sep 01, 2019 at 02:48:20PM +0200, Jiri Olsa escreveu:

Quoted 1 line

Can you explain why this is needed? Wat is the problem with building statically with those features? What happens when one tries to do it that way?

I.e. what is this fixing?

- Arnaldo

Quoted 20 lines
---
 tools/perf/tests/make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/make +1 -1
index 70c48475896d..17ee3facfd4d 100644
@@ -100,7 +100,7 @@ make_install_info   := install-info
 make_install_pdf    := install-pdf
 make_install_prefix       := install prefix=/tmp/krava
 make_install_prefix_slash := install prefix=/tmp/krava/
-make_static         := LDFLAGS=-static
+make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_JVMTI=1
 
 # all the NO_* variable combined
 make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
#6 lore raw

Re: [PATCH 2/4] perf tests: Fix static build test

Quoted 9 lines · Arnaldo Carvalho de Melo

Em Sun, Sep 01, 2019 at 02:48:20PM +0200, Jiri Olsa escreveu:

Quoted 1 line

Can you explain why this is needed? Wat is the problem with building statically with those features? What happens when one tries to do it that way?

I.e. what is this fixing?

sry, I have to disable VDSO and JVMTI for static build, because they are shared libraries and just won't pass with -static in LDFLAGS.. I wanted to throw it out, because I'm confused that the test is passing for you just like it is right now ;-)

I'll send out version with changelog

jirka

Quoted 27 lines

- Arnaldo

Quoted 20 lines
---
 tools/perf/tests/make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/make +1 -1
index 70c48475896d..17ee3facfd4d 100644
@@ -100,7 +100,7 @@ make_install_info   := install-info
 make_install_pdf    := install-pdf
 make_install_prefix       := install prefix=/tmp/krava
 make_install_prefix_slash := install prefix=/tmp/krava/
-make_static         := LDFLAGS=-static
+make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_JVMTI=1
 
 # all the NO_* variable combined
 make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
author reviewer
#7 lore raw

PATCH 3/4 perf tests: Add libperf automated test

In reply to Jiri Olsa

Adding libperf build test.

---
 tools/perf/tests/make | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/make +5 -1
index 17ee3facfd4d..128a0d801ac1 100644
@@ -327,6 +327,10 @@ make_kernelsrc_tools:
 	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
+make_libperf:
+	@echo "- make -C lib";
+	make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@
+
 FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
 FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
 
@@ -365,5 +369,5 @@ $(foreach t,$(run),$(if $(findstring make_static,$(t)),\
 			$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
 endif
 
-.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
+.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf
 endif # ifndef MK
Signature · 1 line
2.21.0
#8 lore raw

Re: [PATCH 3/4] perf tests: Add libperf automated test

Em Sun, Sep 01, 2019 at 02:48:21PM +0200, Jiri Olsa escreveu:

Quoted 1 line

Adding libperf build test.

Thanks, applied. And also added a note that this is used when one does a:

  $ make -C tools/perf built-test
Quoted 30 lines
---
 tools/perf/tests/make | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/make +5 -1
index 17ee3facfd4d..128a0d801ac1 100644
@@ -327,6 +327,10 @@ make_kernelsrc_tools:
 	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
+make_libperf:
+	@echo "- make -C lib";
+	make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@
+
 FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
 FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
 
@@ -365,5 +369,5 @@ $(foreach t,$(run),$(if $(findstring make_static,$(t)),\
 			$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
 endif
 
-.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
+.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf
 endif # ifndef MK
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
merge bot Applied
#9 lore raw

[tip: perf/urgent] perf tests: Add libperf automated test for 'make -C tools/perf build-test'

In reply to Jiri Olsa
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     9eab951f34dbd092ab520bda167f288899858306
Gitweb:        https://git.kernel.org/tip/9eab951f34dbd092ab520bda167f288899858306
Author:        Jiri Olsa <[email protected]>
AuthorDate:    Sun, 01 Sep 2019 14:48:21 +02:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 10 Sep 2019 14:33:32 +01:00

perf tests: Add libperf automated test for 'make -C tools/perf build-test'

Add a libperf build test, that is triggered when one does:

  $ make -C tools/perf build-test
---
 tools/perf/tests/make | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/make +5 -1
index 70c4847..6b3afed 100644
@@ -327,6 +327,10 @@ make_kernelsrc_tools:
 	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
+make_libperf:
+	@echo "- make -C lib";
+	make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@
+
 FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
 FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
 
@@ -365,5 +369,5 @@ $(foreach t,$(run),$(if $(findstring make_static,$(t)),\
 			$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
 endif
 
-.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
+.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf
 endif # ifndef MK
author reviewer
#10 lore raw

PATCH 4/4 libperf: Add missing event.h into install rule

In reply to Jiri Olsa

So it's properly installed.

---
 tools/perf/lib/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/perf/lib/Makefile +1 -0
index a67efb8d9d39..e325c0503dc6 100644
@@ -146,6 +146,7 @@ install_headers:
 		$(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644);
+		$(call do_install,include/perf/event.h,$(prefix)/include/perf,644);
 
 install_pkgconfig: $(LIBPERF_PC)
 	$(call QUIET_INSTALL, $(LIBPERF_PC)) \
Signature · 1 line
2.21.0
#11 lore raw

Re: [PATCH 4/4] libperf: Add missing event.h into install rule

Em Sun, Sep 01, 2019 at 02:48:22PM +0200, Jiri Olsa escreveu:

Quoted 1 line

So it's properly installed.

Thanks, applied.

- Arnaldo

Quoted 20 lines
---
 tools/perf/lib/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/perf/lib/Makefile +1 -0
index a67efb8d9d39..e325c0503dc6 100644
@@ -146,6 +146,7 @@ install_headers:
 		$(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644);
+		$(call do_install,include/perf/event.h,$(prefix)/include/perf,644);
 
 install_pkgconfig: $(LIBPERF_PC)
 	$(call QUIET_INSTALL, $(LIBPERF_PC)) \
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
merge bot Applied
#12 lore raw

[tip: perf/urgent] libperf: Add missing event.h file to install rule

In reply to Jiri Olsa
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     227cb129858a3eb4b874937274b09834ffcc39b0
Gitweb:        https://git.kernel.org/tip/227cb129858a3eb4b874937274b09834ffcc39b0
Author:        Jiri Olsa <[email protected]>
AuthorDate:    Sun, 01 Sep 2019 14:48:22 +02:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 10 Sep 2019 14:33:32 +01:00

libperf: Add missing event.h file to install rule

So that this development header is properly installed and can be found by tools linking with libperf.

---
 tools/perf/lib/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/perf/lib/Makefile +1 -0
index a67efb8..e325c05 100644
@@ -146,6 +146,7 @@ install_headers:
 		$(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \
 		$(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644);
+		$(call do_install,include/perf/event.h,$(prefix)/include/perf,644);
 
 install_pkgconfig: $(LIBPERF_PC)
 	$(call QUIET_INSTALL, $(LIBPERF_PC)) \