From ea9c3fd42d94182ce6f87104b68a51ea92f1a571 Mon Sep 17 00:00:00 2001 From: doujiang24 Date: Fri, 12 Aug 2022 02:28:43 +0000 Subject: runtime/trace: add missing events for the locked g in extra M. Extra Ms may lead to the "no consistent ordering of events possible" error when parsing trace file with cgo enabled, since: 1. The gs in the extra Ms may be in `_Gdead` status while starting trace by invoking `runtime.StartTrace`, 2. and these gs will trigger `traceEvGoSysExit` events in `runtime.exitsyscall` when invoking go functions from c, 3. then, the events of those gs are under non-consistent ordering, due to missing the previous events. Add two events, `traceEvGoCreate` and `traceEvGoInSyscall`, in `runtime.StartTrace`, will make the trace parser happy. Fixes #29707 Change-Id: I7cc4b80822d2c46591304a59c9da2c9fc470f1d0 GitHub-Last-Rev: 445de8eaf3fb54e12795ac31e26650f821c5efbc GitHub-Pull-Request: golang/go#53284 Reviewed-on: https://go-review.googlesource.com/c/go/+/411034 Run-TryBot: Michael Pratt Reviewed-by: Michael Knyszek Auto-Submit: Michael Pratt TryBot-Result: Gopher Robot Reviewed-by: Michael Pratt --- src/runtime/runtime2.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/runtime/runtime2.go') diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 32ad34ccdf..f95e11bec4 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -546,6 +546,7 @@ type m struct { newSigstack bool // minit on C thread called sigaltstack printlock int8 incgo bool // m is executing a cgo call + isextra bool // m is an extra m freeWait uint32 // if == 0, safe to free g0 and delete m (atomic) fastrand uint64 needextram bool -- cgit v1.3-5-g9baa