2019-09-01 12:49:31

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 0/4] 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(-)


2019-09-01 12:49:34

by Jiri Olsa

[permalink] [raw]
Subject: [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.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f9807d8c005b..2ccc12f3730b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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 \
--
2.21.0

2019-09-01 12:50:15

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 3/4] perf tests: Add libperf automated test

Adding libperf build test.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/tests/make | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 17ee3facfd4d..128a0d801ac1 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -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
--
2.21.0

2019-09-01 12:51:16

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 2/4] perf tests: Fix static build test

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/tests/make | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 70c48475896d..17ee3facfd4d 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -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
--
2.21.0

2019-09-01 12:51:20

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 4/4] libperf: Add missing event.h into install rule

So it's properly installed.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/lib/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
index a67efb8d9d39..e325c0503dc6 100644
--- a/tools/perf/lib/Makefile
+++ b/tools/perf/lib/Makefile
@@ -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)) \
--
2.21.0

2019-09-01 15:49:20

by Arnaldo Carvalho de Melo

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

Em Sun, Sep 01, 2019 at 02:48:19PM +0200, Jiri Olsa escreveu:
> 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

> Link: http://lkml.kernel.org/n/[email protected]
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/Makefile.perf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index f9807d8c005b..2ccc12f3730b 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -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 \
> --
> 2.21.0

--

- Arnaldo

2019-09-01 15:49:40

by Arnaldo Carvalho de Melo

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

Em Sun, Sep 01, 2019 at 02:48:20PM +0200, Jiri Olsa escreveu:
> Link: http://lkml.kernel.org/n/[email protected]


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

> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/tests/make | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 70c48475896d..17ee3facfd4d 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -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
> --
> 2.21.0

--

- Arnaldo

2019-09-01 15:50:03

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: 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:
> So it's properly installed.

Thanks, applied.

- Arnaldo

> Link: http://lkml.kernel.org/n/[email protected]
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/lib/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
> index a67efb8d9d39..e325c0503dc6 100644
> --- a/tools/perf/lib/Makefile
> +++ b/tools/perf/lib/Makefile
> @@ -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)) \
> --
> 2.21.0

--

- Arnaldo

2019-09-01 15:50:58

by Arnaldo Carvalho de Melo

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

Em Sun, Sep 01, 2019 at 02:48:21PM +0200, Jiri Olsa escreveu:
> 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

> Link: http://lkml.kernel.org/n/[email protected]
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/tests/make | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 17ee3facfd4d..128a0d801ac1 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -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
> --
> 2.21.0

--

- Arnaldo

2019-09-01 15:53:39

by Jiri Olsa

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

On Sun, Sep 01, 2019 at 12:15:28PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, Sep 01, 2019 at 02:48:20PM +0200, Jiri Olsa escreveu:
> > Link: http://lkml.kernel.org/n/[email protected]
>
>
> 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

>
> - Arnaldo
>
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> > tools/perf/tests/make | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> > index 70c48475896d..17ee3facfd4d 100644
> > --- a/tools/perf/tests/make
> > +++ b/tools/perf/tests/make
> > @@ -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
> > --
> > 2.21.0
>
> --
>
> - Arnaldo

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

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.

Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f9807d8..2ccc12f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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 \

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

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

Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/tests/make | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 70c4847..6b3afed 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -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

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

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.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/lib/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
index a67efb8..e325c05 100644
--- a/tools/perf/lib/Makefile
+++ b/tools/perf/lib/Makefile
@@ -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)) \