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

Post Restore Options Processing Continued #16838

Merged
merged 8 commits into from
Mar 8, 2023

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Mar 7, 2023

  • Ensure jit tracing occurs post restore
  • Process some remaining options
  • Reinitialize number of processors post restore
  • Address Synchronous Compilation
  • Ensure methods can be excluded post restore
  • Address -Xnojit and -Xnoaot
  • Add doc for OptionsPostRestore

@dsouzai dsouzai added comp:jit criu Used to track CRIU snapshot related work labels Mar 7, 2023
@dsouzai
Copy link
Contributor Author

dsouzai commented Mar 7, 2023

@mpirvu could you please review?
@vijaysun-omr fyi.

If logging isn't enabled, then the log file is suppressed via
TR::Options::suppressLogFileBecauseDebugObjectNotCreated. This needs to
be reset post-reset if logging is enabled.

Additionally, another scenario where it needs to be reset is when a
remote compilation request fails. In non-portable CRIU mode, the ability
to connect to a JITServer is implicitly enabled. However, when logging
is specified, the client suppresses the log as the server will generate
the log. However, if the compilation fails, the flag to suppress the log
file should be reset if the compilation will be performed locally.

Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Both the vlog and rtlog have the same semantics. If the vlog/rtlog are
specified pre-checkpoint and not post-restore, they remain unchanged. If
the vlog/rtlog is NOT specified pre-checkpoint but IS specified
post-restore, then the vlog/rtlog is opened post-restore. If they are
specified both pre-checkpoint and post-restore, then the pre-checkpoint
file(s) are closed and the post-restore file(s) are opened. A
consequence of this is that if the same file name is specified then a
new file will be opened. This can have the consequence of overwriting
the previous file if the PID of the restored process is the same.

Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Because synchronous and asynchronous compiled methods have different
preprologues, and because the logic to trigger patching of the Start PC
if the body gets invalidated uses a global flag to determine whether the
method was synchronous or asynchronous, at present the options
processing ignores a request to compile synchronously if it wasn't
already specified pre-checkpoint.

Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

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

I have some small questions here and there.

runtime/compiler/control/OptionsPostRestore.hpp Outdated Show resolved Hide resolved
UDATA expirationTime;
IDATA ret = GET_INTEGER_VALUE_RESTORE_ARGS(argIndex, optString, expirationTime);
if (ret == OPTION_OK)
TR::Options::_samplingThreadExpirationTime = expirationTime;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we update JIT's view of elapsed time during the restore? This is maintained by the sampling thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point, I'll have to look into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll open another PR to address this.

IDATA ret = GET_INTEGER_VALUE_RESTORE_ARGS(argIndex, optString, disclaimMs);
if (ret == OPTION_OK)
{
_compInfo->getPersistentInfo()->setLateSCCDisclaimTime(((uint64_t) disclaimMs) * 1000000);
Copy link
Contributor

Choose a reason for hiding this comment

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

This feature disclaims SCC memory after the specified amount of CPU has been spent by the JVM. Do we account for what happened until checkpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into this and address it in another PR if needed.

// Re-initialize the number of processors
_compInfo->initCPUEntitlement();
uint32_t numProc = _compInfo->getNumTargetCPUs();
TR::Compiler->host.setNumberOfProcessors(numProc);
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the options receive default values that are based on the number of processors. I guess it would be hard to change those values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah there were things here and there that I don't think I can collect up in time for 0.38. It's something I'll make a note of for the next release.

runtime/compiler/control/JITServerHelpers.cpp Show resolved Hide resolved
To prevent a compiled body from running ever again (e.g., because it was
excluded in the post-restore option), the method has to be invalidated.
This may trigger a recompilation, which will be denied because of the
exclude filter. This results in a call to
J9::Recompilation::methodCannotBeRecompiled which should patch the Start
PC to call a helper to transition to the interpreter.

This commit updates the logic that hat determines whether to trasition
to the interpreter or continue executing the existing method body had
to be augmented to include methods invalidated because they were
excluded post-restore.

Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
This comment implements -Xnojit and -Xnoaot post restore. The semantics
is as follows:

-Xnojit invalidates all existing compiled code, and prevents further JIT
compilation. However, AOT loads and compilation is allowed.

-Xnoaot prevents further AOT loads and compilation. However, both
execution of existing compiled code and further JIT compilation is
allowed.

Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
@mpirvu
Copy link
Contributor

mpirvu commented Mar 8, 2023

jenkins test sanity all jdk17

@mpirvu
Copy link
Contributor

mpirvu commented Mar 8, 2023

All tests have passes, hence merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jit criu Used to track CRIU snapshot related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants