Received: by 10.213.65.68 with SMTP id h4csp25559imn; Tue, 3 Apr 2018 14:44:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx48H1thMvuUKvtQnmbSrpkIl2YFsY2KEdbunz0/qt8IF+pbXGXv98rU/TbC64bmz4Gj+UGYu X-Received: by 10.101.78.142 with SMTP id b14mr5498021pgs.406.1522791881170; Tue, 03 Apr 2018 14:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522791881; cv=none; d=google.com; s=arc-20160816; b=0EYe/waWtO+TfCLglf3TqQKyaaM70Qhmf7pWB2CecUbWIhbQb9EIhjqMFaiQvLOdJL U4ubq3PXI2ySKWaGqWlJTf2S0JFBCUrjEOZrY9mhXI9bm1iZogG3Ng4iqk89tle9mfhg 9BvMgBW1qNN8rE1fE7iG5iPvqbmCYxl8Heu40f8TlYM9L/OwaFVUiUwE4lAvhOqY4vOb gcJqH0PqasVxs7AWatnNYCdXWiVm/KXXSJNLzrpRJqwZkDIN72xv29a9xPFtRRIFVHjY 6UL6iybo6576+CbBZgI2w7jzp9k0IFKWgh0Q1kaGmbDt0iuexewgYc5jESg32eCqXc/v KNtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=AsqcHCnEHhKCycqHl3hxVHE2fsQsnGBy28Qjh9D0m1g=; b=V29UQBh1zrtU6CLzsJ99pJS9eVdA/20RhZH26Dw1bFgLZ9AXiQ0yVPJ67vcjG041pg ZvYNH4f0OgwHnYLsLmxIC2cQXKj9woLIhHfCBf2GGU+IeowQuHHfUVtYWbk/Ffmu97Ns PDvKNcaW016Xq5AkEpCYmVCWSB5VHRkRDjAiar+Pg2wtZxdmdNXGWRtC1I0r0OVnGXCm y/zO4rhrNz4/vvc0U+GC3yM+wevAsGK159SEC2bArjg7VxxxwGCU/mk0gUrLsJyq8+En e7TkonFBNUBam/qfXmDAfW6UFZRYc0Gh9b8vzQXHJyoQhtd05gm0xwVpjnOYYRplZJCs tXig== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u24si1051051pfh.326.2018.04.03.14.44.26; Tue, 03 Apr 2018 14:44:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753540AbeDCVnU (ORCPT + 99 others); Tue, 3 Apr 2018 17:43:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38530 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753261AbeDCVnT (ORCPT ); Tue, 3 Apr 2018 17:43:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D70558182D24; Tue, 3 Apr 2018 21:43:18 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-59.rdu2.redhat.com [10.10.120.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0CB363532; Tue, 3 Apr 2018 21:43:14 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: To: Alan Stern Cc: dhowells@redhat.com, Andrea Parri , 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 Subject: Re: [PATCH v2 1/3] locking: Document the semantics of spin_is_locked() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7470.1522791794.1@warthog.procyon.org.uk> Date: Tue, 03 Apr 2018 22:43:14 +0100 Message-ID: <7471.1522791794@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 03 Apr 2018 21:43:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 03 Apr 2018 21:43:18 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. David