summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/systemtap
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
commit972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch)
tree97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-kernel/systemtap
downloadpoky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-kernel/systemtap')
-rw-r--r--meta/recipes-kernel/systemtap/systemtap-uprobes_git.bb44
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch39
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/docproc-build-fix.patch19
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/scheduler-stp.patch109
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/system_map_location.patch23
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/tapset-linux-sendfile-syscall.patch22
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.bb30
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.inc29
9 files changed, 330 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap-uprobes_git.bb b/meta/recipes-kernel/systemtap/systemtap-uprobes_git.bb
new file mode 100644
index 0000000000..4d2bec4714
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap-uprobes_git.bb
@@ -0,0 +1,44 @@
1SUMMARY = "UProbes kernel module for SystemTap"
2
3require systemtap_git.inc
4
5DEPENDS = "systemtap virtual/kernel"
6
7PR = "r1"
8
9# On systems without CONFIG_UTRACE, this package is empty.
10ALLOW_EMPTY_${PN} = "1"
11
12inherit module-base gettext
13
14FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemtap:"
15
16FILES_${PN} += "${datadir}/systemtap/runtime/uprobes"
17
18EXTRA_OEMAKE = ""
19
20# Compile and install the uprobes kernel module on machines with utrace
21# support. Note that staprun expects it in the systemtap/runtime directory,
22# not in /lib/modules.
23do_compile() {
24 if grep -q "CONFIG_UTRACE=y" ${STAGING_KERNEL_DIR}/.config
25 then
26 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS CC LD CPP
27 oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
28 AR="${KERNEL_AR}" \
29 -C ${STAGING_KERNEL_DIR} scripts
30 oe_runmake KDIR=${STAGING_KERNEL_DIR} \
31 M="${S}/runtime/uprobes/" \
32 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
33 AR="${KERNEL_AR}" \
34 -C "${S}/runtime/uprobes/"
35 fi
36}
37
38do_install() {
39 if [ -e "${S}/runtime/uprobes/uprobes.ko" ]
40 then
41 install -d ${D}${datadir}/systemtap/runtime/uprobes/
42 install -m 0644 ${S}/runtime/uprobes/uprobes.ko ${D}${datadir}/systemtap/runtime/uprobes/
43 fi
44}
diff --git a/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch b/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch
new file mode 100644
index 0000000000..b4f2fbc066
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch
@@ -0,0 +1,39 @@
1From 5eb10d90af9178edb65e6091ae939d1b5b19bb78 Mon Sep 17 00:00:00 2001
2From: Wenzong Fan <wenzong.fan@windriver.com>
3Date: Tue, 23 Sep 2014 04:47:10 -0400
4Subject: [PATCH] systemtap: allow to disable libvirt
5
6Upstream-Status: Pending
7
8Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
9---
10 configure.ac | 13 +++++++++----
11 1 file changed, 9 insertions(+), 4 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index a631ae7..cb4885b 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -525,10 +525,15 @@ dnl Check for the libvirt and libxml2 devel packages
18
19 dnl We require libvirt >= 1.0.2 because stapvirt relies on the
20 dnl virDomainOpenChannel function, which was implemented in 1.0.2.
21-PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [
22- have_libvirt=yes
23- AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed])
24- ], [have_libvirt=no])
25+AC_ARG_ENABLE([libvirt],
26+ AS_HELP_STRING([--disable-libvirt], [Do not use libvirt even if present]))
27+
28+if test "$enable_libvirt" != no; then
29+ PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [
30+ have_libvirt=yes
31+ AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed])
32+ ], [have_libvirt=no])
33+fi
34 AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"])
35 PKG_CHECK_MODULES([libxml2], [libxml-2.0], [
36 have_libxml2=yes
37--
381.7.9.5
39
diff --git a/meta/recipes-kernel/systemtap/systemtap/docproc-build-fix.patch b/meta/recipes-kernel/systemtap/systemtap/docproc-build-fix.patch
new file mode 100644
index 0000000000..33a89940ae
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/docproc-build-fix.patch
@@ -0,0 +1,19 @@
1Upstream-Status: Inappropriate [configuration]
2
3Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
4
5Index: git/doc/SystemTap_Tapset_Reference/Makefile.am
6===================================================================
7--- git.orig/doc/SystemTap_Tapset_Reference/Makefile.am 2012-04-13 08:43:46.263339003 -0500
8+++ git/doc/SystemTap_Tapset_Reference/Makefile.am 2012-04-13 09:31:22.470083915 -0500
9@@ -27,6 +27,10 @@
10 noinst_PROGRAMS = docproc
11 SRCTREE=$(abs_top_srcdir)/
12 DOCPROC=$(abs_builddir)/docproc
13+docproc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
14+
15+docproc.o: $(srcdir)/docproc.c
16+ $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) -o $@ $(srcdir)/docproc.c
17
18 all: $(PDFDOCS) stamp-htmldocs stamp-mandocs
19 tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp')
diff --git a/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch b/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch
new file mode 100644
index 0000000000..988cda4f0c
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Pending
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4Index: git/configure.ac
5===================================================================
6--- git.orig/configure.ac
7+++ git/configure.ac
8@@ -19,7 +19,6 @@ AC_PROG_LN_S
9 AC_PROG_CC
10 AC_PROG_CXX
11 AC_PROG_CPP
12-AM_PROG_CC_STDC
13 AM_PROG_CC_C_O
14 AC_PROG_RANLIB
15 AC_OBJEXT
diff --git a/meta/recipes-kernel/systemtap/systemtap/scheduler-stp.patch b/meta/recipes-kernel/systemtap/systemtap/scheduler-stp.patch
new file mode 100644
index 0000000000..9897e481a3
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/scheduler-stp.patch
@@ -0,0 +1,109 @@
1scheduler.stp: Handle missing symbols.
2
3Compiler output code optimization leads to missing debug data for some
4target variables, in particular some inline functions parameters, e.g.
5context_switch.
6
7Handle this by testing for variable name resolvability and provide default
8variable values in case no suitable target data is available through variable
9name. Affected functions: ctxswitch,wakeup.
10
11This fix does not affect the intended context switch tracing.
12
13
14Upstream-Status: Pending
15
16Signed-off-by: George Nita <george.nita@enea.com>
17
18
19diff --git a/tapset/linux/scheduler.stp b/tapset/linux/scheduler.stp
20index 7596a46..539a0f1 100644
21--- a/tapset/linux/scheduler.stp
22+++ b/tapset/linux/scheduler.stp
23@@ -120,7 +120,7 @@ probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
24 %( arch != "x86_64" && arch != "ia64" && arch != "arm" %?
25 kernel.function("__switch_to")
26 %:
27- kernel.function("context_switch")
28+ kernel.function("prepare_task_switch")
29 %)
30 {
31 name = "ctxswitch"
32@@ -140,7 +140,7 @@ probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
33 prev_task_name = task_execname($prev_p)
34 prevtsk_state = $prev_p->state
35 }
36- else {
37+ else if (@defined($prev)) {
38 prev_priority = $prev->prio
39 prev_pid = $prev->tgid
40 prev_tid = $prev->pid
41@@ -148,6 +148,15 @@ probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
42 prev_task_name = task_execname($prev)
43 prevtsk_state = $prev->state
44 }
45+ else {
46+ prev_priority = 0
47+ prev_pid = 0
48+ prev_tid = 0
49+ /* No prev_task, dummy */
50+ prev_task = task_current()
51+ prev_task_name = "UNAVAILABLE"
52+ prevtsk_state = 0
53+ }
54
55 if (@defined($next)) {
56 next_priority = $next->prio
57@@ -165,7 +174,7 @@ probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
58 next_task_name = task_execname($next_p)
59 nexttsk_state = $next_p->state
60 }
61- else {
62+ else if (@defined($new)) {
63 next_priority = $new->prio
64 next_pid = $new->tgid
65 next_tid = $new->pid
66@@ -173,6 +182,14 @@ probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
67 next_task_name = task_execname($new)
68 nexttsk_state = $new->state
69 }
70+ else {
71+ next_task = task_current()
72+ next_priority = task_prio(next_task)
73+ next_pid = task_pid(next_task)
74+ next_tid = task_tid(next_task)
75+ next_task_name = task_execname(next_task)
76+ nexttsk_state = task_state(next_task)
77+ }
78 }
79
80
81@@ -254,12 +271,22 @@ probe scheduler.wakeup =
82 kernel.function("try_to_wake_up")
83 {
84 name = "wakeup"
85- task = $p
86- task_pid = $p->tgid
87- task_tid = $p->pid
88- task_priority = $p->prio
89- task_cpu = task_cpu($p)
90- task_state = task_state($p)
91+ if (@defined($p)) {
92+ task = $p
93+ task_pid = $p->tgid
94+ task_tid = $p->pid
95+ task_priority = $p->prio
96+ task_cpu = task_cpu($p)
97+ task_state = task_state($p)
98+ }
99+ else {
100+ task = task_current()
101+ task_pid = task_pid(task)
102+ task_tid = task_tid(task)
103+ task_priority = task_prio(task)
104+ task_cpu = task_cpu(task)
105+ task_state = task_state(task)
106+ }
107 }
108
109 /**
diff --git a/meta/recipes-kernel/systemtap/systemtap/system_map_location.patch b/meta/recipes-kernel/systemtap/systemtap/system_map_location.patch
new file mode 100644
index 0000000000..013af5c3a4
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/system_map_location.patch
@@ -0,0 +1,23 @@
1systemtap: Cross compilation fix
2
3This is a cross compilation fix. It allows systemtap to find
4the kernel map file in the right place, i.e. in the kernel build tree.
5Without this fix it takes a map file from the build host, if available.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
10
11Index: git/session.cxx
12===================================================================
13--- git.orig/session.cxx
14+++ git/session.cxx
15@@ -1634,7 +1634,7 @@ systemtap_session::parse_kernel_function
16 clog << _F("Kernel symbol table %s unavailable, (%s)",
17 system_map_path.c_str(), strerror(errno)) << endl;
18
19- system_map_path = "/boot/System.map-" + kernel_release;
20+ system_map_path = kernel_build_tree + "/System.map-" + kernel_release;
21 system_map.clear();
22 system_map.open(system_map_path.c_str(), ifstream::in);
23 if (! system_map.is_open())
diff --git a/meta/recipes-kernel/systemtap/systemtap/tapset-linux-sendfile-syscall.patch b/meta/recipes-kernel/systemtap/systemtap/tapset-linux-sendfile-syscall.patch
new file mode 100644
index 0000000000..f945760fde
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/tapset-linux-sendfile-syscall.patch
@@ -0,0 +1,22 @@
1systemtap: Fixed probe syscall.sendfile failure
2
3compat_sendfile syscall is unavailable in kernels starting version 3.8.
4Hence systemtap scripts like 'probe syscall.* { if (target()==pid()) log(name." ".argstr) }' fail.
5This problem is solved by marking __syscall.compat_sendfile as optional in tapset/linux/syscalls2.stp
6
7Upstream-Status: Pending
8
9Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
10
11diff -Naur old/tapset/linux/syscalls2.stp new/tapset/linux/syscalls2.stp
12--- old/tapset/linux/syscalls2.stp 2014-04-21 01:28:41.000000000 -0500
13+++ new/tapset/linux/syscalls2.stp 2014-04-21 01:38:14.961233914 -0500
14@@ -1953,7 +1953,7 @@
15 # COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd,
16 # compat_loff_t __user *, offset, compat_size_t, count)
17 #
18-probe syscall.sendfile = __syscall.sendfile, __syscall.compat_sendfile
19+probe syscall.sendfile = __syscall.sendfile, __syscall.compat_sendfile ?
20 {
21 name = "sendfile"
22 out_fd = __int32($out_fd)
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb
new file mode 100644
index 0000000000..d0dd42a643
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap_git.bb
@@ -0,0 +1,30 @@
1SUMMARY = "Script-directed dynamic tracing and performance analysis tool for Linux"
2
3require systemtap_git.inc
4
5DEPENDS = "elfutils sqlite3 systemtap-native"
6DEPENDS_class-native = "elfutils-native sqlite3-native gettext-native"
7DEPENDS_class-nativesdk = "nativesdk-elfutils nativesdk-sqlite3 nativesdk-gettext"
8
9RDEPENDS_${PN} += "python bash"
10RDEPENDS_${PN}_class-native += "python-native"
11RDEPENDS_${PN}_class-nativesdk += "python-native"
12
13EXTRA_OECONF += "--with-libelf=${STAGING_DIR_TARGET} --without-rpm \
14 --without-nss --without-avahi --without-dyninst \
15 --disable-server --disable-grapher --enable-prologues \
16 ac_cv_prog_have_javac=no \
17 ac_cv_prog_have_jar=no "
18
19STAP_DOCS ?= "--disable-docs --disable-publican --disable-refdocs"
20
21EXTRA_OECONF += "${STAP_DOCS} "
22
23PACKAGECONFIG ??= ""
24PACKAGECONFIG[libvirt] = "--enable-libvirt,--disable-libvirt,libvirt"
25
26inherit autotools gettext pkgconfig
27
28BBCLASSEXTEND = "native nativesdk"
29
30FILES_${PN}-dbg += "${libexecdir}/systemtap/.debug"
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc
new file mode 100644
index 0000000000..9db0dcc2d7
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap_git.inc
@@ -0,0 +1,29 @@
1LICENSE = "GPLv2"
2LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
3SRCREV = "8f0fcd995f7f650a2ee0a94539f90c99e6d19e1d"
4PV = "2.5+git${SRCPV}"
5
6SRC_URI = "git://sourceware.org/git/systemtap.git \
7 file://docproc-build-fix.patch \
8 file://obsolete_automake_macros.patch \
9 file://scheduler-stp.patch \
10 file://system_map_location.patch \
11 file://tapset-linux-sendfile-syscall.patch \
12 file://configure-allow-to-disable-libvirt.patch \
13 "
14
15# systemtap doesn't support mips
16COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64).*-linux'
17
18S = "${WORKDIR}/git"
19
20# systemtap can't be built without optimization, if someone tries to compile an
21# entire image as -O0, we override it with -O2 here and give a note about it.
22def get_optimization(d):
23 selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
24 if bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
25 bb.note("systemtap can't be built with -O0, -O2 will be used instead.")
26 return selected_optimization.replace("-O0", "-O2")
27 return selected_optimization
28
29SELECTED_OPTIMIZATION := "${@get_optimization(d)}"