From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel@vger.kernel.org
Cc: Josh Triplett <josh@freedesktop.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: [RFC 2/3] rcu: allow functions to declare they need RCU locking
Date: Thu, 10 Apr 2008 15:48:12 +0200 [thread overview]
Message-ID: <20080410134828.712275000@sipsolutions.net> (raw)
In-Reply-To: 20080410134810.629048000@sipsolutions.net
[-- Attachment #1: 012-rcu-requires.patch --]
[-- Type: text/plain, Size: 897 bytes --]
Often enough, subsystems have a lookup function that goes from some
sort of key to an RCU-protected structure. They can then declare the
function as such:
struct mystruct *get_mystruct(...) __requires_rcu;
and sparse will automatically be able to check that the function is
invoked under rcu_read_lock().
Not-yet-signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/linux/rcupdate.h | 4 ++++
1 file changed, 4 insertions(+)
--- everything.orig/include/linux/rcupdate.h 2008-04-10 15:36:18.000000000 +0200
+++ everything/include/linux/rcupdate.h 2008-04-10 15:36:43.000000000 +0200
@@ -65,6 +65,10 @@ struct rcu_head {
(ptr)->next = NULL; (ptr)->func = NULL; \
} while (0)
+
+#define __requires_rcu __requires(RCU)
+#define __macro_requires_rcu __macro_requires(RCU)
+
/**
* rcu_read_lock - mark the beginning of an RCU read-side critical section.
*
--
next prev parent reply other threads:[~2008-04-10 14:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-10 13:48 [RFC 0/3] Examples for the new sparse context tracking functionality Johannes Berg
2008-04-10 13:48 ` [RFC 1/3] add macros for new sparse features Johannes Berg
2008-04-10 16:37 ` Stefan Richter
2008-04-11 12:20 ` Johannes Berg
2008-04-10 13:48 ` Johannes Berg [this message]
2008-04-10 13:48 ` [RFC 3/3] mac80211: annotate with __requires_rcu Johannes Berg
[not found] ` <20080410134829.412424000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-04-12 8:50 ` Geert Uytterhoeven
2008-04-12 8:56 ` Johannes Berg
[not found] ` <20080410134810.629048000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-04-10 15:22 ` [RFC 0/3] Examples for the new sparse context tracking functionality Johannes Berg
2008-04-19 23:33 ` Paul E. McKenney
2008-04-21 8:25 ` Johannes Berg
[not found] ` <1208766355.26186.37.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-04-21 14:55 ` Paul E. McKenney
[not found] ` <20080421145525.GB9153-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-04-21 15:05 ` Johannes Berg
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=20080410134828.712275000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=josh@freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).