summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2022-04-12 17:46:02 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-14 16:46:35 +0100
commitb3ea0a07d46ebff0ae3fb02c7521ab971b3410db (patch)
tree756da88ee734e6ce3a1793aced818998f0fab0c0 /meta/recipes-kernel
parent09fdbbcd193fdbb87af6dad57541e389a0a3a59f (diff)
downloadpoky-b3ea0a07d46ebff0ae3fb02c7521ab971b3410db.tar.gz
lttng-modules: support kernel 5.18+
Backporting changes from lttng master to support building against the 5.18+ kernel. No changes required to the patches. Once a new -stable 2.13.x is released, we can drop these patches. To enable newer kernel development against the LTS, it is worth pulling these in while we wait for an upstream release. (From OE-Core rev: 8a7237a47488442513741930ea55d69dd6bd7be4) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch37
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch48
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch183
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch45
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch79
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch47
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch72
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch44
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch76
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch106
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb14
11 files changed, 750 insertions, 1 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch
new file mode 100644
index 0000000000..e988f7a3d5
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch
@@ -0,0 +1,37 @@
1From c312bda00d2dc10ce5f6c1189acbefee5c6c8c6c Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Tue, 29 Mar 2022 16:34:07 -0400
4Subject: [PATCH 01/10] Fix: compaction migratepages event name
5
6The commit "fix: mm: compaction: fix the migration stats in trace_mm_compaction_migratepages() (v5.17)"
7
8Triggers this warning:
9
10 LTTng: event provider mismatch: The event name needs to start with provider name + _ + one or more letter, provider: compaction, event name: mm_compaction_migratepages
11
12Upstream-Status: Backport
13
14Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15Change-Id: I01c7485af765084dafb33bf33ae392e60bfbf1e7
16---
17 include/instrumentation/events/compaction.h | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
21index 340e41f5..15964537 100644
22--- a/include/instrumentation/events/compaction.h
23+++ b/include/instrumentation/events/compaction.h
24@@ -98,7 +98,9 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
25 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
26
27 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
28-LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages,
29+LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
30+
31+ compaction_migratepages,
32
33 TP_PROTO(unsigned long nr_all,
34 unsigned int nr_succeeded),
35--
362.19.1
37
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch
new file mode 100644
index 0000000000..00367eebf8
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch
@@ -0,0 +1,48 @@
1From a7eb2e3d0a4beb1ee80b132927641dd05ef2d542 Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Mon, 4 Apr 2022 15:49:32 -0400
4Subject: [PATCH 02/10] Fix: tracepoint event: allow same provider and event
5 name
6
7Using the same name for the provider (TRACE_SYSTEM) and event name
8causes a compilation error because the same identifiers are emitted
9twice.
10
11Fix this by prefixing the provider identifier with
12"__provider_event_desc___".
13
14Upstream-Status: Backport
15
16Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
17Change-Id: I8cdf8f859e35b8bd5c19737860d12f1ed546dfc2
18---
19 include/lttng/tracepoint-event-impl.h | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h
23index 38b1dc43..dcb22247 100644
24--- a/include/lttng/tracepoint-event-impl.h
25+++ b/include/lttng/tracepoint-event-impl.h
26@@ -1255,7 +1255,7 @@ static const struct lttng_kernel_event_desc __event_desc___##_map = { \
27 #define TP_ID1(_token, _system) _token##_system
28 #define TP_ID(_token, _system) TP_ID1(_token, _system)
29
30-static const struct lttng_kernel_event_desc * const TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
31+static const struct lttng_kernel_event_desc * const TP_ID(__provider_event_desc___, TRACE_SYSTEM)[] = {
32 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
33 };
34
35@@ -1274,8 +1274,8 @@ static const struct lttng_kernel_event_desc * const TP_ID(__event_desc___, TRACE
36 /* non-const because list head will be modified when registered. */
37 static __used struct lttng_kernel_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
38 .provider_name = __stringify(TRACE_SYSTEM),
39- .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
40- .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
41+ .event_desc = TP_ID(__provider_event_desc___, TRACE_SYSTEM),
42+ .nr_events = ARRAY_SIZE(TP_ID(__provider_event_desc___, TRACE_SYSTEM)),
43 .head = { NULL, NULL },
44 .lazy_init_head = { NULL, NULL },
45 .lazy = 0,
46--
472.19.1
48
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch
new file mode 100644
index 0000000000..afe514de82
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch
@@ -0,0 +1,183 @@
1From 8e52fd71e693619f7a58de2692e59f0c826e9988 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 13:52:57 -0400
4Subject: [PATCH 03/10] fix: sched/tracing: Don't re-read p->state when
5 emitting sched_switch event (v5.18)
6
7See upstream commit :
8
9 commit fa2c3254d7cfff5f7a916ab928a562d1165f17bb
10 Author: Valentin Schneider <valentin.schneider@arm.com>
11 Date: Thu Jan 20 16:25:19 2022 +0000
12
13 sched/tracing: Don't re-read p->state when emitting sched_switch event
14
15 As of commit
16
17 c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu")
18
19 the following sequence becomes possible:
20
21 p->__state = TASK_INTERRUPTIBLE;
22 __schedule()
23 deactivate_task(p);
24 ttwu()
25 READ !p->on_rq
26 p->__state=TASK_WAKING
27 trace_sched_switch()
28 __trace_sched_switch_state()
29 task_state_index()
30 return 0;
31
32 TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in
33 the trace event.
34
35 Prevent this by pushing the value read from __schedule() down the trace
36 event.
37
38Upstream-Status: Backport
39
40Change-Id: I46743cd006be4b4d573cae2d77df7d6d16744d04
41Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
42Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
43---
44 include/instrumentation/events/sched.h | 88 +++++++++++++++++++++++---
45 1 file changed, 78 insertions(+), 10 deletions(-)
46
47diff --git a/include/instrumentation/events/sched.h b/include/instrumentation/events/sched.h
48index 91953a6f..339bec94 100644
49--- a/include/instrumentation/events/sched.h
50+++ b/include/instrumentation/events/sched.h
51@@ -20,7 +20,37 @@
52 #ifndef _TRACE_SCHED_DEF_
53 #define _TRACE_SCHED_DEF_
54
55-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
56+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
57+
58+static inline long __trace_sched_switch_state(bool preempt,
59+ unsigned int prev_state,
60+ struct task_struct *p)
61+{
62+ unsigned int state;
63+
64+#ifdef CONFIG_SCHED_DEBUG
65+ BUG_ON(p != current);
66+#endif /* CONFIG_SCHED_DEBUG */
67+
68+ /*
69+ * Preemption ignores task state, therefore preempted tasks are always
70+ * RUNNING (we will not have dequeued if state != RUNNING).
71+ */
72+ if (preempt)
73+ return TASK_REPORT_MAX;
74+
75+ /*
76+ * task_state_index() uses fls() and returns a value from 0-8 range.
77+ * Decrement it by 1 (except TASK_RUNNING state i.e 0) before using
78+ * it for left shift operation to get the correct task->state
79+ * mapping.
80+ */
81+ state = __task_state_index(prev_state, p->exit_state);
82+
83+ return state ? (1 << (state - 1)) : state;
84+}
85+
86+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
87
88 static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
89 {
90@@ -321,43 +351,81 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new,
91 /*
92 * Tracepoint for task switches, performed by the scheduler:
93 */
94+
95+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
96 LTTNG_TRACEPOINT_EVENT(sched_switch,
97
98-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
99 TP_PROTO(bool preempt,
100- struct task_struct *prev,
101- struct task_struct *next),
102+ unsigned int prev_state,
103+ struct task_struct *prev,
104+ struct task_struct *next),
105
106- TP_ARGS(preempt, prev, next),
107+ TP_ARGS(preempt, prev_state, prev, next),
108+
109+ TP_FIELDS(
110+ ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
111+ ctf_integer(pid_t, prev_tid, prev->pid)
112+ ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
113+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
114+ ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(preempt, prev_state, prev))
115 #else
116- TP_PROTO(struct task_struct *prev,
117+ ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev_state, prev))
118+#endif
119+ ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
120+ ctf_integer(pid_t, next_tid, next->pid)
121+ ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
122+ )
123+)
124+
125+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
126+
127+LTTNG_TRACEPOINT_EVENT(sched_switch,
128+
129+ TP_PROTO(bool preempt,
130+ struct task_struct *prev,
131 struct task_struct *next),
132
133- TP_ARGS(prev, next),
134-#endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0)) */
135+ TP_ARGS(preempt, prev, next),
136
137 TP_FIELDS(
138 ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
139 ctf_integer(pid_t, prev_tid, prev->pid)
140 ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
141-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
142 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
143 ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(preempt, prev))
144 #else
145 ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev))
146 #endif
147+ ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
148+ ctf_integer(pid_t, next_tid, next->pid)
149+ ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
150+ )
151+)
152+
153 #else
154+
155+LTTNG_TRACEPOINT_EVENT(sched_switch,
156+
157+ TP_PROTO(struct task_struct *prev,
158+ struct task_struct *next),
159+
160+ TP_ARGS(prev, next),
161+
162+ TP_FIELDS(
163+ ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
164+ ctf_integer(pid_t, prev_tid, prev->pid)
165+ ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
166 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
167 ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(prev))
168 #else
169 ctf_integer(long, prev_state, __trace_sched_switch_state(prev))
170-#endif
171 #endif
172 ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
173 ctf_integer(pid_t, next_tid, next->pid)
174 ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
175 )
176 )
177+#endif
178
179 /*
180 * Tracepoint for a task being migrated:
181--
1822.19.1
183
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch
new file mode 100644
index 0000000000..9248ffe4ff
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch
@@ -0,0 +1,45 @@
1From 868e0b6db59159197c2cec3550fa4ad5e6572bc5 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 13:54:59 -0400
4Subject: [PATCH 04/10] fix: block: remove genhd.h (v5.18)
5
6See upstream commit :
7
8 commit 322cbb50de711814c42fb088f6d31901502c711a
9 Author: Christoph Hellwig <hch@lst.de>
10 Date: Mon Jan 24 10:39:13 2022 +0100
11
12 block: remove genhd.h
13
14 There is no good reason to keep genhd.h separate from the main blkdev.h
15 header that includes it. So fold the contents of genhd.h into blkdev.h
16 and remove genhd.h entirely.
17
18Upstream-Status: Backport
19
20Change-Id: I7cf2aaa3a4c133320b95f2edde49f790f9515dbd
21Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
22Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23---
24 include/wrapper/genhd.h | 4 ++++
25 1 file changed, 4 insertions(+)
26
27diff --git a/include/wrapper/genhd.h b/include/wrapper/genhd.h
28index 3c6dbcbe..4a59b68e 100644
29--- a/include/wrapper/genhd.h
30+++ b/include/wrapper/genhd.h
31@@ -12,7 +12,11 @@
32 #ifndef _LTTNG_WRAPPER_GENHD_H
33 #define _LTTNG_WRAPPER_GENHD_H
34
35+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
36+#include <linux/blkdev.h>
37+#else
38 #include <linux/genhd.h>
39+#endif
40
41 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
42 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_HIDDEN
43--
442.19.1
45
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch
new file mode 100644
index 0000000000..0751827613
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch
@@ -0,0 +1,79 @@
1From 2bc7cb7193124d20aa4e1b5dbad0410bfb97a470 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 14:12:13 -0400
4Subject: [PATCH 05/10] fix: scsi: block: Remove REQ_OP_WRITE_SAME support
5 (v5.18)
6
7See upstream commit :
8
9 commit 73bd66d9c834220579c881a3eb020fd8917075d8
10 Author: Christoph Hellwig <hch@lst.de>
11 Date: Wed Feb 9 09:28:28 2022 +0100
12
13 scsi: block: Remove REQ_OP_WRITE_SAME support
14
15 No more users of REQ_OP_WRITE_SAME or drivers implementing it are left,
16 so remove the infrastructure.
17
18Upstream-Status: Backport
19
20Change-Id: Ifbff71f79f8b590436fc7cb79f82d90c6e033d84
21Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
22Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23---
24 include/instrumentation/events/block.h | 32 ++++++++++++++++++++++++++
25 1 file changed, 32 insertions(+)
26
27diff --git a/include/instrumentation/events/block.h b/include/instrumentation/events/block.h
28index 3e1104d7..050a59a2 100644
29--- a/include/instrumentation/events/block.h
30+++ b/include/instrumentation/events/block.h
31@@ -66,6 +66,37 @@ LTTNG_TRACEPOINT_ENUM(block_rq_type,
32 #define lttng_bio_op(bio) bio_op(bio)
33 #define lttng_bio_rw(bio) ((bio)->bi_opf)
34
35+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
36+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
37+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
38+ ctf_enum(block_rq_type, type, rwbs, \
39+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
40+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
41+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
42+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
43+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
44+ ( 0 )))))) \
45+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
46+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
47+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
48+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
49+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
50+#else
51+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
52+ ctf_integer(type, rwbs, \
53+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
54+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
55+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
56+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
57+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
58+ ( 0 )))))) \
59+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
60+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
61+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
62+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
63+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
64+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
65+#else
66 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
67 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
68 ctf_enum(block_rq_type, type, rwbs, \
69@@ -95,6 +126,7 @@ LTTNG_TRACEPOINT_ENUM(block_rq_type,
70 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
71 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
72 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
73+#endif
74
75 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
76
77--
782.19.1
79
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch
new file mode 100644
index 0000000000..9c2f70d4af
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch
@@ -0,0 +1,47 @@
1From 369d82bb1746447514c877088d7c5fd0f39140f8 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 14:33:42 -0400
4Subject: [PATCH 06/10] fix: random: remove unused tracepoints (v5.18)
5
6See upstream commit :
7
8 commit 14c174633f349cb41ea90c2c0aaddac157012f74
9 Author: Jason A. Donenfeld <Jason@zx2c4.com>
10 Date: Thu Feb 10 16:40:44 2022 +0100
11
12 random: remove unused tracepoints
13
14 These explicit tracepoints aren't really used and show sign of aging.
15 It's work to keep these up to date, and before I attempted to keep them
16 up to date, they weren't up to date, which indicates that they're not
17 really used. These days there are better ways of introspecting anyway.
18
19Upstream-Status: Backport
20
21Change-Id: I3b8c3e2732e7efdd76ce63204ac53a48784d0df6
22Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
24---
25 src/probes/Kbuild | 5 ++++-
26 1 file changed, 4 insertions(+), 1 deletion(-)
27
28diff --git a/src/probes/Kbuild b/src/probes/Kbuild
29index e26b4359..8d6ff0f2 100644
30--- a/src/probes/Kbuild
31+++ b/src/probes/Kbuild
32@@ -187,8 +187,11 @@ ifneq ($(CONFIG_FRAME_WARN),0)
33 CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
34 endif
35
36+# Introduced in v3.6, remove in v5.18
37 obj-$(CONFIG_LTTNG) += $(shell \
38- if [ $(VERSION) -ge 4 \
39+ if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) \) \
40+ -a \
41+ $(VERSION) -ge 4 \
42 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
43 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
44 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
45--
462.19.1
47
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch
new file mode 100644
index 0000000000..effd37ffe1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch
@@ -0,0 +1,72 @@
1From 3c46ddc134621dba65030263aa321dd6bdae3ba3 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:02:10 -0400
4Subject: [PATCH 07/10] fix: kprobes: Use rethook for kretprobe if possible
5 (v5.18)
6
7See upstream commit :
8
9 commit 73f9b911faa74ac5107879de05c9489c419f41bb
10 Author: Masami Hiramatsu <mhiramat@kernel.org>
11 Date: Sat Mar 26 11:27:05 2022 +0900
12
13 kprobes: Use rethook for kretprobe if possible
14
15 Use rethook for kretprobe function return hooking if the arch sets
16 CONFIG_HAVE_RETHOOK=y. In this case, CONFIG_KRETPROBE_ON_RETHOOK is
17 set to 'y' automatically, and the kretprobe internal data fields
18 switches to use rethook. If not, it continues to use kretprobe
19 specific function return hooks.
20
21Upstream-Status: Backport
22
23Change-Id: I2b7670dc04e4769c1e3c372582ad2f555f6d7a66
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26---
27 include/wrapper/kprobes.h | 17 +++++++++++++++++
28 src/probes/lttng-kretprobes.c | 2 +-
29 2 files changed, 18 insertions(+), 1 deletion(-)
30
31diff --git a/include/wrapper/kprobes.h b/include/wrapper/kprobes.h
32index b546d615..51d32b7c 100644
33--- a/include/wrapper/kprobes.h
34+++ b/include/wrapper/kprobes.h
35@@ -29,4 +29,21 @@ struct kretprobe *lttng_get_kretprobe(struct kretprobe_instance *ri)
36
37 #endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) */
38
39+
40+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
41+static inline
42+unsigned long lttng_get_kretprobe_retaddr(struct kretprobe_instance *ri)
43+{
44+ return get_kretprobe_retaddr(ri);
45+}
46+
47+#else
48+
49+static inline
50+unsigned long lttng_get_kretprobe_retaddr(struct kretprobe_instance *ri)
51+{
52+ return (unsigned long) ri->ret_addr;
53+}
54+#endif
55+
56 #endif /* _LTTNG_WRAPPER_KPROBES_H */
57diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c
58index 5cb2e953..565df739 100644
59--- a/src/probes/lttng-kretprobes.c
60+++ b/src/probes/lttng-kretprobes.c
61@@ -81,7 +81,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
62 int ret;
63
64 payload.ip = (unsigned long) lttng_get_kretprobe(krpi)->kp.addr;
65- payload.parent_ip = (unsigned long) krpi->ret_addr;
66+ payload.parent_ip = lttng_get_kretprobe_retaddr(krpi);
67
68 lib_ring_buffer_ctx_init(&ctx, event_recorder, sizeof(payload),
69 lttng_alignof(payload), &lttng_probe_ctx);
70--
712.19.1
72
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch
new file mode 100644
index 0000000000..13c504b859
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch
@@ -0,0 +1,44 @@
1From e8d2f286b5b208ac8870d0a9c167b170e96169b3 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:08:48 -0400
4Subject: [PATCH 08/10] fix: scsi: core: Remove <scsi/scsi_request.h> (v5.18)
5
6See upstream commit :
7
8 commit 26440303310591e29121964ede0048583cb3126d
9 Author: Christoph Hellwig <hch@lst.de>
10 Date: Thu Feb 24 18:55:52 2022 +0100
11
12 scsi: core: Remove <scsi/scsi_request.h>
13
14 This header is empty now except for an include of <linux/blk-mq.h>, so
15 remove it.
16
17Upstream-Status: Backport
18
19Change-Id: Ic8ee3352f1e8bddfcd44c31be9b788db82f183aa
20Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
21Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22---
23 include/instrumentation/events/block.h | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26diff --git a/include/instrumentation/events/block.h b/include/instrumentation/events/block.h
27index 050a59a2..882e6e08 100644
28--- a/include/instrumentation/events/block.h
29+++ b/include/instrumentation/events/block.h
30@@ -11,9 +11,9 @@
31 #include <linux/trace_seq.h>
32 #include <lttng/kernel-version.h>
33
34-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
35+#if LTTNG_KERNEL_RANGE(4,11,0, 5,18,0)
36 #include <scsi/scsi_request.h>
37-#endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
38+#endif /* LTTNG_KERNEL_RANGE(4,11,0, 5,18,0) */
39
40 #ifndef _TRACE_BLOCK_DEF_
41 #define _TRACE_BLOCK_DEF_
42--
432.19.1
44
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch
new file mode 100644
index 0000000000..90fec9dc58
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch
@@ -0,0 +1,76 @@
1From 82fbf9d383ff9069808fb0f5f75c660098dbae52 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Tue, 5 Apr 2022 14:57:41 -0400
4Subject: [PATCH 09/10] Rename genhd wrapper to blkdev
5
6The genhd.h header was folded into blkdev.h in v5.18, rename our wrapper
7to follow upstream.
8
9Upstream-Status: Backport
10
11Change-Id: I4ec94fb94d11712dd20f0680aea1de77fbfa9d17
12Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
13Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14---
15 include/wrapper/{genhd.h => blkdev.h} | 10 +++++-----
16 src/lttng-statedump-impl.c | 2 +-
17 2 files changed, 6 insertions(+), 6 deletions(-)
18 rename include/wrapper/{genhd.h => blkdev.h} (93%)
19
20diff --git a/include/wrapper/genhd.h b/include/wrapper/blkdev.h
21similarity index 93%
22rename from include/wrapper/genhd.h
23rename to include/wrapper/blkdev.h
24index 4a59b68e..0d5ad90f 100644
25--- a/include/wrapper/genhd.h
26+++ b/include/wrapper/blkdev.h
27@@ -1,6 +1,6 @@
28 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
29 *
30- * wrapper/genhd.h
31+ * wrapper/blkdev.h
32 *
33 * wrapper around block layer functions and data structures. Using
34 * KALLSYMS to get its address when available, else we need to have a
35@@ -9,8 +9,8 @@
36 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
37 */
38
39-#ifndef _LTTNG_WRAPPER_GENHD_H
40-#define _LTTNG_WRAPPER_GENHD_H
41+#ifndef _LTTNG_WRAPPER_BLKDEV_H
42+#define _LTTNG_WRAPPER_BLKDEV_H
43
44 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
45 #include <linux/blkdev.h>
46@@ -45,7 +45,7 @@ struct class *wrapper_get_block_class(void)
47 /*
48 * Canary function to check for 'block_class' at compile time.
49 *
50- * From 'include/linux/genhd.h':
51+ * From 'include/linux/blkdev.h':
52 *
53 * extern struct class block_class;
54 */
55@@ -104,4 +104,4 @@ struct device_type *wrapper_get_disk_type(void)
56
57 #endif
58
59-#endif /* _LTTNG_WRAPPER_GENHD_H */
60+#endif /* _LTTNG_WRAPPER_BLKDEV_H */
61diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c
62index 4d7b2921..0e753090 100644
63--- a/src/lttng-statedump-impl.c
64+++ b/src/lttng-statedump-impl.c
65@@ -41,7 +41,7 @@
66 #include <wrapper/namespace.h>
67 #include <wrapper/irq.h>
68 #include <wrapper/tracepoint.h>
69-#include <wrapper/genhd.h>
70+#include <wrapper/blkdev.h>
71 #include <wrapper/file.h>
72 #include <wrapper/fdtable.h>
73 #include <wrapper/sched.h>
74--
752.19.1
76
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch
new file mode 100644
index 0000000000..892d3f0d23
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch
@@ -0,0 +1,106 @@
1From f9208dc00756dfa0a2f191799722030bdf3f793d Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:14:01 -0400
4Subject: [PATCH 10/10] fix: mm: compaction: cleanup the compaction trace
5 events (v5.18)
6
7See upstream commit :
8
9 commit abd4349ff9b8d242376b67711254221f64f447c7
10 Author: Baolin Wang <baolin.wang@linux.alibaba.com>
11 Date: Tue Mar 22 14:45:56 2022 -0700
12
13 mm: compaction: cleanup the compaction trace events
14
15 As Steven suggested [1], we should access the pointers from the trace
16 event to avoid dereferencing them to the tracepoint function when the
17 tracepoint is disabled.
18
19 [1] https://lkml.org/lkml/2021/11/3/409
20
21Upstream-Status: Backport
22
23Change-Id: I6c08250df8596e8dbc76780ae5d95c899c12e6fe
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26---
27 include/instrumentation/events/compaction.h | 17 ++++++++++++++++-
28 src/probes/Kbuild | 17 ++++++++++++++++-
29 src/probes/lttng-probe-compaction.c | 5 +++++
30 3 files changed, 37 insertions(+), 2 deletions(-)
31
32diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
33index 15964537..ecae39a8 100644
34--- a/include/instrumentation/events/compaction.h
35+++ b/include/instrumentation/events/compaction.h
36@@ -97,7 +97,22 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
37
38 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
39
40-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
41+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
42+LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
43+
44+ compaction_migratepages,
45+
46+ TP_PROTO(struct compact_control *cc,
47+ unsigned int nr_succeeded),
48+
49+ TP_ARGS(cc, nr_succeeded),
50+
51+ TP_FIELDS(
52+ ctf_integer(unsigned long, nr_migrated, nr_succeeded)
53+ ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded)
54+ )
55+)
56+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
57 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
58
59 compaction_migratepages,
60diff --git a/src/probes/Kbuild b/src/probes/Kbuild
61index 8d6ff0f2..54784477 100644
62--- a/src/probes/Kbuild
63+++ b/src/probes/Kbuild
64@@ -167,7 +167,22 @@ ifneq ($(CONFIG_BTRFS_FS),)
65 endif # $(wildcard $(btrfs_dep))
66 endif # CONFIG_BTRFS_FS
67
68-obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o
69+# A dependency on internal header 'mm/internal.h' was introduced in v5.18
70+compaction_dep = $(srctree)/mm/internal.h
71+compaction_dep_wildcard = $(wildcard $(compaction_dep))
72+compaction_dep_check = $(shell \
73+if [ \( $(VERSION) -ge 6 \
74+ -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) -a \
75+ -z "$(compaction_dep_wildcard)" ] ; then \
76+ echo "warn" ; \
77+else \
78+ echo "ok" ; \
79+fi ;)
80+ifeq ($(compaction_dep_check),ok)
81+ obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o
82+else
83+ $(warning Files $(compaction_dep) not found. Probe "compaction" is disabled. Use full kernel source tree to enable it.)
84+endif # $(wildcard $(compaction_dep))
85
86 ifneq ($(CONFIG_EXT4_FS),)
87 ext4_dep = $(srctree)/fs/ext4/*.h
88diff --git a/src/probes/lttng-probe-compaction.c b/src/probes/lttng-probe-compaction.c
89index f8ddf384..ffaf45f0 100644
90--- a/src/probes/lttng-probe-compaction.c
91+++ b/src/probes/lttng-probe-compaction.c
92@@ -10,6 +10,11 @@
93
94 #include <linux/module.h>
95 #include <lttng/tracer.h>
96+#include <lttng/kernel-version.h>
97+
98+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
99+#include "../mm/internal.h"
100+#endif
101
102 /*
103 * Create the tracepoint static inlines from the kernel to validate that our
104--
1052.19.1
106
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb
index b6f8ac1315..2b00534e53 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb
@@ -9,7 +9,19 @@ inherit module
9 9
10include lttng-platforms.inc 10include lttng-platforms.inc
11 11
12SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2" 12SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
13 file://0001-Fix-compaction-migratepages-event-name.patch \
14 file://0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch \
15 file://0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch \
16 file://0004-fix-block-remove-genhd.h-v5.18.patch \
17 file://0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch \
18 file://0006-fix-random-remove-unused-tracepoints-v5.18.patch \
19 file://0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch \
20 file://0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch \
21 file://0009-Rename-genhd-wrapper-to-blkdev.patch \
22 file://0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch \
23 "
24
13# Use :append here so that the patch is applied also when using devupstream 25# Use :append here so that the patch is applied also when using devupstream
14SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" 26SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch"
15 27