Received: by 10.213.65.68 with SMTP id h4csp1425400imn; Mon, 26 Mar 2018 07:18:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx49DGw/c9aSDRdT9aI+bCXkwgXF6IoKPk2N5TmS48BS4jRVawb+E1ejl+/cNPOP1vhNS06aD X-Received: by 2002:a17:902:1a4:: with SMTP id b33-v6mr4537485plb.303.1522073933837; Mon, 26 Mar 2018 07:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522073933; cv=none; d=google.com; s=arc-20160816; b=NiB6b5XJUAlQd8TWNIDAfz4vzzDIijo06+Z7RC5XXbFK5z+ZKJleJjgpfc2V6laD/v TBktt3f7o8hnA/ubnHovvFIMnJ9lYgCAIUcYlv1ev8FeX9SqRGBnKzXZ3q1K367cDr6x aeqCZ4qdZJSflEf6Ouz/eliTdzVAcsqWKt+huQPG6PRifs6i1r3BPDHn8hQqRsWN+L44 rfGZUMyF0Hjybim0lmFgDXZUsgfQJ8FTgKE5Fjnbnl4JHDOP559cOfbSH4aDQFc93832 8Glle+lQgPE9swe4y8DHWv6lTZShqb+/JkaxdUvUEOuQMSv1BhNYyMNqCbjFCpb0LGAr U3Xw== 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:dkim-signature:arc-authentication-results; bh=JM7/GO3ioQTbD/7hYXv+rgCAgm22ECiPViyXzjtypY4=; b=yitNAauFWVI9YJWeanfm/gNJHwvG+JE0K8qTp8Z5+W3rfEpI3ii8htm8gof9Snbgzz xCBJxl8wWg+u+WRKi65Za/geKVD08HTxXa6pLxwz+aBmnOhsXtIdUVgU3gF6VlEwRIRl Yq2r9fs5jpGBzeQ2pMTL+pGRjZpPLE/yjaiTmvifEzlh8hjDsZcIA/P/tMFg1kWuNEFO lZkmxguRVEgYBxt4zwRSLwhpnhAADtWQfCBA5KNwey2jEXE/Bssp0B4yRWrNTB14+BxP 0DWj+CJ3EBJJCf6sti0Pipbd/h6Lu7ZidvGUOCvf8hEc+68418J4YgHYXTRR3KlPuQAs yGeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XY1a4ZZh; 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 z69si11675281pfk.321.2018.03.26.07.18.38; Mon, 26 Mar 2018 07:18:53 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XY1a4ZZh; 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 S1752642AbeCZOOs (ORCPT + 99 others); Mon, 26 Mar 2018 10:14:48 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46528 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbeCZOOp (ORCPT ); Mon, 26 Mar 2018 10:14:45 -0400 Received: by mail-wr0-f195.google.com with SMTP id d1so7076145wrj.13 for ; Mon, 26 Mar 2018 07:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JM7/GO3ioQTbD/7hYXv+rgCAgm22ECiPViyXzjtypY4=; b=XY1a4ZZhMYpMe/QFKj7z6j056nRwafCN41+2nxxAXsmYss3xfWR8tqBIDTx9r/n/TJ 46nh6/KWUELW4g38nx9PTearPCEw17x28o65IGGb00kizWKQCvTBDsCoZEB9+RSjzgRA 6M/bEFjunBJrdEYqZH/fGPv8utMbqlFo+XqHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JM7/GO3ioQTbD/7hYXv+rgCAgm22ECiPViyXzjtypY4=; b=sOhUEPFq+zhvBjgKj/fsoWSJkj17sSNEHnWkeqITKUs30iO+95FSkiE6Cm02tu64m9 KYjhbiHLzcqEkJQQFYP8Bb6BRM0BpPZj48k34gupVbzIQfJe886XkE0fW6tFMh+8eFw5 ku+wFWust6q45UjCZfu1xLHKKsm0ewBTiIvFji67gOkqoO08K0QKfd/tYjcCI/Csa/Dq nQq/clMI+67GSDer1X4vEpR7+n3H0v5ITOv9xOfGzWLjEIOQfbdGnjb/viDulKniY2Sg or69ZHbWAP5V9m6w5G6ujSUI6X75aiVKRgN4bm7DcGqvyaRs2n3TwDi8v1wQrJgB+vV+ SaDw== X-Gm-Message-State: AElRT7FIvPwKPMFJ4upzDrlTjo5EAIoCU1rpT9SQ7If+AYOGdNEg92+u JxR+XUNs3ctfOuVPfeW7xpYI7fZx X-Received: by 10.223.156.131 with SMTP id d3mr2280636wre.197.1522073684706; Mon, 26 Mar 2018 07:14:44 -0700 (PDT) Received: from andrea (host187-49-dynamic.250-95-r.retail.telecomitalia.it. [95.250.49.187]) by smtp.gmail.com with ESMTPSA id n12sm6830010wrg.16.2018.03.26.07.14.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 07:14:43 -0700 (PDT) Date: Mon, 26 Mar 2018 16:14:36 +0200 From: Andrea Parri To: Will Deacon 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: <20180326141436.GA11739@andrea> References: <1522060641-6986-1-git-send-email-andrea.parri@amarulasolutions.com> <20180326105705.GA6579@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180326105705.GA6579@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Also -- does this mean we can kill the #ifndef queued_spin_is_locked > guards in asm-generic/qspinlock.h? I don't see why arch may want to override that definition (maybe lack of imagination?); please let me know if you'd like to see the #ifndef gone. Andrea --- From 1b77a9a70823620f1c98e43453edf5707d02074e Mon Sep 17 00:00:00 2001 From: Andrea Parri Date: Mon, 26 Mar 2018 15:03:58 +0200 Subject: [PATCH] mutex: Remove the comment about spin_is_locked() from mutex_is_locked() Still true/valid, but not particularly useful [IMO]. Suggested-by: Will Deacon Signed-off-by: Andrea Parri --- include/linux/mutex.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/mutex.h b/include/linux/mutex.h index cb3bbed4e6339..9921822c51585 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -147,9 +147,6 @@ extern void __mutex_init(struct mutex *lock, const char *name, */ static inline bool mutex_is_locked(struct mutex *lock) { - /* - * XXX think about spin_is_locked - */ return __mutex_owner(lock) != NULL; } -- 2.7.4 > > Will