fix build error

This commit is contained in:
zhouwenpei 2021-12-20 17:04:50 +08:00
parent 565109ed14
commit ac440606c5
2 changed files with 162 additions and 2 deletions

View File

@ -0,0 +1,156 @@
From d6ddec3f8a747381dfb2af999731b83379713960 Mon Sep 17 00:00:00 2001
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Wed, 28 Nov 2018 16:56:59 -0500
Subject: [PATCH] Adapt lttng-ust to use multiflavor symbols from liburcu 0.11
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
configure.ac | 6 +++---
include/lttng/tracepoint-rcu.h | 6 +++---
liblttng-ust/lttng-ust-comm.c | 5 +++--
liblttng-ust/tracepoint-internal.h | 2 +-
liblttng-ust/tracepoint.c | 14 +++++++-------
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index f90c5ba..c2280dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -246,10 +246,10 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
])
# 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.])])
+AC_CHECK_LIB([urcu-bp], [urcu_bp_synchronize_rcu], [], [AC_MSG_ERROR([Cannot find liburcu-bp 0.11 or newer. Use [LDFLAGS]=-Ldir to specify its location.])])
-# urcu - check that URCU lib is at least version 0.6
-AC_CHECK_LIB([urcu-bp], [call_rcu_bp], [], [AC_MSG_ERROR([liburcu 0.6 or newer is needed, please update your version or use [LDFLAGS]=-Ldir to specify the right location.])])
+# urcu - check that URCU lib is at least version 0.11
+AC_CHECK_LIB([urcu-bp], [urcu_bp_call_rcu], [], [AC_MSG_ERROR([liburcu 0.11 or newer is needed, please update your version or use [LDFLAGS]=-Ldir to specify the right location.])])
# optional linux/perf_event.h
AC_CHECK_HEADERS([linux/perf_event.h], [have_perf_event=yes], [])
diff --git a/include/lttng/tracepoint-rcu.h b/include/lttng/tracepoint-rcu.h
index 0e08485..95d6049 100644
--- a/include/lttng/tracepoint-rcu.h
+++ b/include/lttng/tracepoint-rcu.h
@@ -27,10 +27,10 @@
#ifdef _LGPL_SOURCE
-#include <urcu-bp.h>
+#include <urcu/urcu-bp.h>
-#define tp_rcu_read_lock_bp rcu_read_lock_bp
-#define tp_rcu_read_unlock_bp rcu_read_unlock_bp
+#define tp_rcu_read_lock_bp urcu_bp_read_lock
+#define tp_rcu_read_unlock_bp urcu_bp_read_unlock
#define tp_rcu_dereference_bp rcu_dereference
#define TP_RCU_LINK_TEST() 1
diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
index 511b9cf..b8b3314 100644
--- a/liblttng-ust/lttng-ust-comm.c
+++ b/liblttng-ust/lttng-ust-comm.c
@@ -1908,6 +1908,7 @@ void ust_before_fork(sigset_t *save_sigset)
ust_lock_nocheck();
rcu_bp_before_fork();
+ urcu_bp_before_fork();
}
static void ust_after_fork_common(sigset_t *restore_sigset)
@@ -1931,7 +1932,7 @@ void ust_after_fork_parent(sigset_t *restore_sigset)
if (URCU_TLS(lttng_ust_nest_count))
return;
DBG("process %d", getpid());
- rcu_bp_after_fork_parent();
+ urcu_bp_after_fork_parent();
/* Release mutexes and reenable signals */
ust_after_fork_common(restore_sigset);
}
@@ -1952,7 +1953,7 @@ void ust_after_fork_child(sigset_t *restore_sigset)
lttng_context_vtid_reset();
DBG("process %d", getpid());
/* Release urcu mutexes */
- rcu_bp_after_fork_child();
+ urcu_bp_after_fork_child();
lttng_ust_cleanup(0);
/* Release mutexes and reenable signals */
ust_after_fork_common(restore_sigset);
diff --git a/liblttng-ust/tracepoint-internal.h b/liblttng-ust/tracepoint-internal.h
index 298f78e..1e6f92b 100644
--- a/liblttng-ust/tracepoint-internal.h
+++ b/liblttng-ust/tracepoint-internal.h
@@ -50,7 +50,7 @@ extern void __tracepoint_probe_prune_release_queue(void);
*/
static inline void tracepoint_synchronize_unregister(void)
{
- synchronize_rcu_bp();
+ urcu_bp_synchronize_rcu();
}
extern void init_tracepoint(void);
diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c
index 14b8231..1c27e40 100644
--- a/liblttng-ust/tracepoint.c
+++ b/liblttng-ust/tracepoint.c
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <urcu/arch.h>
-#include <urcu-bp.h>
+#include <urcu/urcu-bp.h>
#include <urcu/hlist.h>
#include <urcu/uatomic.h>
#include <urcu/compiler.h>
@@ -149,7 +149,7 @@ static void release_probes(void *old)
if (old) {
struct tp_probes *tp_probes = caa_container_of(old,
struct tp_probes, probes[0]);
- synchronize_rcu();
+ urcu_bp_synchronize_rcu();
free(tp_probes);
}
}
@@ -709,7 +709,7 @@ void __tracepoint_probe_prune_release_queue(void)
release_queue_need_update = 0;
/* Wait for grace period between all sync_callsites and free. */
- synchronize_rcu();
+ urcu_bp_synchronize_rcu();
cds_list_for_each_entry_safe(pos, next, &release_probes, u.list) {
cds_list_del(&pos->u.list);
@@ -800,7 +800,7 @@ void tracepoint_probe_update_all(void)
tracepoint_update_probes();
/* Wait for grace period between update_probes and free. */
- synchronize_rcu();
+ urcu_bp_synchronize_rcu();
cds_list_for_each_entry_safe(pos, next, &release_probes, u.list) {
cds_list_del(&pos->u.list);
free(pos);
@@ -946,15 +946,15 @@ void exit_tracepoint(void)
void tp_rcu_read_lock_bp(void)
{
- rcu_read_lock_bp();
+ urcu_bp_read_lock();
}
void tp_rcu_read_unlock_bp(void)
{
- rcu_read_unlock_bp();
+ urcu_bp_read_unlock();
}
void *tp_rcu_dereference_sym_bp(void *p)
{
- return rcu_dereference_bp(p);
+ return urcu_bp_dereference(p);
}
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: lttng-ust Name: lttng-ust
Version: 2.10.1 Version: 2.10.1
Release: 10 Release: 11
Summary: LTTng Userspace Tracer library Summary: LTTng Userspace Tracer library
License: LGPLv2 and GPLv2 and MIT License: LGPLv2 and GPLv2 and MIT
URL: https://lttng.org URL: https://lttng.org
@ -8,7 +8,8 @@ URL: https://lttng.org
Source0: https://lttng.org/files/lttng-ust/%{name}-%{version}.tar.bz2 Source0: https://lttng.org/files/lttng-ust/%{name}-%{version}.tar.bz2
Patch0: Fix-namespace-our-gettid-wrapper.patch Patch0: Fix-namespace-our-gettid-wrapper.patch
Patch1: lttng-gen-tp-shebang.patch Patch1: lttng-gen-tp-shebang.patch
patch2: fix-build-with-fno-common.patch Patch2: fix-build-with-fno-common.patch
Patch3: 0001-Adapt-lttng-ust-to-use-multiflavor-symbols-form-liburcu-0.11.patch
BuildRequires: libuuid-devel autoconf automake libtool BuildRequires: libuuid-devel autoconf automake libtool
BuildRequires: userspace-rcu-devel >= 0.8.0 BuildRequires: userspace-rcu-devel >= 0.8.0
@ -61,6 +62,9 @@ make check
%{_docdir}/%{name}/* %{_docdir}/%{name}/*
%changelog %changelog
* Mon Dec 20 2021 zhouwenpei <zhouwenpei1@huawei.com> - 2.10.1-11
- fix build error
* Fri Jul 30 2021 zhouwenpei <zhouwenpei1@huawei.com> - 2.10.1-10 * Fri Jul 30 2021 zhouwenpei <zhouwenpei1@huawei.com> - 2.10.1-10
- fix build with -fno-common - fix build with -fno-common