Received: by 10.213.65.68 with SMTP id h4csp850944imn; Tue, 27 Mar 2018 09:57:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49UXs6SLPCKqknstRFEJMvvXHuCblIxSDkaEG6L0VmwqFG9Qg6mVVkOUF4LYQQT6IkWRCJv X-Received: by 2002:a17:902:43e4:: with SMTP id j91-v6mr124458pld.118.1522169824364; Tue, 27 Mar 2018 09:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169824; cv=none; d=google.com; s=arc-20160816; b=lAmZIY8CCu6A7gZQfCPs/9scfO0uILTSlcoGWdAwdj/jRvaKCpZ6KL9mt7S46VvMKb MP+zIwgm5uphm26liXDIQVHw7cVeGmVx9RjCL+qvIVaGr+1Pw29cS0/w0vKi/YS2jfT1 BD7x28ARdp1mdJ3+RLpspw0/ylRCmXLUHHPXFGuLZ6CABXASbHAFQAUlCExKKlyaHAet XPZboCSnLo8FYvULkx8B2dvxRMzgPQMy6bHYCBC08jz2uJ5eicrDaKz1vgnGwINmBCTt z3QxhwthQjkVrKOYn9y/tyxbqsZSXtFvQMUPQIhPxXSxe7v3cLHhe0lXOkWSTyB7n/2J Ravg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HP1zqtPf20ag0w3GhG/wJxYIPp0yFjMYNL/gcMrXSW0=; b=xjU4guQcJRL6brSzLYH8j8nGbfSHTBLIlkTXmHA3PjWcB1qqNf7mTdAY7/FNjxREjr uRDKbse3SQ6dSEA/okw0cn2TBl8geS4hRYNB/iVKVyv7PtBAN3mw9ve+Dl7pMTkAPb86 dfnOlKgD74MZmS+Kmo7vJ7dLT+N3sn3nHvDvoztchTjaZgWSBSc2bCdjg+geil1SHrqp eI3xZGn55agUSfVH5VT8YASp6bIqHucnzjcDAM1riWJ51L4vxd7VVbTaKTNuNHDEKF/a TT4STixYczw5l3+3b8ErdO/pOfybyqPovnkjz+caUylsQPyNa0kCFijsU9NQFzzJOnRm zH3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9-v6si1711050plo.41.2018.03.27.09.56.50; Tue, 27 Mar 2018 09:57:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754044AbeC0QyT (ORCPT + 99 others); Tue, 27 Mar 2018 12:54:19 -0400 Received: from foss.arm.com ([217.140.101.70]:59756 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbeC0QyN (ORCPT ); Tue, 27 Mar 2018 12:54:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 40D261529; Tue, 27 Mar 2018 09:54:13 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 120FD3F590; Tue, 27 Mar 2018 09:54:13 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id CB2AA1AE5517; Tue, 27 Mar 2018 17:54:23 +0100 (BST) Date: Tue, 27 Mar 2018 17:54:23 +0100 From: Will Deacon To: Andrea Parri Cc: Catalin Marinas , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH for-4.17 1/2] arm64: Remove smp_mb() from arch_spin_is_locked() Message-ID: <20180327165423.GF18435@arm.com> References: <1522060641-6986-1-git-send-email-andrea.parri@amarulasolutions.com> <20180326105705.GA6579@arm.com> <20180326141436.GA11739@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180326141436.GA11739@andrea> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrea, On Mon, Mar 26, 2018 at 04:14:36PM +0200, Andrea Parri wrote: > On Mon, Mar 26, 2018 at 11:57:05AM +0100, Will Deacon wrote: > > On Mon, Mar 26, 2018 at 12:37:21PM +0200, Andrea Parri wrote: > > > Commit 38b850a73034f ("arm64: spinlock: order spin_{is_locked,unlock_wait} > > > against local locks") added an smp_mb() to arch_spin_is_locked(), in order > > > "to ensure that the lock value is always loaded after any other locks have > > > been taken by the current CPU", and reported one example (the "insane case" > > > in ipc/sem.c) relying on such guarantee. > > > > > > It is however understood (and not documented) that spin_is_locked() is not > > > required to ensure such an ordering guarantee, guarantee that is currently > > > _not_ provided by all implementations/architectures, and that callers rely- > > > ing on such ordering should instead insert suitable memory barriers before > > > acting on the result of spin_is_locked(). > > > > > > Following a recent auditing[1] of the callsites of {,raw_}spin_is_locked() > > > revealing that none of these callers are relying on the ordering guarantee > > > anymore, this commit removes the leading smp_mb() from this primitive thus > > > effectively reverting 38b850a73034f. > > > > > > [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2 > > > > What is patch 2/2 in this series? I couldn't find it in the archive. > > 2/2 is this change for powerpc: > > https://marc.info/?l=linux-kernel&m=152206068707522&w=2 > > > > > Assuming that patch doesn't do it, please can you remove the comment > > about spin_is_locked from mutex_is_locked? > > I ended up with the patch below but I suspect that it's not what you had > in mind; please let me know if you'd like me to add it into this series. That's exactly what I meant! I think you can remove the #ifndef queued_spin_is_locked in the same patch. If you do that: Acked-by: Will Deacon for the arm64 patch and the mythical core patch we've been discussing. Will