go.arm64 icon indicating copy to clipboard operation
go.arm64 copied to clipboard

Go executables fail when CONFIG_ARM64_64K_PAGES=y

Open stevecapperlinaro opened this issue 9 years ago • 3 comments

Hi, I've tried out the merge.arm64 branch (06c5ac294452a4f1a5c22bd91f65eb0e3664fe94) on a system running 64K pages. Unfortunately I get regular crashes when running go executables. Switching to 4K pages, made the problems go away. From a cursory glance at the go code, I think there are some 4K assumptions baked into go that need tweaking.

An example failure:

$ ./go
unexpected fault address 0x5f2220
fatal error: fault
[signal 0xb code=0x2 addr=0x5f2220 pc=0x5f2220]

goroutine 1 [running, locked to thread]:
runtime.throw(0x7574f0, 0x5)
    /home/steven/tmp/go/src/runtime/panic.go:543 +0x108 fp=0x4208085b20 sp=0x4208085b00
runtime.sigpanic()
    /home/steven/tmp/go/src/runtime/sigpanic_unix.go:27 +0x470 fp=0x4208085b70 sp=0x4208085b20
crypto/sha512.init()
    ?:0 fp=0x4208085b80 sp=0x4208085b80
crypto/ecdsa.init()
    /home/steven/tmp/go/src/crypto/ecdsa/ecdsa.go:246 +0x88 fp=0x4208085ba0 sp=0x4208085b80
crypto/x509.init()
    /home/steven/tmp/go/src/crypto/x509/x509.go:1922 +0xb4 fp=0x4208085be0 sp=0x4208085ba0
crypto/tls.init()
    /home/steven/tmp/go/src/crypto/tls/tls.go:271 +0x98 fp=0x4208085c30 sp=0x4208085be0
net/http.init()
    /home/steven/tmp/go/src/net/http/transport.go:1281 +0xcc fp=0x4208085e80 sp=0x4208085c30
main.init()
    /home/steven/tmp/go/src/cmd/go/zdefaultcc.go:6 +0xd0 fp=0x4208085f80 sp=0x4208085e80
runtime.main()
    /home/steven/tmp/go/src/runtime/proc.go:83 +0x294 fp=0x4208085fd0 sp=0x4208085f80
runtime.goexit()
    /home/steven/tmp/go/src/runtime/asm_arm64.s:891 +0x4 fp=0x4208085fd0 sp=0x4208085fd0

Cheers, Steve

stevecapperlinaro avatar Mar 12 '15 11:03 stevecapperlinaro

Have a look at the _PageSize constant in the runtime package, you can change that to 64k and rebuild.

On 12 Mar 2015, at 22:30, stevecapperlinaro [email protected] wrote:

Hi, I've tried out the merge.arm64 branch (06c5ac2) on a system running 64K pages. Unfortunately I get regular crashes when running go executables. Switching to 4K pages, made the problems go away. From a cursory glance at the go code, I think there are some 4K assumptions baked into go that need tweaking.

An example failure:

$ ./go unexpected fault address 0x5f2220 fatal error: fault [signal 0xb code=0x2 addr=0x5f2220 pc=0x5f2220]

goroutine 1 [running, locked to thread]: runtime.throw(0x7574f0, 0x5) /home/steven/tmp/go/src/runtime/panic.go:543 +0x108 fp=0x4208085b20 sp=0x4208085b00 runtime.sigpanic() /home/steven/tmp/go/src/runtime/sigpanic_unix.go:27 +0x470 fp=0x4208085b70 sp=0x4208085b20 crypto/sha512.init() ?:0 fp=0x4208085b80 sp=0x4208085b80 crypto/ecdsa.init() /home/steven/tmp/go/src/crypto/ecdsa/ecdsa.go:246 +0x88 fp=0x4208085ba0 sp=0x4208085b80 crypto/x509.init() /home/steven/tmp/go/src/crypto/x509/x509.go:1922 +0xb4 fp=0x4208085be0 sp=0x4208085ba0 crypto/tls.init() /home/steven/tmp/go/src/crypto/tls/tls.go:271 +0x98 fp=0x4208085c30 sp=0x4208085be0 net/http.init() /home/steven/tmp/go/src/net/http/transport.go:1281 +0xcc fp=0x4208085e80 sp=0x4208085c30 main.init() /home/steven/tmp/go/src/cmd/go/zdefaultcc.go:6 +0xd0 fp=0x4208085f80 sp=0x4208085e80 runtime.main() /home/steven/tmp/go/src/runtime/proc.go:83 +0x294 fp=0x4208085fd0 sp=0x4208085f80 runtime.goexit() /home/steven/tmp/go/src/runtime/asm_arm64.s:891 +0x4 fp=0x4208085fd0 sp=0x4208085fd0 Cheers, Steve

— Reply to this email directly or view it on GitHub.

davecheney avatar Mar 12 '15 11:03 davecheney

Unfortunately Go doesn't work very well with non-4k pages. I am not sure if what Dave mentioned is enough, but you can try. Even if it works, you lose a few features, like the scavanger.

The plan is, of course, to eventually make Go work well with non-4k pages. That has to be a dynamic thing, we can't assume any particular page size, we have to get the page size in runtime initialisation. I will switch my machine to a kernel with 64k pages.

4ad avatar Mar 12 '15 14:03 4ad

I think I've fixed this for my systems running 64KB pages with pull request #148 . Please can an adult sanity check this :-). (I'm not a go expert).

stevecapperlinaro avatar Mar 25 '15 13:03 stevecapperlinaro