summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2014-09-04 10:07:59 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-10 15:38:55 +0100
commit73ef4032a9ad915fc142ef35248df5c8a30fbfe2 (patch)
tree2f07b5648a836188bef69118d8ac274e28d644a3 /meta/recipes-kernel/lttng/lttng-modules
parente1072391817e6cf20d8d569ca4fdbe1688c215a6 (diff)
downloadpoky-73ef4032a9ad915fc142ef35248df5c8a30fbfe2.tar.gz
lttng-modules: fix compilation for 3.17-rcX
Updating the lttng-modules 2.5 recipe with backports from the master branch to enable builds on 3.17 based kernels. (From OE-Core rev: cc2ef9b0f6371837faa5e430c0b6c48bf24a8c4c) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules')
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/Fix-noargs-probes-should-calculate-alignment-and-eve.patch130
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/Update-kvm-instrumentation-compile-on-3.17-rc1.patch46
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/Update-statedump-to-3.17-nsproxy-locking.patch70
3 files changed, 246 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/Fix-noargs-probes-should-calculate-alignment-and-eve.patch b/meta/recipes-kernel/lttng/lttng-modules/Fix-noargs-probes-should-calculate-alignment-and-eve.patch
new file mode 100644
index 0000000000..9c3dc9c1e1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/Fix-noargs-probes-should-calculate-alignment-and-eve.patch
@@ -0,0 +1,130 @@
1Upstream-Status: Backport
2Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
3
4From d3de7f1468be0b18145ff85b3c1a7c7fb1d48c15 Mon Sep 17 00:00:00 2001
5From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6Date: Fri, 25 Jul 2014 12:30:43 -0400
7Subject: [PATCH 1/3] Fix: noargs probes should calculate alignment and event
8 length
9
10A noargs probe could have event fields. noargs just means that the probe
11does not receive any argument as parameter. However, it could very well
12serialize data into fields (global variables, constants, etc).
13
14It just happens that LTTng does not serialize any data in noargs events
15at the moment, but this may very well change.
16
17The if (0) with (void) variable access strategy to stop compiler from
18complaining from unused variables does not seem to work as expected with
19gcc 4.9.1. Use "unused" attribute instead.
20
21Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22---
23 probes/lttng-events.h | 49 +++++++++++++++++++++++++++++++++++--------------
24 1 file changed, 35 insertions(+), 14 deletions(-)
25
26diff --git a/probes/lttng-events.h b/probes/lttng-events.h
27index 596b70608584..ba9563b15cf9 100644
28--- a/probes/lttng-events.h
29+++ b/probes/lttng-events.h
30@@ -456,10 +456,19 @@ static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
31 static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
32 { \
33 size_t __event_len = 0; \
34- unsigned int __dynamic_len_idx = 0; \
35+ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
36+ \
37+ _tstruct \
38+ return __event_len; \
39+}
40+
41+#undef DECLARE_EVENT_CLASS_NOARGS
42+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
43+static inline size_t __event_get_size__##_name(size_t *__dynamic_len) \
44+{ \
45+ size_t __event_len = 0; \
46+ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
47 \
48- if (0) \
49- (void) __dynamic_len_idx; /* don't warn if unused */ \
50 _tstruct \
51 return __event_len; \
52 }
53@@ -514,6 +523,15 @@ static inline size_t __event_get_align__##_name(_proto) \
54 return __event_align; \
55 }
56
57+#undef DECLARE_EVENT_CLASS_NOARGS
58+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
59+static inline size_t __event_get_align__##_name(void) \
60+{ \
61+ size_t __event_align = 1; \
62+ _tstruct \
63+ return __event_align; \
64+}
65+
66 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
67
68
69@@ -553,12 +571,16 @@ static inline size_t __event_get_align__##_name(_proto) \
70 #undef TP_STRUCT__entry
71 #define TP_STRUCT__entry(args...) args
72
73-#undef DECLARE_EVENT_CLASS
74-#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
75+#undef DECLARE_EVENT_CLASS_NOARGS
76+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
77 struct __event_typemap__##_name { \
78 _tstruct \
79 };
80
81+#undef DECLARE_EVENT_CLASS
82+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
83+ DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print)
84+
85 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
86
87
88@@ -760,15 +782,11 @@ static void __event_probe__##_name(void *__data, _proto) \
89 struct lttng_channel *__chan = __event->chan; \
90 struct lib_ring_buffer_ctx __ctx; \
91 size_t __event_len, __event_align; \
92- size_t __dynamic_len_idx = 0; \
93- size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)]; \
94- struct __event_typemap__##_name __typemap; \
95+ size_t __dynamic_len_idx __attribute__((unused)) = 0; \
96+ size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \
97+ struct __event_typemap__##_name __typemap __attribute__((unused)); \
98 int __ret; \
99 \
100- if (0) { \
101- (void) __dynamic_len_idx; /* don't warn if unused */ \
102- (void) __typemap; /* don't warn if unused */ \
103- } \
104 if (!_TP_SESSION_CHECK(session, __chan->session)) \
105 return; \
106 if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
107@@ -800,6 +818,9 @@ static void __event_probe__##_name(void *__data) \
108 struct lttng_channel *__chan = __event->chan; \
109 struct lib_ring_buffer_ctx __ctx; \
110 size_t __event_len, __event_align; \
111+ size_t __dynamic_len_idx __attribute__((unused)) = 0; \
112+ size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \
113+ struct __event_typemap__##_name __typemap __attribute__((unused)); \
114 int __ret; \
115 \
116 if (!_TP_SESSION_CHECK(session, __chan->session)) \
117@@ -810,8 +831,8 @@ static void __event_probe__##_name(void *__data) \
118 return; \
119 if (unlikely(!ACCESS_ONCE(__event->enabled))) \
120 return; \
121- __event_len = 0; \
122- __event_align = 1; \
123+ __event_len = __event_get_size__##_name(__dynamic_len); \
124+ __event_align = __event_get_align__##_name(); \
125 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
126 __event_align, -1); \
127 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
128--
1291.8.1.2
130
diff --git a/meta/recipes-kernel/lttng/lttng-modules/Update-kvm-instrumentation-compile-on-3.17-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/Update-kvm-instrumentation-compile-on-3.17-rc1.patch
new file mode 100644
index 0000000000..3541b50b79
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/Update-kvm-instrumentation-compile-on-3.17-rc1.patch
@@ -0,0 +1,46 @@
1Upstream-Status: Backport
2Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
3
4From 458c2022e992c057bd21d02e4c77bcc7d4d6cd6c Mon Sep 17 00:00:00 2001
5From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6Date: Thu, 21 Aug 2014 11:15:50 -0400
7Subject: [PATCH 3/3] Update kvm instrumentation: compile on 3.17-rc1
8
9Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10---
11 instrumentation/events/lttng-module/arch/x86/kvm/trace.h | 12 +++++++++++-
12 1 file changed, 11 insertions(+), 1 deletion(-)
13
14diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
15index 2354884074eb..3c299c58a1cf 100644
16--- a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
17+++ b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
18@@ -724,7 +724,7 @@ TRACE_EVENT(kvm_emulate_insn,
19 tp_memcpy(insn,
20 vcpu->arch.emulate_ctxt.decode.fetch.data,
21 15)
22-#else
23+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
24 tp_assign(rip, vcpu->arch.emulate_ctxt.fetch.start)
25 tp_assign(csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS))
26 tp_assign(len, vcpu->arch.emulate_ctxt._eip
27@@ -732,6 +732,16 @@ TRACE_EVENT(kvm_emulate_insn,
28 tp_memcpy(insn,
29 vcpu->arch.emulate_ctxt.fetch.data,
30 15)
31+#else
32+ tp_assign(rip, vcpu->arch.emulate_ctxt._eip -
33+ (vcpu->arch.emulate_ctxt.fetch.ptr -
34+ vcpu->arch.emulate_ctxt.fetch.data))
35+ tp_assign(csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS))
36+ tp_assign(len, vcpu->arch.emulate_ctxt.fetch.ptr -
37+ vcpu->arch.emulate_ctxt.fetch.data)
38+ tp_memcpy(insn,
39+ vcpu->arch.emulate_ctxt.fetch.data,
40+ 15)
41 #endif
42 tp_assign(flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
43 tp_assign(failed, failed)
44--
451.8.1.2
46
diff --git a/meta/recipes-kernel/lttng/lttng-modules/Update-statedump-to-3.17-nsproxy-locking.patch b/meta/recipes-kernel/lttng/lttng-modules/Update-statedump-to-3.17-nsproxy-locking.patch
new file mode 100644
index 0000000000..0f18c8a3e6
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/Update-statedump-to-3.17-nsproxy-locking.patch
@@ -0,0 +1,70 @@
1Upstream-Status: Backport
2Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
3
4From 4ba1f53c5aebb4433fedc25d65af010274985043 Mon Sep 17 00:00:00 2001
5From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6Date: Thu, 21 Aug 2014 10:53:12 -0400
7Subject: [PATCH 2/3] Update statedump to 3.17 nsproxy locking
8
9This Linux upstream commit introduces locking strategy back and forth:
10
11commit 728dba3a39c66b3d8ac889ddbe38b5b1c264aec3
12Author: Eric W. Biederman <ebiederm@xmission.com>
13Date: Mon Feb 3 19:13:49 2014 -0800
14
15 namespaces: Use task_lock and not rcu to protect nsproxy
16
17Use the task lock starting from kernel 3.17 rather than RCU to access
18the task nsproxy.
19
20Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
21---
22 lttng-statedump-impl.c | 15 +++++++++++++++
23 1 file changed, 15 insertions(+)
24
25diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
26index dad51ddaa250..e4caa488e436 100644
27--- a/lttng-statedump-impl.c
28+++ b/lttng-statedump-impl.c
29@@ -378,6 +378,9 @@ int lttng_list_interrupts(struct lttng_session *session)
30 }
31 #endif
32
33+/*
34+ * Called with task lock held.
35+ */
36 static
37 void lttng_statedump_process_ns(struct lttng_session *session,
38 struct task_struct *p,
39@@ -389,8 +392,18 @@ void lttng_statedump_process_ns(struct lttng_session *session,
40 struct nsproxy *proxy;
41 struct pid_namespace *pid_ns;
42
43+ /*
44+ * Back and forth on locking strategy within Linux upstream for nsproxy.
45+ * See Linux upstream commit 728dba3a39c66b3d8ac889ddbe38b5b1c264aec3
46+ * "namespaces: Use task_lock and not rcu to protect nsproxy"
47+ * for details.
48+ */
49+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
50 rcu_read_lock();
51 proxy = task_nsproxy(p);
52+#else /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) */
53+ proxy = p->nsproxy;
54+#endif /* #else #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) */
55 if (proxy) {
56 pid_ns = lttng_get_proxy_pid_ns(proxy);
57 do {
58@@ -402,7 +415,9 @@ void lttng_statedump_process_ns(struct lttng_session *session,
59 trace_lttng_statedump_process_state(session,
60 p, type, mode, submode, status, NULL);
61 }
62+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
63 rcu_read_unlock();
64+#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) */
65 }
66
67 static
68--
691.8.1.2
70