projects
/
lttng-ust.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2982a61
)
Use initial-exec TLS model
author
Mathieu Desnoyers
<mathieu.desnoyers@efficios.com>
Thu, 19 Oct 2017 13:27:27 +0000
(09:27 -0400)
committer
Mathieu Desnoyers
<mathieu.desnoyers@efficios.com>
Thu, 19 Oct 2017 14:49:49 +0000
(10:49 -0400)
Use initial-exec TLS model for TLS variables. Those are faster, and
signal-handler-safe.
Link:
https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter8-20.html
Link:
https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
patch
|
blob
|
blame
|
history
liblttng-ust-comm/lttng-ust-fd-tracker.c
patch
|
blob
|
blame
|
history
liblttng-ust-java-agent/jni/common/lttng_ust_context.c
patch
|
blob
|
blame
|
history
liblttng-ust-java-agent/jni/common/lttng_ust_context.h
patch
|
blob
|
blame
|
history
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
patch
|
blob
|
blame
|
history
liblttng-ust-libc-wrapper/lttng-ust-pthread.c
patch
|
blob
|
blame
|
history
liblttng-ust/lttng-context-procname.c
patch
|
blob
|
blame
|
history
liblttng-ust/lttng-context-vtid.c
patch
|
blob
|
blame
|
history
liblttng-ust/lttng-ust-comm.c
patch
|
blob
|
blame
|
history
libringbuffer/ring_buffer_frontend.c
patch
|
blob
|
blame
|
history
tests/test-app-ctx/hello.c
patch
|
blob
|
blame
|
history
diff --git
a/configure.ac
b/configure.ac
index e2acfa9057bbd20a0cefcb104c047021ab5bd10d..08ca3b6587438405864385dcfaf96e78b0a69237 100644
(file)
--- a/
configure.ac
+++ b/
configure.ac
@@
-225,26
+225,22
@@
AM_CONDITIONAL([HAVE_DLINFO], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xye
AC_CHECK_HEADERS([urcu-bp.h], [], [AC_MSG_ERROR([Cannot find [URCU] headers (urcu-bp.h). Use [CPPFLAGS]=-Idir to specify their location.
This error can also occur when the liburcu package's configure script has not been run.])])
AC_CHECK_HEADERS([urcu-bp.h], [], [AC_MSG_ERROR([Cannot find [URCU] headers (urcu-bp.h). Use [CPPFLAGS]=-Idir to specify their location.
This error can also occur when the liburcu package's configure script has not been run.])])
+# URCU library version needed or newer
+m4_define([WRONG_LIBURCU_MSG], [Userspace RCU (liburcu) >= 0.11.0 is needed])
+
+#Macro added in urcu 0.6.6
+AC_CHECK_DECL([caa_likely], [],
+ [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include <urcu.h>]])
+#Macro added in urcu 0.11.0
+AC_CHECK_DECL([DEFINE_URCU_TLS_IE], [],
+ [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include <urcu/tls-compat.h>]]
+)
+
# urcu-cds - check that URCU Concurrent Data Structure lib is available to compilation
# Part of Userspace RCU library 0.7.2 or better.
AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], [AC_MSG_ERROR([Cannot find
liburcu-cds lib, part of Userspace RCU 0.7 or better. Use [LDFLAGS]=-Ldir to specify its location.])])
# urcu-cds - check that URCU Concurrent Data Structure lib is available to compilation
# Part of Userspace RCU library 0.7.2 or better.
AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], [AC_MSG_ERROR([Cannot find
liburcu-cds lib, part of Userspace RCU 0.7 or better. Use [LDFLAGS]=-Ldir to specify its location.])])
-AC_MSG_CHECKING([caa_likely()])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- #include <urcu/compiler.h>
- void fct(void)
- {
- if (caa_likely(1)) {
- }
- }
-]])], [
- AC_MSG_RESULT([yes])
-], [
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Please upgrade your version of liburcu to 0.6.6 or better])
-])
-
# urcu - check that URCU lib is available to compilation
AC_CHECK_LIB([urcu-bp], [synchronize_rcu_bp], [], [AC_MSG_ERROR([Cannot find liburcu-bp lib. Use [LDFLAGS]=-Ldir to specify its location.])])
# urcu - check that URCU lib is available to compilation
AC_CHECK_LIB([urcu-bp], [synchronize_rcu_bp], [], [AC_MSG_ERROR([Cannot find liburcu-bp lib. Use [LDFLAGS]=-Ldir to specify its location.])])
diff --git
a/liblttng-ust-comm/lttng-ust-fd-tracker.c
b/liblttng-ust-comm/lttng-ust-fd-tracker.c
index 5a763ff2960550c094306d9d7d90de3d2bf9d037..04ae2391f034f7f8a23e92aef97d3e4ace8518a0 100644
(file)
--- a/
liblttng-ust-comm/lttng-ust-fd-tracker.c
+++ b/
liblttng-ust-comm/lttng-ust-fd-tracker.c
@@
-65,7
+65,7
@@
static pthread_mutex_t ust_safe_guard_fd_mutex = PTHREAD_MUTEX_INITIALIZER;
* Track whether we are within lttng-ust or application, for close
* system call override by LD_PRELOAD library.
*/
* Track whether we are within lttng-ust or application, for close
* system call override by LD_PRELOAD library.
*/
-static DEFINE_URCU_TLS(int, thread_fd_tracking);
+static DEFINE_URCU_TLS
_IE
(int, thread_fd_tracking);
/* fd_set used to book keep fd being used by lttng-ust. */
static fd_set *lttng_fd_set;
/* fd_set used to book keep fd being used by lttng-ust. */
static fd_set *lttng_fd_set;
diff --git
a/liblttng-ust-java-agent/jni/common/lttng_ust_context.c
b/liblttng-ust-java-agent/jni/common/lttng_ust_context.c
index 3bed11ec8ff435768259a460d9dffbfb0636efc0..e9b6da282db3bfbc5ec075a8ea64178c6f9ef851 100644
(file)
--- a/
liblttng-ust-java-agent/jni/common/lttng_ust_context.c
+++ b/
liblttng-ust-java-agent/jni/common/lttng_ust_context.c
@@
-24,6
+24,7
@@
#include <lttng/ust-events.h>
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
#include <lttng/ust-events.h>
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
+#include <urcu/tls-compat.h>
#include "helper.h"
#include "lttng_ust_context.h"
#include "helper.h"
#include "lttng_ust_context.h"
@@
-56,7
+57,7
@@
struct lttng_ust_jni_ctx_entry {
} __attribute__((packed));
/* TLS passing context info from JNI to callbacks. */
} __attribute__((packed));
/* TLS passing context info from JNI to callbacks. */
-
__thread struct lttng_ust_jni_tls lttng_ust_context_info_tls
;
+
DECLARE_URCU_TLS_IE(struct lttng_ust_jni_tls, lttng_ust_context_info_tls)
;
static const char *get_ctx_string_at_offset(int32_t offset)
{
static const char *get_ctx_string_at_offset(int32_t offset)
{
diff --git
a/liblttng-ust-java-agent/jni/common/lttng_ust_context.h
b/liblttng-ust-java-agent/jni/common/lttng_ust_context.h
index 415f7de228fa9bcbc500dc28929a978272ef0b76..8ea43e1ae362d471279c7b77c18c5bee9e2abf3f 100644
(file)
--- a/
liblttng-ust-java-agent/jni/common/lttng_ust_context.h
+++ b/
liblttng-ust-java-agent/jni/common/lttng_ust_context.h
@@
-19,6
+19,8
@@
#ifndef LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
#define LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
#ifndef LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
#define LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_
+#include <urcu/tls-compat.h>
+
struct lttng_ust_jni_ctx_entry;
struct lttng_ust_jni_tls {
struct lttng_ust_jni_ctx_entry;
struct lttng_ust_jni_tls {
@@
-28,6
+30,6
@@
struct lttng_ust_jni_tls {
int32_t ctx_strings_len;
};
int32_t ctx_strings_len;
};
-extern
__thread struct lttng_ust_jni_tls lttng_ust_context_info_tls
;
+extern
DECLARE_URCU_TLS(struct lttng_ust_jni_tls, lttng_ust_context_info_tls)
;
#endif /* LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_ */
#endif /* LIBLTTNG_UST_JAVA_AGENT_JNI_COMMON_LTTNG_UST_CONTEXT_H_ */
diff --git
a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
index f3e1e19e28e52d8d5fe07d399f6c4741d0d87282..f30a2c694372970c7f68581364075a67534dbeb4 100644
(file)
--- a/
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
+++ b/
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
@@
-95,7
+95,7
@@
void ust_malloc_spin_unlock(pthread_mutex_t *lock)
#define calloc static_calloc
#define pthread_mutex_lock ust_malloc_spin_lock
#define pthread_mutex_unlock ust_malloc_spin_unlock
#define calloc static_calloc
#define pthread_mutex_lock ust_malloc_spin_lock
#define pthread_mutex_unlock ust_malloc_spin_unlock
-static DEFINE_URCU_TLS(int, malloc_nesting);
+static DEFINE_URCU_TLS
_IE
(int, malloc_nesting);
#undef ust_malloc_spin_unlock
#undef ust_malloc_spin_lock
#undef calloc
#undef ust_malloc_spin_unlock
#undef ust_malloc_spin_lock
#undef calloc
diff --git
a/liblttng-ust-libc-wrapper/lttng-ust-pthread.c
b/liblttng-ust-libc-wrapper/lttng-ust-pthread.c
index 7836ffa02175d7599e4472403964b1b1069f4c33..6554a47afe7057f3b8c2c21147574c2f77d5ad09 100644
(file)
--- a/
liblttng-ust-libc-wrapper/lttng-ust-pthread.c
+++ b/
liblttng-ust-libc-wrapper/lttng-ust-pthread.c
@@
-23,6
+23,7
@@
* libc.
*/
#include <lttng/ust-dlfcn.h>
* libc.
*/
#include <lttng/ust-dlfcn.h>
+#include <urcu/tls-compat.h>
#include <helper.h>
#include <pthread.h>
#include <helper.h>
#include <pthread.h>
@@
-31,7
+32,7
@@
#define TP_IP_PARAM ip
#include "ust_pthread.h"
#define TP_IP_PARAM ip
#include "ust_pthread.h"
-static
__thread int thread_in_trace
;
+static
DEFINE_URCU_TLS_IE(int, thread_in_trace)
;
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
diff --git
a/liblttng-ust/lttng-context-procname.c
b/liblttng-ust/lttng-context-procname.c
index b6e69501d81c08bc79c5f82d9ff5b85d1d22230a..4b8da28f255aa56d74fe87c67f12cdd214680782 100644
(file)
--- a/
liblttng-ust/lttng-context-procname.c
+++ b/
liblttng-ust/lttng-context-procname.c
@@
-38,7
+38,7
@@
* thread.
*/
typedef char procname_array[17];
* thread.
*/
typedef char procname_array[17];
-static DEFINE_URCU_TLS(procname_array, cached_procname);
+static DEFINE_URCU_TLS
_IE
(procname_array, cached_procname);
static inline
char *wrapper_getprocname(void)
static inline
char *wrapper_getprocname(void)
diff --git
a/liblttng-ust/lttng-context-vtid.c
b/liblttng-ust/lttng-context-vtid.c
index f28e470a38c91be3e88c7b1d1fcd42c591d73c67..8c9bbec56e67324bdaeeca71893197a58b571f38 100644
(file)
--- a/
liblttng-ust/lttng-context-vtid.c
+++ b/
liblttng-ust/lttng-context-vtid.c
@@
-34,7
+34,7
@@
* We cache the result to ensure we don't trigger a system call for
* each event.
*/
* We cache the result to ensure we don't trigger a system call for
* each event.
*/
-static DEFINE_URCU_TLS(pid_t, cached_vtid);
+static DEFINE_URCU_TLS
_IE
(pid_t, cached_vtid);
/*
* Upon fork or clone, the TID assigned to our thread is not the same as
/*
* Upon fork or clone, the TID assigned to our thread is not the same as
diff --git
a/liblttng-ust/lttng-ust-comm.c
b/liblttng-ust/lttng-ust-comm.c
index 511b9cf4a88214c0225ff8a7e15a63cbca32145e..eec049b31fb2a09de4add833adac706e2e4168ce 100644
(file)
--- a/
liblttng-ust/lttng-ust-comm.c
+++ b/
liblttng-ust/lttng-ust-comm.c
@@
-86,7
+86,7
@@
static int initialized;
static pthread_mutex_t ust_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Allow nesting the ust_mutex within the same thread. */
static pthread_mutex_t ust_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Allow nesting the ust_mutex within the same thread. */
-static DEFINE_URCU_TLS(int, ust_mutex_nest);
+static DEFINE_URCU_TLS
_IE
(int, ust_mutex_nest);
/*
* ust_exit_mutex protects thread_active variable wrt thread exit. It
/*
* ust_exit_mutex protects thread_active variable wrt thread exit. It
diff --git
a/libringbuffer/ring_buffer_frontend.c
b/libringbuffer/ring_buffer_frontend.c
index 331639f1e86826b2c67d186dfa8d0907df70f0d8..396b0064b5b13dd59cc4488008c9df9e2f75c9fb 100644
(file)
--- a/
libringbuffer/ring_buffer_frontend.c
+++ b/
libringbuffer/ring_buffer_frontend.c
@@
-118,7
+118,7
@@
struct switch_offsets {
switch_old_end:1;
};
switch_old_end:1;
};
-DEFINE_URCU_TLS(unsigned int, lib_ring_buffer_nesting);
+DEFINE_URCU_TLS
_IE
(unsigned int, lib_ring_buffer_nesting);
/*
* wakeup_fd_mutex protects wakeup fd use by timer from concurrent
/*
* wakeup_fd_mutex protects wakeup fd use by timer from concurrent
diff --git
a/tests/test-app-ctx/hello.c
b/tests/test-app-ctx/hello.c
index 197df21e1ada8bbc1d9e1cdadfc992ae522abd0c..f2859a7a13612318650abc313cafddd7c3b25e06 100644
(file)
--- a/
tests/test-app-ctx/hello.c
+++ b/
tests/test-app-ctx/hello.c
@@
-26,6
+26,7
@@
#include <fcntl.h>
#include <signal.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <string.h>
+#include <urcu/tls-compat.h>
/*
* Work-around inet.h missing struct mmsghdr forward declaration, with
* triggers a warning when system files warnings are enabled.
/*
* Work-around inet.h missing struct mmsghdr forward declaration, with
* triggers a warning when system files warnings are enabled.
@@
-43,7
+44,7
@@
struct mmsghdr;
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
#include <lttng/ringbuffer-config.h>
#include <lttng/ust-context-provider.h>
-static
__thread unsigned int test_count
;
+static
DEFINE_URCU_TLS_IE(unsigned int, test_count)
;
void test_inc_count(void)
{
void test_inc_count(void)
{
This page took
0.037026 seconds
and
4
git commands to generate.