From: Johannes Berg <johannes@sipsolutions.net>
To: paulmck@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org,
Josh Triplett <josh@freedesktop.org>,
linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: [RFC 0/3] Examples for the new sparse context tracking functionality
Date: Mon, 21 Apr 2008 17:05:33 +0200 [thread overview]
Message-ID: <1208790333.26186.112.camel@johannes.berg> (raw)
In-Reply-To: <20080421145525.GB9153@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
> > my_specific_rcu_get() __acquires(RCU) __acquires(specificRCU);
> >
> > and then annotate whatever needs the specific RCU type with
> > __requires(specificRCU)
>
> Cute!!! I didn't realize you could mark a single interface with
> multiple __acquires() markings.
>
> So if there is at least one match, sparse is happy?
No, sparse requires all the given contexts to match. For example, say
you have
#define __requires_rcu __requires(RCU)
#define __requires_special_rcu \
__requires(specificRCU)
#define __acquires_special_rcu \
__acquires(RCU) __acquires(specificRCU)
#define __acquires_regular_rcu __acquires(RCU)
Then a function marked "__acquires_special_rcu" with acquire *both*
contexts, and a function marked __requires_special_rcu will require just
the special one. And a function marked __requires_rcu just requires the
regular one. So say you have
rcu_special_lock __acquires_special_rcu
rcu_special_unlock __releases_special_rcu
rcu_regular_lock __acquires_rcu
rcu_regular_unlock __releases_rcu
rcu_do_special __requires_special_rcu
rcu_do_something __requires_rcu
Then both this will be fine:
rcu_special_lock()
rcu_do_special()
rcu_do_something()
rcu_special_unlock()
but this will result in a warning:
rcu_regular_lock()
rcu_do_special()
rcu_regular_unlock()
because the "specialRCU" context is missing.
You could mark do_special with *both* __requires(RCU) and
__requires(specialRCU) but as long as the acquires/releases parts have a
strict dependency (specialRCU implies RCU) that isn't necessary.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2008-04-21 15:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-10 13:48 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 ` [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
2008-04-12 8:50 ` Geert Uytterhoeven
2008-04-12 8:56 ` Johannes Berg
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
2008-04-21 14:55 ` Paul E. McKenney
2008-04-21 15:05 ` Johannes Berg [this message]
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=1208790333.26186.112.camel@johannes.berg \
--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
all inboxes | Powered by JetHome®