Bug 1737114

Summary: port openjdk jstack systemtap tapset to ppc64[be,le]
Product: Red Hat Enterprise Linux 7 Reporter: Andrew John Hughes <ahughes>
Component: java-11-openjdkAssignee: Andrew John Hughes <ahughes>
Status: CLOSED ERRATA QA Contact: OpenJDK QA <java-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dbhole, jandrlik, jvanek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: java-11-openjdk-11.0.7.10-6.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:53:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew John Hughes 2019-08-02 16:58:40 UTC
This bug was initially created as a copy of Bug #1434241

I am copying this bug because: 

Change is in java-1.8.0-openjdk in RHEL 7, so should really be fixed in java-11-openjdk too.

+++ This bug was initially created as a clone of Bug #1373848 +++

Steps to Reproduce:
1. stap -v -e 'probe hotspot.jni.GetStringUTFChars { log(probestr); print_jstack_full(); log(" === "); }' -c "java Hello" 2>&1 | c++filt

Additional info:
Hello.java: public class Hello{public static void main(String args[]){System.out.println("Hello World!");}}


--- Additional comment from Lukas Zachar on 2016-09-06 12:23:55 EDT ---

What is the systemtap support for other arches than x86_64?

On x86_64 it works (kernel-devel-4.5.0-7.el7, systemtap-3.0-6.el7)
On aarch64, ppc64, ppc64le, s390x I'm getting:

Pass 1: parsed user script and 113 library scripts using 159488virt/44096res/6400shr/35648data kb, in 500usr/10sys/517real ms.
semantic error: while resolving probe point: identifier 'hotspot' at <input>:1:7
        source: probe hotspot.jni.GetStringUTFChars { log(probestr); print_jstack_full(); log(" === "); }
                      ^

semantic error: probe point mismatch (similar: oneshot, tcp, init, scsi, stap): identifier 'hotspot' at :1:7
        source: probe hotspot.jni.GetStringUTFChars { log(probestr); print_jstack_full(); log(" === "); }
                      ^

Pass 2: analyzed script: 0 probes, 0 functions, 0 embeds, 0 globals using 160064virt/44096res/6400shr/36224data kb, in 10usr/0sys/10real ms.
Pass 2: analysis failed.  [man error::pass2]

--- Additional comment from Frank Ch. Eigler on 2016-09-06 12:42:44 EDT ---

Lukas, systemtap in general is fine on all of those platforms.  Perhaps openjdk doesn't include the systemtap tapset .stp files in its non-x86 java-*-openjdk-devel subrpms?

--- Additional comment from Andrew John Hughes on 2016-09-06 14:53:19 EDT ---

OpenJDK provides the SystemTap tapset for all JIT architectures; on java-1.8.0-openjdk, that's x86, x86_64, sparc, sparc64, AArch64, ppc64 & ppc64le. So three of the four you tried should work (s390x doesn't have them).

How much they've been tested I don't know. ppc64, ppc64le and AArch64 are all new JITs that were added after the tapsets.

--- Additional comment from Lukas Zachar on 2016-09-07 04:37:43 EDT ---

Ah, maybe I see the problem. I've run stap -vvv and it systemtap does not search in directory where openjdk installs stp.

ppc64) 
....
Searched: "/usr/share/systemtap/tapset/linux/*.stp", found: 71, processed: 71
Processing tapset "/usr/share/systemtap/tapset/powerpc/registers.stp"
Searched: "/usr/share/systemtap/tapset/powerpc/*.stp", found: 1, processed: 1

x86_64)
Searched: "/usr/share/systemtap/tapset/linux/*.stp", found: 71, processed: 71
Processing tapset "/usr/share/systemtap/tapset/x86_64/hotspot-1.8.0.102-3.b14.el7.x86_64.stp"
Processing tapset "/usr/share/systemtap/tapset/x86_64/hotspot_gc-1.8.0.102-3.b14.el7.x86_64.stp"
Processing tapset "/usr/share/systemtap/tapset/x86_64/hotspot_jni-1.8.0.102-3.b14.el7.x86_64.stp"
Processing tapset "/usr/share/systemtap/tapset/x86_64/jstack-1.8.0.102-3.b14.el7.x86_64.stp"
Processing tapset "/usr/share/systemtap/tapset/x86_64/registers.stp"
Searched: "/usr/share/systemtap/tapset/x86_64/*.stp", found: 5, processed: 5

----------------------------

ppc64 openjdk contains following stp (/usr/share/... is symlink to /usr/lib/...):

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-3.b14.el7.ppc64/tapset/hotspot-1.8.0.102-3.b14.el7.ppc64.stp
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-3.b14.el7.ppc64/tapset/hotspot_gc-1.8.0.102-3.b14.el7.ppc64.stp
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-3.b14.el7.ppc64/tapset/hotspot_jni-1.8.0.102-3.b14.el7.ppc64.stp
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-3.b14.el7.ppc64/tapset/jstack-1.8.0.102-3.b14.el7.ppc64.stp
/usr/share/systemtap/tapset/ppc64/hotspot-1.8.0.102-3.b14.el7.ppc64.stp
/usr/share/systemtap/tapset/ppc64/hotspot_gc-1.8.0.102-3.b14.el7.ppc64.stp
/usr/share/systemtap/tapset/ppc64/hotspot_jni-1.8.0.102-3.b14.el7.ppc64.stp
/usr/share/systemtap/tapset/ppc64/jstack-1.8.0.102-3.b14.el7.ppc64.stp

----------------------------

I've tried to symlink openjdk's stp to /usr/share/systemtap/tapset/powerpc/, but
Processing tapset "/usr/share/systemtap/tapset/powerpc/jstack-1.7.0.111-2.6.7.4.el7.stp"
parse error: expected literal string or number
        saw: operator '*' at /usr/share/systemtap/tapset/powerpc/jstack-1.7.0.111-2.6.7.4.el7.stp:141:6
     source:   %: **ERROR** unknown architecture
                  ^

1 parse error.
WARNING: tapset "/usr/share/systemtap/tapset/powerpc/jstack-1.7.0.111-2.6.7.4.el7.stp" has errors, and will be skipped
Processing tapset "/usr/share/systemtap/tapset/powerpc/jstack-1.8.0.102-3.b14.el7.ppc64.stp"
parse error: expected literal string or number
        saw: operator '*' at /usr/share/systemtap/tapset/powerpc/jstack-1.8.0.102-3.b14.el7.ppc64.stp:103:6
     source:   %: **ERROR** unknown architecture
                  ^

1 parse error.
WARNING: tapset "/usr/share/systemtap/tapset/powerpc/jstack-1.8.0.102-3.b14.el7.ppc64.stp" has errors, and will be skipped

Should I open new bug for that?

--- Additional comment from Frank Ch. Eigler on 2016-09-07 05:02:38 EDT ---

It should not be a big problem putting ppc & ppc64 .stp files into the same tapset/powerpc/ subdirectory.  (I don't recall why stap collapses those two.)

Yeah, jstack.stp's  probe hotspot.vm_init_end needs some explicit porting work to other architectures:

  // Should really check arch of user space (for 32bit jvm on 64bit kernel).
  %( arch == "i386" %?
     sp_register = "esp";
     fp_register = "ebp";
     pc_register = "eip";
     ptr_size = 4;
     ptr_mask = 0xFFFFFFFF;
  %: %(arch == "x86_64" %?
     sp_register = "rsp";
     fp_register = "rbp";
     pc_register = "rip";
     ptr_size = 8; // XXX - might be probing 32-on-64 jvm.
     ptr_mask = 0xFFFFFFFFFFFFFFFF;
  %: **ERROR** unknown architecture
  %) %)

needs other arches handled.  Plus the "arch of user space" check can be done with the systemtap function call probing_32bit_app().

Let's use a separate bug for porting of jstack.stp.  At the least, we could arrange for the error to be a runtime one rather than a parse-time one.

--- Additional comment from Andrew John Hughes on 2016-09-07 11:34:16 EDT ---

This is going to need to change tapsets in all three versions of the JDK.

I'm guessing it's also going to be something for RHEL 7.4 now.

--- Additional comment from Andrew John Hughes on 2016-09-07 11:36:43 EDT ---

Switching to RHEL 7.4 as 7.3 is past dev-freeze.

--- Additional comment from Andrew John Hughes on 2016-09-07 12:24:25 EDT ---

Bug 1373986 will handle java-1.7.0-openjdk. Not worth updating java-1.6.0-openjdk at this stage.

--- Additional comment from Andrew John Hughes on 2017-03-21 00:45:02 EDT ---

Support has been added for AArch64 and directories for all architectures adjusted to match those used by SystemTap.

We'll split ppc64[le,be] support into a separate bug.

--- Additional comment from Andrew John Hughes on 2017-03-21 00:46:34 EDT ---

https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=545161

Comment 1 Andrew John Hughes 2019-11-20 06:19:18 UTC
Moving to rhel-7.9.0 as rhel-7.8 now requires exception+ or blocker+.

Comment 2 Andrew John Hughes 2019-11-20 06:30:31 UTC
Drop from 7.8 RPL.

Comment 4 jiri vanek 2020-04-23 07:30:55 UTC
jstack tests are covering this.

Comment 10 errata-xmlrpc 2020-09-29 19:53:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (java-11-openjdk bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:3919