Skip to content

Commit 0a1da09

Browse files
tklausergopherbot
authored andcommitted
runtime/internal/atomic: remove double-check in kernelcas on linux/arm
Older kernels which require the double check of the __kuser_cmpxchg result are no longer supported as of Go 1.18 which requires at least Linux 2.6.32. For #45964 Change-Id: Ic3d6691bf006353ac51b9d43e742d970e3d4e961 Reviewed-on: https://go-review.googlesource.com/c/go/+/424556 Auto-Submit: Tobias Klauser <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent dc8e2a6 commit 0a1da09

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/runtime/internal/atomic/sys_linux_arm.s

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
// LR = return address
1616
// The function returns with CS true if the swap happened.
1717
// http://lxr.linux.no/linux+v2.6.37.2/arch/arm/kernel/entry-armv.S#L850
18-
// On older kernels (before 2.6.24) the function can incorrectly
19-
// report a conflict, so we have to double-check the compare ourselves
20-
// and retry if necessary.
2118
//
2219
// https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b49c0f24cf6744a3f4fd09289fe7cade349dead5
2320
//
@@ -37,20 +34,13 @@ TEXT kernelcas<>(SB),NOSPLIT,$0
3734
// because we don't know how to traceback through __kuser_cmpxchg
3835
MOVW (R2), R0
3936
MOVW old+4(FP), R0
40-
loop:
4137
MOVW new+8(FP), R1
4238
BL cas<>(SB)
43-
BCC check
39+
BCC ret0
4440
MOVW $1, R0
4541
MOVB R0, ret+12(FP)
4642
RET
47-
check:
48-
// Kernel lies; double-check.
49-
MOVW ptr+0(FP), R2
50-
MOVW old+4(FP), R0
51-
MOVW 0(R2), R3
52-
CMP R0, R3
53-
BEQ loop
43+
ret0:
5444
MOVW $0, R0
5545
MOVB R0, ret+12(FP)
5646
RET

0 commit comments

Comments
 (0)