From: Mathieu Desnoyers Date: Thu, 1 Mar 2012 17:13:47 +0000 (-0500) Subject: Fix: fixup vtid TLS X-Git-Tag: v2.1.0-rc1~97^2~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=daeb93bb244bf406d9e8bd620247b64f9144127a;p=lttng-ust.git Fix: fixup vtid TLS Signed-off-by: Mathieu Desnoyers --- 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 3fe86405..c419d18b 100644 --- a/liblttng-ust/lttng-context-vtid.c +++ b/liblttng-ust/lttng-context-vtid.c @@ -13,6 +13,7 @@ #include #include #include +#include "ltt-tracer-core.h" /* * We cache the result to ensure we don't trigger a system call for @@ -74,3 +75,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 2f2c783b..1815801a 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -835,6 +835,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