-
Notifications
You must be signed in to change notification settings - Fork 18k
sync/atomic: generalCAS64 broken #6440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
The numbers are continually increasing without the program running so I don't know how useful any info received from it would be. It's unclear to me what you mean with "If your program fails" as it fails always and immediately with tip. It's supposed to print out the connection and exit as soon as a client connects, but it doesn't. Nothing is printed on the screen and the connection remains open and thus it has immediately failed. I can let it run until it SIGSEVs some point in the future, but again as the numbers in /proc/cpu/alignment are continually incrementing without the program running I'm not sure what info you hope to gain from that. Please clarify. |
TLDR: diff -r 125bf33c1905 src/pkg/sync/atomic/asm_linux_arm.s --- a/src/pkg/sync/atomic/asm_linux_arm.s Sat Sep 21 17:53:44 2013 +1000 +++ b/src/pkg/sync/atomic/asm_linux_arm.s Sat Sep 21 19:13:42 2013 +0200 @@ -129,12 +129,14 @@ BEQ 2(PC) MOVW R1, (R1) MOVW R0, 4(R13) - MOVW $4(FP), R1 // oldval + MOVW oldlo+4(FP), R1 MOVW R1, 8(R13) + MOVW oldhi+8(FP), R1 + MOVW R1, 12(R13) MOVW newlo+12(FP), R2 - MOVW R2, 12(R13) + MOVW R2, 16(R13) MOVW newhi+16(FP), R3 - MOVW R3, 16(R13) + MOVW R3, 20(R13) BL runtime·cas64(SB) MOVW R0, 20(FP) RET Without it "go test sync/atomic" (and probably much else using atomic operations) freezes on tip, and with the patch "go test sync/atomic" does not freeze until it hits TestNilDeref's use of CompareAndSwapUint64. Someone who knows the expected behaviour better would have to take a closer look at fixing that one. Details: r17651 is the offending changelist for the original issue reported which isn't too helpful as that's the revision where fd_mutex.go was first introduced. Rather than just a freeze we immediately get this though: runtime: unknown argument frame size for generalCAS64 called from 0x9b400 [sync/atomic.loadUint64] fatal error: invalid stack goroutine 1 [garbage collection]: runtime.gc(0x0) /Users/quarnster/code/3rdparty/go/src/pkg/runtime/mgc0.c:2052 +0x1c4 fp=0x40050e74 runtime.mallocgc(0x8, 0x0, 0x0) /Users/quarnster/code/3rdparty/go/src/pkg/runtime/malloc.goc:142 +0x22c fp=0x40050eb0 runtime.mal(0x8) /Users/quarnster/code/3rdparty/go/src/pkg/runtime/malloc.goc:698 +0x38 fp=0x40050ec0 copyin(0xd17e0, 0x40050f00, 0x40050f0c) /Users/quarnster/code/3rdparty/go/src/pkg/runtime/iface.c:152 +0x6c fp=0x40050edc runtime.convT2E(0xd17e0, 0xf98a8, 0xd, 0xd17e0, 0x4000d188) /Users/quarnster/code/3rdparty/go/src/pkg/runtime/iface.c:220 +0x44 fp=0x40050ef8 main.main() /Users/quarnster/code/go/hellonet.go:27 +0x204 fp=0x40050f90 runtime.main() /Users/quarnster/code/3rdparty/go/src/pkg/runtime/proc.c:200 +0xf4 fp=0x40050fc4 runtime.goexit() /Users/quarnster/code/3rdparty/go/src/pkg/runtime/proc.c:1364 fp=0x40050fc4 goroutine 3 [runnable]: runtime: unknown argument frame size for generalCAS64 called from 0x9b400 [sync/atomic.loadUint64] sync/atomic.loadUint64(0x105230c0, 0x0, 0x0) /Users/quarnster/code/3rdparty/go/src/pkg/sync/atomic/64bit_arm.go:10 +0x6c net.(*fdMutex).RWLock(0x105230c0, 0x1, 0x3fae8) /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_mutex.go:121 +0x94 net.(*netFD).readLock(0x105230c0, 0x21, 0x40) /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_unix.go:128 +0x34 net.(*netFD).accept(0x105230c0, 0x114b48, 0x0, 0x0, 0x0) /Users/quarnster/code/3rdparty/go/src/pkg/net/fd_unix.go:374 +0x40 net.(*TCPListener).AcceptTCP(0x10500168, 0x10525090, 0xd, 0x0) /Users/quarnster/code/3rdparty/go/src/pkg/net/tcpsock_posix.go:240 +0x50 net.(*TCPListener).Accept(0x10500168, 0x1, 0x1, 0xd17e0, 0x10500178) /Users/quarnster/code/3rdparty/go/src/pkg/net/tcpsock_posix.go:250 +0x2c main.func·001() /Users/quarnster/code/go/hellonet.go:17 +0xf0 created by main.main /Users/quarnster/code/go/hellonet.go:24 +0x198 That issue was then fixed in r17687, and from thereon it just spins forever in 64bit_arm.go:loadUint64 as CompareAndSwapUint64 always returns false. Creating a small test for CompareAndSwapUint64 I can confirm that it's broken, or more specifically generalCAS64 is broken, which is only used if __kuser_helper_version is < 5. (On the arm machine running this test on it appears to be 3). Apparently I can't change the title myself, but sync/atomic would be the correct package and I don't believe it's a regression, or rather the regression in net is just because net now uses a feature that might not ever have worked on this particular arm setup. |
Thank you for your excellent diagnosis! Labels changed: added priority-soon, go1.2, removed priority-triage. Owner changed to @minux. Status changed to Accepted. |
Issue #6462 has been merged into this issue. |
Issue #6462 has been merged into this issue. |
Issue #6462 has been merged into this issue. |
The problem is that I changed the prototype for runtime.cas64 without realizing it was called from here. Does https://golang.org/cl/13859043 fix the problem? |
I think the problem is that we try pretty hard not to need to fall back to generalCAS64, and we do a good job of it. Instead of having yet another arm builder, I think it is okay just to test generalCAS64. I added a test to https://golang.org/cl/13859043 but I am not near an ARM machine. Can someone try it? Thanks. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: