Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Jamie Lokier
Richard Henderson wrote: > On 03/25/2010 06:39 AM, Nathan Froyd wrote: > > On Wed, Mar 24, 2010 at 05:11:43PM -0700, Richard Henderson wrote: > >> Use __sync_bool_compare_and_swap to yield correctly atomic results. > >> As yet, this assumes running on an strict-memory-ordering host (i.e. x86), > >>

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Jamie Lokier
Richard Henderson wrote: > On 03/25/2010 10:40 AM, Blue Swirl wrote: > > Sparc V8 has two atomic instructions, ldstub and swap. > > I know -- but not the CAS operation being discussed here. > > As I think about this more and more, the Real Problem is > not with the CAS, but with the memory orderi

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Richard Henderson
On 03/25/2010 10:40 AM, Blue Swirl wrote: > Sparc V8 has two atomic instructions, ldstub and swap. I know -- but not the CAS operation being discussed here. As I think about this more and more, the Real Problem is not with the CAS, but with the memory ordering requirements of the guest vs the mem

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Blue Swirl
On 3/25/10, Richard Henderson wrote: > On 03/25/2010 06:39 AM, Nathan Froyd wrote: > > On Wed, Mar 24, 2010 at 05:11:43PM -0700, Richard Henderson wrote: > >> Use __sync_bool_compare_and_swap to yield correctly atomic results. > >> As yet, this assumes running on an strict-memory-ordering host

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Richard Henderson
On 03/25/2010 09:42 AM, Nathan Froyd wrote: > Ah, OK. Those helpers are never called for user-mode emulation, > though. They're only called for system emulation and...well, everybody > lies about being atomic in system mode. :) Ah, right. I missed the user/system variations of OP_ST_ATOMIC. r

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Nathan Froyd
On Thu, Mar 25, 2010 at 09:29:18AM -0700, Richard Henderson wrote: > On 03/25/2010 09:06 AM, Nathan Froyd wrote: > > It pretends just as much as ppc and arm. See translate.c:OP_ST_ATOMIC. > > No it doesn't. Look at HELPER_ST_ATOMIC: > > tmp = do_##ld_insn(arg2, mem_idx);

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Richard Henderson
On 03/25/2010 09:06 AM, Nathan Froyd wrote: >> Mips doesn't even pretend to be atomic. > > It pretends just as much as ppc and arm. See translate.c:OP_ST_ATOMIC. No it doesn't. Look at HELPER_ST_ATOMIC: tmp = do_##ld_insn(arg2, mem_idx);\ if

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Nathan Froyd
On Thu, Mar 25, 2010 at 08:46:06AM -0700, Richard Henderson wrote: > On 03/25/2010 06:39 AM, Nathan Froyd wrote: > > On Wed, Mar 24, 2010 at 05:11:43PM -0700, Richard Henderson wrote: > >> Use __sync_bool_compare_and_swap to yield correctly atomic results. > >> As yet, this assumes running on an st

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Richard Henderson
On 03/25/2010 06:39 AM, Nathan Froyd wrote: > On Wed, Mar 24, 2010 at 05:11:43PM -0700, Richard Henderson wrote: >> Use __sync_bool_compare_and_swap to yield correctly atomic results. >> As yet, this assumes running on an strict-memory-ordering host (i.e. x86), >> since we're still "implementing" t

Re: [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-25 Thread Nathan Froyd
On Wed, Mar 24, 2010 at 05:11:43PM -0700, Richard Henderson wrote: > Use __sync_bool_compare_and_swap to yield correctly atomic results. > As yet, this assumes running on an strict-memory-ordering host (i.e. x86), > since we're still "implementing" the memory-barrier instructions as nops. Did the

[Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly.

2010-03-24 Thread Richard Henderson
Use __sync_bool_compare_and_swap to yield correctly atomic results. As yet, this assumes running on an strict-memory-ordering host (i.e. x86), since we're still "implementing" the memory-barrier instructions as nops. Rename the "lock" cpu field to "lock_addr" and add a "lock_value" field to be use