Received: by 10.223.185.116 with SMTP id b49csp6024760wrg; Wed, 28 Feb 2018 02:41:59 -0800 (PST) X-Google-Smtp-Source: AG47ELuLV8mJKfBL+J4ru0XyRaLe6GxUNyGzvW8DT3hdg/3XyGfNOS6UIs5RdU7mBDAb4YvmBy0R X-Received: by 10.98.15.72 with SMTP id x69mr5347158pfi.16.1519814519876; Wed, 28 Feb 2018 02:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519814519; cv=none; d=google.com; s=arc-20160816; b=NC03YTZ0IUE7jL26I4BlyTGYSbMOxv9VLSg1jgGFmiPJiQ/2dScatjR2IFE1V6jzcG fGAXwpHJ7lFd86K7EytyZgLpw2NRNKntvHNCoBMzurX+NpjMtzQ20mG25GeSP+occ2mT kmxFWBNoNy6LRtQeKlFtMWCpVaGlyAsdi7BuaXC6atsexExjIya2TCw7S7g+PHM1ziiD b2pPvv5uWlUuX2/h9EoyHVhbFFNoJTxsLFEb/CnFqUTAkZPHQ4lfr+qw1WSbcnAPUmPv TxROmdwLkmkV2Yms8ZK4PfTWKo55mIYBr+18zmBtDLz/cycMQz2Esv90Y1qw12s007U/ VlgQ== 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:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=5ylroNzPrqlYnS70PpddQCn5sempZ1Ga2ev880n6vkk=; b=kxrMfJ4l9QQ5rTUqrbJt3DuotTI/NCTOOiQ+Px61Pe98aG4CauErHvgNNeXCzHGEke 7Smdq5Kbr80Fbn25hdvpzzIlbkXxycFGcipCnfISOotYbnjqC6wgFXJypgOJ2GFBfM0n 9ArskcF1/vCm7icw2f4lBGIj6UVis85tPnwOTrwIRH3dwO2LOlS1HyA5GdfSIifeeU3s mcDPmExRN9pNFVuB4w8Q38KzIoJoWDpuEWu6dHAln4qBvQJSw95x27+KTZuiVUegV7wI KGXQ9g2y6g4KJ1TBPkLFBETAFZXwm85c+7KTC4FzsvpUmSHwb0hERwujddqbsYO3Spsa y8Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QmcejG3j; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c63si1045525pfd.51.2018.02.28.02.41.42; Wed, 28 Feb 2018 02:41:59 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=QmcejG3j; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752416AbeB1Kjw (ORCPT + 99 others); Wed, 28 Feb 2018 05:39:52 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37286 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbeB1Kju (ORCPT ); Wed, 28 Feb 2018 05:39:50 -0500 Received: by mail-wm0-f66.google.com with SMTP id 139so4115842wmn.2 for ; Wed, 28 Feb 2018 02:39:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5ylroNzPrqlYnS70PpddQCn5sempZ1Ga2ev880n6vkk=; b=QmcejG3j/jyuR4BFdn+rIs7q/PugYIfc1S4qQuaxl709b0u5AatyuHZvzG3/LIUe5E 7tQQ0rBE9DyRnPkY/lLl35ty34Le4gzKLBOT0hLHQFmi7mhPi+2QSY2Oit/5sI43MDoZ G+t1AMaAmV7K7FaAodz0bykekSdX9P56ssL79+vWuoeJCcDKeH87wNYlgtRwkRJNpv/4 jhq98JKXECkMLyFuUnub7MZJt1h7dw/H72xa65mGEPxvP496GLNp4x7OI2outNBWbU0D 5zOtl88kvGDwZv0emTCRzhXUI8fQDntEc1jFMJt4xGqor9YWk5E96b1ZFodFRNMxXazx r1og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5ylroNzPrqlYnS70PpddQCn5sempZ1Ga2ev880n6vkk=; b=SkcNakSJ2mSoA2p8/5BijWtVrw4lum1zqKsTMsonpYwqcZAJAYSjA93IAXTnnNesAH aU2jENrNTNe8e9ceXFFJQt2vLj7G7RyrwzVY2RMuYS+yUM0308jPbjqFC4cIWXwyQhje adVr2s9EM/US3SNA5N6uyB9pqkzgdVwhGBFhNLT+gE9gbcOhn0HhM2lB1VC599OlL30s EKurhUm58sMuE9XBE871RWO4FPCVkF1Ih/q0XHSt7+eTwHALMKv8fmPemXhM1UDrinp4 ql65janDEZkFs0/9wcmSV2cE2XVwK75GcTnYsrfSKvsNWNukuEKJRiTVDLvYsbqdu4nM BsUw== X-Gm-Message-State: APf1xPAk1zLjk2b8+idocCpZfBfdsxvKx/6JH1qRpxiSmTyufb1vZVr9 IwYdLajU7TjlGpt2uU+uAvozQJTk X-Received: by 10.28.20.8 with SMTP id 8mr13521546wmu.106.1519814388691; Wed, 28 Feb 2018 02:39:48 -0800 (PST) Received: from andrea.amarulasolutions.com (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id 41sm856503wrc.33.2018.02.28.02.39.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 02:39:47 -0800 (PST) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , Alan Stern , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa Subject: [PATCH] Documentation/locking: Document the semantics of spin_is_locked() Date: Wed, 28 Feb 2018 11:39:32 +0100 Message-Id: <1519814372-19941-1-git-send-email-parri.andrea@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Document this semantics. Signed-off-by: Andrea Parri Cc: Alan Stern Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Nicholas Piggin Cc: David Howells Cc: Jade Alglave Cc: Luc Maranget Cc: "Paul E. McKenney" Cc: Akira Yokosawa --- include/linux/spinlock.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 4894d322d2584..2639fdc9a916c 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -380,6 +380,17 @@ 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. + * + * Return: 1, if @lock is (found to be) locked; 0, otherwise. + */ static __always_inline int spin_is_locked(spinlock_t *lock) { return raw_spin_is_locked(&lock->rlock); -- 2.7.4