RFR: 8267079: Support async handshakes that can be executed by a remote thread

Man Cao manc at openjdk.java.net
Tue May 18 18:55:05 UTC 2021


On Thu, 13 May 2021 02:05:30 GMT, Man Cao <manc at openjdk.org> wrote:

> Hi all,
> 
> Can I have reviews for this small refactoring change? It resolves a pending concern from [JDK-8238761](https://bugs.openjdk.java.net/browse/JDK-8238761), clarifies the code and allows more use case of async handshakes. See [JDK-8267079](https://bugs.openjdk.java.net/browse/JDK-8267079) for detailed description.
> 
> -Man

Thanks for the feedback!

For David's question, I'm looking for adding support for HandshakeState::try_process() to execute non-self executable async handshakes . The caller of try_process() could be the VM thread, or a third thread, or the original requesting thread. 

Consider this scenario:

Thread A calls Handshake::enqueue(async_op, Thread_B);
Thread X calls Handshake::execute(sync_op, Thread_B);

Thread X could be the same as thread A, or a third thread C. In either case, X can execute any non-self executable handshake op on B's queue if it is safe to do so. Currently only synchronous handshake can be executed.

The goal is to support asynchronous handshake with all threads for JDK-8236485, and skipping threads that are blocked, without entering a safepoint in the requesting thread. The requesting thread can stop waiting if it has timed out. I experimented that it could work with some modification to the handshake code.

A minimal requirement is to be able to safely check if the target thread is blocked, and skip them. This was disussed in https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2021-April/034697.html. 
The first four if conditions in HandshakeState::try_process() already check for this condition, provided that there is at least one non-self executable handshake op on the queue so that HandshakeState::claim_handshake() can return true. I'd like to extract the four if conditions in a single public method in JDK-8236485.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4005


More information about the hotspot-dev mailing list