]> Cypherpunks.ru repositories - gostls13.git/commit
internal/trace/v2: resolve syscall parsing ambiguity
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 10 Nov 2023 22:46:47 +0000 (22:46 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 14 Nov 2023 16:35:09 +0000 (16:35 +0000)
commitc06beb9eff441271bedf34ea9777a92db8018f9d
tree5fe125caa0587845801ef2122ec6e6322e9ce151
parent859c13a5ad80308125c79521cfc047200fd5a512
internal/trace/v2: resolve syscall parsing ambiguity

After landing the new execution tracer, the Windows builders failed with
some new errors.

Currently the GoSyscallBegin event has no indicator that its the target
of a ProcSteal event. This can lead to an ambiguous situation that is
unresolvable if timestamps are broken. For instance, if the tracer sees
the ProcSteal event while a goroutine has been observed to be in a
syscall (one that, for instance, did not actually lose its P), it will
proceed with the ProcSteal incorrectly.

This is a little abstract. For a more concrete example, see the
go122-syscall-steal-proc-ambiguous test.

This change resolves this ambiguity by interleaving GoSyscallBegin
events into how Ps are sequenced. Because a ProcSteal has a sequence
number (it has to, it's stopping a P from a distance) it necessarily
has to synchronize with a precise ProcStart event. This change basically
just extends this synchronization to GoSyscallBegin, so the ProcSteal
can't advance until _exactly the right_ syscall has been entered.

This change removes the test skip, since it and CL 541695 fix the two
main issues observed on Windows platforms.

For #60773.
Fixes #64061.

Change-Id: I069389cd7fe1ea903edf42d79912f6e2bcc23f62
Reviewed-on: https://go-review.googlesource.com/c/go/+/541696
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
19 files changed:
src/internal/trace/goroutinesv2_test.go
src/internal/trace/v2/event/go122/event.go
src/internal/trace/v2/internal/testgen/go122/trace.go
src/internal/trace/v2/order.go
src/internal/trace/v2/testdata/generators/go122-syscall-steal-proc-ambiguous.go [new file with mode: 0644]
src/internal/trace/v2/testdata/generators/go122-syscall-steal-proc-reacquire-new-proc-bare-m.go
src/internal/trace/v2/testdata/generators/go122-syscall-steal-proc-reacquire-new-proc.go
src/internal/trace/v2/testdata/generators/go122-syscall-steal-proc-simple-bare-m.go
src/internal/trace/v2/testdata/generators/go122-syscall-steal-proc-simple.go
src/internal/trace/v2/testdata/tests/go122-annotations.test
src/internal/trace/v2/testdata/tests/go122-gc-stress.test
src/internal/trace/v2/testdata/tests/go122-syscall-steal-proc-ambiguous.test [new file with mode: 0644]
src/internal/trace/v2/testdata/tests/go122-syscall-steal-proc-reacquire-new-proc-bare-m.test
src/internal/trace/v2/testdata/tests/go122-syscall-steal-proc-reacquire-new-proc.test
src/internal/trace/v2/testdata/tests/go122-syscall-steal-proc-simple-bare-m.test
src/internal/trace/v2/testdata/tests/go122-syscall-steal-proc-simple.test
src/internal/trace/v2/trace_test.go
src/runtime/trace2event.go
src/runtime/trace2runtime.go