From: Ed Cashin <ecashin@coraid.com>
To: akpm@linux-foundation.org
Cc: ecashin@coraid.com, josh@joshtriplett.org, rob@landley.net,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sparse@vger.kernel.org, sam@ravnborg.org,
sparse@chrisli.org, ak@linux.intel.com
Subject: [PATCH] Documentation/sparse.txt: document context annotations for lock checking
Date: Thu, 18 Oct 2012 07:27:26 -0700 [thread overview]
Message-ID: <1350570446.22036@cat.he.net> (raw)
The context feature of sparse is used with the Linux kernel
sources to check for imbalanced uses of locks. Document the
annotations defined in include/linux/compiler.h that tell sparse
what to expect when a lock is held on function entry, exit, or
both.
Signed-off-by: Ed Cashin <ecashin@coraid.com>
---
Documentation/sparse.txt | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index 4909d41..eceab13 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -49,6 +49,24 @@ be generated without __CHECK_ENDIAN__.
__bitwise - noisy stuff; in particular, __le*/__be* are that. We really
don't want to drown in noise unless we'd explicitly asked for it.
+Using sparse for lock checking
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following macros are undefined for gcc and defined during a sparse
+run to use the "context" tracking feature of sparse, applied to
+locking. These annotations tell sparse when a lock is held, with
+regard to the annotated function's entry and exit.
+
+__must_hold - The specified lock is held on function entry and exit.
+
+__acquires - The specified lock is held on function exit, but not entry.
+
+__releases - The specified lock is held on function entry, but not exit.
+
+If the function enters and exits without the lock held, acquiring and
+releasing the lock inside the function in a balanced way, no
+annotation is needed. The tree annotations above are for cases where
+sparse would otherwise report a context imbalance.
Getting sparse
~~~~~~~~~~~~~~
--
1.7.1
next reply other threads:[~2012-10-18 14:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 14:27 Ed Cashin [this message]
2012-10-18 23:09 ` [PATCH] Documentation/sparse.txt: document context annotations for lock checking Josh Triplett
2012-10-19 22:14 ` Christopher Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350570446.22036@cat.he.net \
--to=ecashin@coraid.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=josh@joshtriplett.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=rob@landley.net \
--cc=sam@ravnborg.org \
--cc=sparse@chrisli.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox