Re: [PATCH 2/3] rcu: Create rcu_sync infrastructure

From: Peter Zijlstra
Date: Thu Oct 03 2013 - 14:40:35 EST


On Thu, Oct 03, 2013 at 09:41:17AM -0700, Paul E. McKenney wrote:
> On Wed, Oct 02, 2013 at 04:56:57PM +0200, Peter Zijlstra wrote:
> #ifdef CONFIG_PROVE_RCU
> #define rcu_sync_is_idle_check(rss) BUG_ON(!rss->read_side_check())
> #else
> #define rcu_sync_is_idle_check(rss) do { } while (0)
> #endif
>
> rcu_sync_is_idle_check(rss);

The below actually seems to build, although I didn't test the config
permutations, only defconfig.

---
--- a/include/linux/rcusync.h
+++ b/include/linux/rcusync.h
@@ -14,6 +14,7 @@ struct rcu_sync_struct {

void (*sync)(void);
void (*call)(struct rcu_head *, void (*)(struct rcu_head *));
+ int (*held)(void);
};

#define ___RCU_SYNC_INIT(name) \
@@ -26,18 +27,21 @@ struct rcu_sync_struct {
___RCU_SYNC_INIT(name), \
.sync = synchronize_sched, \
.call = call_rcu_sched, \
+ .held = rcu_read_lock_sched_held, \
}

#define __RCU_BH_SYNC_INIT(name) { \
___RCU_SYNC_INIT(name), \
.sync = synchronize_rcu_bh, \
.call = call_rcu_bh, \
+ .held = rcu_read_lock_bh_held, \
}

#define __RCU_SYNC_INIT(name) { \
___RCU_SYNC_INIT(name), \
.sync = synchronize_rcu, \
.call = call_rcu, \
+ .held = rcu_read_lock_held, \
}

#define DEFINE_RCU_SCHED_SYNC(name) \
@@ -51,6 +55,9 @@ struct rcu_sync_struct {

static inline bool rcu_sync_is_idle(struct rcu_sync_struct *rss)
{
+#ifdef CONFIG_PROVE_RCU
+ BUG_ON(!rss->held());
+#endif
return !rss->gp_state; /* GP_IDLE */
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/