]> Cypherpunks repositories - gostls13.git/commit
runtime: clean up panic and deadlock lock ranks
authorAustin Clements <austin@google.com>
Wed, 20 Jul 2022 21:44:45 +0000 (17:44 -0400)
committerAustin Clements <austin@google.com>
Thu, 4 Aug 2022 15:31:49 +0000 (15:31 +0000)
commit44ff9bff0cd02642c37cce0223d25dc57230c8d2
tree0c9e86833260775d3615837bf880cf3679be003a
parentf42dc0de74f83d39e5ca1af72fc5334c73bd41f9
runtime: clean up panic and deadlock lock ranks

I'm not entirely sure why these locks are currently ranked "deadlock <
panic" since we drop panic before acquiring deadlock, and we actually
want deadlock to be below panic because panic is implicitly below
everything else and we want deadlock to be, too. My best guess is that
we had this edge because we intentionally acquire deadlock twice to
deadlock, and that causes the lock rank checking to panic on the
second acquire.

Fix this in a more sensible way by capturing that deadlock can be
acquired in a self-cycle and flipping the rank to "panic < deadlock"
to express that deadlock needs to be under all other locks, just like
panic.

For #53789.

Change-Id: I8809e5d102ce473bd3ace0ba07bf2200ef60263f
Reviewed-on: https://go-review.googlesource.com/c/go/+/418719
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Austin Clements <austin@google.com>
src/runtime/lockrank.go
src/runtime/mklockrank.go