Add kernel and userspace callstack event context
authorFrancis Giraldeau <francis.giraldeau@gmail.com>
Wed, 17 Jul 2013 21:06:23 +0000 (17:06 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 11 Jun 2018 19:21:39 +0000 (15:21 -0400)
LTTng callstack context. The callstack context can be added to any kernel
channel. It records either the kernel or the userspace callstack, up to a
max depth. The context is a CTF sequence, such that it uses only the space
required for the number of callstack entries.

The symbol name resolution is left to the trace reader.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
include/lttng/event.h
src/bin/lttng-sessiond/context.c
src/bin/lttng/commands/add_context.c
src/common/lttng-kernel.h

index 7c85cff4a78df07fbce2c276a855eba63d5be395..6a26e49982ffa0286184c9131577d0ee83bef0ad 100644 (file)
@@ -955,6 +955,51 @@ AS_IF([test x$build_lib_relayd = xyes],
       ]
 )
 
+# Find arch type
+AS_CASE([$host_cpu],
+        [k1om], [ARCHTYPE="x86"],
+        [i386], [ARCHTYPE="x86"],
+        [i486], [ARCHTYPE="x86"],
+        [i586], [ARCHTYPE="x86"],
+        [i686], [ARCHTYPE="x86"],
+        [amd64], [ARCHTYPE="x86"],
+        [x86_64], [ARCHTYPE="x86"],
+        [powerpc], [ARCHTYPE="ppc"],
+        [ppc64], [ARCHTYPE="ppc"],
+        [powerpc64], [ARCHTYPE="ppc"],
+        [powerpc64le], [ARCHTYPE="ppc"],
+        [ppc], [ARCHTYPE="ppc"],
+        [s390], [ARCHTYPE="s390"],
+        [s390x], [ARCHTYPE="s390"],
+        [sparc], [ARCHTYPE="sparc64"],
+        [sparc64], [ARCHTYPE="sparc64"],
+        [alpha*], [ARCHTYPE="alpha"],
+        [ia64], [ARCHTYPE="ia64"],
+        [arm*], [ARCHTYPE="arm"],
+        [aarch64*], [ARCHTYPE="aarch64"],
+        [mips*], [ARCHTYPE="mips"],
+        [nios2*], [ARCHTYPE="nios2"],
+        [tile*], [ARCHTYPE="tile"],
+        [hppa*], [ARCHTYPE="hppa"],
+        [m68k], [ARCHTYPE="m68k"],
+        [riscv*], [ARCHTYPE="riscv"],
+        [ARCHTYPE="unknown"]
+)
+
+AC_SUBST(ARCHTYPE)
+
+AH_TEMPLATE([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [Define if you have LTTng-modules userspace callstack tracing support])
+AC_MSG_CHECKING([for architecture support of userspace callstack tracing from the kernel])
+AS_IF([test "x$ARCHTYPE" = "xx86"],[
+        # Userspace callstack capture is only supported by the Linux kernel on x86.
+        AC_MSG_RESULT([yes])
+        have_modules_userspace_callstack_context=yes
+        AC_DEFINE([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [1])
+], [
+        AC_MSG_RESULT([no])
+        have_modules_userspace_callstack_context=no
+])
+AM_CONDITIONAL([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [test x$have_modules_userspace_callstack_context != xno])
 
 # Export binaries build conditions.
 AM_CONDITIONAL([BUILD_BIN_LTTNG], [test x$enable_bin_lttng != xno])
index 16b4d4f59437c4a982e4e6bae307d314cf341415..b89590dbde01c44d402979afc27d045ea01a0fab 100644 (file)
@@ -142,6 +142,8 @@ enum lttng_event_context_type {
        LTTNG_EVENT_CONTEXT_PREEMPTIBLE         = 17,
        LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE     = 18,
        LTTNG_EVENT_CONTEXT_MIGRATABLE          = 19,
+       LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL    = 20,
+       LTTNG_EVENT_CONTEXT_CALLSTACK_USER      = 21, /* Supported on x86_32 and x86_64 only. */
 };
 
 enum lttng_event_field_type {
index 3c7c34df48d6c23b62c43b14e9908d7fb0f763e3..6cf301dcd04488b1a9f02ce79584e5cf0c445dea 100644 (file)
@@ -259,6 +259,12 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        case LTTNG_EVENT_CONTEXT_MIGRATABLE:
                kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_MIGRATABLE;
                break;
+       case LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL;
+               break;
+       case LTTNG_EVENT_CONTEXT_CALLSTACK_USER:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_USER;
+               break;
        default:
                ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
                goto error;
index 0adaa75385b55f3472b783a75c520e8d04c228b8..2c29a45ca3a4ce569140553480bf804020130876 100644 (file)
@@ -84,6 +84,8 @@ enum context_type {
        CONTEXT_PREEMPTIBLE  = 17,
        CONTEXT_NEED_RESCHEDULE = 18,
        CONTEXT_MIGRATABLE   = 19,
+       CONTEXT_CALLSTACK_KERNEL = 20,
+       CONTEXT_CALLSTACK_USER = 21,
 };
 
 /*
@@ -240,6 +242,10 @@ const struct ctx_opts {
        { "preemptible", CONTEXT_PREEMPTIBLE },
        { "need_reschedule", CONTEXT_NEED_RESCHEDULE },
        { "migratable", CONTEXT_MIGRATABLE },
+       { "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
+#if HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT
+       { "callstack-user", CONTEXT_CALLSTACK_USER },
+#endif
 
        /* Perf options */
 
index 8d87539a47ac25b05a8e86d239422a1af8a81dc2..9d6d60c404f885a6388969962356940c4a870319 100644 (file)
@@ -58,6 +58,8 @@ enum lttng_kernel_context_type {
        LTTNG_KERNEL_CONTEXT_PREEMPTIBLE    = 13,
        LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14,
        LTTNG_KERNEL_CONTEXT_MIGRATABLE     = 15,
+       LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL = 16,
+       LTTNG_KERNEL_CONTEXT_CALLSTACK_USER   = 17,
 };
 
 /* Perf counter attributes */
This page took 0.04085 seconds and 5 git commands to generate.