Provide fixes on top on LTTng 2.4

To make base address state tracing to work better or appliations that
fork without exec (e.g. daemons, web servers, ...) the following patch
is applied to lttng-ust:
lttng-ust/0001-Fix-Make-deadlocks-with-baddr-statedump-unlikely.patch

To work around an ARM specific compiler bug that causes babeltrace to
miscompile with optimizations the following patch is used:
babeltrace/do-not-optimize-parser.patch

To workaround a crosscompiling issue with babeltrace 1.2 the following
patch is used:
babeltrace/lttng-live-missing-header.patch

To enable building of lttng-modules for ARM the following modifications
are required to the recipe in poky:
packagegroup-core-tools-profile.bbappend
lttng-modules_2.4.0.bbappend

To enable compiling liburcu without --disable-compiler-tls on ARM the
following recipe is added:
liburcu_0.8.4.bb
This commit is contained in:
Paul Woegerer
2014-03-19 09:03:16 +01:00
parent edc3532d6a
commit 1188f6fd03
13 changed files with 256 additions and 82 deletions
@@ -0,0 +1 @@
LTTNGMODULES_arm = "lttng-modules"
@@ -0,0 +1,10 @@
diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y
index 68fde93..9403f64 100644
--- a/formats/ctf/metadata/ctf-parser.y
+++ b/formats/ctf/metadata/ctf-parser.y
@@ -1,4 +1,5 @@
%{
+#pragma GCC optimize ("O0")
/*
* ctf-parser.y
*
@@ -0,0 +1,10 @@
diff --git a/formats/lttng-live/Makefile.am b/formats/lttng-live/Makefile.am
index c834699..0142e1f 100644
--- a/formats/lttng-live/Makefile.am
+++ b/formats/lttng-live/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir) -I$(top_builddir)/include
lib_LTLIBRARIES = libbabeltrace-lttng-live.la
@@ -1 +0,0 @@
CFLAGS_append_arm = " -g -O0"
@@ -0,0 +1,25 @@
SUMMARY = "Babeltrace - Trace Format Babel Tower"
DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log."
HOMEPAGE = "http://www.efficios.com/babeltrace/"
BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace"
LICENSE = "MIT & GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa"
inherit autotools
DEPENDS = "glib-2.0 util-linux popt"
SRCREV = "7efc443724d404bc06df5d484be36f7b7d2bcf60"
PV = "1.2.1+git${SRCPV}"
SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.2 \
file://lttng-live-missing-header.patch"
SRC_URI_append_arm = " file://do-not-optimize-parser.patch"
S = "${WORKDIR}/git"
do_configure_prepend () {
( cd ${S}; ${S}/bootstrap )
}
@@ -1,43 +0,0 @@
From 26cb9d81e0dff472f3da338ab8b2de1cd77676a7 Mon Sep 17 00:00:00 2001
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Sun, 24 Nov 2013 03:31:44 -0500
Subject: [PATCH] Blacklist ARM gcc 4.8.0, 4.8.1, 4.8.2
It produces clobbered frame accesses, which can lead to stack corruption
when racing with signal handlers nested on stack.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
urcu/compiler.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/urcu/compiler.h b/urcu/compiler.h
index 19534f0..1e30903 100644
--- a/urcu/compiler.h
+++ b/urcu/compiler.h
@@ -108,4 +108,23 @@
#define CAA_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+/*
+ * Don't allow compiling with buggy compiler.
+ */
+
+#ifdef __GNUC__
+# define URCU_GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+
+/*
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
+ */
+# ifdef __ARMEL__
+# if URCU_GCC_VERSION >= 40800 && URCU_GCC_VERSION <= 40802
+# error Your gcc version produces clobbered frame accesses
+# endif
+# endif
+#endif
+
#endif /* _URCU_COMPILER_H */
--
1.8.3.4
@@ -1,6 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append_arm = "\
file://blacklist-arm-gcc-4.8.0-4.8.1-4.8.2.patch \
file://whitelist-sourcery-codebench-2013.11-32.patch \
"
EXTRA_OECONF_append_arm = " --disable-compiler-tls"
@@ -0,0 +1,18 @@
DESCRIPTION = "Userspace RCU Implementation by Mathieu Desnoyers and Paul E. McKenney"
HOMEPAGE = "http://lttng.org/urcu"
BUGTRACKER = "http://lttng.org/project/issues"
LICENSE = "LGPLv2.1+ & MIT-style"
LIC_FILES_CHKSUM = "file://LICENSE;md5=0f060c30a27922ce9c0d557a639b4fa3 \
file://urcu.h;beginline=4;endline=32;md5=4de0d68d3a997643715036d2209ae1d9 \
file://urcu/uatomic/x86.h;beginline=4;endline=21;md5=220552f72c55b102f2ee35929734ef42"
SRC_URI = "http://lttng.org/files/urcu/userspace-rcu-${PV}.tar.bz2"
SRC_URI[md5sum] = "2ca6671b20a550aa0e8020a1a9a96fd4"
SRC_URI[sha256sum] = "96c0a157e94a15b1506efe9aedd98145e6eb41a3fbcf5b0d118b7a783b22fe12"
SRC_URI_append_arm = " file://whitelist-sourcery-codebench-2013.11-32.patch"
S = "${WORKDIR}/userspace-rcu-${PV}"
CFLAGS_append_libc-uclibc = " -D_GNU_SOURCE"
inherit autotools
@@ -1,2 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append_arm = " file://whitelist-sourcery-codebench-2013.11-32.patch"
COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|mips).*-linux'
@@ -1,30 +0,0 @@
diff --git a/src/common/consumer.c b/src/common/consumer.c
index ede214c..b10988b 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -1,3 +1,5 @@
+#pragma GCC optimize ("O1")
+
/*
* Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
* Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c
index d15329f..78c7725 100644
--- a/src/common/kernel-consumer/kernel-consumer.c
+++ b/src/common/kernel-consumer/kernel-consumer.c
@@ -1,3 +1,5 @@
+#pragma GCC optimize ("O1")
+
/*
* Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
* Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index 0955e66..0f8f75a 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -1,3 +1,5 @@
+#pragma GCC optimize ("O1")
+
/*
* Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
* Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
@@ -1,2 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append_arm = " file://compile-consumers-with-o1.patch"
@@ -0,0 +1,189 @@
From 18863aebd7707c79388d7830536f4de1a978dc9c Mon Sep 17 00:00:00 2001
From: Paul Woegerer <paul_woegerer@mentor.com>
Date: Mon, 17 Mar 2014 09:43:35 +0100
Subject: [PATCH lttng-ust] Fix: Make deadlocks with baddr statedump unlikely
To: lttng-dev@lists.lttng.org,
mathieu.desnoyers@efficios.com
Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
---
liblttng-ust/lttng-ust-baddr.c | 95 ++++++++++++++++++++++++++++++++----------
1 file changed, 74 insertions(+), 21 deletions(-)
diff --git a/liblttng-ust/lttng-ust-baddr.c b/liblttng-ust/lttng-ust-baddr.c
index dec7e82..0e8ff24 100644
--- a/liblttng-ust/lttng-ust-baddr.c
+++ b/liblttng-ust/lttng-ust-baddr.c
@@ -39,17 +39,50 @@
#define TP_SESSION_CHECK
#include "ust_baddr_statedump.h"
+struct baddr_entry {
+ void *base_addr_ptr;
+ char resolved_path[PATH_MAX];
+ int vdso;
+};
+
struct extract_data {
- void *owner;
void *exec_baddr; /* executable base address */
+ struct baddr_entry *baddrs; /* other base addresses */
+ size_t num_baddrs; /* number of other base addresses */
+ size_t idx_baddrs; /* current base addresse index */
};
+static
+int add_baddr(void *base_addr_ptr,
+ const char *resolved_path,
+ int vdso,
+ struct extract_data *data)
+{
+ struct baddr_entry *baddr;
+
+ if (data->num_baddrs < data->idx_baddrs + 1) {
+ data->num_baddrs *= 2;
+ data->baddrs = realloc(data->baddrs,
+ data->num_baddrs * sizeof(struct baddr_entry));
+ if (!data->baddrs)
+ return 1;
+ }
+
+ baddr = data->baddrs + data->idx_baddrs;
+ baddr->base_addr_ptr = base_addr_ptr;
+ strncpy(baddr->resolved_path, resolved_path, PATH_MAX - 1);
+ baddr->vdso = vdso;
+
+ data->idx_baddrs += 1;
+ return 0;
+}
+
/*
* Trace baddr into all sessions for which statedump is pending owned by
* the caller thread.
*/
static
-int trace_baddr(void *base_addr_ptr,
+void trace_baddr(void *base_addr_ptr,
const char *resolved_path,
int vdso,
void *owner)
@@ -62,16 +95,6 @@ int trace_baddr(void *base_addr_ptr,
sostat.st_size = 0;
sostat.st_mtime = -1;
}
- /*
- * UST lock nests within dynamic loader lock.
- */
- if (ust_lock()) {
- /*
- * Stop iteration on headers if need to exit.
- */
- ust_unlock();
- return 1;
- }
sessionsp = _lttng_get_sessions();
cds_list_for_each_entry(session, sessionsp, node) {
@@ -84,8 +107,6 @@ int trace_baddr(void *base_addr_ptr,
resolved_path, sostat.st_size,
sostat.st_mtime);
}
- ust_unlock();
- return 0;
}
static
@@ -93,7 +114,6 @@ int extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *_data)
{
int j;
struct extract_data *data = _data;
- void *owner = data->owner;
for (j = 0; j < info->dlpi_phnum; j++) {
char resolved_path[PATH_MAX];
@@ -138,9 +158,8 @@ int extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *_data)
vdso = 1;
}
}
- if (trace_baddr(base_addr_ptr, resolved_path, vdso, owner)) {
+ if (add_baddr(base_addr_ptr, resolved_path, vdso, data))
return 1;
- }
/*
* We are only interested in the base address (lowest virtual
* address associated with the memory image), skip the rest
@@ -151,9 +170,8 @@ int extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *_data)
}
static
-void dump_exec_baddr(struct extract_data *data)
+void dump_exec_baddr(struct extract_data *data, void *owner)
{
- void *owner = data->owner;
void *base_addr_ptr;
char exe_path[PATH_MAX];
ssize_t exe_len;
@@ -172,6 +190,38 @@ void dump_exec_baddr(struct extract_data *data)
trace_baddr(base_addr_ptr, exe_path, 0, owner);
}
+static
+void dump_baddrs(struct extract_data *data, void *owner)
+{
+ /* Emit tracepoints for shared objects */
+ struct baddr_entry *baddrs = data->baddrs;
+ size_t idx_baddrs = data->idx_baddrs;
+ size_t i = 0;
+
+ /*
+ * UST lock nests within dynamic loader lock.
+ */
+ if (ust_lock()) {
+ /*
+ * Stop if need to exit.
+ */
+ ust_unlock();
+ return;
+ }
+
+ while (i < idx_baddrs) {
+ struct baddr_entry *baddr = baddrs + i;
+ trace_baddr(baddr->base_addr_ptr,
+ baddr->resolved_path,
+ baddr->vdso, owner);
+ i += 1;
+ }
+ /* Emit tracepoint for executable */
+ dump_exec_baddr(data, owner);
+
+ ust_unlock();
+}
+
int lttng_ust_baddr_statedump(void *owner)
{
struct extract_data data;
@@ -179,8 +229,10 @@ int lttng_ust_baddr_statedump(void *owner)
if (!getenv("LTTNG_UST_WITH_EXPERIMENTAL_BADDR_STATEDUMP"))
return 0;
- data.owner = owner;
data.exec_baddr = NULL;
+ data.num_baddrs = 32;
+ data.baddrs = malloc(data.num_baddrs * sizeof(struct baddr_entry));
+ data.idx_baddrs = 0;
/*
* Iterate through the list of currently loaded shared objects and
* generate events for loadable segments using
@@ -193,7 +245,8 @@ int lttng_ust_baddr_statedump(void *owner)
* deadlocks, so dump the executable outside of the phdr
* iteration.
*/
- dump_exec_baddr(&data);
+ dump_baddrs(&data, owner);
+ free(data.baddrs);
return 0;
}
--
1.9.0
@@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append = " file://0001-Fix-Make-deadlocks-with-baddr-statedump-unlikely.patch"