diff options
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/proc.go | 10 | ||||
| -rw-r--r-- | src/runtime/trace/subscribe_test.go | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 4bca9f1347..465a1adb60 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -4385,7 +4385,6 @@ func preemptPark(gp *g) { // up. Hence, we set the scan bit to lock down further // transitions until we can dropg. casGToPreemptScan(gp, _Grunning, _Gscan|_Gpreempted) - dropg() // Be careful about ownership as we trace this next event. // @@ -4411,10 +4410,19 @@ func preemptPark(gp *g) { if trace.ok() { trace.GoPark(traceBlockPreempted, 0) } + + // Drop the goroutine from the M. Only do this after the tracer has + // emitted an event, because it needs the association for GoPark to + // work correctly. + dropg() + + // Drop the scan bit and release the trace locker if necessary. casfrom_Gscanstatus(gp, _Gscan|_Gpreempted, _Gpreempted) if trace.ok() { traceRelease(trace) } + + // All done. schedule() } diff --git a/src/runtime/trace/subscribe_test.go b/src/runtime/trace/subscribe_test.go index 869ab0e75b..2822094a02 100644 --- a/src/runtime/trace/subscribe_test.go +++ b/src/runtime/trace/subscribe_test.go @@ -17,9 +17,10 @@ import ( func TestSubscribers(t *testing.T) { validate := func(t *testing.T, source string, tr []byte) { + t.Log("validating", source) defer func() { if t.Failed() { - testtrace.Dump(t, "trace", tr, *dumpTraces) + testtrace.Dump(t, "TestSubscribers."+source, tr, *dumpTraces) } }() |
