Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for persistent SCC on z/OS #17073

Merged
merged 1 commit into from May 29, 2023

Conversation

hangshao0
Copy link
Contributor

@hangshao0 hangshao0 commented Mar 30, 2023

  1. Use mmap implementation of SCC on z/OS which can be enabled by
    "persistent" sub-option.
  2. Flush the change of the mapped region to the SCC file on VM exit.
  3. Use map64 by default on Java 11 and up. Add new sub-option "map31"
    which maps SCC below the 2G addressing range.
  4. Add test cases
  5. Remove the temporary define of OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE

Depends on eclipse/omr#6940
Depends on eclipse/omr#6989

Signed-off-by: Hang Shao hangshao@ca.ibm.com

@hangshao0
Copy link
Contributor Author

@pshipton

runtime/nls/shrc/j9shr.nls Outdated Show resolved Hide resolved
runtime/oti/j9port.h Show resolved Hide resolved
@pshipton
Copy link
Member

What are the concerns with making map64 the default?

The testing is light. Have you tried making a JVM with persistent as the default and running all the functional tests?

@pshipton
Copy link
Member

running all the functional tests

Actually the system tests as well, there are some class loading and shared cache related system tests.

@hangshao0
Copy link
Contributor Author

What are the concerns with making map64 the default?

__MAP_64 is only supported on z/OS version 2.5 and some z/OS version 2.4. The 64 bit mapping is not on by default on z/OS mmap() where it is supported. Both @r30shah and I have seen __MAP_64 is easy to cause out of memory error (ENOMEM) on mmap(). The ENOMEM goes away if a smaller cache size is used. There might be some machine configurations that could control this. Not sure if @r30shah has found out something on this.

The testing is light. Have you tried making a JVM with persistent as the default and running all the functional tests?

Not yet.

@hangshao0 hangshao0 force-pushed the FixSCC branch 2 times, most recently from a37bfd4 to 9ea5c3e Compare March 31, 2023 15:11
@hangshao0
Copy link
Contributor Author

I've also added change regarding:
eclipse/omr#6940 (comment).

@pshipton
Copy link
Member

I've also added change regarding:
eclipse/omr#6940 (comment).

I think you misunderstood. This change doesn't add any value to this PR since the OMR PR must be merged first. I want a separate PR from this that adds that code and the changes for mmapflag |= OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE that can be merged now before the OMR change, so merging the OMR change doesn't break OpenJ9.

@hangshao0
Copy link
Contributor Author

PR for the OMR flag #17083

@hangshao0
Copy link
Contributor Author

As #17083 is merged, I pushed to resolve the merge conflicts.

@pshipton
Copy link
Member

Now this PR can be updated to remove #define OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE 0 because this won't be merged until after the OMR change is merged.

@hangshao0
Copy link
Contributor Author

Now this PR can be updated to remove #define OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE 0

Yes, it can be done.

buildspecs/j9.flags Show resolved Hide resolved
runtime/shared_common/CompositeCache.cpp Outdated Show resolved Hide resolved
runtime/shared_common/CompositeCache.cpp Outdated Show resolved Hide resolved
runtime/shared_common/OSCachemmap.cpp Outdated Show resolved Hide resolved
runtime/shared_common/shrinit.cpp Outdated Show resolved Hide resolved
runtime/tests/shared/AttachedDataTest.cpp Outdated Show resolved Hide resolved
@hangshao0
Copy link
Contributor Author

Have you tried making a JVM with persistent as the default and running all the functional tests?
Actually the system tests as well, there are some class loading and shared cache related system tests.

The heavy class loading tests like SharedClasses.SCM01.SingleCL, SharedClasses.SCM01.MultiThreadMultiCL are in extended.system.
But there are issues with Jenkins machines, no persistent SCC > 10m are allowed to create on these machine. I get:

JVMSHRC336E Port layer error code = -155
JVMSHRC337E Platform error message: EDC5124I Too many open files.
JVMSHRC840E Failed to start up the shared cache.
JVMJ9VM015W Initialization error for library j9shr29(11): JVMJ9VM009E J9VMDllMain failed
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

This means mmap() failed with EMFILE. Most SCC related tests directly fail on this error.

I tried another build with the default cache size reduced to 10m, most of these SCC class loading tests passed. There are much fewer tests failed with the error above.

I guess there are machine settings that is related to this error. Probably things like MAXFILEPROC, MAXMMAPAREA, MAXSHAREPAGES. Could you check these settings on internal Jenkins z/OS machine, like fyrec51n.vmec.svl.ibm.com ? @jdekonin @vsebe

@jdekonin
Copy link
Contributor

jdekonin commented Apr 6, 2023

bash-4.3$ oeconsol "D VS,HVSHARE"
IAR019I  10.28.37 DISPLAY VIRTSTOR 870
 SOURCE = DEFAULT
 TOTAL SHARED = 522240G
 SHARED RANGE = 2048G-524288G
 SHARED ALLOCATED = 1050446M
bash-4.3$ oeconsol "D OMVS,OPTIONS"
BPXO043I 10.27.08 DISPLAY OMVS 866
OMVS     000F ACTIVE             OMVS=(00)
CURRENT UNIX CONFIGURATION SETTINGS:
MAXPROCSYS      =        900    MAXPROCUSER     =        100
MAXFILEPROC     =      10000    MAXFILESIZE     = NOLIMIT
MAXCPUTIME      =      10800    MAXUIDS         =         50
MAXPTYS         =        800    MAXIOBUFUSER    =       2048
MAXMMAPAREA     =       4096    MAXASSIZE       = 2147483647
MAXTHREADS      =      10000    MAXTHREADTASKS  =      10000
MAXCORESIZE     =    4194304
IPCMSGQBYTES    = 2147483647    IPCMSGQMNUM     =      10000
IPCMSGNIDS      =        500    IPCSEMNIDS      =        500
IPCSEMNOPS      =         25    IPCSEMNSEMS     =       1000
IPCSHMMPAGES    =      25600    IPCSHMNIDS      =        500
IPCSHMNSEGS     =        500    IPCSHMSPAGES    =     262144
SUPERUSER       = BPXROOT       FORKCOPY        = COPY
STEPLIBLIST     =
USERIDALIASTABLE=
PRIORITYPG VALUES: NONE
PRIORITYGOAL VALUES: NONE
MAXQUEUEDSIGS   =       1000    SHRLIBRGNSIZE   =  157286400
SHRLIBMAXPAGES  =       4096    VERSION         = /       ,N
SYSCALL COUNTS  = NO            TTYGROUP        = TTY
SYSPLEX         = NO            BRLM SERVER     = N/A
LIMMSG          = SYSTEM        AUTOCVT         = OFF
RESOLVER PROC   = DEFAULT       LOSTMSG         = ON
AUTHPGMLIST     = NONE
SWA             = BELOW         NONEMPTYMOUNTPT = NOWARN
SERV_LINKLIB    =
SERV_LPALIB     =
MAXUSERMOUNTSYS =          0    MAXUSERMOUNTUSER=          0
MAXPIPEUSER     =       8730    PWT             = ENV
KERNELSTACKS    = ABOVE         UMASK           = NONE

@hangshao0
Copy link
Contributor Author

hangshao0 commented Apr 6, 2023

I notice that I can create persistent SCC with a much larger size 60m on VM farm machine stlab92.svl.ibm.com:

java -Xshareclasses:name=C1,persistent,reset -Xscmx60m -version
JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa29.so"
JVMSHRC023E Cache does not exist
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 8.0.8.0 - pmz6480sr8-20230208_02(SR8))
IBM J9 VM (build 2.9, JRE 1.8.0 z/OS s390x-64-Bit Compressed References 20230321_47772 (JIT enabled, AOT enabled)
OpenJ9   - cd369c6
OMR      - 0d8205c
IBM      - 103e724)
JCL - 20230208_01 based on Oracle jdk8u361-b09

Could you check the settings of stlab92.svl.ibm.com so that we can compare them against #17073 (comment) ? @jdekonin

@jdekonin
Copy link
Contributor

jdekonin commented Apr 6, 2023

The 2 systems are not the same release. fyrec51n is 2.5, whereas stlab92 is 2.1. Note the older system has a MAXSHAREPAGES env var.

MAXPROCSYS      =       1000    MAXPROCUSER     =        500 
MAXFILEPROC     =      64000    MAXFILESIZE     = NOLIMIT    
MAXCPUTIME      =     100000    MAXUIDS         =        250 
MAXPTYS         =        512    MAXIOBUFUSER    =       2048 
MAXMMAPAREA     =      40960    MAXASSIZE       = 2147483647 
MAXTHREADS      =       1000    MAXTHREADTASKS  =       1000 
MAXCORESIZE     =    4194304    MAXSHAREPAGES   =     131072 
IPCMSGQBYTES    = 2147483647    IPCMSGQMNUM     =      10000 
IPCMSGNIDS      =        500    IPCSEMNIDS      =        500 
IPCSEMNOPS      =         25    IPCSEMNSEMS     =       1000 
IPCSHMMPAGES    =      25600    IPCSHMNIDS      =        500 
IPCSHMNSEGS     =        500    IPCSHMSPAGES    =     262144 

@hangshao0
Copy link
Contributor Author

Looks like it is MAXMMAPAREA that is making a difference here:

On fyrec51n.vmec.svl.ibm.com, it is 4096, which is equivalent to 16MB
On stlab92.svl.ibm.com, it is 40960, which is equivalent to 160MB.

stlab92.svl.ibm.com can allow SCC with 160m, but fail with 161m.

java -Xshareclasses:name=C1,persistent,reset -Xscmx160m -version
JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa29.so"
JVMSHRC023E Cache does not exist
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 8.0.8.0 - pmz6480sr8-20230208_02(SR8))
IBM J9 VM (build 2.9, JRE 1.8.0 z/OS s390x-64-Bit Compressed References 20230321_47772 (JIT enabled, AOT enabled)
OpenJ9   - cd369c6
OMR      - 0d8205c
IBM      - 103e724)

java -Xshareclasses:name=C1,persistent,reset -Xscmx161m -version
JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa29.so"
JVMSHRC256I Persistent shared cache "C1" has been destroyed
JVMSHRC245E Error mapping shared class cache file
JVMSHRC336E Port layer error code = -155
JVMSHRC337E Platform error message: EDC5124I Too many open files. (errno2=0x07360344)
JVMSHRC840E Failed to start up the shared cache.
JVMJ9VM015W Initialization error for library j9shr29(11): JVMJ9VM009E J9VMDllMain failed
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

@hangshao0
Copy link
Contributor Author

hangshao0 commented Apr 6, 2023

Seems that the MAXMMAPAREA value is too small on both VM farm and Jenkins z/OS test machines:

I just randomly tried on a VM farm machine fyrec51a.vmec.svl.ibm.com, 16m is allowed but 17m is too big:

java -Xshareclasses:name=C1,persistent,reset -Xscmx16m -version
JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa29.so"
JVMSHRC256I Persistent shared cache "C1" has been destroyed
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 8.0.8.0 - pmz6480sr8-20230208_02(SR8))
IBM J9 VM (build 2.9, JRE 1.8.0 z/OS s390x-64-Bit Compressed References 20230321_47772 (JIT enabled, AOT enabled)
OpenJ9   - cd369c6
OMR      - 0d8205c
IBM      - 103e724)
JCL - 20230208_01 based on Oracle jdk8u361-b09

java -Xshareclasses:name=C1,persistent,reset -Xscmx17m -version
JVMJ9VM082E Unable to switch to IFA processor - issue "extattr +a libj9ifa29.so"
JVMSHRC256I Persistent shared cache "C1" has been destroyed
JVMSHRC245E Error mapping shared class cache file
JVMSHRC336E Port layer error code = -155
JVMSHRC337E Platform error message: EDC5124I Too many open files. (errno2=0x07360344)
JVMSHRC840E Failed to start up the shared cache.

I guess we need to increase the MAXMMAPAREA value on z/OS machines. Maybe set it to 262,144 (==1GB) or 131,072 (==512MB) @jdekonin

mmap limits are a subset of the more general shared memory limits. May need to update them as well on some machines.

hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we should always set flag
__MAP_64

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
@pshipton
Copy link
Member

@keithc-ca this seems ready for another review. I want a change, but it's on the OMR side, and isn't a prereq for this.

hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we should always set flag
__MAP_64

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
@hangshao0
Copy link
Contributor Author

The implementation of zos_version_at_least() is in OMR code, not in OpenJ9. I have removed its declaration from OpenJ9 header util_api.h in this PR and added it into OMR header omrutil.h in eclipse/omr#6989

@hangshao0
Copy link
Contributor Author

I have removed its declaration from OpenJ9 header util_api.h in this PR and added it into OMR header omrutil.h in eclipse/omr#6989

This creates dependency between the OMR and OpenJ9 PR.

runtime/shared_common/CompositeCache.cpp Outdated Show resolved Hide resolved
runtime/shared_common/CompositeCacheImpl.hpp Outdated Show resolved Hide resolved
runtime/shared_common/OSCachemmap.cpp Outdated Show resolved Hide resolved
runtime/shared_common/OSCachemmap.cpp Show resolved Hide resolved
runtime/shared_common/shrinit.cpp Outdated Show resolved Hide resolved
runtime/tests/port/j9mmapTest.c Outdated Show resolved Hide resolved
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 12, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 15, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 15, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
hangshao0 added a commit to hangshao0/omr that referenced this pull request May 15, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
1. Use mmap implementation of SCC on z/OS which can be enabled by
"persistent" sub-option.
2. Flush the change of the mapped region to the SCC file on VM exit.
3. Use map64 by default on Java 11 and up. Add new sub-option "map31"
which maps SCC below the 2G addressing range.
4. Add test cases
5. Remove the temporary define of OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE 

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
@hangshao0
Copy link
Contributor Author

All existing review comments addressed.

@keithc-ca
Copy link
Contributor

Jenkins test sanity zlinux,win32 jdk8 depends eclipse/omr#6989

Copy link
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to wait until eclipse/omr#6989 is promoted to the openj9 branch of OMR.

@pshipton
Copy link
Member

I've promoted eclipse/omr#6989

@keithc-ca keithc-ca merged commit 3b029b0 into eclipse-openj9:master May 29, 2023
7 checks passed
rmnattas pushed a commit to rmnattas/omr that referenced this pull request Nov 7, 2023
When OMRPORT_MMAP_FLAG_ZOS_64BIT is passed in, we set flag
__MAP_64 on z/OS version 2.4 and up.

Related to eclipse-openj9/openj9#17073

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants