Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread Paolo Bonzini
On 04/11/2016 11:16, John Paul Adrian Glaubitz wrote: >> > >> > If Haskell is compiled to use the "negative sp" trick that Richard >> > mentioned, it would rely on the SH machine being uniprocessor. Try >> > running chroot with "taskset -c 0". > Doesn't help unfortunately, still either crashes

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread John Paul Adrian Glaubitz
On 11/04/2016 11:13 AM, Paolo Bonzini wrote: >> $ wget http://users.physik.fu-berlin.de/~glaubitz/sid-sh4-sbuild-ghc.tgz >> $ tar xf sid-sh4-sbuild-ghc.tgz >> (compile qemu with --target-list=sh4-linux-user --static) >> $ cp -av qemu-sh4 sid-sh4-sbuild-ghc/usr/bin/qemu-sh4-static >> $ chroot sid-sh

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread Paolo Bonzini
On 04/11/2016 11:00, John Paul Adrian Glaubitz wrote: > On 11/04/2016 10:53 AM, Laurent Vivier wrote: >> I think it's more likely a linux-user bug than a target-sh4 bug. >> >> As you report in a mail to me in February, "do_futex()" must be >> protected against parallel execution for some futex co

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread John Paul Adrian Glaubitz
On 11/04/2016 10:53 AM, Laurent Vivier wrote: > I think it's more likely a linux-user bug than a target-sh4 bug. > > As you report in a mail to me in February, "do_futex()" must be > protected against parallel execution for some futex commands. FWIW, it works fine on qemu-user-armel last time I t

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread Laurent Vivier
Le 04/11/2016 à 10:43, John Paul Adrian Glaubitz a écrit : > On 11/04/2016 10:23 AM, John Paul Adrian Glaubitz wrote: >> On 11/03/2016 05:21 PM, Laurent Vivier wrote: >>> It should,:the problem was reported by Adrian (cc:) while compiling ghc >>> in qemu-sh4, but I have just tested the functionalit

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread John Paul Adrian Glaubitz
On 11/04/2016 10:23 AM, John Paul Adrian Glaubitz wrote: > On 11/03/2016 05:21 PM, Laurent Vivier wrote: >> It should,:the problem was reported by Adrian (cc:) while compiling ghc >> in qemu-sh4, but I have just tested the functionality with the softmmu >> version, not the atomicity. >> >> Adrian,

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-04 Thread John Paul Adrian Glaubitz
On 11/03/2016 05:21 PM, Laurent Vivier wrote: > It should,:the problem was reported by Adrian (cc:) while compiling ghc > in qemu-sh4, but I have just tested the functionality with the softmmu > version, not the atomicity. > > Adrian, could you test this patch? Will absolutely do that. Awesome to

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Aurelien Jarno
On 2016-11-03 15:07, Laurent Vivier wrote: > Implement real atomic tas: > > When (Rn) = 0, 1 -> T > Otherwise, 0 -> T > In both cases, 1 -> MSB of (Rn) > > using atomic_fetch_or_i32() and setcondi_i32(). > > Tested with image from: > http://wiki.qemu.org/download/sh-test-0.2.tar.bz2

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Richard Henderson
On 11/03/2016 11:52 AM, Paolo Bonzini wrote: UP kernel = no sane way to implement this in user-mode qemu? Probably no straight-forward way, no. Another possibility is to treat the load as a LL and the store as a SC (implemented in turn with cmpxchg+branch if it fails). cmpxchg spans two basi

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Paolo Bonzini
On 03/11/2016 17:51, Richard Henderson wrote: >>> Well, tas_test "runs without error with this change", I suppose it fails >>> before? In other words, is this patch enough to run multithreaded sh4 >>> programs with qemu-user? >> >> It should,:the problem was reported by Adrian (cc:) while compil

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Laurent Vivier
Le 03/11/2016 à 17:21, Laurent Vivier a écrit : > Le 03/11/2016 à 17:18, Paolo Bonzini a écrit : >> >> >> On 03/11/2016 16:35, Laurent Vivier wrote: >>> Le 03/11/2016 à 16:32, Paolo Bonzini a écrit : On 03/11/2016 15:07, Laurent Vivier wrote: > Implement real atomic tas: > >>

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Richard Henderson
On 11/03/2016 10:21 AM, Laurent Vivier wrote: Le 03/11/2016 à 17:18, Paolo Bonzini a écrit : Well, tas_test "runs without error with this change", I suppose it fails before? In other words, is this patch enough to run multithreaded sh4 programs with qemu-user? It should,:the problem was repor

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Laurent Vivier
Le 03/11/2016 à 17:18, Paolo Bonzini a écrit : > > > On 03/11/2016 16:35, Laurent Vivier wrote: >> Le 03/11/2016 à 16:32, Paolo Bonzini a écrit : >>> >>> >>> On 03/11/2016 15:07, Laurent Vivier wrote: Implement real atomic tas: When (Rn) = 0, 1 -> T Otherwise, 0 -> T >

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Paolo Bonzini
On 03/11/2016 16:35, Laurent Vivier wrote: > Le 03/11/2016 à 16:32, Paolo Bonzini a écrit : >> >> >> On 03/11/2016 15:07, Laurent Vivier wrote: >>> Implement real atomic tas: >>> >>> When (Rn) = 0, 1 -> T >>> Otherwise, 0 -> T >>> In both cases, 1 -> MSB of (Rn) >>> >>> using atomic_f

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Paolo Bonzini
On 03/11/2016 15:07, Laurent Vivier wrote: > Implement real atomic tas: > > When (Rn) = 0, 1 -> T > Otherwise, 0 -> T > In both cases, 1 -> MSB of (Rn) > > using atomic_fetch_or_i32() and setcondi_i32(). > > Tested with image from: > http://wiki.qemu.org/download/sh-test-0.2.tar.bz

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Laurent Vivier
Le 03/11/2016 à 16:32, Paolo Bonzini a écrit : > > > On 03/11/2016 15:07, Laurent Vivier wrote: >> Implement real atomic tas: >> >> When (Rn) = 0, 1 -> T >> Otherwise, 0 -> T >> In both cases, 1 -> MSB of (Rn) >> >> using atomic_fetch_or_i32() and setcondi_i32(). >> >> Tested with ima

Re: [Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Richard Henderson
On 11/03/2016 08:07 AM, Laurent Vivier wrote: Implement real atomic tas: When (Rn) = 0, 1 -> T Otherwise, 0 -> T In both cases, 1 -> MSB of (Rn) using atomic_fetch_or_i32() and setcondi_i32(). Tested with image from: http://wiki.qemu.org/download/sh-test-0.2.tar.bz2 This image con

[Qemu-devel] [PATCH v2] target-sh4: add atomic tas

2016-11-03 Thread Laurent Vivier
Implement real atomic tas: When (Rn) = 0, 1 -> T Otherwise, 0 -> T In both cases, 1 -> MSB of (Rn) using atomic_fetch_or_i32() and setcondi_i32(). Tested with image from: http://wiki.qemu.org/download/sh-test-0.2.tar.bz2 This image contains a "tas_test" that runs without error with