Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Sergey Fedorov
On 09/04/16 00:31, Richard Henderson wrote: > On 04/08/2016 02:26 PM, Paolo Bonzini wrote: >> >> On 08/04/2016 23:24, Alex Bennée wrote: Except that quite a lot of hosts can only (efficiently) do atomic operations on a minimum of 4 byte quantities. I'd rather continue to use int

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Richard Henderson
On 04/08/2016 02:26 PM, Paolo Bonzini wrote: > > > On 08/04/2016 23:24, Alex Bennée wrote: >>> Except that quite a lot of hosts can only (efficiently) do atomic >>> operations on >>> a minimum of 4 byte quantities. I'd rather continue to use int here. >> >> I suspect bool == unsigned int

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Paolo Bonzini
On 08/04/2016 23:24, Alex Bennée wrote: > > Except that quite a lot of hosts can only (efficiently) do atomic > > operations on > > a minimum of 4 byte quantities. I'd rather continue to use int here. > > I suspect bool == unsigned int underneath. But having true/false and 0/1 > mixed up >

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Alex Bennée
Richard Henderson writes: > On 04/08/2016 06:02 AM, Alex Bennée wrote: >>> > +typedef struct QemuSpin { >>> > +int value; >> If we are throwing true and false around as the only two values can we >> use bool here and be consistent when setting/clearing. >> > > Except that

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Richard Henderson
On 04/08/2016 06:02 AM, Alex Bennée wrote: >> > +typedef struct QemuSpin { >> > +int value; > If we are throwing true and false around as the only two values can we > use bool here and be consistent when setting/clearing. > Except that quite a lot of hosts can only (efficiently) do atomic

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Richard Henderson
On 04/07/2016 10:32 AM, Emilio G. Cota wrote: > +while (atomic_read(>value)); I really really don't like ; snuggled up behind loop conditions. Isn't this where you want to use pause, anyway? r~

Re: [Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-08 Thread Alex Bennée
Emilio G. Cota writes: > From: Guillaume Delbergue > > Signed-off-by: Guillaume Delbergue > [Rewritten. - Paolo] > Signed-off-by: Paolo Bonzini > --- > include/qemu/thread.h | 31

[Qemu-devel] [PATCH v2 06/13] qemu-thread: add simple test-and-set spinlock

2016-04-07 Thread Emilio G. Cota
From: Guillaume Delbergue Signed-off-by: Guillaume Delbergue [Rewritten. - Paolo] Signed-off-by: Paolo Bonzini --- include/qemu/thread.h | 31 +++ 1 file changed, 31