Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-21 Thread Emilio G. Cota
On Wed, Apr 20, 2016 at 12:39:45 -0700, Richard Henderson wrote: > On 04/20/2016 11:11 AM, Emilio G. Cota wrote: > >On Wed, Apr 20, 2016 at 10:55:45 -0700, Richard Henderson wrote: > >>On 04/20/2016 10:17 AM, Emilio G. Cota wrote: (snip) > >My comment was related to this: > > > >>[...] do note that

Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-20 Thread Richard Henderson
On 04/20/2016 11:11 AM, Emilio G. Cota wrote: On Wed, Apr 20, 2016 at 10:55:45 -0700, Richard Henderson wrote: On 04/20/2016 10:17 AM, Emilio G. Cota wrote: I've tried to find a GCC intrinsic for test-and-set, and I've only found lock_test_and_set, which is what we use for atomic_xchg (except o

Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-20 Thread Emilio G. Cota
On Wed, Apr 20, 2016 at 10:55:45 -0700, Richard Henderson wrote: > On 04/20/2016 10:17 AM, Emilio G. Cota wrote: > >I've tried to find a GCC intrinsic for test-and-set, and I've only found > >lock_test_and_set, which is what we use for atomic_xchg (except on ppc) > >because it really is an atomic e

Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-20 Thread Richard Henderson
On 04/20/2016 10:17 AM, Emilio G. Cota wrote: I've tried to find a GCC intrinsic for test-and-set, and I've only found lock_test_and_set, which is what we use for atomic_xchg (except on ppc) because it really is an atomic exchange: "This builtin, as described by Intel, is not a traditional test

Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-20 Thread Emilio G. Cota
On Wed, Apr 20, 2016 at 08:18:56 -0700, Richard Henderson wrote: > On 04/19/2016 04:07 PM, Emilio G. Cota wrote: > >From: Guillaume Delbergue > > > >Signed-off-by: Guillaume Delbergue > >[Rewritten. - Paolo] > >Signed-off-by: Paolo Bonzini > >[Emilio's additions: call cpu_relax() while spinning;

Re: [Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-20 Thread Richard Henderson
On 04/19/2016 04:07 PM, Emilio G. Cota wrote: From: Guillaume Delbergue Signed-off-by: Guillaume Delbergue [Rewritten. - Paolo] Signed-off-by: Paolo Bonzini [Emilio's additions: call cpu_relax() while spinning; optimize for uncontended locks by acquiring the lock with xchg+test instead of

[Qemu-devel] [PATCH v3 05/11] qemu-thread: add simple test-and-set spinlock

2016-04-19 Thread Emilio G. Cota
From: Guillaume Delbergue Signed-off-by: Guillaume Delbergue [Rewritten. - Paolo] Signed-off-by: Paolo Bonzini [Emilio's additions: call cpu_relax() while spinning; optimize for uncontended locks by acquiring the lock with xchg+test instead of test+xchg+test.] Signed-off-by: Emilio G. Cota -