From de008950e508ac8b5c9dd9d0bcc344debad87522 Mon Sep 17 00:00:00 2001 From: Jason Feng Date: Thu, 11 Jan 2024 10:55:32 -0500 Subject: [PATCH] CRIU removes libj9criu29 This library is not needed after all its functionalities are moved into java.base; setupJNIFieldIDsAndCRIUAPI() is still required to check CRIU library loading before performing a checkpointJVM(). Signed-off-by: Jason Feng --- .../internal/criu/InternalCRIUSupport.java | 31 +++-------- .../org/eclipse/openj9/criu/CRIUSupport.java | 4 +- runtime/CMakeLists.txt | 3 - runtime/criusupport/CMakeLists.txt | 53 ------------------ runtime/criusupport/exports.cmake | 24 -------- runtime/criusupport/j9criu.tdf | 55 ------------------- runtime/criusupport/module.xml | 45 --------------- .../criusupport/uma/criusupport_exports.xml | 23 -------- 8 files changed, 9 insertions(+), 229 deletions(-) delete mode 100644 runtime/criusupport/CMakeLists.txt delete mode 100644 runtime/criusupport/exports.cmake delete mode 100644 runtime/criusupport/j9criu.tdf delete mode 100644 runtime/criusupport/module.xml delete mode 100644 runtime/criusupport/uma/criusupport_exports.xml diff --git a/jcl/src/java.base/share/classes/openj9/internal/criu/InternalCRIUSupport.java b/jcl/src/java.base/share/classes/openj9/internal/criu/InternalCRIUSupport.java index 2949b3fa6ae..15eaf547f59 100644 --- a/jcl/src/java.base/share/classes/openj9/internal/criu/InternalCRIUSupport.java +++ b/jcl/src/java.base/share/classes/openj9/internal/criu/InternalCRIUSupport.java @@ -122,7 +122,7 @@ public static boolean enableCRIUSecProvider() { /** * Queries if CRIU Checkpoint is allowed. * isCRIUSupportEnabled() is invoked first to check if CRIU support is enabled, - * and j9criu29 is to be lazily loaded at checkpointJVM(). + * and criu library has been loaded. * * @return true if Checkpoint is allowed, otherwise false */ @@ -204,20 +204,8 @@ public static enum HookMode { private static boolean loadNativeLibrary() { if (!nativeLoaded) { - try { - AccessController.doPrivileged((PrivilegedAction) () -> { - System.loadLibrary("j9criu29"); //$NON-NLS-1$ - return null; - }); - if (setupJNIFieldIDsAndCRIUAPI()) { - nativeLoaded = true; - } - } catch (UnsatisfiedLinkError e) { - errorMsg = e.getMessage(); - Properties internalProperties = com.ibm.oti.vm.VM.getVMLangAccess().internalGetProperties(); - if (internalProperties.getProperty("enable.j9internal.checkpoint.hook.api.debug") != null) { //$NON-NLS-1$ - e.printStackTrace(); - } + if (setupJNIFieldIDsAndCRIUAPI()) { + nativeLoaded = true; } } @@ -270,7 +258,7 @@ public InternalCRIUSupport(Path imageDir) { } /** - * Queries if CRIU support is enabled and j9criu29 library has been loaded. + * Queries if CRIU support is enabled and criu library has been loaded. * * @return TRUE if support is enabled and the library is loaded, FALSE otherwise */ @@ -868,7 +856,7 @@ private static void clearInetAddressCache() { * restore */ public synchronized void checkpointJVM() { - if (isCRIUSupportEnabled()) { + if (isCRIUSupportEnabledAndNativeLoaded()) { if (isCheckpointAllowed()) { /* Add env variables restore hook. */ String envFilePath = null; @@ -886,13 +874,8 @@ public synchronized void checkpointJVM() { J9InternalCheckpointHookAPI.runPreCheckpointHooksConcurrentThread(); System.gc(); - try { - checkpointJVMImpl(imageDir, leaveRunning, shellJob, extUnixSupport, logLevel, logFile, fileLocks, - workDir, tcpEstablished, autoDedup, trackMemory, unprivileged, optionsFile, envFilePath); - } catch (UnsatisfiedLinkError ule) { - errorMsg = ule.getMessage(); - throw new InternalError("There is a problem with libj9criu in the JDK"); //$NON-NLS-1$ - } + checkpointJVMImpl(imageDir, leaveRunning, shellJob, extUnixSupport, logLevel, logFile, fileLocks, + workDir, tcpEstablished, autoDedup, trackMemory, unprivileged, optionsFile, envFilePath); J9InternalCheckpointHookAPI.runPostRestoreHooksConcurrentThread(); } else { throw new UnsupportedOperationException( diff --git a/jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUSupport.java b/jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUSupport.java index 7746985641d..e935a10bdb8 100644 --- a/jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUSupport.java +++ b/jcl/src/openj9.criu/share/classes/org/eclipse/openj9/criu/CRIUSupport.java @@ -93,12 +93,12 @@ public CRIUSupport(Path imageDir) { } /** - * Queries if CRIU support is enabled and j9criu29 library has been loaded. + * Queries if CRIU support is enabled and criu library has been loaded. * * @return TRUE if support is enabled and the library is loaded, FALSE otherwise */ public static boolean isCRIUSupportEnabled() { - return InternalCRIUSupport.isCRIUSupportEnabled(); + return InternalCRIUSupport.isCRIUSupportEnabledAndNativeLoaded(); } /** diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 586a892f6bb..24ded74b843 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -435,9 +435,6 @@ endif() if(J9VM_MODULE_CODERT_VM) add_subdirectory(codert_vm) endif() -if(J9VM_OPT_CRIU_SUPPORT) - add_subdirectory(criusupport) -endif() add_subdirectory(cuda) if(J9VM_MODULE_DBGEXT) add_subdirectory(dbgext) diff --git a/runtime/criusupport/CMakeLists.txt b/runtime/criusupport/CMakeLists.txt deleted file mode 100644 index 647b1c18565..00000000000 --- a/runtime/criusupport/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -################################################################################ -# Copyright IBM Corp. and others 2021 -# -# This program and the accompanying materials are made available under -# the terms of the Eclipse Public License 2.0 which accompanies this -# distribution and is available at https://www.eclipse.org/legal/epl-2.0/ -# or the Apache License, Version 2.0 which accompanies this distribution and -# is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# This Source Code may also be made available under the following -# Secondary Licenses when the conditions for such availability set -# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU -# General Public License, version 2 with the GNU Classpath -# Exception [1] and GNU General Public License, version 2 with the -# OpenJDK Assembly Exception [2]. -# -# [1] https://www.gnu.org/software/classpath/license.html -# [2] https://openjdk.org/legal/assembly-exception.html -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 -################################################################################ - -add_tracegen(j9criu.tdf) - -j9vm_add_library(j9criu SHARED - OUTPUT_NAME j9criu${J9VM_VERSION_SUFFIX} - - ${CMAKE_CURRENT_BINARY_DIR}/ut_j9criu.c -) - -target_include_directories(j9criu - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) -add_dependencies(j9vm_interface j9vm_m4gen) - -target_link_libraries(j9criu - PRIVATE - j9vm_interface - j9util -) - -include(exports.cmake) - -target_enable_ddr(j9criu) -ddr_set_add_targets(j9ddr j9criu) - -install( - TARGETS j9criu - LIBRARY DESTINATION ${j9vm_SOURCE_DIR} - RUNTIME DESTINATION ${j9vm_SOURCE_DIR} -) diff --git a/runtime/criusupport/exports.cmake b/runtime/criusupport/exports.cmake deleted file mode 100644 index bdf005dde64..00000000000 --- a/runtime/criusupport/exports.cmake +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# Copyright IBM Corp. and others 2021 -# -# This program and the accompanying materials are made available under -# the terms of the Eclipse Public License 2.0 which accompanies this -# distribution and is available at https://www.eclipse.org/legal/epl-2.0/ -# or the Apache License, Version 2.0 which accompanies this distribution and -# is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# This Source Code may also be made available under the following -# Secondary Licenses when the conditions for such availability set -# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU -# General Public License, version 2 with the GNU Classpath -# Exception [1] and GNU General Public License, version 2 with the -# OpenJDK Assembly Exception [2]. -# -# [1] https://www.gnu.org/software/classpath/license.html -# [2] https://openjdk.org/legal/assembly-exception.html -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 -################################################################################ - -if(J9VM_OPT_CRIU_SUPPORT) -endif() diff --git a/runtime/criusupport/j9criu.tdf b/runtime/criusupport/j9criu.tdf deleted file mode 100644 index 87c843c9fc5..00000000000 --- a/runtime/criusupport/j9criu.tdf +++ /dev/null @@ -1,55 +0,0 @@ -//******************************************************************************* -// Copyright IBM Corp. and others 2021 -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which accompanies this -// distribution and is available at https://www.eclipse.org/legal/epl-2.0/ -// or the Apache License, Version 2.0 which accompanies this distribution and -// is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: GNU -// General Public License, version 2 with the GNU Classpath -// Exception [1] and GNU General Public License, version 2 with the -// OpenJDK Assembly Exception [2]. -// -// [1] https://www.gnu.org/software/classpath/license.html -// [2] https://openjdk.org/legal/assembly-exception.html -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 -//****************************************************************************** - -Executable=j9criu -DATFileName=J9TraceFormat.dat -Submodules=j9vmutil,j9util - -TraceAssert=Assert_CRIU_true noEnv Obsolete Overhead=1 Level=1 Assert="(P1)" -TraceAssert=Assert_CRIU_false noEnv Obsolete Overhead=1 Level=1 Assert="!(P1)" -TraceAssert=Assert_CRIU_notNull noEnv Obsolete Overhead=1 Level=1 Assert="(P1) != NULL" -TraceAssert=Assert_CRIU_mustHaveVMAccess noEnv Obsolete Overhead=1 Level=1 Assert="(P1)->publicFlags & J9_PUBLIC_FLAGS_VM_ACCESS" -TraceAssert=Assert_CRIU_mustNotHaveVMAccess noEnv Obsolete Overhead=1 Level=1 Assert="0 == ((P1)->publicFlags & J9_PUBLIC_FLAGS_VM_ACCESS)" - -TraceException=Trc_CRIU_getNativeString_getStringSizeFail Obsolete Overhead=1 Level=1 Template="Failed to get Java string size: mutf8String=%s mutf8StringSize=%zu" -TraceException=Trc_CRIU_getNativeString_convertFail Obsolete Overhead=1 Level=1 Template="Failed to convert Java string: mutf8String=%s mutf8StringSize=%zu requiredConvertedStringSize=%zd" - -TraceEvent=Trc_CRIU_before_checkpoint Obsolete Overhead=1 Level=2 Template="Before checkpoint criu_dump(), j9time_nano_time() returns %lld, j9time_current_time_nanos() returns %llu" -TraceEvent=Trc_CRIU_after_checkpoint Obsolete Overhead=1 Level=2 Template="After checkpoint criu_dump(), restoreNanoUTCTime = %llu, checkpointNanoUTCTime = %llu, checkpointRestoreTimeDelta = %lld, restoreNanoTimeMonotonic = %lld, checkpointNanoTimeMonotonic = %lld, nanoTimeMonotonicClockDelta = %lld" -TraceEntry=Trc_CRIU_checkpointJVMImpl_Entry Obsolete Overhead=1 Level=2 Template="Java_openj9_internal_criu_CRIUSupport_checkpointJVMImpl" -TraceExit=Trc_CRIU_checkpointJVMImpl_Exit Obsolete Overhead=1 Level=2 Template="Java_openj9_internal_criu_CRIUSupport_checkpointJVMImpl" -TraceEvent=Trc_CRIU_checkpointJVMImpl_checkIfSafeToCheckpointBlocked Obsolete Overhead=1 Level=2 Template="Checkpoint blocked because thread=%p is in method=%p marked as not safe to checkpoint" -TraceEvent=Trc_CRIU_checkpointJVMImpl_syslogOptions Obsolete Overhead=1 Level=3 Template="Current syslogOptions: %s" -TraceEvent=Trc_CRIU_checkpoint_nano_times Obsolete Overhead=1 Level=2 Template="Before checkpoint, checkpointNanoTimeMonotonic = %lld, checkpointNanoUTCTime = %llu" -TraceEvent=Trc_CRIU_restore_nano_times Obsolete Overhead=1 Level=2 Template="After restore, restoreNanoUTCTime = %llu, checkpointNanoUTCTime = %llu, checkpointRestoreTimeDelta = %lld, restoreNanoTimeMonotonic = %lld, checkpointNanoTimeMonotonic = %lld, nanoTimeMonotonicClockDelta = %lld" -TraceEvent=Trc_CRIU_after_checkpoint Obsolete Overhead=1 Level=2 Template="After checkpoint criu_dump(), j9time_nano_time() returns %lld, j9time_current_time_nanos() returns %llu" -TraceEvent=Trc_CRIU_restoreArg Obsolete Overhead=1 Level=5 Test Template="Restore arg: %s" -TraceEvent=Trc_CRIU_checkpointJVMImpl_checkIfSafeToCheckpointBlockedVer2 Obsolete Overhead=1 Level=2 Template="Checkpoint blocked because thread=%p is in method=%p due to delay code %zu" -TraceEvent=Trc_CRIU_checkpointJVMImpl_checkpointWithActiveCLinit Obsolete Overhead=1 Level=2 Template="Taking a checkpoint with active clinit" - -TraceException=Trc_CRIU_setupJNIFieldIDsAndCRIUAPI_null_init Obsolete Overhead=1 Level=1 Template="setupJNIFieldIDsAndCRIUAPI() criuSystemRestoreExceptionInit(%p) criuJVMRestoreExceptionInit(%p) criuSystemCheckpointExceptionInit(%p) criuJVMCheckpointExceptionInit(%p)" -TraceException=Trc_CRIU_setupJNIFieldIDsAndCRIUAPI_null_exception_class Obsolete Overhead=1 Level=1 Template="setupJNIFieldIDsAndCRIUAPI() criuJVMCheckpointExceptionClass(%p) criuSystemCheckpointExceptionClass(%p) criuJVMRestoreExceptionClass(%p) criuSystemRestoreExceptionClass(%p)" -TraceException=Trc_CRIU_setupJNIFieldIDsAndCRIUAPI_load_criu_failure Obsolete Overhead=1 Level=1 Template="setupJNIFieldIDsAndCRIUAPI() The JVM attempted to load libcriu.so but was unable to: %zi" -TraceException=Trc_CRIU_setupJNIFieldIDsAndCRIUAPI_not_find_criu_methods Obsolete Overhead=1 Level=1 Template="setupJNIFieldIDsAndCRIUAPI() The JVM could not find critical criu functions in libcriu.so: %zi" - -TraceEvent=Trc_CRIU_after_criu_dump Obsolete Overhead=1 Level=2 Template="After checkpoint criu_dump(), criuRestoreNanoTimeMonotonic (%lld), criuRestoreNanoUTCTime (%llu), lastRestoreTimeMillis (%lld)" -TraceException=Trc_CRIU_checkpointJVMImpl_triggerOneOffJavaDump Obsolete Overhead=1 Level=1 Template="checkpointJVMImpl triggerOneOffDump() returns %d" diff --git a/runtime/criusupport/module.xml b/runtime/criusupport/module.xml deleted file mode 100644 index 06bc7453ee5..00000000000 --- a/runtime/criusupport/module.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - core j2se - - - - - - - - - - - - - - diff --git a/runtime/criusupport/uma/criusupport_exports.xml b/runtime/criusupport/uma/criusupport_exports.xml deleted file mode 100644 index 33baf3c1cb6..00000000000 --- a/runtime/criusupport/uma/criusupport_exports.xml +++ /dev/null @@ -1,23 +0,0 @@ - - -