Remove backward compatibility for liburcu-bp
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Feb 2021 20:48:59 +0000 (15:48 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 24 Feb 2021 15:23:18 +0000 (10:23 -0500)
Now that the soname is bumped, there is no backward compatibility to
keep for tracepoint call sites using liburcu-bp for synchronization,
so this compatibility code can be removed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I35d84fa1ffdb033c094b1a6989cc1c3bc29ce7f8

include/lttng/tracepoint.h
liblttng-ust/lttng-ust-comm.c
liblttng-ust/tracepoint.c

index 51eafdeb5a4cce36e957ede0d5af31557fb5d803..c4668eab025f6360aff6c5bcec135cca61f58235 100644 (file)
@@ -271,7 +271,6 @@ struct lttng_ust_tracepoint_dlopen *tracepoint_dlopen_ptr
  * control and check if the destructors should be executed.
  */
 struct lttng_ust_tracepoint_destructors_syms {
-       int *old_tracepoint_disable_destructors;
        void (*tracepoint_disable_destructors)(void);
        int (*tracepoint_get_destructors_state)(void);
 };
@@ -293,7 +292,6 @@ static inline void tracepoint_disable_destructors(void)
        if (tracepoint_dlopen_ptr->liblttngust_handle
                        && tracepoint_destructors_syms_ptr->tracepoint_disable_destructors)
                tracepoint_destructors_syms_ptr->tracepoint_disable_destructors();
-       *tracepoint_destructors_syms_ptr->old_tracepoint_disable_destructors = 1;
 }
 
 #ifndef _LGPL_SOURCE
@@ -384,19 +382,6 @@ __tracepoints__destroy(void)
                 */
                return;
        }
-       /*
-        * Lookup if destructors must be executed using the old method.
-        */
-       if (tracepoint_destructors_syms_ptr->old_tracepoint_disable_destructors
-               && *tracepoint_destructors_syms_ptr->old_tracepoint_disable_destructors) {
-               /*
-                * The old_tracepoint_disable_destructors symbol was found with
-                * dlsym but its value is 1 meaning that destructors must not
-                * be executed.
-                */
-               return;
-       }
-
        ret = dlclose(tracepoint_dlopen_ptr->liblttngust_handle);
        if (ret) {
                fprintf(stderr, "Error (%d) in dlclose\n", ret);
@@ -479,15 +464,11 @@ __tracepoints__ptrs_init(void)
        tracepoint_dlopen_ptr->tracepoint_register_lib =
                URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *, int),
                                dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "tracepoint_register_lib2"));
+                                       "tracepoint_register_lib"));
        tracepoint_dlopen_ptr->tracepoint_unregister_lib =
                URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *),
                                dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "tracepoint_unregister_lib2"));
-       tracepoint_destructors_syms_ptr->old_tracepoint_disable_destructors =
-               URCU_FORCE_CAST(int *,
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "__tracepoints__disable_destructors"));
+                                       "tracepoint_unregister_lib"));
        tracepoint_destructors_syms_ptr->tracepoint_disable_destructors =
                URCU_FORCE_CAST(void (*)(void),
                                dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
index 8d90e2c367dafae1a88b8f077208a8fb0596e82d..81dfbc9a16d1258148c14e6d736d8204ab081ad4 100644 (file)
@@ -430,17 +430,17 @@ void lttng_fixup_ust_mutex_nest_tls(void)
 }
 
 /*
- * Fixup urcu bp TLS.
+ * Fixup lttng-ust urcu TLS.
  */
 static
-void lttng_fixup_urcu_bp_tls(void)
+void lttng_fixup_lttng_ust_urcu_tls(void)
 {
        (void) lttng_ust_urcu_read_ongoing();
 }
 
 void lttng_ust_fixup_tls(void)
 {
-       lttng_fixup_urcu_bp_tls();
+       lttng_fixup_lttng_ust_urcu_tls();
        lttng_fixup_ringbuffer_tls();
        lttng_fixup_vtid_tls();
        lttng_fixup_nest_count_tls();
@@ -2402,8 +2402,6 @@ void ust_before_fork(sigset_t *save_sigset)
 
        ust_lock_nocheck();
        lttng_ust_urcu_before_fork();
-       if (lttng_ust_liburcu_bp_before_fork)
-               lttng_ust_liburcu_bp_before_fork();
        lttng_ust_lock_fd_tracker();
        lttng_perf_lock();
 }
@@ -2432,8 +2430,6 @@ void ust_after_fork_parent(sigset_t *restore_sigset)
                return;
        DBG("process %d", getpid());
        lttng_ust_urcu_after_fork_parent();
-       if (lttng_ust_liburcu_bp_after_fork_parent)
-               lttng_ust_liburcu_bp_after_fork_parent();
        /* Release mutexes and reenable signals */
        ust_after_fork_common(restore_sigset);
 }
@@ -2460,8 +2456,6 @@ void ust_after_fork_child(sigset_t *restore_sigset)
        DBG("process %d", getpid());
        /* Release urcu mutexes */
        lttng_ust_urcu_after_fork_child();
-       if (lttng_ust_liburcu_bp_after_fork_child)
-               lttng_ust_liburcu_bp_after_fork_child();
        lttng_ust_cleanup(0);
        /* Release mutexes and reenable signals */
        ust_after_fork_common(restore_sigset);
index ce7dbbb283947f608978d4948c2df62656f1275a..b556af89b3364d49ea4e0fb566fed3f1132f51d5 100644 (file)
@@ -60,15 +60,6 @@ static int initialized;
  */
 static int tracepoint_destructors_state = 1;
 
-/*
- * Expose the now deprecated symbol __tracepoints__disable_destructors for
- * backward compatibility of applications built against old versions of
- * lttng-ust. We need to keep __tracepoints__disable_destructors up to date
- * within the new destructor disabling API because old applications read this
- * symbol directly.
- */
-int __tracepoints__disable_destructors __attribute__((weak));
-
 static void (*new_tracepoint_cb)(struct lttng_ust_tracepoint *);
 
 /*
@@ -151,86 +142,6 @@ struct callsite_entry {
        bool tp_entry_callsite_ref; /* Has a tp_entry took a ref on this callsite */
 };
 
-static int tracepoint_v1_api_used;
-static void (*lttng_ust_liburcu_bp_synchronize_rcu)(void);
-static void (*lttng_ust_liburcu_bp_rcu_read_lock)(void);
-static void (*lttng_ust_liburcu_bp_rcu_read_unlock)(void);
-void (*lttng_ust_liburcu_bp_before_fork)(void);
-void (*lttng_ust_liburcu_bp_after_fork_parent)(void);
-void (*lttng_ust_liburcu_bp_after_fork_child)(void);
-
-static bool lttng_ust_tracepoint_v1_used(void)
-{
-       return uatomic_read(&tracepoint_v1_api_used);
-}
-
-static void lttng_ust_tracepoint_set_v1_used(void)
-{
-       if (!lttng_ust_tracepoint_v1_used()) {
-               /*
-                * Perform dlsym here rather than lazily on first use to
-                * eliminate nesting of dynamic loader lock (used within
-                * dlsym) inside the ust lock.
-                */
-               if (!lttng_ust_liburcu_bp_synchronize_rcu) {
-                       lttng_ust_liburcu_bp_synchronize_rcu = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "synchronize_rcu_bp"));
-                       /*
-                        * Allow legacy applications compiled without
-                        * _LGPL_SOURCE to use v1 API. Those are not
-                        * required to be linked against liburcu-bp,
-                        * so in those situations the liburcu-bp symbols
-                        * are not present in the global symbol table,
-                        * and we do not need to call urcu-bp
-                        * synchronize.
-                        *
-                        * However, nothing prevents a _LGPL_SOURCE
-                        * instrumented library loaded afterwards to
-                        * require liburcu-bp, so we need to check again
-                        * in that situation.
-                        */
-                       if (!lttng_ust_liburcu_bp_synchronize_rcu)
-                               return;
-               }
-               if (!lttng_ust_liburcu_bp_before_fork) {
-                       lttng_ust_liburcu_bp_before_fork = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "rcu_bp_before_fork"));
-                       if (!lttng_ust_liburcu_bp_before_fork)
-                               abort();
-               }
-               if (!lttng_ust_liburcu_bp_after_fork_parent) {
-                       lttng_ust_liburcu_bp_after_fork_parent = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "rcu_bp_after_fork_parent"));
-                       if (!lttng_ust_liburcu_bp_after_fork_parent)
-                               abort();
-               }
-               if (!lttng_ust_liburcu_bp_after_fork_child) {
-                       lttng_ust_liburcu_bp_after_fork_child = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "rcu_bp_after_fork_child"));
-                       if (!lttng_ust_liburcu_bp_after_fork_child)
-                               abort();
-               }
-               if (!lttng_ust_liburcu_bp_rcu_read_lock) {
-                       lttng_ust_liburcu_bp_rcu_read_lock = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "rcu_read_lock_bp"));
-                       if (!lttng_ust_liburcu_bp_rcu_read_lock)
-                               abort();
-               }
-               if (!lttng_ust_liburcu_bp_rcu_read_unlock) {
-                       lttng_ust_liburcu_bp_rcu_read_unlock = URCU_FORCE_CAST(void (*)(void),
-                               dlsym(RTLD_DEFAULT, "rcu_read_unlock_bp"));
-                       if (!lttng_ust_liburcu_bp_rcu_read_unlock)
-                               abort();
-               }
-
-               /* Fixup URCU bp TLS. */
-               lttng_ust_liburcu_bp_rcu_read_lock();
-               lttng_ust_liburcu_bp_rcu_read_unlock();
-
-               uatomic_set(&tracepoint_v1_api_used, 1);
-       }
-}
-
 /* coverity[+alloc] */
 static void *allocate_probes(int count)
 {
@@ -960,7 +871,7 @@ static void new_tracepoints(struct lttng_ust_tracepoint * const *start,
  * against recent liblttng-ust headers require a recent liblttng-ust
  * runtime for those tracepoints to be taken into account.
  */
-int tracepoint_register_lib2(struct lttng_ust_tracepoint * const *tracepoints_start,
+int tracepoint_register_lib(struct lttng_ust_tracepoint * const *tracepoints_start,
                             int tracepoints_count)
 {
        struct tracepoint_lib *pl, *iter;
@@ -1009,15 +920,7 @@ lib_added:
        return 0;
 }
 
-/* Exposed for backward compatibility with old instrumented applications. */
-int tracepoint_register_lib(struct lttng_ust_tracepoint * const *tracepoints_start,
-                            int tracepoints_count)
-{
-       lttng_ust_tracepoint_set_v1_used();
-       return tracepoint_register_lib2(tracepoints_start, tracepoints_count);
-}
-
-int tracepoint_unregister_lib2(struct lttng_ust_tracepoint * const *tracepoints_start)
+int tracepoint_unregister_lib(struct lttng_ust_tracepoint * const *tracepoints_start)
 {
        struct tracepoint_lib *lib;
 
@@ -1043,13 +946,6 @@ int tracepoint_unregister_lib2(struct lttng_ust_tracepoint * const *tracepoints_
        return 0;
 }
 
-/* Exposed for backward compatibility with old instrumented applications. */
-int tracepoint_unregister_lib(struct lttng_ust_tracepoint * const *tracepoints_start)
-{
-       lttng_ust_tracepoint_set_v1_used();
-       return tracepoint_unregister_lib2(tracepoints_start);
-}
-
 /*
  * Report in debug message whether the compiler correctly supports weak
  * hidden symbols. This test checks that the address associated with two
@@ -1135,28 +1031,4 @@ int tp_get_destructors_state(void)
 void lttng_ust_synchronize_trace(void)
 {
        lttng_ust_urcu_synchronize_rcu();
-       /*
-        * For legacy tracepoint instrumentation, also wait for urcu-bp
-        * grace period.
-        */
-       if (lttng_ust_liburcu_bp_synchronize_rcu)
-               lttng_ust_liburcu_bp_synchronize_rcu();
-}
-
-/*
- * Create the wrapper symbols for legacy v1 API.
- */
-void tp_rcu_read_lock_bp(void)
-{
-       lttng_ust_urcu_read_lock();
-}
-
-void tp_rcu_read_unlock_bp(void)
-{
-       lttng_ust_urcu_read_unlock();
-}
-
-void *tp_rcu_dereference_sym_bp(void *p)
-{
-       return lttng_ust_rcu_dereference(p);
 }
This page took 0.029575 seconds and 4 git commands to generate.