From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] rcu_sync: Cleanup the CONFIG_PROVE_RCU checks
Date: Fri, 11 Sep 2015 14:40:20 -0700 [thread overview]
Message-ID: <20150911214020.GG4029@linux.vnet.ibm.com> (raw)
In-Reply-To: <20150911155918.GA27250@redhat.com>
On Fri, Sep 11, 2015 at 05:59:18PM +0200, Oleg Nesterov wrote:
> 1. Rename __rcu_sync_is_idle() to rcu_sync_lockdep_assert() and
> change it to use rcu_lockdep_assert().
>
> 2. Change rcu_sync_is_idle() to return rsp->gp_state == GP_IDLE
> unconditonally, this way we can remove the same check from
> rcu_sync_lockdep_assert() and clearly isolate the debugging
> code.
>
> Note: rcu_sync_enter()->wait_event(gp_state == GP_PASSED) needs
> another CONFIG_PROVE_RCU check, the same we do in ->sync(); but
> this needs some simple preparations in the core RCU code to avoid
> the code duplication.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Queued for v4.4, thank you, Oleg!
Thanx, Paul
> ---
> include/linux/rcu_sync.h | 7 +++----
> kernel/rcu/sync.c | 6 +++---
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/rcu_sync.h b/include/linux/rcu_sync.h
> index 8069d64..a63a33e 100644
> --- a/include/linux/rcu_sync.h
> +++ b/include/linux/rcu_sync.h
> @@ -40,7 +40,7 @@ struct rcu_sync {
> enum rcu_sync_type gp_type;
> };
>
> -extern bool __rcu_sync_is_idle(struct rcu_sync *);
> +extern void rcu_sync_lockdep_assert(struct rcu_sync *);
>
> /**
> * rcu_sync_is_idle() - Are readers permitted to use their fastpaths?
> @@ -53,10 +53,9 @@ extern bool __rcu_sync_is_idle(struct rcu_sync *);
> static inline bool rcu_sync_is_idle(struct rcu_sync *rsp)
> {
> #ifdef CONFIG_PROVE_RCU
> - return __rcu_sync_is_idle(rsp);
> -#else
> - return !rsp->gp_state; /* GP_IDLE */
> + rcu_sync_lockdep_assert(rsp);
> #endif
> + return !rsp->gp_state; /* GP_IDLE */
> }
>
> extern void rcu_sync_init(struct rcu_sync *, enum rcu_sync_type);
> diff --git a/kernel/rcu/sync.c b/kernel/rcu/sync.c
> index 1c73c57..a8cf199 100644
> --- a/kernel/rcu/sync.c
> +++ b/kernel/rcu/sync.c
> @@ -63,10 +63,10 @@ enum { CB_IDLE = 0, CB_PENDING, CB_REPLAY };
> #define rss_lock gp_wait.lock
>
> #ifdef CONFIG_PROVE_RCU
> -bool __rcu_sync_is_idle(struct rcu_sync *rsp)
> +void rcu_sync_lockdep_assert(struct rcu_sync *rsp)
> {
> - WARN_ON(!gp_ops[rsp->gp_type].held());
> - return rsp->gp_state == GP_IDLE;
> + rcu_lockdep_assert(gp_ops[rsp->gp_type].held(),
> + "suspicious rcu_sync_is_idle() usage");
> }
> #endif
>
> --
> 1.5.5.1
>
>
next prev parent reply other threads:[~2015-09-11 21:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 15:59 [PATCH 0/1] rcu_sync: Cleanup the CONFIG_PROVE_RCU checks Oleg Nesterov
2015-09-11 15:59 ` [PATCH 1/1] " Oleg Nesterov
2015-09-11 21:40 ` Paul E. McKenney [this message]
2015-09-11 17:05 ` [PATCH 0/1] " Paul E. McKenney
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=20150911214020.GG4029@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.