diff options
author | 2024-12-13 17:12:02 -0800 | |
---|---|---|
committer | 2024-12-17 11:03:35 -0800 | |
commit | 37ec22b569fceb88b0f6ffa6ff2acc027dae904c (patch) | |
tree | eb1710b5d9a12fdd98a50a17e751f9fef8a5195b /openjdkjvmti/ti_thread.cc | |
parent | 81101f0095c2201fa729993a80adf590f60a5480 (diff) |
Document and fix thread flags memory ordering
Expand mutator_gc_coord.md with a discussion of memory ordering
for state and flags accesses.
Change ReadFlag() to take a non-defaulted memory order argument.
Fix all calls to supply it. The prior memory_order_relaxed default does
not make sense, since it is incorrect in a few places. And even when it
is correct, the arguments behind that are extremely subtle and vary by
call site. We want this to be very explicit and documented.
Document ThreadList::RunCheckpoint memory ordering requirements.
Document the fact that empty checkpoinst should also satisfy those
requirements, but currently do not fully do so.
Temporarily strengthen memory ordering to test kEmptyCheckpointRequest
to partially work around the above issue.
Strengthen some of the loads to test kRunningFlipFunction. We did not
always perform an acquire load before concluding that the flip function
had completed.
Weaken one load in EnsureFlipFunctionStarted for consistency.
In a corner case, reload a flag with acquire ordering in the same
function.
This is the result of a fairly complete pass over the flag setting
and reading logic. The empty checkpoint issue still needs to be more
completley addressed, most probably by switching empty checkpoints to
use the general checkpoint logic. It currently uses an "optimization"
that is very difficult, and probably expensive, to fully correct.
It is not clear whether we have observed bugs caused by this in the
field.
Bug: 382722942
Bug: 380159893
Test: Build and boot aosp
Test: Checked .md file with lowdown
Change-Id: I793eac7ddf80fada36bb4f16ddfaaf317829caa3
Diffstat (limited to 'openjdkjvmti/ti_thread.cc')
-rw-r--r-- | openjdkjvmti/ti_thread.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc index 9c71d4e3cc..f89a9d9a14 100644 --- a/openjdkjvmti/ti_thread.cc +++ b/openjdkjvmti/ti_thread.cc @@ -550,7 +550,7 @@ static jint GetJavaStateFromInternal(const InternalThreadState& state) { // Suspends the current thread if it has any suspend requests on it. void ThreadUtil::SuspendCheck(art::Thread* self) { - DCHECK(!self->ReadFlag(art::ThreadFlag::kSuspensionImmune)); + DCHECK(!self->ReadFlag(art::ThreadFlag::kSuspensionImmune, std::memory_order_relaxed)); art::ScopedObjectAccess soa(self); // Really this is only needed if we are in FastJNI and actually have the mutator_lock_ already. self->FullSuspendCheck(); |