/
LTTng for Xilinx Zynq Linux
LTTng for Xilinx Zynq Linux
This page describes how to build and run LTTng(with limited functionality) on Xilnx Zynq Linux.
Table of Contents
Overview
The LTTng(Linux Trace Toolkit - next generation) project aims at efficient tracing tools for Linux. LTTng consists of kernel tracer and user tracer, and as a part of project, there are multiple viewers to show and analyze traces. LTTng can trace a lot of kernel functions such as memory, scheduling, filesystem, network, and more.Requirements
Required modules for LTTng for Xilinx Zynq Linux- Xilinx Zynq Linux : Zynq Linux with tracepoints feature(CONFIG_TRACEPOINTS) on
- LTTng modules : kernel modules for LTTng
- LTTng tools : userspace daemons and tools
- userspace rcu : userspace rcu library used by LTTng tools
- libpopt : used by LTTng tools
Note:
|
Build Process
Build Directory Hierachy
lttng-build-root /| - linux-xlnx : Xilinx Zynq Linux for LTTng
| - lttng-modules-xlnx : LTTng kernel modules for Xilinx Zynq linux
| - kos : generated LTTng kernel modules
| - popt-1.16-xlnx : libpopt for LLTng tools
| - userspace-rcu-xlnx : userspace rcu library for LLTng tools
| - lttng-tools-xlnx : LTTng tools
/tmp/<YOUR_LTTNG_ROOT> : the build root directory where all created binaries are placed. (YOUR_LTTNG_ROOT=username-lttng-root for this page)
Building Xilinx Zynq Linux for LTTng
The kernel can be downloaded from Xilinx git,build > git clone git://github.com/Xilinx/linux-xlnx.git linux-xlnx build > cd linux-xlnx
diff --git a/arch/arm/configs/xilinx_zynq_defconfig b/arch/arm/configs/xilinx_zynq_defconfig index 58c226e..e9c069c 100644 --- a/arch/arm/configs/xilinx_zynq_defconfig +++ b/arch/arm/configs/xilinx_zynq_defconfig @@ -30,7 +30,8 @@ CONFIG_BUILDTIME_EXTABLE_SORT=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-xilinx" +CONFIG_LOCALVERSION="-xilinx-lttng" +CONFIG_TRACEPOINTS=y CONFIG_LOCALVERSION_AUTO=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index 96e1668..7a557c3 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig @@ -54,3 +54,10 @@ config XILINX_AXIPCIE endmenu endif + +config TRACEPOINTS + bool "Tracepoints for lttng modules" + default y + help + Enable tracepoints for lttng modules +
build > make ARCH=arm xilinx_zynq_defconfig
build > make ARCH=arm uImage UIMAGE_LOADADDR=0x8000
Return to the build root,
build > cd ..
Building LTTng Kernel Modules
The source code can be downloaded by the following command
build > wget https://lttng.org/files/lttng-modules/lttng-modules-2.1.1.tar.bz2 build > tar -xf lttng-modules-2.1.1.tar.bz2 build > cd lttng-modules-2.1.1
--- /instrumentation/events/lttng-module/sched.h <span style="font-family: arial,helvetica,sans-serif; line-height: 1.5;">@@ -5,6 +5,7 @@ #define _TRACE_SCHED_H #include <linux/sched.h> +#include <linux/sched/rt.h> #include <linux/tracepoint.h> #ifndef _TRACE_SCHED_DEF_
--- /instrumentation/syscalls/headers/arm-32-syscalls-2.6.38_integers_override.h @@ -2,7 +2,6 @@ #define OVERRIDE_TABLE_32_sys_arm_fadvise64_64 #define OVERRIDE_TABLE_32_sys_sync_file_range2 -#define OVERRIDE_TABLE_32_sys_set_tls #ifndef CREATE_SYSCALL_TABLE @@ -38,18 +37,6 @@ SC_TRACE_EVENT(sys_sync_file_range2, TP_printk() ) -SC_TRACE_EVENT(sys_set_tls, - TP_PROTO(unsigned int tid, unsigned long tls), - TP_ARGS(tid, tls), - TP_STRUCT__entry( - __field(unsigned int, tid) - __field_hex(unsigned int, tls)), - TP_fast_assign( - tp_assign(tid, tid) - tp_assign(tls, tls)), - TP_printk() -) - #else /* CREATE_SYSCALL_TABLE */ #define OVVERRIDE_TABLE_32_sys_mmap @@ -59,9 +46,6 @@ TRACE_SYSCALL_TABLE(sys_mmap, sys_mmap, 90, 6) TRACE_SYSCALL_TABLE(sys_arm_fadvise64_64, sys_arm_fadvise64_64, 270, 4) #define OVERRIDE_TABLE_32_sys_sync_file_range2 TRACE_SYSCALL_TABLE(sys_sync_file_range2, sys_sync_file_range2, 341, 4) -#define OVERRIDE_TABLE_32_sys_set_tls -TRACE_SYSCALL_TABLE(sys_set_tls, sys_set_tls, 0xf0005, 2) - #endif /* CREATE_SYSCALL_TABLE */
build > make KERNELDIR=lttng-build-root/linux-xlnx ARCH=arm
build > mkdir lttng-build-root/kos build > find . -name "*.ko" -exec cp -i {} lttng-build-root/kos/. \;
build > cd ..
Building libpopt for LTTng Tools
libpopt and userspace rcu should be built before building LTTng tools.
libpopt can be downloaded from the following link,
build > wget http://rpm5.org/files/popt/popt-1.16.tar.gz build > tar -xf popt-1.16.tar.gz build > cd popt-1.16
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi build > make install
build > cd ..
Building userspace rcu library for LTTng tools
Userspace rcu can be downloaded using the command show below
build > wget https://lttng.org/files/urcu/userspace-rcu-0.7.6.tar.bz2 build > tar -xf userspace-rcu-0.7.6.tar.bz2 build > cd userspace-rcu-0.7.6
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi
+++ config.h @@ -45,7 +45,7 @@ /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ -#define HAVE_MALLOC 0 +#define HAVE_MALLOC 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 @@ -136,7 +136,7 @@ #endif /* Define to rpl_malloc if the replacement function should be used. */ -#define malloc rpl_malloc +/*#define malloc rpl_malloc*/ /* Define to `int' if <sys/types.h> does not define. */ /* #undef pid_t */
build > make install
build > cd ..
Building LTTng Tools
Since all dependent libraries are built, LTTng tools can be built upon those. The source tree can be downloaded by the following command,
build > wget https://lttng.org/files/lttng-tools/lttng-tools-2.1.1.tar.bz2 build > tar -xf lttng-tools-2.1.1.tar.bz2 build > cd lttng-tools-2.1.1
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi LDFLAGS=-L/tmp/username-lttng-root/lib CPPFLAGS="-I/tmp/username-lttng-root/include -DXILINX_MOD" --disable-lttng-ust
+++ src/common/defaults.h @@ -32,8 +32,13 @@ /* Environment variable to set session daemon binary path. */ #define DEFAULT_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" +#ifdef XILINX_MOD +/* Default trace output directory name */ +#define DEFAULT_TRACE_DIR_NAME "/tmp/lttng-traces" +#else /* Default trace output directory name */ #define DEFAULT_TRACE_DIR_NAME "lttng-traces" +#endif /* Default size of a hash table */ #define DEFAULT_HT_SIZE 4 @@ -77,7 +82,11 @@ /* Default lttng run directory */ +#ifdef XILINX_MOD +#define DEFAULT_LTTNG_RUNDIR "/tmp/lttng" +#else #define DEFAULT_LTTNG_RUNDIR "/var/run/lttng" +#endif #define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng" #define DEFAULT_LTTNG_SESSIOND_PIDFILE "lttng-sessiond.pid"
build > make install
build > cd ..
Running Process
Running LTTng on Xilinx Zynq Linux
Make sure its the kernel built from previous steps by checking if its uname is '3.6.0-linux-xilinx-lttng-dirty',zynq > uname -r 3.6.0-linux-xilinx-lttng-dirty
zynq > mkdir -p /lib/modules/$(uname -r)
A LTTng session needs to be created,
zynq > /tmp/username-lttng-root/bin/lttng create <YOUR_SESSION>
zynq > /tmp/username-lttng-root/bin/lttng list -k
zynq > /tmp/username-lttng-root/bin/lttng enable-event -k -a
zynq > /tmp/username-lttng-root/bin/lttng start zynq > /tmp/username-lttng-root/bin/lttng stop
zynq > /tmp/username-lttng-root/bin/lttng destroy
Viewing LTTng Traces
All traces are stored in /tmp/lttng-traces/<YOUR_SESSION_DIR>, and traces can be viewed and analyzed using several viewers. For example, Eclipse with LTTng plugin can be downloaded and used as a LTTng viewer(https://lttng.org/eclipse). Detailed instructions for LTTng viewers are available on the official website(https://lttng.org/viewers)External Links
, multiple selections available,
Related content
Linux CAN driver
Linux CAN driver
Read with this
SmartLynq+ Module
SmartLynq+ Module
More like this
Device Tree Tips
Device Tree Tips
Read with this
FreeRTOS
FreeRTOS
More like this
Real-Time Linux
Real-Time Linux
Read with this
Build Device Tree Blob
Build Device Tree Blob
More like this
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy