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

Fix PowerPC specific issues #18637

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Fix PowerPC specific issues #18637

merged 1 commit into from
Dec 19, 2023

Conversation

LinHu2016
Copy link
Contributor

@LinHu2016 LinHu2016 commented Dec 16, 2023

-Replace do_{_if_(condition)_{_..._continute;_}_}while_{false}; with
for(;;)_{_if_(condition)_{...}_else{break;_}_} for an infinite loop
with a break logic to handle waiting concurrent gc finish during
continuation mounting. compiler might generate wrong logic for
do_while infinite loop.

-fix small hole during mounting synchronization with concurrent
scanning(for the case concurrent scanning start just before resetting
pendingmount flag-before reading the value of state for atomic update)

  • new assertion check for catching issue earlier.

issue: #16728 (comment) [ISSUE3]

Signed-off-by: hulin [email protected]

@pshipton
Copy link
Member

jenkins compile amac jdk21

ContinuationState returnContinuationState = 0;
volatile ContinuationState oldContinuationState = 0;
volatile ContinuationState returnContinuationState = 0;
volatile ContinuationState newContinuationState = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd remove volatile here, and in other methods where used for local variables (not for a pointer to a volatile location)

@@ -319,7 +319,7 @@ MM_GCExtensions::needScanStacksForContinuationObject(J9VMThread *vmThread, j9obj
{
bool needScan = false;
#if JAVA_SPEC_VERSION >= 19
ContinuationState volatile *continuationStatePtr = VM_ContinuationHelpers::getContinuationStateAddress(vmThread, objectPtr);
volatile ContinuationState *continuationStatePtr = VM_ContinuationHelpers::getContinuationStateAddress(vmThread, objectPtr);
Copy link
Contributor

@amicic amicic Dec 18, 2023

Choose a reason for hiding this comment

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

while I prefer the new style, the old style should still be valid with identical effects - so I'd minimize the change and revert to the old style

@pshipton
Copy link
Member

pshipton commented Dec 18, 2023

jenkins compile aix jdk21

https://openj9-jenkins.osuosl.org/job/PullRequest-OpenJ9/4861/


} else {
oldContinuationState = returnContinuationState;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is hard to follow
either we need more comments or better we just start this loop from scratch: read oldContinuationState from continuationStatePtr and check isConcurrentlyScanned against oldContinuationState...

@amicic amicic added comp:gc project:loom Used to track Project Loom related work labels Dec 18, 2023
 -Replace do_{_if_(condition)_{_..._continute;_}_}while_{false}; with
  for(;;)_{_if_(condition)_{...}_else{break;_}_} for an infinite loop
  with a break logic to handle waiting concurrent gc finish during
  continuation mounting. compiler might generate wrong logic for
  do_while infinite loop.

 -fix small hole during mounting synchronization with concurrent
  scanning(for the case concurrent scanning start just before resetting
  pendingmount flag-before reading the value of state for atomic update)

- new assertion check for catching issue earlier.

signed-off-by: hulin <[email protected]>
@amicic
Copy link
Contributor

amicic commented Dec 18, 2023

The change looks good now (assuming it still fixes the problem), although I have hard time believing that the part that changed while to for loop had any effect. We'll have to investigate and understand that part more...

@amicic
Copy link
Contributor

amicic commented Dec 18, 2023

jenkins test sanity aix,xLinux,win jdk21

@amicic
Copy link
Contributor

amicic commented Dec 18, 2023

jenkins test sanity win jdk21

@pshipton
Copy link
Member

pshipton commented Dec 18, 2023

Windows machines don't seem to be working too well atm. Edit - tried again later and it worked.

@pshipton
Copy link
Member

jenkins test sanity xmac jdk21

Assert_VM_true(VM_ContinuationHelpers::isMountedWithCarrierThread(oldContinuationState, currentThread));
Assert_VM_true(VM_ContinuationHelpers::isPendingToBeMounted(oldContinuationState));
ContinuationState newContinuationState = oldContinuationState;
VM_ContinuationHelpers::resetPendingState(&newContinuationState);
returnContinuationState = VM_AtomicSupport::lockCompareExchange(continuationStatePtr, oldContinuationState, newContinuationState);
} while (oldContinuationState != returnContinuationState);
Assert_VM_false(VM_ContinuationHelpers::isPendingToBeMounted(*continuationStatePtr));
Assert_VM_false(VM_ContinuationHelpers::isConcurrentlyScanned(*continuationStatePtr));
Copy link
Contributor

@amicic amicic Dec 19, 2023

Choose a reason for hiding this comment

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

Actually, I think this assert is ambitious since it's based on newly re-read state. Another scan can start just after this one finished. It could be a rescan within the same cycle (concurrent card cleaning) or in another cycle of same type or overlapping cycle of the complement type.

My bad, no new scan can start while this is fully mounted. So, the assert is ok.

@amicic
Copy link
Contributor

amicic commented Dec 19, 2023

While windows and mac sanity testing failed, I don't see any real functional problems.

@amicic amicic merged commit 9cde1d0 into eclipse-openj9:master Dec 19, 2023
8 of 11 checks passed
@pshipton
Copy link
Member

Pls cherry pick for the 0.42 and 0.43 branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:gc project:loom Used to track Project Loom related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants