]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/internal/atomic: remove double-check in kernelcas on linux/arm
authorTobias Klauser <tklauser@distanz.ch>
Thu, 18 Aug 2022 09:49:39 +0000 (11:49 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 19 Aug 2022 17:28:00 +0000 (17:28 +0000)
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 <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/internal/atomic/sys_linux_arm.s

index 0cc7fa73d1e6cf24f7602d40bb30fec9c165fd57..9225df843948e9992cd1dd222caed094e5cadce4 100644 (file)
@@ -15,9 +15,6 @@
 //     LR = return address
 // The function returns with CS true if the swap happened.
 // http://lxr.linux.no/linux+v2.6.37.2/arch/arm/kernel/entry-armv.S#L850
-// On older kernels (before 2.6.24) the function can incorrectly
-// report a conflict, so we have to double-check the compare ourselves
-// and retry if necessary.
 //
 // https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b49c0f24cf6744a3f4fd09289fe7cade349dead5
 //
@@ -37,20 +34,13 @@ TEXT kernelcas<>(SB),NOSPLIT,$0
        // because we don't know how to traceback through __kuser_cmpxchg
        MOVW    (R2), R0
        MOVW    old+4(FP), R0
-loop:
        MOVW    new+8(FP), R1
        BL      cas<>(SB)
-       BCC     check
+       BCC     ret0
        MOVW    $1, R0
        MOVB    R0, ret+12(FP)
        RET
-check:
-       // Kernel lies; double-check.
-       MOVW    ptr+0(FP), R2
-       MOVW    old+4(FP), R0
-       MOVW    0(R2), R3
-       CMP     R0, R3
-       BEQ     loop
+ret0:
        MOVW    $0, R0
        MOVB    R0, ret+12(FP)
        RET