]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu_sync: Cleanup the CONFIG_PROVE_RCU checks
authorOleg Nesterov <oleg@redhat.com>
Fri, 11 Sep 2015 15:59:18 +0000 (17:59 +0200)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 6 Oct 2015 18:25:45 +0000 (11:25 -0700)
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>
include/linux/rcu_sync.h
kernel/rcu/sync.c

index 8069d6468bc4cef5c3c9003c5b6e8ac30b610049..a63a33e6196e23905406e2dab831b17b5d883597 100644 (file)
@@ -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);
index 1e353f0a2b66aee9832f37c0a777d9b5dd8220dc..be922c9f3d37256fc060d5b9ba0aaf6a2d1f085c 100644 (file)
@@ -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_WARN(!gp_ops[rsp->gp_type].held(),
+                        "suspicious rcu_sync_is_idle() usage");
 }
 #endif