Detect RCU read-side overflows
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 13 Sep 2015 15:46:04 +0000 (11:46 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 13 Sep 2015 15:46:04 +0000 (11:46 -0400)
Use the urcu_assert() macro (enabled on DEBUG_RCU) to check for
unmatched rcu_read_lock() that eventually leads to nesting counter
overflow in urcu.h and urcu-bp.h. This won't necessarily point the the
exact rcu_read_lock() that is unmatched, but will at least detect the
overflow condition.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/static/urcu-bp.h
urcu/static/urcu.h

index ffd4b8959b61e49c092fa7d72a3053d5223ab500..df25393d06d6a1a19b0b281f81cedf767bd2d470 100644 (file)
@@ -154,6 +154,7 @@ static inline void _rcu_read_lock(void)
                rcu_bp_register(); /* If not yet registered. */
        cmm_barrier();  /* Ensure the compiler does not reorder us with mutex */
        tmp = URCU_TLS(rcu_reader)->ctr;
+       urcu_assert((tmp & RCU_GP_CTR_NEST_MASK) != RCU_GP_CTR_NEST_MASK);
        _rcu_read_lock_update(tmp);
 }
 
index c44c137278301a9b02e5b0c13693968c95e75d03..3fb457b4e3e00916b2a2e06e172b4eced08f0df0 100644 (file)
@@ -224,6 +224,7 @@ static inline void _rcu_read_lock(void)
        urcu_assert(URCU_TLS(rcu_reader).registered);
        cmm_barrier();
        tmp = URCU_TLS(rcu_reader).ctr;
+       urcu_assert((tmp & RCU_GP_CTR_NEST_MASK) != RCU_GP_CTR_NEST_MASK);
        _rcu_read_lock_update(tmp);
 }
 
This page took 0.025675 seconds and 4 git commands to generate.