diff options
author | Oleg Nesterov <oleg@redhat.com> | 2015-09-11 11:59:18 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-10-06 14:25:45 -0400 |
commit | 4bace7344d6dbd7a1b0b801abf24ea9878064317 (patch) | |
tree | d6d2eeb78cbbb002f105a7a0d4d8928c2e4dca29 | |
parent | cc5f730b41506d37a5c2826b2e801d0a59853d11 (diff) |
rcu_sync: Cleanup the CONFIG_PROVE_RCU checks
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 as is done 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>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r-- | include/linux/rcu_sync.h | 7 | ||||
-rw-r--r-- | 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 8069d6468bc4..a63a33e6196e 100644 --- a/include/linux/rcu_sync.h +++ b/include/linux/rcu_sync.h | |||
@@ -40,7 +40,7 @@ struct rcu_sync { | |||
40 | enum rcu_sync_type gp_type; | 40 | enum rcu_sync_type gp_type; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | extern bool __rcu_sync_is_idle(struct rcu_sync *); | 43 | extern void rcu_sync_lockdep_assert(struct rcu_sync *); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * rcu_sync_is_idle() - Are readers permitted to use their fastpaths? | 46 | * rcu_sync_is_idle() - Are readers permitted to use their fastpaths? |
@@ -53,10 +53,9 @@ extern bool __rcu_sync_is_idle(struct rcu_sync *); | |||
53 | static inline bool rcu_sync_is_idle(struct rcu_sync *rsp) | 53 | static inline bool rcu_sync_is_idle(struct rcu_sync *rsp) |
54 | { | 54 | { |
55 | #ifdef CONFIG_PROVE_RCU | 55 | #ifdef CONFIG_PROVE_RCU |
56 | return __rcu_sync_is_idle(rsp); | 56 | rcu_sync_lockdep_assert(rsp); |
57 | #else | ||
58 | return !rsp->gp_state; /* GP_IDLE */ | ||
59 | #endif | 57 | #endif |
58 | return !rsp->gp_state; /* GP_IDLE */ | ||
60 | } | 59 | } |
61 | 60 | ||
62 | extern void rcu_sync_init(struct rcu_sync *, enum rcu_sync_type); | 61 | 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 1e353f0a2b66..be922c9f3d37 100644 --- a/kernel/rcu/sync.c +++ b/kernel/rcu/sync.c | |||
@@ -63,10 +63,10 @@ enum { CB_IDLE = 0, CB_PENDING, CB_REPLAY }; | |||
63 | #define rss_lock gp_wait.lock | 63 | #define rss_lock gp_wait.lock |
64 | 64 | ||
65 | #ifdef CONFIG_PROVE_RCU | 65 | #ifdef CONFIG_PROVE_RCU |
66 | bool __rcu_sync_is_idle(struct rcu_sync *rsp) | 66 | void rcu_sync_lockdep_assert(struct rcu_sync *rsp) |
67 | { | 67 | { |
68 | WARN_ON(!gp_ops[rsp->gp_type].held()); | 68 | RCU_LOCKDEP_WARN(!gp_ops[rsp->gp_type].held(), |
69 | return rsp->gp_state == GP_IDLE; | 69 | "suspicious rcu_sync_is_idle() usage"); |
70 | } | 70 | } |
71 | #endif | 71 | #endif |
72 | 72 | ||