Integrated: 8306767: Concurrent repacking of extra data in MethodData is potentially unsafe
Emanuel Peter
epeter at openjdk.org
Thu Jan 25 15:52:52 UTC 2024
On Tue, 28 Nov 2023 06:23:29 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
> As explained in a [comment below](https://github.com/openjdk/jdk/pull/16840#issuecomment-1833529561), we have to ensure that reading/writing/cleaning the extra data all needs to be guarded by the `extra_data_lock`, and that no safepoint should happen while holding that lock, so that the lock is not broken.
>
> I introduced `check_extra_data_locked`, where I check that we hold the lock, and if we are a java thread (only those ever safepoint), that we currently are in a `NoSafepointVerifier` scope, hence we verify that no safepoint will be taken.
>
> I placed `check_extra_data_locked` in all the places where we access the extra data, and then placed locks (with implicit no-safepoint-verifiers) at the call-site of those places.
>
> I also needed to change the rank of `extra_data_lock` to `nosafepoint` and set the `Mutex::_no_safepoint_check_flag` when taking the lock. Otherwise I could not take the lock from a VM thread.
>
> **Testing**
> Testing: tier1-3 and stress.
This pull request has now been integrated.
Changeset: 746a0868
Author: Emanuel Peter <epeter at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/746a08686bfad629fe045a762ed2fbb209763f6b
Stats: 177 lines in 13 files changed: 125 ins; 24 del; 28 mod
8306767: Concurrent repacking of extra data in MethodData is potentially unsafe
Reviewed-by: eosterlund, roland, coleenp, never
-------------
PR: https://git.openjdk.org/jdk/pull/16840
More information about the hotspot-dev
mailing list