[lttng-ust] Remove dependency on urcu for probes

Yannick Brosseau greenscientist at fedoraproject.org
Wed Feb 27 15:41:36 UTC 2013


commit e42614d78ec1448ddf931c500d1e7d2cf603f153
Author: Yannick Brosseau <yannick.brosseau at gmail.com>
Date:   Wed Feb 27 10:41:20 2013 -0500

    Remove dependency on urcu for probes

 ...st-2.1.1-Use-tp-rcu-link-test-in-provider.patch |   28 ++++++++++++
 lttng-ust-2.1.1-remove-dep-urcu-bp.patch           |   46 ++++++++++++++++++++
 lttng-ust.spec                                     |   12 +++++-
 3 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/lttng-ust-2.1.1-Use-tp-rcu-link-test-in-provider.patch b/lttng-ust-2.1.1-Use-tp-rcu-link-test-in-provider.patch
new file mode 100644
index 0000000..158a7a0
--- /dev/null
+++ b/lttng-ust-2.1.1-Use-tp-rcu-link-test-in-provider.patch
@@ -0,0 +1,28 @@
+From 3ac4bd8ab309129f091ac180fb68e49cfc23dc8b Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+Date: Tue, 26 Feb 2013 15:25:18 -0500
+Subject: [PATCH 2/2] Use tp rcu link test in provider
+
+Ensure we never trigger a null pointer exception.
+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+---
+ include/lttng/ust-tracepoint-event.h |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h
+index b3fb2d4..e46cc1a 100644
+--- a/include/lttng/ust-tracepoint-event.h
++++ b/include/lttng/ust-tracepoint-event.h
+@@ -502,6 +502,8 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))	      \
+ 		return;							      \
+ 	if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled)))		      \
+ 		return;							      \
++	if (caa_unlikely(!TP_RCU_LINK_TEST()))				      \
++		return;							      \
+ 	if (caa_unlikely(!cds_list_empty(&__event->bytecode_runtime_head))) { \
+ 		struct lttng_bytecode_runtime *bc_runtime;		      \
+ 		int __filter_record = __event->has_enablers_without_bytecode; \
+-- 
+1.7.10.4
+
diff --git a/lttng-ust-2.1.1-remove-dep-urcu-bp.patch b/lttng-ust-2.1.1-remove-dep-urcu-bp.patch
new file mode 100644
index 0000000..b860b83
--- /dev/null
+++ b/lttng-ust-2.1.1-remove-dep-urcu-bp.patch
@@ -0,0 +1,46 @@
+From fd9619bcf98bae43e3418b6c61d2727d49d7d54b Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+Date: Tue, 26 Feb 2013 15:16:57 -0500
+Subject: [PATCH 1/2] Remove direct dependency of probes on urcu-bp
+
+The filter feature added a direct dependency of probes providers against
+urcu-bp .so, while linking them against liblttng-ust should suffice. Fix
+this by using the tracepoint.h wrapper for rcu_dereference().
+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+---
+ include/lttng/ust-tracepoint-event.h |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h
+index 8fea921..b3fb2d4 100644
+--- a/include/lttng/ust-tracepoint-event.h
++++ b/include/lttng/ust-tracepoint-event.h
+@@ -26,8 +26,15 @@
+ #include <lttng/ust-events.h>
+ #include <lttng/ringbuffer-config.h>
+ #include <lttng/ust-compiler.h>
++#include <lttng/tracepoint.h>
+ #include <string.h>
+ 
++#undef tp_list_for_each_entry_rcu
++#define tp_list_for_each_entry_rcu(pos, head, member)	\
++	for (pos = cds_list_entry(tp_rcu_dereference_bp((head)->next), __typeof__(*pos), member);	\
++	     &pos->member != (head);					\
++	     pos = cds_list_entry(tp_rcu_dereference_bp(pos->member.next), __typeof__(*pos), member))
++
+ /*
+  * TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
+  * same arguments and having the same field layout.
+@@ -501,7 +508,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))	      \
+ 									      \
+ 		__event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
+ 			_TP_ARGS_DATA_VAR(_args));			      \
+-		cds_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
++		tp_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
+ 			if (caa_unlikely(bc_runtime->filter(bc_runtime,	      \
+ 					__stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
+ 				__filter_record = 1;			      \
+-- 
+1.7.10.4
+
diff --git a/lttng-ust.spec b/lttng-ust.spec
index a7d13f6..ba66973 100644
--- a/lttng-ust.spec
+++ b/lttng-ust.spec
@@ -1,12 +1,17 @@
 Name:           lttng-ust
 Version:        2.1.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 License:        LGPLv2 and GPLv2 and MIT
 Group:          Development/Libraries
 Summary:        LTTng Userspace Tracer library
 URL:            http://lttng.org/ust/
 Source0:        http://lttng.org/files/lttng-ust/%{name}-%{version}.tar.bz2
 
+#Patch applied in upstream stable-2.1 branch (commit d9619bcf98bae)
+Patch0:         lttng-ust-2.1.1-Use-tp-rcu-link-test-in-provider.patch
+#Patch applied in upstream stable-2.1 branch (commit 3ac4bd8ab3091)
+Patch1:         lttng-ust-2.1.1-remove-dep-urcu-bp.patch
+
 BuildRequires:  libuuid-devel texinfo systemtap-sdt-devel libtool
 BuildRequires:  userspace-rcu-devel >= 0.6.6
 
@@ -26,6 +31,8 @@ LTTng userspace tracing
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 
 %build
 #Reinitialize libtool with the fedora version to remove Rpath
@@ -64,6 +71,9 @@ rm -vf %{buildroot}%{_libdir}/*.la
 %{_docdir}/%{name}/examples/*
 
 %changelog
+* Wed Feb 27 2013 Yannick Brosseau <yannick.brosseau at gmail.com> - 2.1.1-2
+- Remove dependency of probes on urcu-bp
+
 * Tue Feb 26 2013 Yannick Brosseau <yannick.brosseau at gmail.com> - 2.1.1-1
 - New upstream release
 


More information about the scm-commits mailing list