]> Cypherpunks repositories - gostls13.git/commit
runtime: add missing trace lock edges
authorAustin Clements <austin@google.com>
Thu, 21 Jul 2022 01:49:15 +0000 (21:49 -0400)
committerAustin Clements <austin@google.com>
Thu, 4 Aug 2022 15:31:45 +0000 (15:31 +0000)
commitc5be4ed7df3b2ae8f9d0a5c85afa4cf49e22a56d
treedf3e163dece9ac839ec389bc83f5bdff146c5cd8
parent2b8a9a484fbc91b7b0d21890e33b28a0b48e3a10
runtime: add missing trace lock edges

We're missing lock edges to trace.lock that happen only rarely. Any
trace event can potentially fill up a trace buffer and acquire
trace.lock in order to flush the buffer, but this happens relatively
rarely, so we simply haven't seen some of these lock edges that could
happen.

With this change, we promote "fin, notifyList < traceStackTab" to
"fin, notifyList < trace" and now everything that emits trace events
with a P enters the tracer lock ranks via "trace", rather than some
things entering at "trace" and others at "traceStackTab".

This was found by inspecting the rank graph for things that didn't
make sense.

Ideally we would add a mayAcquire annotation that any trace event can
potentially acquire trace.lock, but there are actually cases that
violate this ranking right now. This is #53979. The chance of a lock
cycle is extremely low given the number of conditions that have to
happen simultaneously.

For #53789.

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