From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752967AbbJMNYI (ORCPT ); Tue, 13 Oct 2015 09:24:08 -0400 Received: from foss.arm.com ([217.140.101.70]:52897 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752133AbbJMNYF (ORCPT ); Tue, 13 Oct 2015 09:24:05 -0400 Date: Tue, 13 Oct 2015 14:24:04 +0100 From: Will Deacon To: Boqun Feng Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Peter Zijlstra , Ingo Molnar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , "Paul E. McKenney" , Waiman Long , Davidlohr Bueso Subject: Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants Message-ID: <20151013132404.GI21550@arm.com> References: <1444659246-24769-1-git-send-email-boqun.feng@gmail.com> <1444659246-24769-7-git-send-email-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444659246-24769-7-git-send-email-boqun.feng@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2015 at 10:14:06PM +0800, Boqun Feng wrote: > Implement cmpxchg{,64}_relaxed and atomic{,64}_cmpxchg_relaxed, based on > which _release variants can be built. > > To avoid superfluous barriers in _acquire variants, we implement these > operations with assembly code rather use __atomic_op_acquire() to build > them automatically. The "superfluous barriers" are for the case where the cmpxchg fails, right? And you don't do the same thing for release, because you want to avoid a barrier in the middle of the critical section? (just checking I understand your reasoning). Will