From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-kernel@vger.kernel.org,
Josh Triplett <josh@freedesktop.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: [RFC 1/3] add macros for new sparse features
Date: Thu, 10 Apr 2008 18:37:48 +0200 [thread overview]
Message-ID: <47FE425C.7060405@s5r6.in-berlin.de> (raw)
In-Reply-To: <20080410134827.771251000@sipsolutions.net>
Johannes Berg wrote:
> This patch adds kernel macros for a few new sparse features, namely
> * checking try_lock functions and
> * making a function or macro require a certain lock.
>
> Still waiting to see what the sparse folks say to my patches.
>
> Not-yet-signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> include/linux/compiler.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> --- everything.orig/include/linux/compiler.h 2008-04-10 15:36:18.000000000 +0200
> +++ everything/include/linux/compiler.h 2008-04-10 15:36:40.000000000 +0200
> @@ -11,9 +11,12 @@
> # define __nocast __attribute__((nocast))
> # define __iomem __attribute__((noderef, address_space(2)))
> # define __acquires(x) __attribute__((context(x,0,1)))
> +# define __try_acquires(x,t,f) __attribute__((conditional_context(x,0,t,f)))
> # define __releases(x) __attribute__((context(x,1,0)))
> # define __acquire(x) __context__(x,1)
> # define __release(x) __context__(x,-1)
> +# define __requires(x) __attribute__((context(x,1,1)))
> +# define __macro_requires(x) __context__(x,0,1)
So, instead of
/* always call with host_lock held */
int foo(struct bar *b)
{
we could write
int foo(struct bar *b) __requires(host_lock)
{
and let sparse check the call chains... or how is it used?
And what about dynamically allocated locks?
E.g. b->lock
Or struct host h* = container_of(b, struct host, m); with the necessity
to hold h->lock...
--
Stefan Richter
-=====-==--- -=-- -=-=-
http://arcgraph.de/sr/
next prev parent reply other threads:[~2008-04-10 16:37 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 [this message]
2008-04-11 12:20 ` Johannes Berg
2008-04-10 13:48 ` [RFC 2/3] rcu: allow functions to declare they need RCU locking Johannes Berg
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=47FE425C.7060405@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=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).