diff options
author | Jamie Liu <jamieliu@google.com> | 2019-09-06 17:23:15 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-06 17:25:07 -0700 |
commit | 9e1cbdf565a1f5bf5bbc84bad0103fe2289e817c (patch) | |
tree | a314fc1e1eb496f7dfcff6177b85597acf306b91 /pkg/flipcall/ctrl_futex.go | |
parent | 98f7fbb59fc5aca00f47a8145ce1227550869cb8 (diff) |
Indicate flipcall synchronization to the Go race detector.
Since each Endpoint has a distinct mapping of the packet window, the Go race
detector does not recognize accesses by connected Endpoints to be related. This
means that this change isn't necessary for the Go race detector to accept
accesses of flipcall.Endpoint.Data(), but it *is* necessary for it to accept
accesses to shared variables outside the scope of flipcall that are
synchronized by flipcall.Endpoint state; see updated test for an example.
RaceReleaseMerge is needed (instead of RaceRelease) because calls to
raceBecomeInactive() from *unrelated* Endpoints can occur in any order.
(DowngradableRWMutex.RUnlock() has a similar property: calls to RUnlock() on
the same DowngradableRWMutex from different goroutines can occur in any order.
Remove the TODO asking to explain this now that this is understood.)
PiperOrigin-RevId: 267705325
Diffstat (limited to 'pkg/flipcall/ctrl_futex.go')
-rw-r--r-- | pkg/flipcall/ctrl_futex.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/flipcall/ctrl_futex.go b/pkg/flipcall/ctrl_futex.go index d59159912..8390915a2 100644 --- a/pkg/flipcall/ctrl_futex.go +++ b/pkg/flipcall/ctrl_futex.go @@ -82,6 +82,7 @@ func (ep *Endpoint) ctrlWaitFirst() error { *ep.dataLen() = w.Len() // Return control to the client. + raceBecomeInactive() if err := ep.futexSwitchToPeer(); err != nil { return err } |