Received: by 10.213.65.68 with SMTP id h4csp1928806imn; Sun, 8 Apr 2018 15:01:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx48EBQlE7xcChJk211BmQzoXAgzk/+JeRPxuq/nE0e44yA/j3DaGFHxNXIfDsnI54hfJjHpa X-Received: by 2002:a17:902:9a03:: with SMTP id v3-v6mr28778720plp.162.1523224872364; Sun, 08 Apr 2018 15:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523224872; cv=none; d=google.com; s=arc-20160816; b=TQJMesIMev0CJzE2MgikUnF/Yo6edvrHktMdPvEjy8R8+60ifhTmeNxuyAS7YPt1l2 zdhF/FwIMTqR/n0Sqt0g3PXO2Pkcp7nu0b5/N/Sue9vkrhxGBItQfEiaaw6BLlNUrPco hT4g0+T5hSz4XCz8uSkjmupfWeKALQIjkLii60iWMw+AogG6sSnCDjFztQnmZFX69oNl Qt9wegyeEay6S0zbxWgAMqeeFe5dSoFr6Lt/8S4aHqjjpTrSuubmZcDewkejQ1Q0JvRv jBfhEtaxCtQ+lLInfMBKb7egZRJlm/2YiTa49sfO5wmLVIPDdaMqQwi0JwYnmyk2qkDz 7mNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=nTLCH51gFdgsSdkTATSLmoTHo9lfAKL7d5nsl3T/OGU=; b=Yzf4SZ9l1+MdFfgyCmhH2TGOE1q8vlnUdcoMYrCP7GgJL7xVOd+gWeaQEVjgr93/mC qU2BZAVUvRHaWUeateW4VEbNyUM3RQQwYqQ89aLWI8ruz59HKhHggsvKT+91JOf3PioZ oszUT46Gmgp/dEAxFvcds55KVbM2Hw/m+uaTX7xjOw9BRX64SZfhoeNtYi8S2VWKXUFh 4X05djhvOAUJs4KkBAeNZwiVyzc0CF4BWl0U4EmiQ3MnJwg5OpuAL+sik2TBtjgfjhxW d6u/AJkEE8ikuF2gax5birW5uYpWlmP1kWNvcLmQrSPrdnuzKNvJS0dYTli9576Zap5C WIaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Tj/Fnt0L; 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 u2-v6si15803445plm.671.2018.04.08.15.00.35; Sun, 08 Apr 2018 15:01:12 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Tj/Fnt0L; 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 S1753141AbeDHVdF (ORCPT + 99 others); Sun, 8 Apr 2018 17:33:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57100 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbeDHVdE (ORCPT ); Sun, 8 Apr 2018 17:33:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nTLCH51gFdgsSdkTATSLmoTHo9lfAKL7d5nsl3T/OGU=; b=Tj/Fnt0LFd66H3R3o6I+gFmmq hMhrhKTGrr8tt8uYDrJM3+G2K273MjvPBNgluvNP7FoTDn8bHJChVorXDPaREq0AQN7Ec3YM2CPtC Jx+pfOheLX54B8c0jn1jnJcvgMRQAgGxeBKu3W7tjahuS5Ou+yrWwlxLgnQEmcu3xGY4XcADl2H0d 3+UAZUh32lcCqRo/Y6HxM6zlBzjzFdLfnKZOaWKmECOOwfER5X+dVVjwSuJLrBWBa8jo0zZUPEzgw Uk3X4iFVCD5MWsQqHVE9ZfedGOzUGbQ2MoYCcQgMSN6yKSlvrWxjnDBsXqIv2W2WVgTjyn6I3zI80 99uq0v50Q==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5Hvi-000864-BM; Sun, 08 Apr 2018 21:32:54 +0000 Subject: Re: [PATCH v4 1/3] locking: Document the semantics of spin_is_locked() To: paulmck@linux.vnet.ibm.com, Andrea Parri Cc: linux-kernel@vger.kernel.org, Alan Stern , David Howells , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , Jade Alglave , Luc Maranget , Akira Yokosawa , Ingo Molnar References: <1522600912-6208-2-git-send-email-andrea.parri@amarulasolutions.com> <1523044060-5568-1-git-send-email-andrea.parri@amarulasolutions.com> <20180406210741.GF3948@linux.vnet.ibm.com> <30d15756-1cb4-7123-b4d9-ce2e66861df3@infradead.org> <20180406215825.GA3646@andrea> <20180408211446.GU3948@linux.vnet.ibm.com> From: Randy Dunlap Message-ID: <2a404a5a-de6b-8cf8-325a-9c6c2d78bc10@infradead.org> Date: Sun, 8 Apr 2018 14:32:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180408211446.GU3948@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/08/2018 02:14 PM, Paul E. McKenney wrote: > On Fri, Apr 06, 2018 at 11:58:25PM +0200, Andrea Parri wrote: >> On Fri, Apr 06, 2018 at 02:08:16PM -0700, Randy Dunlap wrote: >>> On 04/06/2018 02:07 PM, Paul E. McKenney wrote: >>>> On Fri, Apr 06, 2018 at 02:01:41PM -0700, Randy Dunlap wrote: >>>>> On 04/06/2018 12:47 PM, Andrea Parri wrote: >>>>>> There appeared to be a certain, recurrent uncertainty concerning the >>>>>> semantics of spin_is_locked(), likely a consequence of the fact that >>>>>> this semantics remains undocumented or that it has been historically >>>>>> linked to the (likewise unclear) semantics of spin_unlock_wait(). >>>>>> >>>>>> A recent auditing [1] of the callers of the primitive confirmed that >>>>>> none of them are relying on particular ordering guarantees; document >>>>>> this semantics by adding a docbook header to spin_is_locked(). Also, >>>>>> describe behaviors specific to certain CONFIG_SMP=n builds. >>>>>> >>>>>> [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2 >>>>>> https://marc.info/?l=linux-kernel&m=152042843808540&w=2 >>>>>> https://marc.info/?l=linux-kernel&m=152043346110262&w=2 >>>>>> >>>>>> Co-Developed-by: Andrea Parri >>>>>> Co-Developed-by: Alan Stern >>>>>> Co-Developed-by: David Howells >>>>>> Signed-off-by: Andrea Parri >>>>>> Signed-off-by: Alan Stern >>>>>> Signed-off-by: David Howells >>>>>> Cc: Will Deacon >>>>>> Cc: Peter Zijlstra >>>>>> Cc: Boqun Feng >>>>>> Cc: Nicholas Piggin >>>>>> Cc: Jade Alglave >>>>>> Cc: Luc Maranget >>>>>> Cc: "Paul E. McKenney" >>>>>> Cc: Akira Yokosawa >>>>>> Cc: Ingo Molnar >>>>>> --- >>>>>> include/linux/spinlock.h | 18 ++++++++++++++++++ >>>>>> 1 file changed, 18 insertions(+) >>>>>> >>>>>> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h >>>>>> index 4894d322d2584..1e8a464358384 100644 >>>>>> --- a/include/linux/spinlock.h >>>>>> +++ b/include/linux/spinlock.h >>>>>> @@ -380,6 +380,24 @@ static __always_inline int spin_trylock_irq(spinlock_t *lock) >>>>>> raw_spin_trylock_irqsave(spinlock_check(lock), flags); \ >>>>>> }) >>>>>> >>>>>> +/** >>>>>> + * spin_is_locked() - Check whether a spinlock is locked. >>>>>> + * @lock: Pointer to the spinlock. >>>>>> + * >>>>>> + * This function is NOT required to provide any memory ordering >>>>>> + * guarantees; it could be used for debugging purposes or, when >>>>>> + * additional synchronization is needed, accompanied with other >>>>>> + * constructs (memory barriers) enforcing the synchronization. >>>>>> + * >>>>>> + * Returns: 1 if @lock is locked, 0 otherwise. >>>>> >>>>> Sorry, minor nit: >>>>> s/Returns:/Return:/ >>>>> (according to kernel-doc.rst) >>>>> >>>>> although I agree that "Returns:" is better. >>>>> [I should have changed that years ago.] >>>> >>>> Agreed, English grammar and templates often seem to conflict. >>>> >>>> So should we change this comment, or are you instead proposing to add >>>> "Returns:" as valid kernel-doc? >>> >>> Please change this patch to current doc syntax. >>> Any changes to kernel-doc syntax would come later. > > Are you sure? > > $ git grep "\* Returns:" | wc -l > 2470 > $ git grep "\* Return:" | wc -l > 4144 > > Looks like more than a third of them are already "Returns:". ;-) > >> Paul: I understand that you're going to do this change "in place"; please >> let me know if I'm wrong/if you need a new submission. > > If Randy is certain that he would like to continue propagating > this grammatical infelicity, sure. ;-) eh? Well, Documentation/doc-guide/kernel-doc.rst says "Return:", but it appears that it does not matter to scripts/kernel-doc -- it's just the name of a "section" of the documentation and can be spelled any way! oh well. :) Acked-by: Randy Dunlap Thanks. -- ~Randy