From 143bc4b3366ca332e4c2c3a01e59efa3c94d2ad5 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Fri, 12 Jul 2013 19:20:44 -0400 Subject: [PATCH] regressions: Add ck_spinlock locked coverage. --- regressions/ck_spinlock/ck_anderson.h | 1 + regressions/ck_spinlock/ck_cas.h | 1 + regressions/ck_spinlock/ck_clh.h | 1 + regressions/ck_spinlock/ck_dec.h | 1 + regressions/ck_spinlock/ck_fas.h | 1 + regressions/ck_spinlock/ck_mcs.h | 1 + regressions/ck_spinlock/ck_spinlock.h | 1 + regressions/ck_spinlock/ck_ticket.h | 1 + regressions/ck_spinlock/ck_ticket_pb.h | 1 + regressions/ck_spinlock/validate/validate.h | 5 +++++ 10 files changed, 14 insertions(+) diff --git a/regressions/ck_spinlock/ck_anderson.h b/regressions/ck_spinlock/ck_anderson.h index cf7b04d..7dc8e6e 100644 --- a/regressions/ck_spinlock/ck_anderson.h +++ b/regressions/ck_spinlock/ck_anderson.h @@ -5,6 +5,7 @@ #define LOCK ck_spinlock_anderson_lock(&lock, &nad) #define UNLOCK ck_spinlock_anderson_unlock(&lock, nad) #define LOCK_INIT ck_spinlock_anderson_init(&lock, malloc(MAX(64,sizeof(ck_spinlock_anderson_thread_t)) * nthr), nthr) +#define LOCKED ck_spinlock_anderson_locked(&lock) #define NO_LOCAL diff --git a/regressions/ck_spinlock/ck_cas.h b/regressions/ck_spinlock/ck_cas.h index 7406b0c..bd4ae13 100644 --- a/regressions/ck_spinlock/ck_cas.h +++ b/regressions/ck_spinlock/ck_cas.h @@ -2,4 +2,5 @@ #define LOCK_DEFINE static ck_spinlock_cas_t CK_CC_CACHELINE lock = CK_SPINLOCK_CAS_INITIALIZER #define LOCK ck_spinlock_cas_lock_eb(&lock) #define UNLOCK ck_spinlock_cas_unlock(&lock) +#define LOCKED ck_spinlock_cas_locked(&lock) diff --git a/regressions/ck_spinlock/ck_clh.h b/regressions/ck_spinlock/ck_clh.h index 685c343..df7e49f 100644 --- a/regressions/ck_spinlock/ck_clh.h +++ b/regressions/ck_spinlock/ck_clh.h @@ -5,4 +5,5 @@ #define LOCK ck_spinlock_clh_lock(&lock, na) #define UNLOCK ck_spinlock_clh_unlock(&na) #define LOCK_INIT ck_spinlock_clh_init(&lock, malloc(MAX(sizeof(ck_spinlock_clh_t), 64))) +#define LOCKED ck_spinlock_clh_locked(&lock) diff --git a/regressions/ck_spinlock/ck_dec.h b/regressions/ck_spinlock/ck_dec.h index d2169f5..c21a390 100644 --- a/regressions/ck_spinlock/ck_dec.h +++ b/regressions/ck_spinlock/ck_dec.h @@ -2,4 +2,5 @@ #define LOCK_DEFINE static ck_spinlock_dec_t CK_CC_CACHELINE lock = CK_SPINLOCK_DEC_INITIALIZER #define LOCK ck_spinlock_dec_lock_eb(&lock) #define UNLOCK ck_spinlock_dec_unlock(&lock) +#define LOCKED ck_spinlock_dec_locked(&lock) diff --git a/regressions/ck_spinlock/ck_fas.h b/regressions/ck_spinlock/ck_fas.h index 45fad65..e244746 100644 --- a/regressions/ck_spinlock/ck_fas.h +++ b/regressions/ck_spinlock/ck_fas.h @@ -2,4 +2,5 @@ #define LOCK_DEFINE static ck_spinlock_fas_t CK_CC_CACHELINE lock = CK_SPINLOCK_FAS_INITIALIZER #define LOCK ck_spinlock_fas_lock_eb(&lock) #define UNLOCK ck_spinlock_fas_unlock(&lock) +#define LOCKED ck_spinlock_fas_locked(&lock) diff --git a/regressions/ck_spinlock/ck_mcs.h b/regressions/ck_spinlock/ck_mcs.h index 59551c8..dd127df 100644 --- a/regressions/ck_spinlock/ck_mcs.h +++ b/regressions/ck_spinlock/ck_mcs.h @@ -3,4 +3,5 @@ #define LOCK_STATE ck_spinlock_mcs_context_t node CK_CC_CACHELINE; #define LOCK ck_spinlock_mcs_lock(&lock, &node) #define UNLOCK ck_spinlock_mcs_unlock(&lock, &node) +#define LOCKED ck_spinlock_mcs_locked(&lock) diff --git a/regressions/ck_spinlock/ck_spinlock.h b/regressions/ck_spinlock/ck_spinlock.h index a3de26e..938e1ce 100644 --- a/regressions/ck_spinlock/ck_spinlock.h +++ b/regressions/ck_spinlock/ck_spinlock.h @@ -2,4 +2,5 @@ #define LOCK_DEFINE static ck_spinlock_t CK_CC_CACHELINE lock = CK_SPINLOCK_INITIALIZER #define LOCK ck_spinlock_lock_eb(&lock) #define UNLOCK ck_spinlock_unlock(&lock) +#define LOCKED ck_spinlock_locked(&lock) diff --git a/regressions/ck_spinlock/ck_ticket.h b/regressions/ck_spinlock/ck_ticket.h index 3459f16..39054a6 100644 --- a/regressions/ck_spinlock/ck_ticket.h +++ b/regressions/ck_spinlock/ck_ticket.h @@ -7,4 +7,5 @@ #ifdef CK_F_SPINLOCK_TICKET_TRYLOCK #define TRYLOCK ck_spinlock_ticket_trylock(&lock) #endif +#define LOCKED ck_spinlock_ticket_locked(&lock) diff --git a/regressions/ck_spinlock/ck_ticket_pb.h b/regressions/ck_spinlock/ck_ticket_pb.h index 47b74a1..b8a7a84 100644 --- a/regressions/ck_spinlock/ck_ticket_pb.h +++ b/regressions/ck_spinlock/ck_ticket_pb.h @@ -2,4 +2,5 @@ #define LOCK_DEFINE static ck_spinlock_ticket_t CK_CC_CACHELINE lock = CK_SPINLOCK_TICKET_INITIALIZER #define LOCK ck_spinlock_ticket_lock_pb(&lock, 0) #define UNLOCK ck_spinlock_ticket_unlock(&lock) +#define LOCKED ck_spinlock_ticket_locked(&lock) diff --git a/regressions/ck_spinlock/validate/validate.h b/regressions/ck_spinlock/validate/validate.h index a0845d6..42998ab 100644 --- a/regressions/ck_spinlock/validate/validate.h +++ b/regressions/ck_spinlock/validate/validate.h @@ -81,6 +81,11 @@ thread(void *null CK_CC_UNUSED) LOCK; #endif +#ifdef LOCKED + if (LOCKED == false) + ck_error("is_locked operation failed."); +#endif + ck_pr_inc_uint(&locked); ck_pr_inc_uint(&locked); ck_pr_inc_uint(&locked);