]> Cypherpunks repositories - gostls13.git/commit
runtime: check partial lock ranking order
authorMichael Pratt <mpratt@google.com>
Tue, 9 Mar 2021 21:13:23 +0000 (16:13 -0500)
committerMichael Pratt <mpratt@google.com>
Wed, 10 Mar 2021 19:07:29 +0000 (19:07 +0000)
commitc41bf9ee81e26d0fc0aca858a3d96d96be29ccba
treed3abc5b6ab1296f962c9aca089c750b3d31c7d2a
parent5ce51ea74177513b473e2da05d0e4e9b7affb3c4
runtime: check partial lock ranking order

To ease readability we typically keep the partial order lists sorted by
rank. This isn't required for correctness, it just makes it (slightly)
easier to read the lists.

Currently we must notice out-of-order entries during code review, which
is an error-prone process.

Add a test to enforce ordering, and fix the errors that have crept in.
Most of the existing errors were misordered lockRankHchan or
lockRankPollDesc.

While we're here, I've moved the correctness check that the partial
ordering satisfies the total ordering from init to a test case. This
will allow us to catch these errors without even running
staticlockranking.

Change-Id: I9c11abe49ea26c556439822bb6a3183129600c3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/300171
Trust: Michael Pratt <mpratt@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/runtime/export_test.go
src/runtime/lockrank.go
src/runtime/lockrank_on.go
src/runtime/lockrank_test.go [new file with mode: 0644]