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

Execute read barrier for constrained TX within the GS event handler #2790

Merged
merged 1 commit into from
Sep 17, 2018

Conversation

fjeremic
Copy link
Contributor

@fjeremic fjeremic commented Sep 6, 2018

We currently only take advantage of constrained transactions (TX) in
ConcurrentLinkedQueue methods we recognize. The problem for the
constrained TX is that the return address the hardware populates for us
in J9GSParameters.returnAddr points to the TBEGIC instruction
because the constrained transaction has no fall back path!

The very first thing we do inside of the transactions in the
ConcurrentLinkedQueue methods we recognize is load a field which
requires the read barrier. So the control flow ends up looping forever
failing on the read barrier in the TBEGIC region, then the handler
aborts the read barrier because we are in a TX and we loop again, etc.

This causes a hang in the JVM. There is another bit in J9GSParameters
which tells us whether the TX that triggered the guarded storage event
was constrained or not. Currently there are two read barriers in each
of the two methods we recognize and inline. The read barriers are both
of the form o.f.g i.e. two field indirections both requiring hardware
read barrier instructions. Given that if we reach the hardware read
barrier event handler the transaction would have already aborted there
should be no functional issue to executing the read barrier at that
point for either the read of f or g because the JIT has ensured
there are no side-effects (stores) before the hardware read barriers,
only after.

The fix here is to execute the read barriers for constrained
transactions but avoid executing them for non-constrained transactions
since we have a fall back path in that case.

Signed-off-by: Filip Jeremic fjeremic@ca.ibm.com

@fjeremic fjeremic force-pushed the gs-cs-constrained-tx branch 2 times, most recently from 3bac168 to 2847b62 Compare September 6, 2018 19:01
We currently only take advantage of constrained transactions (TX) in
ConcurrentLinkedQueue methods we recognize. The problem for the
constrained TX is that the return address the hardware populates for us
in `J9GSParameters.returnAddr` points to the `TBEGIC` instruction
because the constrained transaction has no fall back path!

The very first thing we do inside of the transactions in the
ConcurrentLinkedQueue methods we recognize is load a field which
requires the read barrier. So the control flow ends up looping forever
failing on the read barrier in the `TBEGIC` region, then the handler
aborts the read barrier because we are in a TX and we loop again, etc.

This causes a hang in the JVM. There is another bit in `J9GSParameters`
which tells us whether the TX that triggered the guarded storage event
was constrained or not. Currently there are two read barriers in each
of the two methods we recognize and inline. The read barriers are both
of the form `o.f.g` i.e. two field indirections both requiring hardware
read barrier instructions. Given that if we reach the hardware read
barrier event handler the transaction would have already aborted there
should be no functional issue to executing the read barrier at that
point for either the read of `f` or `g` because the JIT has ensured
there are no side-effects (stores) before the hardware read barriers,
only after.

The fix here is to execute the read barriers for constrained
transactions but avoid executing them for non-constrained transactions
since we have a fall back path in that case.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
@fjeremic fjeremic changed the title Execute read barrier for constrained TX within the GS event handler WIP: Execute read barrier for constrained TX within the GS event handler Sep 6, 2018
@fjeremic
Copy link
Contributor Author

fjeremic commented Sep 6, 2018

Leaving as WIP until I've done a bit more testing on my side. Should be ready for review however.

Copy link
Member

@joransiu joransiu left a comment

Choose a reason for hiding this comment

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

LGTM

@fjeremic
Copy link
Contributor Author

fjeremic commented Sep 7, 2018

My testing has been complete. This PR should be ready to go @joransiu. Launching builds on your behalf.

Jenkins test sanity zlinux JDK8

@fjeremic fjeremic changed the title WIP: Execute read barrier for constrained TX within the GS event handler Execute read barrier for constrained TX within the GS event handler Sep 17, 2018
@fjeremic
Copy link
Contributor Author

This PR should be ready to go @joransiu.

@joransiu joransiu merged commit c1cdb30 into eclipse-openj9:master Sep 17, 2018
@fjeremic fjeremic deleted the gs-cs-constrained-tx branch March 31, 2021 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants