Received: by 10.213.65.68 with SMTP id h4csp3530777imn; Tue, 3 Apr 2018 06:38:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Cv/h2VipoXrXKhAZO3nto0PKB75EsnUE+Dgs9LtHAFR+gz/fhA7IBWJVkSi4ZiNihW4/J X-Received: by 10.98.253.17 with SMTP id p17mr10546951pfh.105.1522762712287; Tue, 03 Apr 2018 06:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522762712; cv=none; d=google.com; s=arc-20160816; b=UGf1U07PCIDw/UQpTLc+N5bPqmRBeVqDZYZsEuAskCZnA7WRZBHcDUs+SJ4BryHHir ZheVC1MnYo1jUs4MGVPXf4zmSIdQkGp/jzvKq6BEhr8tdDjyov9q6bmWXzD7pvPJtlKA IDqiHrfCEl8ppnfUIaf5TrDvKAfFTFCZS0MkREPy8MqLoe9CV4KKZjftwvA2nHGao2lh pmVhHmhN1afqZLFYmXbmn1fs+jJTHzT5PEwIPlI18xb1OzVqy3eZVgWFqtfHftazIH09 WcfTn2VN4DpNGae2/UdnxaXizTocfztMwuEmzSJnJ69GbBR4WWIvJD9RZWquprYEUj7Q utOg== 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=kV9mH0cF18s4PIQBjg84TKx8TweCVfcfCAUN7udqWNM=; b=E8PIqNzuKyY6iJTgzAInvIk9odeTW7xPsqa4jHy+75sSmS65YlGXEnsk8N+Hvp0n70 ZnD1DtAIr4v07S4BqGWortdDAxihh6J+8kky0R48nSY7rgHLMgodCqvcT558gxVAfhpN fZu1fqt7NeeXEfNUEfT+DuUnFHQG7GReAzvxaeOnJKBJcB3lDy0PnVkvE7Soz6AlEkVi +OVJcbKLbKmXmy7kqlSRj37lhe4+vU19Qj00oSb5Ui7A6Q8txSVDFmIAnceFQrCzsaob dftQ3Fc1psigaXEKfIxP2N3kiOIzRqBo1a4Sby/NV61gWWamhYmtxMerGZTIWTmYA/os fOyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AwWm9ieg; 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 m5si403728pfh.27.2018.04.03.06.38.17; Tue, 03 Apr 2018 06:38:32 -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=AwWm9ieg; 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 S1751263AbeDCNf4 (ORCPT + 99 others); Tue, 3 Apr 2018 09:35:56 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37526 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbeDCNfy (ORCPT ); Tue, 3 Apr 2018 09:35:54 -0400 Received: by mail-wm0-f65.google.com with SMTP id r131so35245307wmb.2 for ; Tue, 03 Apr 2018 06:35:54 -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=kV9mH0cF18s4PIQBjg84TKx8TweCVfcfCAUN7udqWNM=; b=AwWm9iegjJHh3dFKSZREJLrw1FiDfG1EZy5SE1nn17HUH+7BMpqjxqrVFOl6ZDNI++ 9IpqkL+dmjeSe138Y6m0hAet8FrhBEKdbfaZSeyRj7uCt7Yu0X6v22xqHgcBhwh0qnGc cy1g1cl+m4VLdZ0XS2TJ3H/YZ0GfQp4k08Ulg= 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=kV9mH0cF18s4PIQBjg84TKx8TweCVfcfCAUN7udqWNM=; b=b6+12lGjeABJ9jVA8p50xnD6SFnUUhrEz4MNB6E8F8paeB07TrqPqdwJgVJ+RO1Z4B WRBSoHuXn12OS5+8rpiY31TCZQx1h9yv3v4PpXSesBBjj84HQb9u9uKFXykqsPzmbgN3 SPOmVEda9m6BsXFQ3QpCD3D/i2jHEexzQ3WgjWL52HxbF8nxx9leqLnO/OE3J02PN3n4 g4FXrPYti3nKJEVjGj9fqM8GFrt3oycJuS/jokJZVTwKBJiWMoOlRP7xrPSpba5hJGyd ++txeM9ZLC4KfGvHyPp07UiqWgVH7rx0tsXBNlPLoTfAp/v6ptbkCw4wRwAm85AtMrek ykfA== X-Gm-Message-State: AElRT7GKCrfE6DRgJSqYjH/aV90jAiTxsvNXkgaNZHHfJcNZMQbzFayh 6zZG9G4jSjjy7kLUcuRgUK5D9A== X-Received: by 10.28.51.6 with SMTP id z6mr3910217wmz.63.1522762553553; Tue, 03 Apr 2018 06:35:53 -0700 (PDT) Received: from andrea ([213.209.242.222]) by smtp.gmail.com with ESMTPSA id f20sm871917wmc.24.2018.04.03.06.35.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 06:35:52 -0700 (PDT) Date: Tue, 3 Apr 2018 15:35:43 +0200 From: Andrea Parri To: David Howells Cc: paulmck@linux.vnet.ibm.com, Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Andrea Parri , Alan Stern , Will Deacon , Boqun Feng , Nicholas Piggin , Jade Alglave , Luc Maranget , Akira Yokosawa Subject: Re: [PATCH v2 1/3] locking: Document the semantics of spin_is_locked() Message-ID: <20180403133543.GA26653@andrea> References: <1522600912-6208-2-git-send-email-andrea.parri@amarulasolutions.com> <1522600912-6208-1-git-send-email-andrea.parri@amarulasolutions.com> <29562.1522759749@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29562.1522759749@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 01:49:09PM +0100, David Howells wrote: > Andrea Parri wrote: > > > +/** > > + * 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. > > + * > > + * Return: 1, if @lock is (found to be) locked; 0, otherwise. > > It's more complicated than that. This function is dangerous and should be > used with extreme care. In the case where CONFIG_SMP=n the value is locked > one way or the other and it might be the wrong way. You mean "unlocked"? (aka, return 0) Andrea > > David