From: Francis Deslauriers Date: Wed, 1 Sep 2021 15:45:01 +0000 (-0400) Subject: Rename `urcu_assert()` to `urcu_assert_debug()` X-Git-Tag: v0.14.0~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2a27e9319bacc9bc98f38afb7e4f050601ab979b;p=userspace-rcu.git Rename `urcu_assert()` to `urcu_assert_debug()` This is done in preparation for the addition of the `urcu_posix_assert()` macro that will replace the vanilla `assert()` in the project. We must continue to expose the `urcu_assert()` macro in the `urcu/debug.h` file as it's used by at least one external project (LTTng-UST). Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: I02f237450a35b57e37718c87a0596a5a14468f58 --- diff --git a/include/urcu/debug.h b/include/urcu/debug.h index 4a7eac9..1920a7d 100644 --- a/include/urcu/debug.h +++ b/include/urcu/debug.h @@ -24,9 +24,15 @@ #include #if defined(DEBUG_RCU) || defined(CONFIG_RCU_DEBUG) -#define urcu_assert(...) assert(__VA_ARGS__) +# define urcu_assert_debug(...) assert(__VA_ARGS__) #else -#define urcu_assert(...) +# define urcu_assert_debug(...) #endif +/* + * For backward compatibility reasons, this file must expose the urcu_assert() + * macro. + */ +#define urcu_assert(_cond) urcu_assert_debug(_cond) + #endif /* _URCU_DEBUG_H */ diff --git a/include/urcu/static/urcu-bp.h b/include/urcu/static/urcu-bp.h index 8614d68..7f5d873 100644 --- a/include/urcu/static/urcu-bp.h +++ b/include/urcu/static/urcu-bp.h @@ -169,7 +169,7 @@ static inline void _urcu_bp_read_lock(void) urcu_bp_register(); /* If not yet registered. */ cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ tmp = URCU_TLS(urcu_bp_reader)->ctr; - urcu_assert((tmp & URCU_BP_GP_CTR_NEST_MASK) != URCU_BP_GP_CTR_NEST_MASK); + urcu_assert_debug((tmp & URCU_BP_GP_CTR_NEST_MASK) != URCU_BP_GP_CTR_NEST_MASK); _urcu_bp_read_lock_update(tmp); } @@ -183,7 +183,7 @@ static inline void _urcu_bp_read_unlock(void) unsigned long tmp; tmp = URCU_TLS(urcu_bp_reader)->ctr; - urcu_assert(tmp & URCU_BP_GP_CTR_NEST_MASK); + urcu_assert_debug(tmp & URCU_BP_GP_CTR_NEST_MASK); /* Finish using rcu before decrementing the pointer. */ urcu_bp_smp_mb_slave(); _CMM_STORE_SHARED(URCU_TLS(urcu_bp_reader)->ctr, tmp - URCU_BP_GP_COUNT); diff --git a/include/urcu/static/urcu-mb.h b/include/urcu/static/urcu-mb.h index 577fdcd..20e604d 100644 --- a/include/urcu/static/urcu-mb.h +++ b/include/urcu/static/urcu-mb.h @@ -91,10 +91,10 @@ static inline void _urcu_mb_read_lock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_mb_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_mb_reader).registered); cmm_barrier(); tmp = URCU_TLS(urcu_mb_reader).ctr; - urcu_assert((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); + urcu_assert_debug((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); _urcu_mb_read_lock_update(tmp); } @@ -126,9 +126,9 @@ static inline void _urcu_mb_read_unlock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_mb_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_mb_reader).registered); tmp = URCU_TLS(urcu_mb_reader).ctr; - urcu_assert(tmp & URCU_GP_CTR_NEST_MASK); + urcu_assert_debug(tmp & URCU_GP_CTR_NEST_MASK); _urcu_mb_read_unlock_update_and_wakeup(tmp); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } diff --git a/include/urcu/static/urcu-memb.h b/include/urcu/static/urcu-memb.h index d30365a..65a985b 100644 --- a/include/urcu/static/urcu-memb.h +++ b/include/urcu/static/urcu-memb.h @@ -114,10 +114,10 @@ static inline void _urcu_memb_read_lock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_memb_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_memb_reader).registered); cmm_barrier(); tmp = URCU_TLS(urcu_memb_reader).ctr; - urcu_assert((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); + urcu_assert_debug((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); _urcu_memb_read_lock_update(tmp); } @@ -149,9 +149,9 @@ static inline void _urcu_memb_read_unlock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_memb_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_memb_reader).registered); tmp = URCU_TLS(urcu_memb_reader).ctr; - urcu_assert(tmp & URCU_GP_CTR_NEST_MASK); + urcu_assert_debug(tmp & URCU_GP_CTR_NEST_MASK); _urcu_memb_read_unlock_update_and_wakeup(tmp); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } diff --git a/include/urcu/static/urcu-qsbr.h b/include/urcu/static/urcu-qsbr.h index a6063e2..5eca3e2 100644 --- a/include/urcu/static/urcu-qsbr.h +++ b/include/urcu/static/urcu-qsbr.h @@ -117,7 +117,7 @@ static inline enum urcu_state urcu_qsbr_reader_state(unsigned long *ctr) */ static inline void _urcu_qsbr_read_lock(void) { - urcu_assert(URCU_TLS(urcu_qsbr_reader).ctr); + urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).ctr); } /* @@ -129,7 +129,7 @@ static inline void _urcu_qsbr_read_lock(void) */ static inline void _urcu_qsbr_read_unlock(void) { - urcu_assert(URCU_TLS(urcu_qsbr_reader).ctr); + urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).ctr); } /* @@ -178,7 +178,7 @@ static inline void _urcu_qsbr_quiescent_state(void) { unsigned long gp_ctr; - urcu_assert(URCU_TLS(urcu_qsbr_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered); if ((gp_ctr = CMM_LOAD_SHARED(urcu_qsbr_gp.ctr)) == URCU_TLS(urcu_qsbr_reader).ctr) return; _urcu_qsbr_quiescent_state_update_and_wakeup(gp_ctr); @@ -194,7 +194,7 @@ static inline void _urcu_qsbr_quiescent_state(void) */ static inline void _urcu_qsbr_thread_offline(void) { - urcu_assert(URCU_TLS(urcu_qsbr_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered); cmm_smp_mb(); CMM_STORE_SHARED(URCU_TLS(urcu_qsbr_reader).ctr, 0); cmm_smp_mb(); /* write URCU_TLS(urcu_qsbr_reader).ctr before read futex */ @@ -212,7 +212,7 @@ static inline void _urcu_qsbr_thread_offline(void) */ static inline void _urcu_qsbr_thread_online(void) { - urcu_assert(URCU_TLS(urcu_qsbr_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ _CMM_STORE_SHARED(URCU_TLS(urcu_qsbr_reader).ctr, CMM_LOAD_SHARED(urcu_qsbr_gp.ctr)); cmm_smp_mb(); diff --git a/include/urcu/static/urcu-signal.h b/include/urcu/static/urcu-signal.h index 4de6da0..56730e1 100644 --- a/include/urcu/static/urcu-signal.h +++ b/include/urcu/static/urcu-signal.h @@ -92,10 +92,10 @@ static inline void _urcu_signal_read_lock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_signal_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_signal_reader).registered); cmm_barrier(); tmp = URCU_TLS(urcu_signal_reader).ctr; - urcu_assert((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); + urcu_assert_debug((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK); _urcu_signal_read_lock_update(tmp); } @@ -127,9 +127,9 @@ static inline void _urcu_signal_read_unlock(void) { unsigned long tmp; - urcu_assert(URCU_TLS(urcu_signal_reader).registered); + urcu_assert_debug(URCU_TLS(urcu_signal_reader).registered); tmp = URCU_TLS(urcu_signal_reader).ctr; - urcu_assert(tmp & URCU_GP_CTR_NEST_MASK); + urcu_assert_debug(tmp & URCU_GP_CTR_NEST_MASK); _urcu_signal_read_unlock_update_and_wakeup(tmp); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ }