qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set s


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set spinlock
Date: Tue, 17 May 2016 20:28:14 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, May 17, 2016 at 23:20:11 +0300, Sergey Fedorov wrote:
> On 17/05/16 23:04, Emilio G. Cota wrote:
(snip)
> > +/*
> > + * We might we tempted to use __atomic_test_and_set with __ATOMIC_ACQUIRE;
> > + * however, the documentation explicitly says that we should only pass
> > + * a boolean to it, so we use __sync_lock_test_and_set, which doesn't
> > + * have this limitation, and is documented to have acquire semantics.
> > + */
> > +#define atomic_test_and_set_acquire(ptr) __sync_lock_test_and_set(ptr, 
> > true)
> 
> So you are going to stick to *legacy* built-ins?

Why not? AFAIK the reason to avoid __sync primitives is that in most cases
they include barriers that callers might not necessarily need; __atomic's
allow for finer tuning, which is in general a good thing. However,
__sync_test_and_set has the exact semantics we need, without the limitations
documented for __atomic_test_and_set; so why not use it?

                E.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]