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 option to disable SCC after CRIU restore #16921

Merged
merged 1 commit into from
Mar 17, 2023

Conversation

ehrenjulzert
Copy link

for #16868

@ehrenjulzert
Copy link
Author

@hangshao0
fyi @dsouzai

@@ -276,6 +276,8 @@ IDATA J9VMDllMain(J9JavaVM* vm, IDATA stage, void* reserved)
}
vm->sharedCacheAPI->runtimeFlags = runtimeFlags;
}

vm->sharedCacheAPI->xShareClassCacheDisabledOnCRIURestore = FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to set xShareClassCacheDisabledOnCRIURestore to FALSE ? Line 53 memset the whole sharedCacheAPI struct to 0 already.

Copy link
Author

Choose a reason for hiding this comment

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

Good point, I missed that

Copy link
Author

Choose a reason for hiding this comment

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

removed in 86ce34e

J9JavaVM *vm = currentThread->javaVM;

if (NULL != vm->checkpointState.restoreArgsList) {
if (FIND_AND_CONSUME_ARG(vm->checkpointState.restoreArgsList, EXACT_MATCH, VMOPT_XSHARECLASSES_DISABLEONRESTORE, NULL) >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a NULL check of vm->sharedClassConfig. If it is NULL, the shared class is already disabled.

Copy link
Author

Choose a reason for hiding this comment

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

Added a check in 86ce34e

* @param[in] currentThread vmThread token
* @param[in] userData J9InternalHookRecord pointer
*
* @return BOOLEAN TRUE if no error, otherwise FALSE
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this function can only return TRUE.

Copy link
Author

Choose a reason for hiding this comment

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

Updated in 86ce34e

void
j9shr_disableSharedClassCacheForCriuRestore(J9JavaVM* vm)
{
vm->sharedClassConfig->runtimeFlags |= J9SHR_RUNTIMEFLAG_DENY_CACHE_ACCESS | J9SHR_RUNTIMEFLAG_DENY_CACHE_UPDATES;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you check the APIs checking these 2 flags (J9SHR_RUNTIMEFLAG_DENY_CACHE_ACCESS and J9SHR_RUNTIMEFLAG_DENY_CACHE_UPDATES), we may need to update the return code. e.g.

(localRuntimeFlags & J9SHR_RUNTIMEFLAG_DENY_CACHE_ACCESS)) {

The comment of this API says Return -1 in the case of error. But if xShareClassCacheDisabledOnCRIURestore is TRUE, it should not be an error case. It should behave as if the data is not in the shared cache and return 0.

Copy link
Author

Choose a reason for hiding this comment

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

I just checked every usage of those two flags and I didn't find anything else that was incorrect, so I'll just fix that one.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed that function in 86ce34e

@dsouzai dsouzai added comp:vm criu Used to track CRIU snapshot related work labels Mar 15, 2023
if (vm->sharedCacheAPI->xShareClassCacheDisabledOnCRIURestore) {
return 0;
} else {
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add trace point Trc_SHR_INIT_findSharedData_exit_Noop before these 2 returns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Approve assuming trace points are added.

Copy link
Author

Choose a reason for hiding this comment

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

Added in 734a570

@hangshao0 hangshao0 requested a review from tajila March 15, 2023 20:04
j9shr_disableSharedClassCacheForCriuRestore(J9JavaVM* vm)
{
vm->sharedClassConfig->runtimeFlags |= J9SHR_RUNTIMEFLAG_DENY_CACHE_ACCESS | J9SHR_RUNTIMEFLAG_DENY_CACHE_UPDATES;
vm->sharedCacheAPI->xShareClassCacheDisabledOnCRIURestore = TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

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

@dsouzai JIT can check this variable vm->sharedCacheAPI->xShareClassCacheDisabledOnCRIURestore. It is TRUE if vm->sharedClassConfig is not NULL and "-Xshareclasses:disableOnRestore" presents. (If vm->sharedClassConfig is NULL, SCC is already disabled)

@tajila
Copy link
Contributor

tajila commented Mar 16, 2023

@ehrenjulzert please rebase these changes

@hangshao0
Copy link
Contributor

@tajila Are the CRIU related options documented ? If yes, a doc issue should be created for the new option added here.

@dsouzai
Copy link
Contributor

dsouzai commented Mar 16, 2023

@tajila Are the CRIU related options documented ? If yes, a doc issue should be created for the new option added here.

-Xshareclasses:disableOnRestore is listed out here.

for eclipse-openj9#16868

Signed-off-by: Ehren Julien-Neitzert <ehren.julien-neitzert@ibm.com>
@ehrenjulzert
Copy link
Author

Just rebased

@tajila
Copy link
Contributor

tajila commented Mar 16, 2023

jenkins compile win jdk8

@tajila
Copy link
Contributor

tajila commented Mar 16, 2023

jenkins test sanity xlinux jdk17

@tajila tajila merged commit 3d7ba05 into eclipse-openj9:master Mar 17, 2023
@tajila
Copy link
Contributor

tajila commented Mar 17, 2023

@ehrenjulzert Please make a PR for 0.38

@ehrenjulzert
Copy link
Author

0.38 PR: #16921

@hangshao0
Copy link
Contributor

0.38 PR: #16921

I think you mean #16947

@ehrenjulzert
Copy link
Author

Whoops, yes that's correct

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

Successfully merging this pull request may close these issues.

None yet

4 participants