qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 1839325] [NEW] Go programs crash on qemu-sh4 due to issues with atomics
Date: Wed, 07 Aug 2019 13:04:20 -0000	[thread overview]
Message-ID: <156518306048.32528.10373743991208371347.malonedeb@chaenomeles.canonical.com> (raw)

Public bug reported:

After #1738545 [1] was fixed, Go applications work fine on qemu-arm but
still crash on qemu-sh4. From the backtrace, it looks like an issue with
the atomics in qemu-sh4:

(sid-sh4-sbuild)root@epyc:/# cat hello.go
package main

import "fmt"

func main() {
      fmt.Println("hello world")
}

(sid-sh4-sbuild)root@epyc:/# gccgo-9 hello.go -o hello
(sid-sh4-sbuild)root@epyc:/# ./hello 
panic: (        runtime runtime.errorString) (0x7f74527c,0x80a038)
fatal error: panic on system stack
panic: (        runtime runtime.errorString) (0x7f74527c,0x80a038)
fatal error: panic on system stack

runtime stack:
runtime..z2finternal..z2fatomic.Load64
        ../../../src/libgo/go/runtime/internal/atomic/atomic.c:37
runtime_mstart
        ../../../src/libgo/runtime/proc.c:596

goroutine 1 [running]:
        goroutine running on other thread; stack unavailable

runtime stack:
runtime..z2finternal..z2fatomic.Load64
        ../../../src/libgo/go/runtime/internal/atomic/atomic.c:37
runtime_mstart
        ../../../src/libgo/runtime/proc.c:596
(sid-sh4-sbuild)root@epyc:/#

The same sample Go program runs fine on my SH7785LCR SH4 evaluation
board:

root@tirpitz:~> uname -a
Linux tirpitz 3.16.7-ckt7 #8 PREEMPT Fri Oct 21 18:47:41 CEST 2016 sh4a GNU/Linux
root@tirpitz:~> cat hello.go
package main

import "fmt"

func main() {
      fmt.Println("hello world")
}

root@tirpitz:~> gccgo-9 hello.go -o hello
root@tirpitz:~> ./hello 
hello world
root@tirpitz:~>

Please note: In order to be able to reproduce this, one also needs to
revert commit 61dedf2af7 [2], otherwise the Go application crashes
differently:

(sid-sh4-sbuild)root@epyc:/# ./hello        
Unhandled trap: 0x180
pc=0x7e5f7f9e sr=0x00000000 pr=0x7ee3d582 fpscr=0x00080004
spc=0x00000000 ssr=0x00000000 gbr=0x7e590480 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0x7e5f7f60 fpul=0x00034f3b
r0=0x008007d4 r1=0x00000000 r2=0xfffe0b2a r3=0x00000002
r4=0x008006e4 r5=0x00872000 r6=0x00200000 r7=0x00000000
r8=0x7f7bca7c r9=0x7fffebd4 r10=0x00800480 r11=0x7f7bc0f0
r12=0x7f7a3fa4 r13=0x008004c0 r14=0x7f7b2238 r15=0x7fffebd0
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
(sid-sh4-sbuild)root@epyc:/#

> [1] https://bugs.launchpad.net/bugs/1738545
> [2] https://bugs.launchpad.net/bugs/1796520

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1839325

Title:
  Go programs crash on qemu-sh4 due to issues with atomics

Status in QEMU:
  New

Bug description:
  After #1738545 [1] was fixed, Go applications work fine on qemu-arm
  but still crash on qemu-sh4. From the backtrace, it looks like an
  issue with the atomics in qemu-sh4:

  (sid-sh4-sbuild)root@epyc:/# cat hello.go
  package main

  import "fmt"

  func main() {
        fmt.Println("hello world")
  }

  (sid-sh4-sbuild)root@epyc:/# gccgo-9 hello.go -o hello
  (sid-sh4-sbuild)root@epyc:/# ./hello 
  panic: (        runtime runtime.errorString) (0x7f74527c,0x80a038)
  fatal error: panic on system stack
  panic: (        runtime runtime.errorString) (0x7f74527c,0x80a038)
  fatal error: panic on system stack

  runtime stack:
  runtime..z2finternal..z2fatomic.Load64
          ../../../src/libgo/go/runtime/internal/atomic/atomic.c:37
  runtime_mstart
          ../../../src/libgo/runtime/proc.c:596

  goroutine 1 [running]:
          goroutine running on other thread; stack unavailable

  runtime stack:
  runtime..z2finternal..z2fatomic.Load64
          ../../../src/libgo/go/runtime/internal/atomic/atomic.c:37
  runtime_mstart
          ../../../src/libgo/runtime/proc.c:596
  (sid-sh4-sbuild)root@epyc:/#

  The same sample Go program runs fine on my SH7785LCR SH4 evaluation
  board:

  root@tirpitz:~> uname -a
  Linux tirpitz 3.16.7-ckt7 #8 PREEMPT Fri Oct 21 18:47:41 CEST 2016 sh4a GNU/Linux
  root@tirpitz:~> cat hello.go
  package main

  import "fmt"

  func main() {
        fmt.Println("hello world")
  }

  root@tirpitz:~> gccgo-9 hello.go -o hello
  root@tirpitz:~> ./hello 
  hello world
  root@tirpitz:~>

  Please note: In order to be able to reproduce this, one also needs to
  revert commit 61dedf2af7 [2], otherwise the Go application crashes
  differently:

  (sid-sh4-sbuild)root@epyc:/# ./hello        
  Unhandled trap: 0x180
  pc=0x7e5f7f9e sr=0x00000000 pr=0x7ee3d582 fpscr=0x00080004
  spc=0x00000000 ssr=0x00000000 gbr=0x7e590480 vbr=0x00000000
  sgr=0x00000000 dbr=0x00000000 delayed_pc=0x7e5f7f60 fpul=0x00034f3b
  r0=0x008007d4 r1=0x00000000 r2=0xfffe0b2a r3=0x00000002
  r4=0x008006e4 r5=0x00872000 r6=0x00200000 r7=0x00000000
  r8=0x7f7bca7c r9=0x7fffebd4 r10=0x00800480 r11=0x7f7bc0f0
  r12=0x7f7a3fa4 r13=0x008004c0 r14=0x7f7b2238 r15=0x7fffebd0
  r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
  r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
  (sid-sh4-sbuild)root@epyc:/#

  > [1] https://bugs.launchpad.net/bugs/1738545
  > [2] https://bugs.launchpad.net/bugs/1796520

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1839325/+subscriptions


             reply	other threads:[~2019-08-07 13:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 13:04 John Paul Adrian Glaubitz [this message]
2019-08-09 15:21 ` [Qemu-devel] [Bug 1839325] Re: Go programs crash on qemu-sh4 due to issues with atomics Peter Maydell
2019-08-09 16:35 ` Peter Maydell
2019-08-09 17:22 ` Peter Maydell
2019-08-09 17:38 ` John Paul Adrian Glaubitz
2019-09-20 15:18 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156518306048.32528.10373743991208371347.malonedeb@chaenomeles.canonical.com \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=1839325@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).