Received: from eggs.gnu.org ([2001:4830:134:3::10]:46388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxEUB-0000uO-Jp for qemu-devel@nongnu.org; Thu, 20 Oct 2016 10:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxEU7-0008R0-IR for qemu-devel@nongnu.org; Thu, 20 Oct 2016 10:38:23 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:32772) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bxEU7-0008Pi-C0 for qemu-devel@nongnu.org; Thu, 20 Oct 2016 10:38:19 -0400 Received: by mail-pf0-x243.google.com with SMTP id i85so5785122pfa.0 for ; Thu, 20 Oct 2016 07:38:19 -0700 (PDT) Sender: Richard Henderson References: <1476897727-791-1-git-send-email-rth@twiddle.net> <1476897727-791-14-git-send-email-rth@twiddle.net> <87bmyffg7y.fsf@linaro.org> From: Richard Henderson Message-ID: Date: Thu, 20 Oct 2016 07:38:16 -0700 MIME-Version: 1.0 In-Reply-To: <87bmyffg7y.fsf@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v7 13/35] tcg: Add atomic helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: qemu-devel@nongnu.org, cota@braap.org On 10/20/2016 03:49 AM, Alex Bennée wrote: > > Richard Henderson writes: > >> Add all of cmpxchg, op_fetch, fetch_op, and xchg. >> Handle both endian-ness, and sizes up to 8. >> Handle expanding non-atomically, when emulating in serial. >> >> Reviewed-by: Emilio G. Cota >> Reviewed-by: Alex Bennée >> Signed-off-by: Richard Henderson > >> >> /* Provide shorter names for GCC atomic builtins, return old value */ >> #define atomic_fetch_inc(ptr) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST) >> @@ -308,8 +321,11 @@ >> /* These will only be atomic if the processor does the fetch or store >> * in a single issue memory operation >> */ >> -#define atomic_read(ptr) (*(__typeof__(*ptr) volatile*) (ptr)) >> -#define atomic_set(ptr, i) ((*(__typeof__(*ptr) volatile*) (ptr)) = (i)) >> +#define atomic_read__nocheck(p) (*(__typeof__(*ptr) volatile*) (p)) >> +#define atomic_set__nocheck(p, i) ((*(__typeof__(*ptr) volatile*) (p)) = (i)) >> + >> +#define atomic_read(ptr) atomic_read__nocheck(ptr) >> +#define atomic_set(ptr, i) atomic_set__nocheck(ptr,i) > > s/ptr/p/ during the transposition: > > /* These will only be atomic if the processor does the fetch or store > * in a single issue memory operation > */ > #define atomic_read__nocheck(p) (*(__typeof__(*p) volatile*) (p)) > #define atomic_set__nocheck(p, i) ((*(__typeof__(*p) volatile*) (p)) = (i)) > > #define atomic_read(ptr) atomic_read__nocheck(ptr) > #define atomic_set(ptr, i) atomic_set__nocheck(ptr, i) > > Otherwise fine. Gah. I knew I should have re-checked centos6. r~