From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5WaR-0003y2-B0 for qemu-devel@nongnu.org; Wed, 25 May 2016 07:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5WaL-0003E0-II for qemu-devel@nongnu.org; Wed, 25 May 2016 07:02:51 -0400 Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:36145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5WaL-0003Dw-6W for qemu-devel@nongnu.org; Wed, 25 May 2016 07:02:45 -0400 Received: by mail-lf0-x236.google.com with SMTP id e130so16596470lfe.3 for ; Wed, 25 May 2016 04:02:45 -0700 (PDT) References: <1463863336-28760-1-git-send-email-cota@braap.org> <1463863336-28760-2-git-send-email-cota@braap.org> <20160523170912.GA16390@flamenco> <20160524195609.GA30809@flamenco> <5744B2BD.5000705@gmail.com> <87y46ycyee.fsf@linaro.org> From: Sergey Fedorov Message-ID: <57458650.8090902@gmail.com> Date: Wed, 25 May 2016 14:02:40 +0300 MIME-Version: 1.0 In-Reply-To: <87y46ycyee.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: "Emilio G. Cota" , Paolo Bonzini , Richard Henderson , MTTCG Devel , QEMU Developers On 25/05/16 11:52, Alex Bennée wrote: > Sergey Fedorov writes: > >> On 24/05/16 22:56, Emilio G. Cota wrote: >>> On Tue, May 24, 2016 at 09:08:01 +0200, Paolo Bonzini wrote: >>>> On 23/05/2016 19:09, Emilio G. Cota wrote: >>>>> PS. And really equating smp_wmb/rmb to release/acquire as we have under >>>>> #ifdef __ATOMIC is hard to justify, other than to please tsan. >>>> That only makes a difference on arm64, right? >>>> >>>> acquire release rmb wmb >>>> x86 -- -- -- -- >>>> power lwsync lwsync lwsync lwsync >>>> armv7 dmb dmb dmb dmb >>>> arm64 dmb ishld dmb ish dmb ishld dmb ishst >>>> ia64 -- -- -- -- >>> Yes. I now see why we're defining rmb/wmb based on acquire/release: >>> it's quite convenient given that the compiler provides them, and >>> the (tiny) differences in practice are not worth the trouble of >>> adding asm for them. So I take back my comment =) >>> >>> The gains of getting rid of the consume barrier from atomic_rcu_read >>> are clear though; updated patch to follow. >> However, maybe it's not such a pain to maintain an optimized version for >> AArch64 in assembly :P > Please don't. The advantage of the builtins is they are known by things > like tsan. > We can always do: #if defined(__aarch64__) && !defined(__SANITIZE_THREAD__) /* AArch64 asm variant */ #else /* GCC __atomic variant */ #endif Kind regards, Sergey