diff options
| author | Ian Lance Taylor <iant@golang.org> | 2023-04-23 12:25:47 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-04-24 21:37:06 +0000 |
| commit | f00e947cdf5cdac794d571c87a81ea8878a6fe4f (patch) | |
| tree | 1fc70ecfa42eb3727e8a28ad26f2dab5a645c1f6 /src/runtime/proc.go | |
| parent | 3f987ae61d4c52ddc364abf6472227d7821c9e43 (diff) | |
| download | go-f00e947cdf5cdac794d571c87a81ea8878a6fe4f.tar.xz | |
runtime: add raceFiniLock to lock ranking
Also preserve the PC/SP in reentersyscall when doing lock ranking.
The test is TestDestructorCallbackRace with the staticlockranking
experiment enabled.
For #59711
Change-Id: I87ac1d121ec0d399de369666834891ab9e7d11b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/487955
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index fdbf888c4f..26bab27cb1 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -115,6 +115,7 @@ var ( g0 g mcache0 *mcache raceprocctx0 uintptr + raceFiniLock mutex ) // This slice records the initializing tasks that need to be @@ -3773,6 +3774,11 @@ func reentersyscall(pc, sp uintptr) { gp.syscallsp = sp gp.syscallpc = pc casgstatus(gp, _Grunning, _Gsyscall) + if staticLockRanking { + // When doing static lock ranking casgstatus can call + // systemstack which clobbers g.sched. + save(pc, sp) + } if gp.syscallsp < gp.stack.lo || gp.stack.hi < gp.syscallsp { systemstack(func() { print("entersyscall inconsistent ", hex(gp.syscallsp), " [", hex(gp.stack.lo), ",", hex(gp.stack.hi), "]\n") |
