* [PATCH] [rcu] Add lock annotations to rcu{,_bh}_torture_read_{lock,unlock}
@ 2006-07-26 19:09 Josh Triplett
2006-07-27 1:12 ` Paul E. McKenney
0 siblings, 1 reply; 2+ messages in thread
From: Josh Triplett @ 2006-07-26 19:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Paul McKenney, Dipkanar Sarma
rcu_torture_read_lock and rcu_bh_torture_read_lock acquire locks without
releasing them, and the matching functions rcu_torture_read_unlock and
rcu_bh_torture_read_unlock get called with the corresponding locks held and
release them. Add lock annotations to these four functions so that sparse can
check callers for lock pairing, and so that sparse will not complain about
these functions since they intentionally use locks in this manner.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
---
kernel/rcutorture.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index 4d1c3d2..4f2c427 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -192,13 +192,13 @@ static struct rcu_torture_ops *cur_ops =
* Definitions for rcu torture testing.
*/
-static int rcu_torture_read_lock(void)
+static int rcu_torture_read_lock(void) __acquires(RCU)
{
rcu_read_lock();
return 0;
}
-static void rcu_torture_read_unlock(int idx)
+static void rcu_torture_read_unlock(int idx) __releases(RCU)
{
rcu_read_unlock();
}
@@ -250,13 +250,13 @@ static struct rcu_torture_ops rcu_ops =
* Definitions for rcu_bh torture testing.
*/
-static int rcu_bh_torture_read_lock(void)
+static int rcu_bh_torture_read_lock(void) __acquires(RCU_BH)
{
rcu_read_lock_bh();
return 0;
}
-static void rcu_bh_torture_read_unlock(int idx)
+static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)
{
rcu_read_unlock_bh();
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [rcu] Add lock annotations to rcu{,_bh}_torture_read_{lock,unlock}
2006-07-26 19:09 [PATCH] [rcu] Add lock annotations to rcu{,_bh}_torture_read_{lock,unlock} Josh Triplett
@ 2006-07-27 1:12 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2006-07-27 1:12 UTC (permalink / raw)
To: Josh Triplett; +Cc: linux-kernel, Andrew Morton, Dipkanar Sarma
On Wed, Jul 26, 2006 at 12:09:46PM -0700, Josh Triplett wrote:
> rcu_torture_read_lock and rcu_bh_torture_read_lock acquire locks without
> releasing them, and the matching functions rcu_torture_read_unlock and
> rcu_bh_torture_read_unlock get called with the corresponding locks held and
> release them. Add lock annotations to these four functions so that sparse can
> check callers for lock pairing, and so that sparse will not complain about
> these functions since they intentionally use locks in this manner.
Good stuff!!!
Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
> Signed-off-by: Josh Triplett <josh@freedesktop.org>
> ---
> kernel/rcutorture.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index 4d1c3d2..4f2c427 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -192,13 +192,13 @@ static struct rcu_torture_ops *cur_ops =
> * Definitions for rcu torture testing.
> */
>
> -static int rcu_torture_read_lock(void)
> +static int rcu_torture_read_lock(void) __acquires(RCU)
> {
> rcu_read_lock();
> return 0;
> }
>
> -static void rcu_torture_read_unlock(int idx)
> +static void rcu_torture_read_unlock(int idx) __releases(RCU)
> {
> rcu_read_unlock();
> }
> @@ -250,13 +250,13 @@ static struct rcu_torture_ops rcu_ops =
> * Definitions for rcu_bh torture testing.
> */
>
> -static int rcu_bh_torture_read_lock(void)
> +static int rcu_bh_torture_read_lock(void) __acquires(RCU_BH)
> {
> rcu_read_lock_bh();
> return 0;
> }
>
> -static void rcu_bh_torture_read_unlock(int idx)
> +static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)
> {
> rcu_read_unlock_bh();
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-27 1:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-26 19:09 [PATCH] [rcu] Add lock annotations to rcu{,_bh}_torture_read_{lock,unlock} Josh Triplett
2006-07-27 1:12 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox