Revert^2 "Thread suspension cleanup and deadlock fix"
This reverts commit 7c8835df16147b9096dd4c9380ab4b5f700ea17d.
PS1 is identical to aosp/2171862 .
PS2 makes the following significant changes:
1) Avoid inflating locks from the thread dumping checkpoint Run()
method. This violates the repeatedly stated claim that
checkpoint Run() methods don't suspend threads. This requires
that we print object addresses in thread dumps in some cases in
which we were previously able to give hashcodes instead.
2) For debug builds, check that we do not acquire a higher
level lock in checkpoint Run() methods, thus enforcing that
previously stated property. (Lokesh suggested this, and I
think it's a great idea. But it requires changes 4-6 below.)
3) Add a bit more justification that RunCheckpoint cannot
result in circular suspend requests.
4) For now, allow an explicit override of (2) for ddms code in
which it would otherwise fail. This should be fixed later.
5) Raise the level of monitor locks, to correctly reflect
the fact that they may be held while much of the runtime
is executed.
6) (5) was in conflict with monitor deflation acquiring a
monitor lock after acquiring the monitor list lock. But this
failure is spurious, both because it is a TryLock acquisition
that can't possibly contributed to a deadlock, and secondly
because it conflates all monitor locks, and an actual deadlock
is probably not possible anyway. Leverage the former and add
a facility to avoid checking for safe TryLock calls.
(1) Should fix the one failure I managed to debug after the
last submission attempt. Hopefully it also accounts for the
others.
PS3, PS5, PS6: Trivial corrections and cleanups
PS4, PS7, PS8: Rebase
Test: Build and boot AOSP, Treehugger
Bug: 240742796
Bug: 203363895
Bug: 238032384
Change-Id: I80d441ebe21bb30b586131f7d22b7f2797f2c45f
23 files changed