[Top][All Lists]

[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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set spinlock
Date: Wed, 18 May 2016 16:59:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 18/05/2016 16:47, Sergey Fedorov wrote:
>>> >> 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?
>> > So it should be okay as long as the legacy build-ins are supported.
> However, there's also __atomic_compare_exchange_n(). Could it be the choice?

cmpxchg is not TAS.  I don't see any reason not to use
__sync_test_and_set, the only sensible alternative is to ignore the
standard and use __atomic_test_and_set on int.


reply via email to

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