diff options
| author | Ian Lance Taylor <iant@golang.org> | 2023-10-06 12:20:19 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-10-11 21:04:25 +0000 |
| commit | 655155d0a7ac39062e8234f4286ed1fcf99fb176 (patch) | |
| tree | b739a7f8139cde359c941f0c88a71869420ac334 /src/runtime/internal/atomic | |
| parent | e7c142a19d8b3944c2f1b9ab7fd94c63d8d0c555 (diff) | |
| download | go-655155d0a7ac39062e8234f4286ed1fcf99fb176.tar.xz | |
cmd/compile, runtime/internal/atomic: add lwsync for false ppc64 cas
This CL changes ppc64 atomic compare-and-swap (cas). Before this CL,
if the cas failed--if the value in memory was not the value expected
by the cas call--the atomic function would not synchronize memory.
In the note code in runtime/lock_sema.go, used on BSD systems,
notesleep and notetsleep first try a cas on the key. If that cas fails,
something has already called notewakeup, and the sleep completes.
However, because the cas did not synchronize memory on failure,
this meant that notesleep/notetsleep could return to a core that was
unable to see the memory changes that the notewakeup was reporting.
Fixes #30189
Fixes #63384
Change-Id: I9b921de5c1c09b10a37df6b3206b9003c3f32986
Reviewed-on: https://go-review.googlesource.com/c/go/+/533118
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/internal/atomic')
| -rw-r--r-- | src/runtime/internal/atomic/atomic_ppc64x.s | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/internal/atomic/atomic_ppc64x.s b/src/runtime/internal/atomic/atomic_ppc64x.s index 144439ec23..75635b933d 100644 --- a/src/runtime/internal/atomic/atomic_ppc64x.s +++ b/src/runtime/internal/atomic/atomic_ppc64x.s @@ -101,6 +101,7 @@ cas_again: MOVB R3, ret+16(FP) RET cas_fail: + LWSYNC MOVB R0, ret+16(FP) RET @@ -128,6 +129,7 @@ cas64_again: MOVB R3, ret+24(FP) RET cas64_fail: + LWSYNC MOVB R0, ret+24(FP) RET |
