From: Mathieu Desnoyers Date: Thu, 1 Mar 2012 17:13:47 +0000 (-0500) Subject: Fix: fixup vtid TLS X-Git-Tag: v2.0.0-rc2~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4158a15a59fc6efbbbc99d66107fb4e1f27f9664;p=lttng-ust.git Fix: fixup vtid TLS Signed-off-by: Mathieu Desnoyers Conflicts: liblttng-ust/lttng-context-vtid.c --- diff --git a/liblttng-ust/ltt-tracer-core.h b/liblttng-ust/ltt-tracer-core.h index 7fdf3c9e..2ea4eadf 100644 --- a/liblttng-ust/ltt-tracer-core.h +++ b/liblttng-ust/ltt-tracer-core.h @@ -38,5 +38,6 @@ void ust_lock(void); void ust_unlock(void); void lttng_fixup_event_tls(void); +void lttng_fixup_vtid_tls(void); #endif /* _LTT_TRACER_CORE_H */ diff --git a/liblttng-ust/lttng-context-vtid.c b/liblttng-ust/lttng-context-vtid.c index 6f7e078d..22261f55 100644 --- a/liblttng-ust/lttng-context-vtid.c +++ b/liblttng-ust/lttng-context-vtid.c @@ -12,6 +12,7 @@ #include #include #include +#include "ltt-tracer-core.h" #ifdef __linux__ #include @@ -92,3 +93,11 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx) field->record = vtid_record; return 0; } + +/* + * Force a read (imply TLS fixup for dlopen) of TLS variables. + */ +void lttng_fixup_vtid_tls(void) +{ + asm volatile ("" : : "m" (cached_vtid)); +} diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index b90df861..e19fa949 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -840,6 +840,7 @@ void __attribute__((constructor)) lttng_ust_init(void) */ lttng_fixup_event_tls(); lttng_fixup_ringbuffer_tls(); + lttng_fixup_vtid_tls(); /* * We want precise control over the order in which we construct