[release-branch.go1.18] runtime: add race annotations to cbs.lock
[release-branch.go1.18] runtime: add race annotations to cbs.lock

cbs.lock protects a map. The map implementation is race instrumented
regardless of which package is it called from.

lock/unlock are not automatically race instrumented, so we can trigger
race false positives without manually annotating our lock acquire and
release.

compileCallback is used during initialization before the P is available,
at which point raceacquire will crash during a racecallback to get the
race proc. Thus we skip instrumentation until scheduler initialization
is complete.

Fixes #53613.
For #50249.

Change-Id: Ie49227c9e9210ffbf0aee65f86f2b7b6a2f64638
Reviewed-on: https://go-review.googlesource.com/c/go/+/414518
TryBot-Result: Gopher Robot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Cherry Mui <d62e63aa42ce272d7b6a5055d97e942b33a34679@google.com>
Run-TryBot: Michael Pratt <e7f1edc6d5aa9f6c8c377425db8f1a5816cbbb88@google.com>
(cherry picked from commit 20760cff001e9acc05627dfeab42ea50b57920e6)
Reviewed-on: https://go-review.googlesource.com/c/go/+/415198
Run-TryBot: Heschi Kreinick <e89ab2b172855aa0ad01c40c4d8a3535a61ac68a@google.com>

cloudflare/go,cloudflare/go,cloudflare/go,cloudflare/go,cloudflare/go,cloudflare/go,cloudflare/go,cloudflare/go