From 2f6618651c31c05ba1adbb5cdcf0d92980c38f38 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 7 Nov 2017 09:35:37 -0500 Subject: [PATCH] Revert "Use initial-exec tls model" This reverts commit 6fd172f599e8d798e68974a786dd930d876f182e. The initial-exec model seems to behave differently than global-dynamic with respect to lazy initialization, causing locks to be taken then first time each thread touch the TLS. This introduces deadlocks with library constructors waiting on other threads. This will require further investigation. Signed-off-by: Mathieu Desnoyers --- include/urcu/tls-compat.h | 6 ------ src/urcu-bp.c | 2 +- src/urcu-call-rcu-impl.h | 2 +- src/urcu-defer-impl.h | 2 +- src/urcu-qsbr.c | 2 +- src/urcu.c | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/urcu/tls-compat.h b/include/urcu/tls-compat.h index 3a31eeb..8ac1ea0 100644 --- a/include/urcu/tls-compat.h +++ b/include/urcu/tls-compat.h @@ -72,9 +72,6 @@ extern "C" { # define URCU_TLS(name) (name) -# define DEFINE_URCU_TLS_IE(type, name) \ - CONFIG_RCU_TLS __attribute__((tls_model("initial-exec"))) type name - #else /* #ifndef CONFIG_RCU_TLS */ /* @@ -130,9 +127,6 @@ struct urcu_tls { # define DEFINE_URCU_TLS(type, name) \ DEFINE_URCU_TLS_1(type, name) -# define DEFINE_URCU_TLS_IE(type, name) \ - DEFINE_URCU_TLS_1(type, name) - # define URCU_TLS_1(name) (*__tls_access_ ## name()) # define URCU_TLS(name) URCU_TLS_1(name) diff --git a/src/urcu-bp.c b/src/urcu-bp.c index 675b5d6..ebe96c5 100644 --- a/src/urcu-bp.c +++ b/src/urcu-bp.c @@ -142,7 +142,7 @@ struct rcu_gp rcu_gp = { .ctr = RCU_GP_COUNT }; * Pointer to registry elements. Written to only by each individual reader. Read * by both the reader and the writers. */ -DEFINE_URCU_TLS_IE(struct rcu_reader *, rcu_reader); +DEFINE_URCU_TLS(struct rcu_reader *, rcu_reader); static CDS_LIST_HEAD(registry); diff --git a/src/urcu-call-rcu-impl.h b/src/urcu-call-rcu-impl.h index 56fe943..4562ba4 100644 --- a/src/urcu-call-rcu-impl.h +++ b/src/urcu-call-rcu-impl.h @@ -88,7 +88,7 @@ static CDS_LIST_HEAD(call_rcu_data_list); /* Link a thread using call_rcu() to its call_rcu thread. */ -static DEFINE_URCU_TLS_IE(struct call_rcu_data *, thread_call_rcu_data); +static DEFINE_URCU_TLS(struct call_rcu_data *, thread_call_rcu_data); /* * Guard call_rcu thread creation and atfork handlers. diff --git a/src/urcu-defer-impl.h b/src/urcu-defer-impl.h index b2e1b3c..f965533 100644 --- a/src/urcu-defer-impl.h +++ b/src/urcu-defer-impl.h @@ -126,7 +126,7 @@ static int32_t defer_thread_stop; * Written to only by each individual deferer. Read by both the deferer and * the reclamation tread. */ -static DEFINE_URCU_TLS_IE(struct defer_queue, defer_queue); +static DEFINE_URCU_TLS(struct defer_queue, defer_queue); static CDS_LIST_HEAD(registry_defer); static pthread_t tid_defer; diff --git a/src/urcu-qsbr.c b/src/urcu-qsbr.c index f343f0d..e029ace 100644 --- a/src/urcu-qsbr.c +++ b/src/urcu-qsbr.c @@ -77,7 +77,7 @@ struct rcu_gp rcu_gp = { .ctr = RCU_GP_ONLINE }; * Written to only by each individual reader. Read by both the reader and the * writers. */ -DEFINE_URCU_TLS_IE(struct rcu_reader, rcu_reader); +DEFINE_URCU_TLS(struct rcu_reader, rcu_reader); static CDS_LIST_HEAD(registry); diff --git a/src/urcu.c b/src/urcu.c index af8a2ce..a81b129 100644 --- a/src/urcu.c +++ b/src/urcu.c @@ -118,7 +118,7 @@ struct rcu_gp rcu_gp = { .ctr = RCU_GP_COUNT }; * Written to only by each individual reader. Read by both the reader and the * writers. */ -DEFINE_URCU_TLS_IE(struct rcu_reader, rcu_reader); +DEFINE_URCU_TLS(struct rcu_reader, rcu_reader); static CDS_LIST_HEAD(registry); -- 2.34.1