Revert^10 "Thread suspension cleanup and deadlock fix"""
This reverts commit 63af30b8fe8d4e1dc32db4dcb5e5dae1efdc7f31.
master (aosp/2530206) PS1 is identical to aosp/2377951 .
master (aosp/2530206) PS2 is a rebase.
At this point, master branch was replaced by main, and this CL moved.
PS1: Restructure documentation for the IncrementSuspendCount handshake
to install a suspend barrier.
Document a couple of additional mutator lock assumptions.
Add some DCHECKs to check that suspended threads really are
suspended.
Weaken seq_cst memory order in a couple of places where it really
didn't make sense here. Clearly not a correctness fix.
Includes a rebase and merge with aosp/2587606.
PS2: Another rebase.
Fix thumb assembler test to compensate for Thread structure layout
changes.
PS3: Messy rebase, primarily to handle aosp/2670108, which included both
new fixes around this and a few small snippets of this CL.
Call EnsureFlipFunctionStarted without a state-and-flags argument
only when we actually hold the mutator lock, as promised.
PS4: Minor rebase, some lint fixes.
PS5: Another minor lint fix that I had missed in PS4.
PS6: Fix for RunCheckpoint bug introduced around PS3. Fix expectations
in jni_cfi_test to compensate for thread structure layout changes.
PS7: In PS3+, EnsureFlipFunctionStarted could access a destroyed "this"
thread. Fix that, and make the function static to make this
constraint more explicit. (And running a method on a potentially
destroyed object just seemed unclean.)
PS8: Address reviewer comments. The major issue was that we released
the suspend_count_lock too early in FlipThreadRoots, potentially
allowing an intervening SuspendAll to block us. The fix involved
a very minor extention of the mutex API.
PS9: Comment typo fix.
PS10: Address new reviewer comments. Rebase.
MUST_SLEEP for 129_ThreadGetId debug output.
Test: Treehugger.
Bug: 240742796
Bug: 203363895
Bug: 238032384
Bug: 253671779
Bug: 276660630
(and more)
Change-Id: I0f2450e394c03c17eece3698286b2f3e45727967
30 files changed