public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Josh Triplett <josht@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Dipkanar Sarma <dipankar@in.ibm.com>
Subject: Re: [PATCH] [rcu] Add lock annotations to rcu{,_bh}_torture_read_{lock,unlock}
Date: Wed, 26 Jul 2006 18:12:16 -0700	[thread overview]
Message-ID: <20060727011216.GC4338@us.ibm.com> (raw)
In-Reply-To: <1153940986.12517.66.camel@josh-work.beaverton.ibm.com>

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();
>  }
> 
> 

      reply	other threads:[~2006-07-27  1:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=20060727011216.GC4338@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dipankar@in.ibm.com \
    --cc=josht@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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