lkml.org 
[lkml]   [2008]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 0/3] Examples for the new sparse context tracking functionality
From
Date

> > 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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-04-21 17:17    [W:0.051 / U:2.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site