Earlier the atomicbitops_state_autogen.go was not being built because it had
an impossible build condition: `(amd64 || arm64) && !amd64 && !arm64`.
This is a known deficiency in go_stateify tool. This was solved via having
two identical files like 32b_32bit.go and 32b_64bit.go. Just piggyback this.
This changes also enhances `atomicbitops.Bool` in the following ways:
- Added RacyLoad(), RacyStore() and CompareAndSwap() for Bool to bring it up to
speed with the other types.
- Delegated the actual atomic operations work to the underlying Uint32.
- Cleaned up code with b32(); similar to what sync/atomic.Bool does.
PiperOrigin-RevId: 597607982
This adds a new atomic type, `atomicbitops.Float64`, which has similar
operations as `atomicbitops.Uint64`. It actually uses `atomicbitops.Uint64`
for storing its bits.
`atomicbitops.Float64` supports `Swap`, `CompareAndSwap`, and `Add`
operations.
This is useful in gVisor's metric library for keeping track of the
sum-of-squared-deviation statistic of distribution metrics.
PiperOrigin-RevId: 537127647
For all trivial and zero frame-sized functions, we now require an explicit
NOFRAME annotation as the heuristic has changed. See go.dev/cl/466316.
Most of these functions do not *require* NOFRAME, but this change encodes
the existing behavior in order to avoid accidental bugs or regressions.
PiperOrigin-RevId: 513946210
Also adds the "// +checkalignedignore" escape hatch for packages to opt out of
checking.
See cl/439349432 for justification (https://github.com/google/gvisor/pull/7376).
PiperOrigin-RevId: 444918125
Part of a series of changes that will end with prohibiting use of sync/atomic
(u)int32 functions. See cl/440484071 for more details.
PiperOrigin-RevId: 442673296
All atomic 64 bit ints are changed to atomicbitops.(Ui|I)nt64. A nogo checker
enforces that sync/atomic 64 bit functions are not called.
For reviewers: the interesting changes are in the atomicbitops and checkaligned
packages.
Why do this?
- It is very easy to accidentally use atomic values without sync/atomic funcs.
- We have checkatomics, but this is optional and is forgotten in several places.
- Using a type+checker to enforce this seems less error prone and simpler.
- We get NoCopy protection.
- Use of 64 bit atomics can break 32 bit builds. We have types to handle this
without any runtime cost, so we might as well use them.
PiperOrigin-RevId: 440473398
AlignedAtomicUint64 is 15 bytes and it takes 16 bytes in structures. On
32-bit systems, variables and structure fields is guaranteed to be
32-bit aligned and this means that we need only 12 bytes to find 8
contiguous bytes.
BP should be callee-save. It will be saved automatically if there is nonzero frame size.
$ go vet -framepointer ./pkg/atomicbitops
pkg/atomicbitops/atomicbitops_amd64.s:27:1: frame pointer is clobbered before saving
pkg/atomicbitops/atomicbitops_amd64.s:34:1: frame pointer is clobbered before saving
pkg/atomicbitops/atomicbitops_amd64.s:50:1: frame pointer is clobbered before saving
pkg/atomicbitops/atomicbitops_amd64.s:57:1: frame pointer is clobbered before saving
pkg/atomicbitops/atomicbitops_amd64.s:64:1: frame pointer is clobbered before saving
Signed-off-by: Koichi Shiraishi <[email protected]>
In the case of other signals (preemption), inject a normal bounce and
defer the signal until the vCPU has been returned from guest mode.
PiperOrigin-RevId: 303799678
- Redocument memory ordering from "no ordering" to "acquire-release". (No
functional change: both LOCK WHATEVER on x86, and LDAXR/STLXR loops on ARM64,
already have this property.)
- Remove IncUnlessZeroInt32 and DecUnlessOneInt32, which were only faster than
the equivalent loops using sync/atomic before the Go compiler inlined
non-unsafe.Pointer atomics many releases ago.
PiperOrigin-RevId: 295811743
* Rename syncutil to sync.
* Add aliases to sync types.
* Replace existing usage of standard library sync package.
This will make it easier to swap out synchronization primitives. For example,
this will allow us to use primitives from github.com/sasha-s/go-deadlock to
check for lock ordering violations.
Updates #1472
PiperOrigin-RevId: 289033387
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.
1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.
Fixes#209
PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
Nothing reads them and they can simply get stale.
Generated with:
$ sed -i "s/licenses(\(.*\)).*/licenses(\1)/" **/BUILD
PiperOrigin-RevId: 231818945
Change-Id: Ibc3f9838546b7e94f13f217060d31f4ada9d4bf0
This change also adds extensive testing to the p9 package via mocks. The sanity
checks and type checks are moved from the gofer into the core package, where
they can be more easily validated.
PiperOrigin-RevId: 218296768
Change-Id: I4fc3c326e7bf1e0e140a454cbacbcc6fd617ab55
We have been unnecessarily creating too many savable types implicitly.
PiperOrigin-RevId: 206334201
Change-Id: Idc5a3a14bfb7ee125c4f2bb2b1c53164e46f29a8