From patchwork Thu Jun 26 19:12:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4430851 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99C77BEEAA for ; Thu, 26 Jun 2014 19:15:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB018202AE for ; Thu, 26 Jun 2014 19:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E75A52028D for ; Thu, 26 Jun 2014 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbaFZTP2 (ORCPT ); Thu, 26 Jun 2014 15:15:28 -0400 Received: from mail-qa0-f47.google.com ([209.85.216.47]:53168 "EHLO mail-qa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbaFZTP1 (ORCPT ); Thu, 26 Jun 2014 15:15:27 -0400 Received: by mail-qa0-f47.google.com with SMTP id hw13so3141188qab.20 for ; Thu, 26 Jun 2014 12:15:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=wnYwy18XvkgmtyupK1n3BHsqov+8BLuz7erCYaY7bEM=; b=KLmzNDm1Lw6UOtG3t1Ef65ZeJ2D61QRERGtE726Enk70bCkufG3LXMpV1Xkt4+SXFv 69IJxnvxOjFsHbsWRs1Cc3ZU52QKF29EZlvHMO+pbNMN6wAn3mxNA8ZH+TzVybxa04bL cpC+RFwS0VhOmGitc46ev9J4h0qkgfkHH8aNY4KrWZJ5JRdC3T0HiHLj9F0RD5IFTcSQ Jl+Ie5tFXrmd0mtch8HXY/VWHCwzn7wJ7TpV/yJSNXuHTJp1XbCTfblTR/WQhtRxR4AU +qe9sDD2GYc0NDIiJgMpFX9V5YDDur9P9/l2x6ZuCOSwkBNO2swvyzHuyn0+lEPTvLeq UW5Q== X-Gm-Message-State: ALoCoQlfZHgCcO9hoGcrh32goAcho1stOKZZ2+lH3eIYeR6n/qwttdA1Sdr+ueDXteDQTrxmxWW2 X-Received: by 10.140.102.37 with SMTP id v34mr2933632qge.115.1403810126454; Thu, 26 Jun 2014 12:15:26 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 88sm4763039qgh.5.2014.06.26.12.15.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 12:15:25 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Peter Zijlstra , Ingo Molnar Subject: [PATCH v2 074/117] lockdep: add lockdep_assert_not_held Date: Thu, 26 Jun 2014 15:12:54 -0400 Message-Id: <1403810017-16062-75-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403810017-16062-1-git-send-email-jlayton@primarydata.com> References: <1403810017-16062-1-git-send-email-jlayton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We currently have the ability to call lockdep_assert_held to throw a warning when a spinlock isn't held in a codepath. There are also times when we'd like to throw a warning when a lock is held (i.e. when there is the potential for deadlock with atomic_dec_and_lock or similar). Cc: Peter Zijlstra Cc: Ingo Molnar Signed-off-by: Jeff Layton --- include/linux/lockdep.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 008388f920d7..1e5f1d544029 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -362,6 +362,8 @@ extern void lockdep_trace_alloc(gfp_t mask); WARN_ON(debug_locks && !lockdep_is_held(l)); \ } while (0) +#define lockdep_assert_not_held(l) WARN_ON(debug_locks && lockdep_is_held(l)) + #define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) #else /* !CONFIG_LOCKDEP */ @@ -413,6 +415,8 @@ struct lock_class_key { }; #define lockdep_assert_held(l) do { (void)(l); } while (0) +#define lockdep_assert_not_held(l) (void)(l) + #define lockdep_recursing(tsk) (0) #endif /* !LOCKDEP */