RFR(XL): 8185640: Thread-local handshakes
Robbin Ehn
robbin.ehn at oracle.com
Tue Nov 7 10:58:48 UTC 2017
Hi all,
First a bug have been found, when deopt happens in return, the return is
re-executed and we hit an assert in the call_VM because last_sp is now not NULL.
After some discussion the proposed solution is to move the poll after the
explicit reset of last_sp. (Re-execution is always vtos.) This is fixed in #15
changeset, #14 just some copyright year updates.
(#9 changeset was dropped before it went on RFR, so it's not listed)
The JEP will be targeted to JDK 10 Friday and integration will happen shortly
after. For completeness all inc and a full (rebased on jdk/hs), all on CC I'm
adding as reviewers.
The code will be committed on: "8189941: Implementation JEP 312: Thread-local
handshake"
Tested tier 1-5, jprt, all tonga.
Martin can you have quick look at #15 changeset?
Thanks, Robbin
SafepointMechanism-0
http://cr.openjdk.java.net/~rehn/8185640/v10/SafepointMechanism-0/webrev/
PollingPage-1
http://cr.openjdk.java.net/~rehn/8185640/v10/PollingPage-1/webrev/
Handshakes-2
http://cr.openjdk.java.net/~rehn/8185640/v10/Handshakes-2/webrev/
Atomic-Update-Rebase-3
http://cr.openjdk.java.net/~rehn/8185640/v10/Atomic-Update-Rebase-3/webrev/
Coleen-n-Test-Cleanup-4
http://cr.openjdk.java.net/~rehn/8185640/v10/Coleen-n-Test-Cleanup-4/webrev/
Assorted-Karen-5
http://cr.openjdk.java.net/~rehn/8185640/v10/Assorted-Karen-5/webrev/
Support-Check-Haley-6
http://cr.openjdk.java.net/~rehn/8185640/v10/Support-Check-Haley-6/webrev/
Interpreter-Poll-7
http://cr.openjdk.java.net/~rehn/8185640/v10/Interpreter-Poll-7/webrev/
Interpreter-Poll-Wide_Ret-8
http://cr.openjdk.java.net/~rehn/8185640/v10/Interpreter-Poll-Wide_Ret-8/webrev/
Interpreter-Poll-Switch-10
http://cr.openjdk.java.net/~rehn/8185640/v10/Interpreter-Poll-Switch-10/webrev/
Interpreter-Poll-Ret-11
http://cr.openjdk.java.net/~rehn/8185640/v10/Interpreter-Poll-Ret-11/webrev/
Option-Cleanup-12
http://cr.openjdk.java.net/~rehn/8185640/v10/Option-Cleanup-12/webrev/
DavidH-Option-Cleanup-13
http://cr.openjdk.java.net/~rehn/8185640/v10/DavidH-Option-Cleanup-13/webrev/
Copyright-Update-14
http://cr.openjdk.java.net/~rehn/8185640/v10/Copyright-Update-14/webrev/
Interpreter-Poll-Ret-Deopt-Fix-15
http://cr.openjdk.java.net/~rehn/8185640/v10/Interpreter-Poll-Ret-Deopt-Fix-15/webrev/
Full
http://cr.openjdk.java.net/~rehn/8185640/v10/Full/webrev/
On 10/11/2017 03:37 PM, Robbin Ehn wrote:
> Hi all,
>
> Starting the review of the code while JEP work is still not completed.
>
> JEP: https://bugs.openjdk.java.net/browse/JDK-8185640
>
> This JEP introduces a way to execute a callback on threads without performing a
> global VM safepoint. It makes it both possible and cheap to stop individual
> threads and not just all threads or none.
>
> Entire changeset:
> http://cr.openjdk.java.net/~rehn/8185640/v0/flat/
>
> Divided into 3-parts,
> SafepointMechanism abstraction:
> http://cr.openjdk.java.net/~rehn/8185640/v0/SafepointMechanism-0/
> Consolidating polling page allocation:
> http://cr.openjdk.java.net/~rehn/8185640/v0/PollingPage-1/
> Handshakes:
> http://cr.openjdk.java.net/~rehn/8185640/v0/Handshakes-2/
>
> A handshake operation is a callback that is executed for each JavaThread while
> that thread is in a safepoint safe state. The callback is executed either by the
> thread itself or by the VM thread while keeping the thread in a blocked state.
> The big difference between safepointing and handshaking is that the per thread
> operation will be performed on all threads as soon as possible and they will
> continue to execute as soon as it’s own operation is completed. If a JavaThread
> is known to be running, then a handshake can be performed with that single
> JavaThread as well.
>
> The current safepointing scheme is modified to perform an indirection through a
> per-thread pointer which will allow a single thread's execution to be forced to
> trap on the guard page. In order to force a thread to yield the VM updates the
> per-thread pointer for the corresponding thread to point to the guarded page.
>
> Example of potential use-cases:
> -Biased lock revocation
> -External requests for stack traces
> -Deoptimization
> -Async exception delivery
> -External suspension
> -Eliding memory barriers
>
> All of these will benefit the VM moving towards becoming more low-latency
> friendly by reducing the number of global safepoints.
> Platforms that do not yet implement the per JavaThread poll, a fallback to
> normal safepoint is in place. HandshakeOneThread will then be a normal
> safepoint. The supported platforms are Linux x64 and Solaris SPARC.
>
> Tested heavily with various test suits and comes with a few new tests.
>
> Performance testing using standardized benchmark show no signification changes,
> the latest number was -0.7% on Linux x64 and +1.5% Solaris SPARC (not
> statistically ensured). A minor regression for the load vs load load on x64 is
> expected and a slight increase on SPARC due to the cost of ‘materializing’ the
> page vs load load.
> The time to trigger a safepoint was measured on a large machine to not be an
> issue. The looping over threads and arming the polling page will benefit from
> the work on JavaThread life-cycle (8167108 - SMR and JavaThread Lifecycle:
> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-October/024773.html)
> which puts all JavaThreads in an array instead of a linked list.
>
> Thanks, Robbin
More information about the hotspot-dev
mailing list