2019-09-09 23:49:12

by Thomas Richter

[permalink] [raw]
Subject: [PATCH 0/3] perf/java: Add s390 support for jitted JAVA

This patch set adds support for jitted JAVA and requires the following
packages (The java-8 version is not sufficient for s390):

- java-11-openjdk-11.0.2.7-7.fc30.s390x
- java-11-openjdk-headless-11.0.2.7-7.fc30.s390x
- java-11-openjdk-devel-11.0.2.7-7.fc30.s390x

and this patch series:
Patch 1 (perf jvmti): Compile jvmti/* and generate a loadable
libperf-jvmti.so
Patch 2 (perf): Include JVMTI into the s390 build
Patch 3 (perf/java): Add detection of java-11-openjdk-devel package

Thomas Richter (3):
perf jvmti: Link against tools/lib/string.h to have weak strlcpy()
perf: Include JVMTI support for s390
perf/java: Add detection of java-11-openjdk-devel package

tools/perf/Makefile.config | 2 +-
tools/perf/arch/s390/Makefile | 1 +
tools/perf/jvmti/Build | 13 +++++++++++++
tools/perf/util/genelf.h | 3 +++
4 files changed, 18 insertions(+), 1 deletion(-)

--
2.21.0


2019-09-09 23:53:18

by Thomas Richter

[permalink] [raw]
Subject: [PATCH 1/3] perf jvmti: Link against tools/lib/string.h to have weak strlcpy()

That is needed in systems such some S/390 distros.

[root@m35lp76 perf]# readelf -s jvmti/jvmti-in.o | fgrep strlcpy
408: 0000000000002bc8 216 FUNC WEAK DEFAULT 116 strlcpy
[root@m35lp76 perf]#

Suggested-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Thomas Richter <[email protected]>
---
tools/perf/jvmti/Build | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/tools/perf/jvmti/Build b/tools/perf/jvmti/Build
index eaeb8cb5379b..202cadaaf097 100644
--- a/tools/perf/jvmti/Build
+++ b/tools/perf/jvmti/Build
@@ -1,8 +1,21 @@
jvmti-y += libjvmti.o
jvmti-y += jvmti_agent.o

+# For strlcpy
+jvmti-y += libstring.o libctype.o
+
CFLAGS_jvmti = -fPIC -DPIC -I$(JDIR)/include -I$(JDIR)/include/linux
CFLAGS_REMOVE_jvmti = -Wmissing-declarations
CFLAGS_REMOVE_jvmti += -Wstrict-prototypes
CFLAGS_REMOVE_jvmti += -Wextra
CFLAGS_REMOVE_jvmti += -Wwrite-strings
+
+CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+
+$(OUTPUT)jvmti/libstring.o: ../lib/string.c FORCE
+ $(call rule_mkdir)
+ $(call if_changed_dep,cc_o_c)
+
+$(OUTPUT)jvmti/libctype.o: ../lib/ctype.c FORCE
+ $(call rule_mkdir)
+ $(call if_changed_dep,cc_o_c)
--
2.21.0

2019-09-09 23:55:08

by Thomas Richter

[permalink] [raw]
Subject: [PATCH 3/3] perf/java: Add detection of java-11-openjdk-devel package

With Java 11 there is no seperate JRE anymore.
Details: https://coderanch.com/t/701603/java/JRE-JDK
Therefore the detection of the JRE needs to be adapted.

This change works for s390 and x86.
I have not tested other platforms.

Suggested-by: Andreas Krebbel <[email protected]>
Signed-off-by: Thomas Richter <[email protected]>
---
tools/perf/Makefile.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 89ac5a1f1550..3da374911852 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -908,7 +908,7 @@ ifndef NO_JVMTI
JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
else
ifneq (,$(wildcard /usr/sbin/alternatives))
- JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
+ JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
endif
endif
ifndef JDIR
--
2.21.0

2019-09-10 07:12:03

by Thomas Richter

[permalink] [raw]
Subject: [PATCH 2/3] perf: Include JVMTI support for s390

Enable JTI support for s390 perf tool chain

Signed-off-by: Thomas Richter <[email protected]>
---
tools/perf/arch/s390/Makefile | 1 +
tools/perf/util/genelf.h | 3 +++
2 files changed, 4 insertions(+)

diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index cb198787570a..6ac8887be7c9 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -4,6 +4,7 @@ PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
+PERF_HAVE_JITDUMP := 1

#
# Syscall table generation for perf
diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
index b72440bf9a79..d4137559be05 100644
--- a/tools/perf/util/genelf.h
+++ b/tools/perf/util/genelf.h
@@ -35,6 +35,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
#elif defined(__sparc__)
#define GEN_ELF_ARCH EM_SPARC
#define GEN_ELF_CLASS ELFCLASS32
+#elif defined(__s390x__)
+#define GEN_ELF_ARCH EM_S390
+#define GEN_ELF_CLASS ELFCLASS64
#else
#error "unsupported architecture"
#endif
--
2.21.0

2019-09-26 08:44:52

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 3/3] perf/java: Add detection of java-11-openjdk-devel package

Em Mon, Sep 09, 2019 at 01:41:16PM +0200, Thomas Richter escreveu:
> With Java 11 there is no seperate JRE anymore.
> Details: https://coderanch.com/t/701603/java/JRE-JDK
> Therefore the detection of the JRE needs to be adapted.
>
> This change works for s390 and x86.
> I have not tested other platforms.

Committer testing:

Continues to work with the OpenJDK 8:

$ rm -f ~acme/lib64/libperf-jvmti.so
$ rpm -qa | grep jdk-devel
java-1.8.0-openjdk-devel-1.8.0.222.b10-0.fc30.x86_64
$ git log --oneline -1
a51937170f33 (HEAD -> perf/core) perf build: Add detection of java-11-openjdk-devel package
$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ; make -C tools/perf O=/tmp/build/perf install > /dev/null 2>1
$ ls -la ~acme/lib64/libperf-jvmti.so
-rwxr-xr-x. 1 acme acme 230744 Sep 24 16:46 /home/acme/lib64/libperf-jvmti.so
$


Thanks, applied.

- Arnaldo

> Suggested-by: Andreas Krebbel <[email protected]>
> Signed-off-by: Thomas Richter <[email protected]>
> ---
> tools/perf/Makefile.config | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 89ac5a1f1550..3da374911852 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -908,7 +908,7 @@ ifndef NO_JVMTI
> JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
> else
> ifneq (,$(wildcard /usr/sbin/alternatives))
> - JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
> + JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
> endif
> endif
> ifndef JDIR
> --
> 2.21.0

--

- Arnaldo