Sean Heelan | 11 Feb 15:01 2016
Picon

Crash on first run of target using liblttng-ust-cyg-profile.so, but subsequent runs succeed

Hi all,

I am running a target within a Docker instance, and tracing function execution using the latest LTTng release (2.7). The commands I am issuing look as follows:

----
lttng create cc_session -o bla
lttng enable-event --userspace lttng_ust_cyg_profile:func_entry
lttng start

LD_PRELOAD=liblttng-ust-cyg-profile.so target

lttng stop
lttng destroy
----

When the target is executed it aborts with the following error:

----
php: lttng-ust-comm.c:1582: lttng_ust_init: Assertion `!ret' failed.
----

If I rerun the command it then works fine. In fact, simply doing the following within the Docker container demonstrates the issue:

----
LD_PRELOAD=liblttng-ust-cyg-profile.so ls
LD_PRELOAD=liblttng-ust-cyg-profile.so ls
----

The first 'ls' will fail at the same point mentioned above, while the second will succeed. Off the top of my head I'm struggling to come up with an explanation as to what impact the first execution using LD_PRELOAD would have on the second. Does it impact a shared lib cache in some way, which I'm unaware of?

Any assistance would be appreciated!

Sean


_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Michael Jeanson | 10 Feb 17:08 2016
Gravatar

[PATCH lttng-modules] Fix: Define lttng-tracer metadata only once

Fixes sysfs trying to create the lttng-tracer module version node
multiple times.

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 Makefile                        | 8 ++++----
 lttng-context-cpu-id.c          | 8 --------
 lttng-context-hostname.c        | 8 --------
 lttng-context-interruptible.c   | 8 --------
 lttng-context-migratable.c      | 8 --------
 lttng-context-need-reschedule.c | 8 --------
 lttng-context-nice.c            | 8 --------
 lttng-context-perf-counters.c   | 8 --------
 lttng-context-pid.c             | 8 --------
 lttng-context-ppid.c            | 8 --------
 lttng-context-preemptible.c     | 8 --------
 lttng-context-prio.c            | 8 --------
 lttng-context-procname.c        | 8 --------
 lttng-context-tid.c             | 8 --------
 lttng-context-vpid.c            | 8 --------
 lttng-context-vppid.c           | 8 --------
 lttng-context-vtid.c            | 8 --------
 17 files changed, 4 insertions(+), 132 deletions(-)

diff --git a/Makefile b/Makefile
index 5d6be94..05e4449 100644
--- a/Makefile
+++ b/Makefile
 <at>  <at>  -55,10 +55,6  <at>  <at>  ifneq ($(KERNELRELEASE),)
                          lttng-filter-validator.o \
                          probes/lttng-probe-user.o

-    obj-$(CONFIG_LTTNG) += lttng-statedump.o
-    lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \
-                            wrapper/fdtable.o
-
     ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),)
       lttng-tracer-objs += lttng-syscalls.o
     endif # CONFIG_HAVE_SYSCALL_TRACEPOINTS
 <at>  <at>  -84,6 +80,10  <at>  <at>  ifneq ($(KERNELRELEASE),)
         -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 15 -a $(SUBLEVEL) -ge 0 \) ] ; then \
         echo "lttng-tracepoint.o" ; fi;)

+    obj-$(CONFIG_LTTNG) += lttng-statedump.o
+    lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \
+                            wrapper/fdtable.o
+
     obj-$(CONFIG_LTTNG) += probes/
     obj-$(CONFIG_LTTNG) += lib/

diff --git a/lttng-context-cpu-id.c b/lttng-context-cpu-id.c
index ed2a2a9..94126af 100644
--- a/lttng-context-cpu-id.c
+++ b/lttng-context-cpu-id.c
 <at>  <at>  -85,11 +85,3  <at>  <at>  int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_cpu_id_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit CPU id Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-hostname.c b/lttng-context-hostname.c
index 7d9f081..cd414c0 100644
--- a/lttng-context-hostname.c
+++ b/lttng-context-hostname.c
 <at>  <at>  -118,11 +118,3  <at>  <at>  int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_hostname_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Perf Support");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-interruptible.c b/lttng-context-interruptible.c
index b608a6e..295b10d 100644
--- a/lttng-context-interruptible.c
+++ b/lttng-context-interruptible.c
 <at>  <at>  -92,11 +92,3  <at>  <at>  int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_interruptible_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit interruptible Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-migratable.c b/lttng-context-migratable.c
index 1aaedf6..ef0c4ed 100644
--- a/lttng-context-migratable.c
+++ b/lttng-context-migratable.c
 <at>  <at>  -85,11 +85,3  <at>  <at>  int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_migratable_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit migratable Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-need-reschedule.c b/lttng-context-need-reschedule.c
index 82f2d61..b0ea6d1 100644
--- a/lttng-context-need-reschedule.c
+++ b/lttng-context-need-reschedule.c
 <at>  <at>  -85,11 +85,3  <at>  <at>  int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_need_reschedule_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit need_reschedule Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-nice.c b/lttng-context-nice.c
index b2d7705..2ad3841 100644
--- a/lttng-context-nice.c
+++ b/lttng-context-nice.c
 <at>  <at>  -85,11 +85,3  <at>  <at>  int lttng_add_nice_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_nice_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Nice Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-perf-counters.c b/lttng-context-perf-counters.c
index 0c74234..467b718 100644
--- a/lttng-context-perf-counters.c
+++ b/lttng-context-perf-counters.c
 <at>  <at>  -280,11 +280,3  <at>  <at>  error_attr:
 	kfree(events);
 	return ret;
 }
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Perf Support");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-pid.c b/lttng-context-pid.c
index 5ad92c1..3428be6 100644
--- a/lttng-context-pid.c
+++ b/lttng-context-pid.c
 <at>  <at>  -85,11 +85,3  <at>  <at>  int lttng_add_pid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_pid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit PID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-ppid.c b/lttng-context-ppid.c
index 28c97b5..7323b88 100644
--- a/lttng-context-ppid.c
+++ b/lttng-context-ppid.c
 <at>  <at>  -107,11 +107,3  <at>  <at>  int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit PPID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-preemptible.c b/lttng-context-preemptible.c
index d4d474c..7053414 100644
--- a/lttng-context-preemptible.c
+++ b/lttng-context-preemptible.c
 <at>  <at>  -103,11 +103,3  <at>  <at>  int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_preemptible_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit preemptible Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-prio.c b/lttng-context-prio.c
index 9da51a2..5a27e04 100644
--- a/lttng-context-prio.c
+++ b/lttng-context-prio.c
 <at>  <at>  -106,11 +106,3  <at>  <at>  int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_prio_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Priority Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-procname.c b/lttng-context-procname.c
index 8a747ac..6b5e90a 100644
--- a/lttng-context-procname.c
+++ b/lttng-context-procname.c
 <at>  <at>  -89,11 +89,3  <at>  <at>  int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_procname_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Perf Support");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-tid.c b/lttng-context-tid.c
index 1286265..3eded5b 100644
--- a/lttng-context-tid.c
+++ b/lttng-context-tid.c
 <at>  <at>  -88,11 +88,3  <at>  <at>  int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_tid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit TID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-vpid.c b/lttng-context-vpid.c
index 6fa1c00..a2080f1 100644
--- a/lttng-context-vpid.c
+++ b/lttng-context-vpid.c
 <at>  <at>  -100,11 +100,3  <at>  <at>  int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vpid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit vPID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-vppid.c b/lttng-context-vppid.c
index 8a7d172..9e7e54d 100644
--- a/lttng-context-vppid.c
+++ b/lttng-context-vppid.c
 <at>  <at>  -129,11 +129,3  <at>  <at>  int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit vPPID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
diff --git a/lttng-context-vtid.c b/lttng-context-vtid.c
index a37bb76..425f368 100644
--- a/lttng-context-vtid.c
+++ b/lttng-context-vtid.c
 <at>  <at>  -100,11 +100,3  <at>  <at>  int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vtid_to_ctx);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit vTID Context");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
-	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
-	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
-	LTTNG_MODULES_EXTRAVERSION);
--

-- 
2.7.0
Olof Johansson | 10 Feb 10:39 2016
Picon

[PATCH] Fix: configure.ac: check for possibly required libs for clock_gettime

From: Olof Johansson <olof.johansson <at> axis.com>

On some platforms, you have to link with rt to get clock_gettime. This
solves errors like:

 undefined reference to `clock_gettime'

Fixes: #996

Signed-off-by: Olof Johansson <olof.johansson <at> axis.com>
---
 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 39a7777..c3cf60e 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -79,7 +79,6  <at>  <at>  AC_FUNC_MMAP
 AC_FUNC_FORK
 AC_CHECK_FUNCS([ \
 	atexit \
-	clock_gettime \
 	getcpuid \
 	gettid \
 	gettimeofday \
 <at>  <at>  -215,6 +214,11  <at>  <at>  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 	compat_futex_test=1
 ])

+# Search for clock_gettime
+AC_SEARCH_LIBS([clock_gettime], [rt], [],
+	[AC_MSG_ERROR([Cannot find clock_gettime function.])]
+)
+
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create],
 	[AM_CONDITIONAL(LIBC_INCLUDES_PTHREAD, false)],
--

-- 
2.1.4
Michael Jeanson | 9 Feb 21:16 2016
Gravatar

[PATCH lttng-modules] Fix: Add CONFIG_LTTNG to modules_install target

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 6a8c5c7..5d6be94 100644
--- a/Makefile
+++ b/Makefile
 <at>  <at>  -103,12 +103,12  <at>  <at>  default:
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules

 modules_install:
-	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules_install

 clean:
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean

 %.i: %.c
-	$(MAKE) -C $(KERNELDIR) M=$(PWD) $ <at> 
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m $ <at> 

 endif # KERNELRELEASE
--

-- 
2.7.0
Marek Vasut | 9 Feb 19:30 2016
Picon
Picon

[PATCH V2] Support for NIOS2 architecture

Add support for the Altera NIOS2 CPU archirecture. The atomic operations
are handled by the GCC. The memory barriers on this systems are entirely
trivial too, since the CPU does not support SMP at all.

Signed-off-by: Marek Vasut <marex <at> denx.de>
---
 LICENSE              |  1 +
 README.md            |  1 +
 configure.ac         |  1 +
 urcu/arch/nios2.h    | 40 ++++++++++++++++++++++++++++++++++++++++
 urcu/uatomic/nios2.h | 32 ++++++++++++++++++++++++++++++++
 5 files changed, 75 insertions(+)
 create mode 100644 urcu/arch/nios2.h
 create mode 100644 urcu/uatomic/nios2.h

V2: Fix dangling mips in urcu/arch/nios2.h
    Define cmm_mb() as cmm_barrier()

diff --git a/LICENSE b/LICENSE
index 3147094..a06fdcc 100644
--- a/LICENSE
+++ b/LICENSE
 <at>  <at>  -45,6 +45,7  <at>  <at>  compiler.h
 arch/s390.h
 uatomic/alpha.h
 uatomic/mips.h
+uatomic/nios2.h
 uatomic/s390.h
 system.h

diff --git a/README.md b/README.md
index f6b290f..6fe9c1e 100644
--- a/README.md
+++ b/README.md
 <at>  <at>  -43,6 +43,7  <at>  <at>  Currently, the following architectures are supported:
   - S390, S390x
   - ARM 32/64
   - MIPS
+  - NIOS2
   - Alpha
   - ia64
   - Sparcv9 32/64
diff --git a/configure.ac b/configure.ac
index 1c2fdcc..4f785bb 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -123,6 +123,7  <at>  <at>  AS_CASE([$host_cpu],
 	[arm*], [ARCHTYPE="arm"],
 	[aarch64], [ARCHTYPE="aarch64"],
 	[mips*], [ARCHTYPE="mips"],
+	[nios2*], [ARCHTYPE="nios2"],
 	[tile*], [ARCHTYPE="tile"],
 	[hppa*], [ARCHTYPE="hppa"],
 	[ARCHTYPE="unknown"]
diff --git a/urcu/arch/nios2.h b/urcu/arch/nios2.h
new file mode 100644
index 0000000..b4f3e50
--- /dev/null
+++ b/urcu/arch/nios2.h
 <at>  <at>  -0,0 +1,40  <at>  <at> 
+#ifndef _URCU_ARCH_NIOS2_H
+#define _URCU_ARCH_NIOS2_H
+
+/*
+ * arch_nios2.h: trivial definitions for the NIOS2 architecture.
+ *
+ * Copyright (c) 2016 Marek Vasut <marex <at> denx.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+#include <urcu/syscall-compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define cmm_mb()	cmm_barrier()
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <urcu/arch/generic.h>
+
+#endif /* _URCU_ARCH_NIOS2_H */
diff --git a/urcu/uatomic/nios2.h b/urcu/uatomic/nios2.h
new file mode 100644
index 0000000..5b3c303
--- /dev/null
+++ b/urcu/uatomic/nios2.h
 <at>  <at>  -0,0 +1,32  <at>  <at> 
+#ifndef _URCU_UATOMIC_ARCH_NIOS2_H
+#define _URCU_UATOMIC_ARCH_NIOS2_H
+
+/*
+ * Atomic exchange operations for the NIOS2 architecture. Let GCC do it.
+ *
+ * Copyright (c) 2016 Marek Vasut <marex <at> denx.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+#include <urcu/uatomic/generic.h>
+
+#endif /* _URCU_UATOMIC_ARCH_NIOS2_H */
--

-- 
2.7.0
Mathieu Desnoyers | 9 Feb 19:27 2016
Gravatar

[PATCH babeltrace 1/3] Fix: out-of-bound memory access

We need to check for end of stream before updating the current packet
index, else we access memory beyond the last stream packet index array
element. This fixes valgrind errors which appear at commit

480ef05 Support ctf index version 1.1

due to change of the element size, but actually caused by commit

2654fe9 Fix: events discarded timing inaccuracy

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers <at> efficios.com>
---
 formats/ctf/ctf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index a617497..37ebdfc 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
 <at>  <at>  -951,6 +951,11  <at>  <at>  void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
 			assert(0);
 		}

+		if (pos->cur_index >= pos->packet_index->len) {
+			pos->offset = EOF;
+			return;
+		}
+
 		packet_index = &g_array_index(pos->packet_index,
 				struct packet_index, pos->cur_index);
 		if (pos->cur_index > 0) {
 <at>  <at>  -963,11 +968,6  <at>  <at>  void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
 		ctf_update_current_packet_index(&file_stream->parent,
 				prev_index, packet_index);

-		if (pos->cur_index >= pos->packet_index->len) {
-			pos->offset = EOF;
-			return;
-		}
-
 		/*
 		 * We need to check if we are in trace read or called
 		 * from packet indexing.  In this last case, the
--

-- 
2.1.4
Marek Vasut | 9 Feb 17:55 2016
Picon
Picon

[PATCH] liburcu: Support for NIOS2 architecture

Add support for the Altera NIOS2 CPU archirecture. The atomic operations
are handled by the GCC. The memory barriers on this systems are entirely
trivial too, since the CPU does not support SMP at all.

Signed-off-by: Marek Vasut <marex <at> denx.de>
---
 LICENSE              |  1 +
 README.md            |  1 +
 configure.ac         |  1 +
 urcu/arch/nios2.h    | 40 ++++++++++++++++++++++++++++++++++++++++
 urcu/uatomic/nios2.h | 32 ++++++++++++++++++++++++++++++++
 5 files changed, 75 insertions(+)
 create mode 100644 urcu/arch/nios2.h
 create mode 100644 urcu/uatomic/nios2.h

diff --git a/LICENSE b/LICENSE
index 3147094..a06fdcc 100644
--- a/LICENSE
+++ b/LICENSE
 <at>  <at>  -45,6 +45,7  <at>  <at>  compiler.h
 arch/s390.h
 uatomic/alpha.h
 uatomic/mips.h
+uatomic/nios2.h
 uatomic/s390.h
 system.h

diff --git a/README.md b/README.md
index f6b290f..6fe9c1e 100644
--- a/README.md
+++ b/README.md
 <at>  <at>  -43,6 +43,7  <at>  <at>  Currently, the following architectures are supported:
   - S390, S390x
   - ARM 32/64
   - MIPS
+  - NIOS2
   - Alpha
   - ia64
   - Sparcv9 32/64
diff --git a/configure.ac b/configure.ac
index 39a7777..71a7d71 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -124,6 +124,7  <at>  <at>  AS_CASE([$host_cpu],
 	[arm*], [ARCHTYPE="arm"],
 	[aarch64], [ARCHTYPE="aarch64"],
 	[mips*], [ARCHTYPE="mips"],
+	[nios2*], [ARCHTYPE="nios2"],
 	[tile*], [ARCHTYPE="tile"],
 	[hppa*], [ARCHTYPE="hppa"],
 	[ARCHTYPE="unknown"]
diff --git a/urcu/arch/nios2.h b/urcu/arch/nios2.h
new file mode 100644
index 0000000..030d1bc
--- /dev/null
+++ b/urcu/arch/nios2.h
 <at>  <at>  -0,0 +1,40  <at>  <at> 
+#ifndef _URCU_ARCH_NIOS2_H
+#define _URCU_ARCH_NIOS2_H
+
+/*
+ * arch_mips.h: trivial definitions for the NIOS2 architecture.
+ *
+ * Copyright (c) 2016 Marek Vasut <marex <at> denx.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+#include <urcu/syscall-compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define cmm_mb()	__asm__ __volatile__ ("":::"memory")
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <urcu/arch/generic.h>
+
+#endif /* _URCU_ARCH_NIOS2_H */
diff --git a/urcu/uatomic/nios2.h b/urcu/uatomic/nios2.h
new file mode 100644
index 0000000..5b3c303
--- /dev/null
+++ b/urcu/uatomic/nios2.h
 <at>  <at>  -0,0 +1,32  <at>  <at> 
+#ifndef _URCU_UATOMIC_ARCH_NIOS2_H
+#define _URCU_UATOMIC_ARCH_NIOS2_H
+
+/*
+ * Atomic exchange operations for the NIOS2 architecture. Let GCC do it.
+ *
+ * Copyright (c) 2016 Marek Vasut <marex <at> denx.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+#include <urcu/uatomic/generic.h>
+
+#endif /* _URCU_UATOMIC_ARCH_NIOS2_H */
--

-- 
2.7.0
Mathieu Desnoyers | 8 Feb 23:13 2016
Gravatar

[PATCH lttng-tools 1/2] Fix: handle negative clock offset for lttng-ust metadata

In the unlikely situation where a system sets its hardware clock
(CLOCK_REALTIME) to 0 (Epoch) after boot, the difference

  monotonic - realtime

becomes negative.

Fixup this situation by returning a 0 offset in this case.

This ensures that trace viewer implementations (e.g. babeltrace) which
currently cannot handle the negative offset (known bug) still work with
the generated traces.

This patch should be applied to master and stable-2.7.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers <at> efficios.com>
---
 src/bin/lttng-sessiond/ust-metadata.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c
index 984d5f8..f7c8b9d 100644
--- a/src/bin/lttng-sessiond/ust-metadata.c
+++ b/src/bin/lttng-sessiond/ust-metadata.c
 <at>  <at>  -604,11 +604,17  <at>  <at>  int _lttng_event_header_declare(struct ust_registry_session *session)
 	);
 }

+/*
+ * The offset between monotonic and realtime clock can be negative if
+ * the system sets the REALTIME clock to 0 after boot.
+ * Currently handle this by flooring the offset at 0.
+ */
 static
 int measure_single_clock_offset(struct offset_sample *sample)
 {
-	uint64_t offset, monotonic[2], measure_delta, realtime;
+	uint64_t monotonic_avg, monotonic[2], measure_delta, realtime;
 	uint64_t tcf = trace_clock_freq();
+	int64_t offset;
 	struct timespec rts = { 0, 0 };
 	int ret;

 <at>  <at>  -626,15 +632,18  <at>  <at>  int measure_single_clock_offset(struct offset_sample *sample)
 		 */
 		return 0;
 	}
-	offset = (monotonic[0] + monotonic[1]) >> 1;
+	monotonic_avg = (monotonic[0] + monotonic[1]) >> 1;
 	realtime = (uint64_t) rts.tv_sec * tcf;
 	if (tcf == NSEC_PER_SEC) {
 		realtime += rts.tv_nsec;
 	} else {
 		realtime += (uint64_t) rts.tv_nsec * tcf / NSEC_PER_SEC;
 	}
-	offset = realtime - offset;
-	sample->offset = offset;
+	offset = (int64_t) realtime - monotonic_avg;
+	if (offset < 0)
+		sample->offset = 0;
+	else
+		sample->offset = offset;
 	sample->measure_delta = measure_delta;
 	return 0;
 }
--

-- 
2.1.4
Michael Jeanson | 8 Feb 22:33 2016
Gravatar

[PATCH lttng-modules] Fix: Use kbuild env instead of a custom var KERNELDIR

We currently use the custom variables KERNELDIR and LTTNG_KERNELDIR
to pass the kernel source tree directory to helper scripts. We should
instead use the built-in Kbuild variable CURDIR which is available in
all sub makefiles and always points to the kernel sources.

Signed-off-by: Michael Jeanson <mjeanson <at> efficios.com>
---
 Makefile                 | 9 ++++-----
 Makefile.ABI.workarounds | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 64d5885..6a8c5c7 100644
--- a/Makefile
+++ b/Makefile
 <at>  <at>  -9,7 +9,6  <at>  <at>  ifneq ($(KERNELRELEASE),)

   ifneq ($(CONFIG_TRACEPOINTS),)

-    KERNELDIR = ${LTTNG_KERNELDIR}
     MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST)))

     lttng_check_linux_version = $(shell pwd)/include/linux/version.h
 <at>  <at>  -101,15 +100,15  <at>  <at>  PWD := $(shell pwd)
 CFLAGS = $(EXTCFLAGS)

 default:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules

 modules_install:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

 clean:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean

 %.i: %.c
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) $ <at> 
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) $ <at> 

 endif # KERNELRELEASE
diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds
index e8cf520..f766bc9 100644
--- a/Makefile.ABI.workarounds
+++ b/Makefile.ABI.workarounds
 <at>  <at>  -4,13 +4,13  <at>  <at> 
 # the kernel EXTRAVERSION to figure it out. Translate this information
 # into a define visible from the C preprocessor.

-DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
+DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(CURDIR))

 ifneq ($(DEB_API_VERSION), 0)
   ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
 endif

-RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
+RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(CURDIR))

 ifneq ($(RT_PATCH_VERSION), 0)
   ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
--

-- 
2.7.0
Michael Jeanson | 5 Feb 23:53 2016
Gravatar

[PATCH lttng-modules 1/2] Add RT patch version macros

---
 Makefile.ABI.workarounds |  8 +++++++-
 lttng-kernel-version.h   | 17 +++++++++++++++++
 rt-patch-version.sh      | 25 +++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100755 rt-patch-version.sh

diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds
index d553ee4..e8cf520 100644
--- a/Makefile.ABI.workarounds
+++ b/Makefile.ABI.workarounds
 <at>  <at>  -4,8 +4,14  <at>  <at> 
 # the kernel EXTRAVERSION to figure it out. Translate this information
 # into a define visible from the C preprocessor.

-DEB_API_VERSION=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
+DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))

 ifneq ($(DEB_API_VERSION), 0)
   ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
 endif
+
+RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
+
+ifneq ($(RT_PATCH_VERSION), 0)
+  ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
+endif
diff --git a/lttng-kernel-version.h b/lttng-kernel-version.h
index f98a192..ac61739 100644
--- a/lttng-kernel-version.h
+++ b/lttng-kernel-version.h
 <at>  <at>  -90,4 +90,21  <at>  <at> 
 		LTTNG_RHEL_VERSION_CODE < \
 		LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high))

+#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
+	(((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
+#ifdef RT_PATCH_VERSION
+#define LTTNG_RT_VERSION_CODE \
+	((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
+#else
+#define LTTNG_RT_VERSION_CODE 	0
+#endif
+
+#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+		a_high, b_high, c_high, d_high) \
+	(LTTNG_RT_VERSION_CODE >= \
+		LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+		LTTNG_RT_VERSION_CODE < \
+		LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
 #endif /* _LTTNG_KERNEL_VERSION_H */
diff --git a/rt-patch-version.sh b/rt-patch-version.sh
new file mode 100755
index 0000000..89c7755
--- /dev/null
+++ b/rt-patch-version.sh
 <at>  <at>  -0,0 +1,25  <at>  <at> 
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+VERSIONFILE=""
+
+if [ -f "${KPATH}/localversion-rt" ]; then
+	VERSIONFILE="${KPATH}/localversion-rt"
+
+elif [ -f "${KPATH}/source/localversion-rt" ]; then
+	VERSIONFILE="${KPATH}/source/localversion-rt"
+else
+	echo 0
+	exit 0
+fi
+
+RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
+
+if [ "x${RT_PATCH_VERSION}" = "x" ]; then
+	echo 0
+	exit 0
+fi
+
+echo ${RT_PATCH_VERSION}
--

-- 
2.7.0
Alexandre Montplaisir | 4 Feb 21:02 2016

[PATCH lttng-ust stable-2.7] Fix: Ensure the Java JUL messages are correctly formatted

Same as 4721f9c, but for the stable-2.7 branch.

Signed-off-by: Alexandre Montplaisir <alexmonthy <at> efficios.com>
---
 .../java/org/lttng/ust/agent/jul/LTTngLogHandler.java  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java
index b844d2f..15c7a8e 100644
--- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java
+++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java
 <at>  <at>  -19,11 +19,23  <at>  <at>  package org.lttng.ust.agent.jul;

 import java.lang.String;

+import java.util.logging.Formatter;
 import java.util.logging.Handler;
 import java.util.logging.LogRecord;

 class LTTngLogHandler extends Handler {

+	/**
+	 * Dummy Formatter object, so we can use its
+	 * { <at> link Formatter#formatMessage(LogRecord)} method.
+	 */
+	private static final Formatter FORMATTER = new Formatter() {
+		 <at> Override
+		public String format(LogRecord record) {
+			throw new UnsupportedOperationException();
+		}
+	};
+
 	private final Boolean isRoot;

 	public LTTngLogHandler(Boolean isRoot) {
 <at>  <at>  -54,18 +66,20  <at>  <at>  class LTTngLogHandler extends Handler {

 	 <at> Override
 	public void publish(LogRecord record) {
+		String formattedMessage = FORMATTER.formatMessage(record);
+
 		/*
 		 * Specific tracepoint designed for JUL events. The source class of the
 		 * caller is used for the event name, the raw message is taken, the
 		 * loglevel of the record and the thread ID.
 		 */
 		if (this.isRoot) {
-			tracepointS(record.getMessage(),
+			tracepointS(formattedMessage,
 				    record.getLoggerName(), record.getSourceClassName(),
 				    record.getSourceMethodName(), record.getMillis(),
 				    record.getLevel().intValue(), record.getThreadID());
 		} else {
-			tracepointU(record.getMessage(),
+			tracepointU(formattedMessage,
 				    record.getLoggerName(), record.getSourceClassName(),
 				    record.getSourceMethodName(), record.getMillis(),
 				    record.getLevel().intValue(), record.getThreadID());
--

-- 
2.5.0

Gmane