Received: by 10.213.65.68 with SMTP id h4csp694376imn; Wed, 4 Apr 2018 05:49:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oiXhC19E/BCP24pDzBe7zh9gUeeHaEhFsz/O0UC6/vPeFqxZnsniEoHGLp/OdGNWyykI5 X-Received: by 10.98.7.152 with SMTP id 24mr9196322pfh.94.1522846169620; Wed, 04 Apr 2018 05:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522846169; cv=none; d=google.com; s=arc-20160816; b=UG4FO1d/VDEBiGPHwfZQ/4RGDC/eQ1fuym2z+BJbDcDiR9+xe0HUUqAb7qs8Hf1jgJ ZyZLuUUQvhtKH2D0wE7AjXm0SzFyDFe+k9/Js2jfWKzGzF07j/+4dMJOxVYFh2Y+KQbS 1dmIHpjnCTbpfywOAlqHCPPOrlQ6iVmfkbq6pE6oy5WP6eDySpGu0rAD1PXXLfJ7qzBe 9ooRWAEOPEja0pK5Nb63jjLnsle4tAHpt9iPMK2n5zea7P1uLWOCYJ5HlhEfrRufCM9R AbzyXvr5hwizg/6HyckAyafftN1dl0Hk4vj1/KgH4Phecj0AUTFLJTBoGmvsta9k6kyY FvIA== 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=6uh9511wa/PrSIrSZ3QgKtdMvxY/TMP9E+ELiWaTASg=; b=fjM6Z1pGpnsNIH6CAX/ltJ6EJNCSVjdPvSGLMyGd7+tk3qtaH85m3o4LuGC1vApdIe 0kQOb1iejRgtwzvWdLrHctetsnjjpUl+bGFX6A6Gvia38oU0wGOoobimkeM6wWL23GGG doq+wYJZNd0DPK8vB0xjxo+5CVMtSIZsyNl6zWJ95FvBGG7zKaPCvJ6fGttZinzLH+Wi +Vw7HmruiKLu8caFc/zRCAa+lWg9kxg42hsiK5en+cA5oLWeCVB5wffmqbZGs6HYiSt1 ZVeG7B5XHcyBbl6EgCdrZa7fqshA4YMTECYlXKDVJGVA1z1OHg4BIB7XrrHE9L+uUA8D fPsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IaxIZQ73; 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 q4si4053060pfi.317.2018.04.04.05.49.15; Wed, 04 Apr 2018 05:49:29 -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=IaxIZQ73; 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 S1751555AbeDDMsB (ORCPT + 99 others); Wed, 4 Apr 2018 08:48:01 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:38198 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbeDDMr5 (ORCPT ); Wed, 4 Apr 2018 08:47:57 -0400 Received: by mail-wr0-f176.google.com with SMTP id m13so22465417wrj.5 for ; Wed, 04 Apr 2018 05:47:57 -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=6uh9511wa/PrSIrSZ3QgKtdMvxY/TMP9E+ELiWaTASg=; b=IaxIZQ73A/osQX0KYKfZS5a35FcvatyklJB3yvC8trUTE21570uYCEJUWh78aZgSNL bWXME1bc/xe+2M9w9iKDR5JmQSDwMh6nHGeVMNRdEQf8A7OThUV5MPLIfdyi7dwJvxzT VMkhJ6JrR578L1rliU3aFehTBFpYnoKN0/btI= 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=6uh9511wa/PrSIrSZ3QgKtdMvxY/TMP9E+ELiWaTASg=; b=Z1PV0smhGjJAhXZDn1l82Gy8U3tykXYYMJ5+7s6mwdE7iEqD61YbgXufG2Z3WkdtPc jl3YJUIZizw/fDxfWGoN3/dHWKjbisTczztEpBR3HtYDTubpQkLbsJrbAlPuNvYl2TnW kEVx6buBSe4xWE8ZxIkTtm6EPb2sxxwnSrJGmVSpHYMn5bNY4Q0kS88Foq/xdnCZpZei mrZF7rInoM/jYnwyWO1hRevR5o/Kx03GmMJ5ELh3eNLVHNv7SAB+oJJIAqNgl9yiTiIS NzOdssuUgr/7/WvLI01HsgJxVse0/iG076xvvcDjmVPnTEAKzumPEh5NSb/fRNHy7POD 3Z8w== X-Gm-Message-State: AElRT7G695hwag96dok9WIBu1XjV9K/BinahKAcKaJyBKbVTxqAZuc/G +sLFrwQQijKkHhALLz5sUITtMA== X-Received: by 10.223.138.138 with SMTP id y10mr11830359wry.44.1522846076192; Wed, 04 Apr 2018 05:47:56 -0700 (PDT) Received: from andrea ([213.209.242.222]) by smtp.gmail.com with ESMTPSA id c15sm7198795wrc.64.2018.04.04.05.47.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Apr 2018 05:47:55 -0700 (PDT) Date: Wed, 4 Apr 2018 14:47:47 +0200 From: Andrea Parri To: David Howells Cc: Alan Stern , paulmck@linux.vnet.ibm.com, Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Andrea Parri , Will Deacon , Boqun Feng , Nicholas Piggin , Jade Alglave , Luc Maranget , Akira Yokosawa , Randy Dunlap Subject: Re: [PATCH v2 1/3] locking: Document the semantics of spin_is_locked() Message-ID: <20180404124747.GA8773@andrea> References: <7471.1522791794@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7471.1522791794@warthog.procyon.org.uk> 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 Tue, Apr 03, 2018 at 10:43:14PM +0100, David Howells wrote: > Alan Stern wrote: > > > + * Returns: 1 if @lock is locked, 0 otherwise. > > + * However, on !CONFIG_SMP builds with !CONFIG_DEBUG_SPINLOCK, > > + * the return value is always 0 (see include/linux/spinlock_up.h). > > + * Therefore you should not rely heavily on the return value. > > Seems reasonable. > > It might also want to include a note that the lock isn't necessarily held by > your own CPU. I would also use "=n" rather than "!", so maybe something like: > > * Returns: 1 if @lock is locked, 0 otherwise. > * > * Note that the function only tells you that the CPU is seen to be locked, > * not that it is locked on your CPU. > * > * Further, on CONFIG_SMP=n builds with CONFIG_DEBUG_SPINLOCK=n, the return > * value is always 0 (see include/linux/spinlock_up.h). Therefore you should > * not rely heavily on the return value. Thank you all for the suggestions. I plan to integrate these in the next version of the patch, which should also include your Co-developed-by: Andrea > > David