From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4qju-00071t-1p for qemu-devel@nongnu.org; Mon, 23 May 2016 10:21:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4qjo-0000oH-TL for qemu-devel@nongnu.org; Mon, 23 May 2016 10:21:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4qjo-0000o7-OE for qemu-devel@nongnu.org; Mon, 23 May 2016 10:21:44 -0400 References: <1463863336-28760-1-git-send-email-cota@braap.org> <1463863336-28760-2-git-send-email-cota@braap.org> From: Paolo Bonzini Message-ID: <955e8307-01a5-b2f9-48df-8309bd30c443@redhat.com> Date: Mon, 23 May 2016 16:21:36 +0200 MIME-Version: 1.0 In-Reply-To: <1463863336-28760-2-git-send-email-cota@braap.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] atomics: do not use __atomic primitives for RCU atomics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Richard Henderson , Sergey Fedorov On 21/05/2016 22:42, Emilio G. Cota wrote: > Commit a0aa44b4 ("include/qemu/atomic.h: default to __atomic functions") > set all atomics to default (on recent GCC versions) to __atomic primitives. > > In the process, the atomic_rcu_read/set were converted to implement > consume/release semantics, respectively. This is inefficient; for > correctness and maximum performance we only need an smp_barrier_depends > for reads, and an smp_wmb for writes. Fix it by using the original > definition of these two primitives for all compilers. Indeed most compilers implement consume the same as acquire, which is inefficient. However, isn't in practice atomic_thread_fence(release) + atomic_store(relaxed) the same as atomic_store(release)? Thanks, Paolo