From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754655AbcIALTP (ORCPT ); Thu, 1 Sep 2016 07:19:15 -0400 Received: from foss.arm.com ([217.140.101.70]:55626 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbcIALTO (ORCPT ); Thu, 1 Sep 2016 07:19:14 -0400 Date: Thu, 1 Sep 2016 12:19:15 +0100 From: Will Deacon To: Manfred Spraul Cc: Peter Zijlstra , benh@kernel.crashing.org, paulmck@linux.vnet.ibm.com, Ingo Molnar , Boqun Feng , Andrew Morton , LKML , 1vier1@web.de, Davidlohr Bueso Subject: Re: [PATCH 1/4] spinlock: Document memory barrier rules Message-ID: <20160901111915.GB6721@arm.com> References: <1472385376-8801-2-git-send-email-manfred@colorfullife.com> <20160829104815.GI10153@twins.programming.kicks-ass.net> <968e4c62-4486-a6aa-8fdf-67ff9b05a330@colorfullife.com> <20160829134424.GS10153@twins.programming.kicks-ass.net> <4859166f-ff39-e998-638b-6bf6912422a3@colorfullife.com> <20160831154049.GY10121@twins.programming.kicks-ass.net> <20160831164020.GG29505@arm.com> <80de24e3-fa01-a6d6-99e9-afd1e831e07b@colorfullife.com> <20160901084435.GN10153@twins.programming.kicks-ass.net> <3f7c39e5-4c46-0641-d29e-36c9439ad6dc@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3f7c39e5-4c46-0641-d29e-36c9439ad6dc@colorfullife.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 Thu, Sep 01, 2016 at 01:04:26PM +0200, Manfred Spraul wrote: > If I understand it right, the rules are: > 1. spin_unlock_wait() must behave like spin_lock();spin_unlock(); > 2. spin_is_locked() must behave like spin_trylock() ? spin_unlock(),TRUE : > FALSE I don't think spin_is_locked is as strong as all that. On arm64 and ppc, it's just smp_mb(); followed by a check on the lock value. It can't be used for the same sorts of inter-CPU synchronisation that spin_unlock_wait provides. > 3. the ACQUIRE during spin_lock applies to the lock load, not to the store. Correct. This is already documented for things like cmpxchg. > sem.c and nf_conntrack.c need only rule 1 now, but I would document the rest > as well, ok? > > I'll update the patches. Please CC me! Will