summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/trace-cmd
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2014-06-26 14:36:22 +0200
committerAdrian Dudau <adrian.dudau@enea.com>2014-06-26 15:32:53 +0200
commitf4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch)
tree487180fa9866985ea7b28e625651765d86f515c3 /meta/recipes-kernel/trace-cmd
downloadpoky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-kernel/trace-cmd')
-rw-r--r--meta/recipes-kernel/trace-cmd/kernelshark_1.2.bb30
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/addldflags.patch51
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/blktrace-api-compatibility.patch29
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/kernelshark-fix-syntax-error-of-shell.patch30
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/make-docs-optional.patch36
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch61
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch38
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch96
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-fix-syntax-error-of-shell.patch30
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb31
10 files changed, 432 insertions, 0 deletions
diff --git a/meta/recipes-kernel/trace-cmd/kernelshark_1.2.bb b/meta/recipes-kernel/trace-cmd/kernelshark_1.2.bb
new file mode 100644
index 0000000000..d61097df91
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/kernelshark_1.2.bb
@@ -0,0 +1,30 @@
1SUMMARY = "Graphical trace viewer for Ftrace"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
4 file://kernel-shark.c;beginline=6;endline=8;md5=2c22c965a649ddd7973d7913c5634a5e"
5
6SRCREV = "7055ffd37beeb44714e86a4abc703f7e175a0db5"
7PR = "r3"
8PV = "1.2+git${SRCPV}"
9
10DEPENDS = "gtk+"
11RDEPENDS_${PN} = "trace-cmd"
12
13inherit pkgconfig pythonnative
14
15SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git \
16 file://addldflags.patch \
17 file://make-docs-optional.patch \
18 file://blktrace-api-compatibility.patch \
19 file://kernelshark-fix-syntax-error-of-shell.patch"
20S = "${WORKDIR}/git"
21
22EXTRA_OEMAKE = "'CC=${CC}' 'AR=${AR}' 'prefix=${prefix}' gui"
23
24FILESPATH = "${FILE_DIRNAME}/trace-cmd"
25
26do_install() {
27 oe_runmake CC="${CC}" AR="${AR}" prefix="${prefix}" DESTDIR="${D}" install_gui
28 rm -rf ${D}${datadir}/trace-cmd
29 rmdir ${D}${datadir}
30}
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/addldflags.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/addldflags.patch
new file mode 100644
index 0000000000..14730db905
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/addldflags.patch
@@ -0,0 +1,51 @@
1trace-cmd: Cross-compile fixes for LDFLAGS and include path
2
3Add ability for the Makefile to respect LDFLAGS.
4Also remove hardcoded /usr/local/include include path.
5
6Upstream-Status: Accepted [Post 1.2: 5f576e9af7ad706774d9764a9ae3989376797c0e]
7
8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9Signed-off-by: Darren Hart <dvhart@linux.intel.com>
10
11---
12 Makefile | 7 ++++---
13 1 file changed, 4 insertions(+), 3 deletions(-)
14
15Index: git/Makefile
16===================================================================
17--- git.orig/Makefile
18+++ git/Makefile
19@@ -202,12 +202,13 @@ export Q VERBOSE
20 TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION)
21 KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION)
22
23-INCLUDES = -I. -I/usr/local/include $(CONFIG_INCLUDES)
24+INCLUDES = -I. $(CONFIG_INCLUDES)
25
26 include features.mk
27
28 # Set compile option CFLAGS if not set elsewhere
29 CFLAGS ?= -g -Wall
30+LDFLAGS ?=
31
32 ifndef NO_PTRACE
33 ifneq ($(call try-cc,$(SOURCE_PTRACE),),y)
34@@ -251,7 +252,7 @@ do_fpic_compile = \
35
36 do_app_build = \
37 ($(print_app_build) \
38- $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS))
39+ $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
40
41 do_compile_shared_library = \
42 ($(print_shared_lib_compile) \
43@@ -263,7 +264,7 @@ do_compile_plugin_obj = \
44
45 do_plugin_build = \
46 ($(print_plugin_build) \
47- $(CC) $(CFLAGS) -shared -nostartfiles -o $@ $<)
48+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<)
49
50 do_build_static_lib = \
51 ($(print_static_lib_build) \
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/blktrace-api-compatibility.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/blktrace-api-compatibility.patch
new file mode 100644
index 0000000000..0789e9fdf7
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/blktrace-api-compatibility.patch
@@ -0,0 +1,29 @@
1trace-cmd: Add blktrace_api compatibility for TC_BARRIER
2
3Newer kernels replace TC_BARRIER with TC_FLUSH. Ensure trace-cmd
4can build regardless of the linux-kernel-headers version.
5
6Upstream-Status: Innapropriate [Stop gap]
7
8Signed-off-by: Darren Hart <dvhart@linux.intel.com>
9
10diff --git a/plugin_blk.c b/plugin_blk.c
11index 9327b17..c8e5e1c 100644
12--- a/plugin_blk.c
13+++ b/plugin_blk.c
14@@ -44,6 +44,15 @@ struct blk_data {
15 unsigned short pdu_len;
16 };
17
18+/*
19+ * Newer kernels don't define BLK_TC_BARRIER and have replaced it with
20+ * BLK_TC_FLUSH. In this case, define it here and report FLUSHES as BARRIERS as
21+ * a workaround, as described in:
22+ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=c09c47caedc9854d59378d6e34c989e51cfdd2b4
23+ */
24+#ifndef BLK_TC_BARRIER
25+#define BLK_TC_BARRIER 1<<2
26+#endif
27 static void fill_rwbs(char *rwbs, int action, unsigned int bytes)
28 {
29 int i = 0;
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/kernelshark-fix-syntax-error-of-shell.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/kernelshark-fix-syntax-error-of-shell.patch
new file mode 100644
index 0000000000..351b24b82f
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/kernelshark-fix-syntax-error-of-shell.patch
@@ -0,0 +1,30 @@
1kernelshark: fix syntax error of shell
2
3Delete "<<<" syntax of bash in Makefile, else we would get following error:
4
5 Syntax error: redirection unexpected
6
7Upstream-status: Pending
8
9Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
10---
11 Makefile | 3 +--
12 1 file changed, 1 insertion(+), 2 deletions(-)
13
14diff --git a/Makefile b/Makefile
15index c1fa906..be84415 100644
16--- a/Makefile
17+++ b/Makefile
18@@ -89,8 +89,7 @@ endif
19
20 # $(call test-build, snippet, ret) -> ret if snippet compiles
21 # -> empty otherwise
22-test-build = $(if $(shell $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 \
23- <<<'$1' && echo y), $2)
24+test-build = $(if $(shell echo '$1' |$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y), $2)
25
26 # have udis86 disassembler library?
27 udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
28--
291.7.9.5
30
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/make-docs-optional.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/make-docs-optional.patch
new file mode 100644
index 0000000000..8402426c5f
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/make-docs-optional.patch
@@ -0,0 +1,36 @@
1Disable building docs until we have asciidocs available as a recipe.
2
3Upstream-Status: Inappropriate [Account for missing dependency, the lazy way]
4
5Signed-off-by: Darren Hart <dvhart@linux.intel.com>
6
7---
8 Makefile | 8 ++++++--
9 1 file changed, 6 insertions(+), 2 deletions(-)
10
11Index: git/Makefile
12===================================================================
13--- git.orig/Makefile
14+++ git/Makefile
15@@ -327,7 +327,9 @@ TARGETS = $(CMD_TARGETS) $(GUI_TARGETS)
16 # If you want kernelshark, then do: make gui
17 ###
18
19-all: all_cmd doc show_gui_make
20+# Make doc optional
21+#all: all_cmd doc show_gui_make
22+all: all_cmd show_gui_make
23
24 all_cmd: $(CMD_TARGETS)
25
26@@ -503,7 +505,9 @@ install_python: $(PYTHON_SO_INSTALL) $(P
27 install_cmd: all_cmd install_plugins install_python
28 $(Q)$(call do_install,trace-cmd,$(bindir_SQ))
29
30-install: install_cmd install_doc
31+# Make doc optional
32+#install: install_cmd install_doc
33+install: install_cmd
34 @echo "Note: to install the gui, type \"make install_gui\""
35
36 install_gui: install_cmd gui
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch
new file mode 100644
index 0000000000..8fdeedb008
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch
@@ -0,0 +1,61 @@
1From a6e259b2cd43db3c0f69441f627a8cf214f88506 Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Thu, 5 Apr 2012 15:19:44 -0400
4Subject: [PATCH] trace-cmd: Add checks for invalid pointers to fix segfaults
5
6Upstream-Status: Backport
7
8Running 'trace-cmd report' after running latency tracers will cause a
9segfault due to invalid pointers. Adding checks to ensure
10pointers/lists are initialized before attempting to use them prevents
11these segfaults.
12
13Link: http://lkml.kernel.org/r/1333653586-3379-2-git-send-email-mark.asselstine@windriver.com
14
15Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
16Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
17---
18 trace-input.c | 12 +++++++++---
19 1 file changed, 9 insertions(+), 3 deletions(-)
20
21diff --git a/trace-input.c b/trace-input.c
22index b6af1e6..5151c1e 100644
23--- a/trace-input.c
24+++ b/trace-input.c
25@@ -695,7 +695,8 @@ static void __free_page(struct tracecmd_input *handle, struct page *page)
26
27 static void free_page(struct tracecmd_input *handle, int cpu)
28 {
29- if (!handle->cpu_data[cpu].page)
30+ if (!handle->cpu_data || cpu >= handle->cpus ||
31+ !handle->cpu_data[cpu].page)
32 return;
33
34 __free_page(handle, handle->cpu_data[cpu].page);
35@@ -746,8 +747,12 @@ void tracecmd_record_ref(struct record *record)
36
37 static void free_next(struct tracecmd_input *handle, int cpu)
38 {
39- struct record *record = handle->cpu_data[cpu].next;
40+ struct record *record;
41+
42+ if (!handle->cpu_data || cpu >= handle->cpus)
43+ return;
44
45+ record = handle->cpu_data[cpu].next;
46 if (!record)
47 return;
48
49@@ -2337,7 +2342,8 @@ void tracecmd_close(struct tracecmd_input *handle)
50 /* The tracecmd_peek_data may have cached a record */
51 free_next(handle, cpu);
52 free_page(handle, cpu);
53- if (!list_empty(&handle->cpu_data[cpu].pages))
54+ if (handle->cpu_data &&
55+ !list_empty(&handle->cpu_data[cpu].pages))
56 warning("pages still allocated on cpu %d%s",
57 cpu, show_records(&handle->cpu_data[cpu].pages));
58 }
59--
601.7.10.4
61
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch
new file mode 100644
index 0000000000..4c00c512bb
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch
@@ -0,0 +1,38 @@
1From 356dee73d9ced3e019dea2883a7f357fd4664b3e Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Thu, 5 Apr 2012 15:19:45 -0400
4Subject: [PATCH] trace-cmd: Do not call stop_threads() if doing latency
5 tracing
6
7Upstream-Status: Backport
8
9If we are using a latency tracer we do not call start_threads() we
10should therefore not call stop_threads() if 'latency'. Attempting
11to call stop_threads() without first calling start_threads() will
12cause a segfault since pids will be uninitialized.
13
14Link: http://lkml.kernel.org/r/1333653586-3379-3-git-send-email-mark.asselstine@windriver.com
15
16Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
17Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
18---
19 trace-record.c | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22diff --git a/trace-record.c b/trace-record.c
23index fcec28b..1c56fa9 100644
24--- a/trace-record.c
25+++ b/trace-record.c
26@@ -2216,7 +2216,8 @@ void trace_record (int argc, char **argv)
27 }
28
29 disable_tracing();
30- stop_threads();
31+ if (!latency)
32+ stop_threads();
33 }
34
35 for (cpu = 0; cpu < cpu_count; cpu++) {
36--
371.7.10.4
38
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
new file mode 100644
index 0000000000..724e1e80b1
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
@@ -0,0 +1,96 @@
1From d65740d61e7a4ea6d8d77237954b33dd18e3276c Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Sun, 8 Apr 2012 11:38:45 -0400
4Subject: [PATCH] trace-cmd: Setting plugin to 'nop' clears data before it's
5 recorded
6
7Upstream-Status: Backport
8
9commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
10[trace-cmd: Add trace-cmd record --date option]
11
12moved the call to disable_all() in trace_record() from after record_data()
13to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
14which has the side affect of clearing 'trace', thus all the latency tracer
15reports are empty/useless. Here we make disable_all() optionally call
16set_plugin() thus, where we need to, we can delay the disabling of the tracer
17until we have had a chance to capture 'trace'. We have added this delayed
18behavior to trace_record() to fix the latency reports, for all other calls to
19disable_all() we continue to have set_plugin() called.
20
21Link: http://lkml.kernel.org/r/1333899525-6436-1-git-send-email-mark.asselstine@windriver.com
22
23Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
24Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
25---
26 trace-record.c | 16 ++++++++++------
27 1 file changed, 10 insertions(+), 6 deletions(-)
28
29diff --git a/trace-record.c b/trace-record.c
30index 1c56fa9..95d4a2a 100644
31--- a/trace-record.c
32+++ b/trace-record.c
33@@ -897,11 +897,13 @@ static void disable_tracing(void)
34 write_tracing_on(0);
35 }
36
37-static void disable_all(void)
38+static void disable_all(int disable_tracer)
39 {
40 disable_tracing();
41
42- set_plugin("nop");
43+ if (disable_tracer)
44+ set_plugin("nop");
45+
46 reset_events();
47
48 /* Force close and reset of ftrace pid file */
49@@ -1573,7 +1575,7 @@ static void set_funcs(void)
50 /* make sure we are filtering functions */
51 if (func_stack) {
52 if (!functions_filtered()) {
53- disable_all();
54+ disable_all(1);
55 die("Function stack trace set, but functions not filtered");
56 }
57 save_option(FUNC_STACK_TRACE);
58@@ -1938,7 +1940,7 @@ void trace_record (int argc, char **argv)
59 break;
60 }
61 }
62- disable_all();
63+ disable_all(1);
64 set_buffer_size();
65 exit(0);
66 } else
67@@ -2147,7 +2149,7 @@ void trace_record (int argc, char **argv)
68
69 if (!extract) {
70 fset = set_ftrace(!disable);
71- disable_all();
72+ disable_all(1);
73
74 /* Record records the date first */
75 if (record && date)
76@@ -2227,7 +2229,7 @@ void trace_record (int argc, char **argv)
77 }
78
79 if (!keep)
80- disable_all();
81+ disable_all(0);
82
83 printf("Kernel buffer statistics:\n"
84 " Note: \"entries\" are the entries left in the kernel ring buffer and are not\n"
85@@ -2249,6 +2251,8 @@ void trace_record (int argc, char **argv)
86 if (keep)
87 exit(0);
88
89+ set_plugin("nop");
90+
91 /* If tracing_on was enabled before we started, set it on now */
92 if (tracing_on_init_val)
93 write_tracing_on(tracing_on_init_val);
94--
951.7.10.4
96
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-fix-syntax-error-of-shell.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-fix-syntax-error-of-shell.patch
new file mode 100644
index 0000000000..b1ebf49830
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-fix-syntax-error-of-shell.patch
@@ -0,0 +1,30 @@
1trace-cmd: fix syntax error of shell
2
3Delete "<<<" syntax of bash in Makefile, else we would get following error:
4
5 Syntax error: redirection unexpected
6
7Upstream-status: Pending
8
9Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
10---
11 Makefile | 3 +--
12 1 file changed, 1 insertion(+), 2 deletions(-)
13
14diff --git a/Makefile b/Makefile
15index c1fa906..7973c53 100644
16--- a/Makefile
17+++ b/Makefile
18@@ -89,8 +89,7 @@ endif
19
20 # $(call test-build, snippet, ret) -> ret if snippet compiles
21 # -> empty otherwise
22-test-build = $(if $(shell $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 \
23- <<<'$1' && echo y), $2)
24+test-build = $(if $(shell echo '$1' |$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y), $2)
25
26 # have udis86 disassembler library?
27 udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
28--
291.7.9.5
30
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb b/meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb
new file mode 100644
index 0000000000..a0c823bf62
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb
@@ -0,0 +1,31 @@
1SUMMARY = "User interface to Ftrace"
2LICENSE = "GPLv2 & LGPLv2.1"
3LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
4 file://trace-cmd.c;beginline=6;endline=8;md5=2c22c965a649ddd7973d7913c5634a5e \
5 file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff \
6 file://trace-input.c;beginline=5;endine=8;md5=6ad47cc2b03385d8456771eec5eeea0b"
7
8SRCREV = "7055ffd37beeb44714e86a4abc703f7e175a0db5"
9PR = "r3"
10PV = "1.2+git${SRCPV}"
11
12inherit pkgconfig pythonnative
13
14SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git \
15 file://addldflags.patch \
16 file://make-docs-optional.patch \
17 file://blktrace-api-compatibility.patch \
18 file://trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch \
19 file://trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch \
20 file://trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch \
21 file://trace-cmd-fix-syntax-error-of-shell.patch \
22"
23S = "${WORKDIR}/git"
24
25EXTRA_OEMAKE = "'prefix=${prefix}'"
26
27FILES_${PN}-dbg += "${datadir}/trace-cmd/plugins/.debug/"
28
29do_install() {
30 oe_runmake prefix="${prefix}" DESTDIR="${D}" install
31}