summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2022-01-14 13:23:34 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-12 16:42:13 +0100
commit188059a9c5ef2375eb4471ca87ac1e4578dc9ba9 (patch)
treecf43999e7952d753d5b76ee24f6531fd39495b58
parent3e48263df5e774b74e5225c651afa67e0e2ad60c (diff)
downloadpoky-188059a9c5ef2375eb4471ca87ac1e4578dc9ba9.tar.gz
lttng-modules: update to 2.13.1
Bumping lttng-modules to 2.13.1, which fixes the build against 5.16+ kernels. We drop two previously backported patches. The following commits are part of this update: 8c0aec7e Version 2.13.1 533556cd fix: mm: move kvmalloc-related functions to slab.h (v5.16) 2f0087ab fix: block: don't call blk_status_to_errno in blk_update_request (v5.16) 9b092ff2 fix: KVM: MMU: change tracepoints arguments to kvm_page_fault (v5.16) 036297af fix: KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info (v5.16) a029f2a3 fix: isystem: delete global -isystem compile option (v5.16) d82de6f3 fix: block: move block-related definitions out of fs.h (v5.16) 4fabf854 Fix: syscall tracing: missing trigger actions 38b35aff Warn on event registration/unregistration failure e26f740b fix: implicit-int error in EXPORT_SYMBOL_GPL c570be0d fix: Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" (v5.15) 8be4c8a3 fix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15) (From OE-Core rev: e0c8a921e9cc9fd1c0f120a3012990bba87957cd) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2edeebed4ff172f77e337af82fc1cddc681881df) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch394
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch829
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.13.1.bb (renamed from meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb)4
3 files changed, 1 insertions, 1226 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch
deleted file mode 100644
index 4e52e5f122..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch
+++ /dev/null
@@ -1,394 +0,0 @@
1From 8be4c8a38ee1e297578e094a6e4c143ec5259aba Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 13 Sep 2021 12:00:38 -0400
4Subject: [PATCH 1/2] fix: cpu/hotplug: Remove deprecated CPU-hotplug
5 functions. (v5.15)
6
7The CPU-hotplug functions get|put_online_cpus() were deprecated in v4.13
8and removed in v5.15.
9
10See upstream commits :
11
12commit 8c854303ce0e38e5bbedd725ff39da7e235865d8
13Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
14Date: Tue Aug 3 16:16:21 2021 +0200
15
16 cpu/hotplug: Remove deprecated CPU-hotplug functions.
17
18 No users in tree use the deprecated CPU-hotplug functions anymore.
19
20 Remove them.
21
22Introduced in v4.13 :
23
24 commit 8f553c498e1772cccb39a114da4a498d22992758
25 Author: Thomas Gleixner <tglx@linutronix.de>
26 Date: Wed May 24 10:15:12 2017 +0200
27
28 cpu/hotplug: Provide cpus_read|write_[un]lock()
29
30 The counting 'rwsem' hackery of get|put_online_cpus() is going to be
31 replaced by percpu rwsem.
32
33 Rename the functions to make it clear that it's locking and not some
34 refcount style interface. These new functions will be used for the
35 preparatory patches which make the code ready for the percpu rwsem
36 conversion.
37
38 Rename all instances in the cpu hotplug code while at it.
39
40Upstream-Status: backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=ffcc873470121ef1ebb110df3d9038a38d9cb7cb]
41
42Change-Id: I5a37cf5afc075a402b7347989fac637dfa60a1ed
43Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
44Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
45---
46 include/wrapper/cpu.h | 44 +++++++++++++++++++++++
47 src/lib/ringbuffer/ring_buffer_backend.c | 8 ++---
48 src/lib/ringbuffer/ring_buffer_frontend.c | 17 ++++-----
49 src/lib/ringbuffer/ring_buffer_iterator.c | 15 ++++----
50 src/lttng-context-perf-counters.c | 11 +++---
51 src/lttng-statedump-impl.c | 6 ++--
52 6 files changed, 74 insertions(+), 27 deletions(-)
53 create mode 100644 include/wrapper/cpu.h
54
55diff --git a/include/wrapper/cpu.h b/include/wrapper/cpu.h
56new file mode 100644
57index 00000000..cbee1962
58--- /dev/null
59+++ b/include/wrapper/cpu.h
60@@ -0,0 +1,44 @@
61+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
62+ *
63+ * wrapper/cpu.h
64+ *
65+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
66+ */
67+
68+#ifndef _LTTNG_WRAPPER_CPU_H
69+#define _LTTNG_WRAPPER_CPU_H
70+
71+#include <linux/cpu.h>
72+#include <lttng/kernel-version.h>
73+
74+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0))
75+
76+static inline
77+void lttng_cpus_read_lock(void)
78+{
79+ cpus_read_lock();
80+}
81+
82+static inline
83+void lttng_cpus_read_unlock(void)
84+{
85+ cpus_read_unlock();
86+}
87+
88+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
89+
90+static inline
91+void lttng_cpus_read_lock(void)
92+{
93+ get_online_cpus();
94+}
95+
96+static inline
97+void lttng_cpus_read_unlock(void)
98+{
99+ put_online_cpus();
100+}
101+
102+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
103+
104+#endif /* _LTTNG_WRAPPER_CPU_H */
105diff --git a/src/lib/ringbuffer/ring_buffer_backend.c b/src/lib/ringbuffer/ring_buffer_backend.c
106index 26efb2bc..9a339be0 100644
107--- a/src/lib/ringbuffer/ring_buffer_backend.c
108+++ b/src/lib/ringbuffer/ring_buffer_backend.c
109@@ -12,10 +12,10 @@
110 #include <linux/delay.h>
111 #include <linux/errno.h>
112 #include <linux/slab.h>
113-#include <linux/cpu.h>
114 #include <linux/mm.h>
115 #include <linux/vmalloc.h>
116
117+#include <wrapper/cpu.h>
118 #include <wrapper/mm.h>
119 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
120 #include <ringbuffer/config.h>
121@@ -445,14 +445,14 @@ int channel_backend_init(struct channel_backend *chanb,
122 chanb->cpu_hp_notifier.priority = 5;
123 register_hotcpu_notifier(&chanb->cpu_hp_notifier);
124
125- get_online_cpus();
126+ lttng_cpus_read_lock();
127 for_each_online_cpu(i) {
128 ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i),
129 chanb, i);
130 if (ret)
131 goto free_bufs; /* cpu hotplug locked */
132 }
133- put_online_cpus();
134+ lttng_cpus_read_unlock();
135 #else
136 for_each_possible_cpu(i) {
137 ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i),
138@@ -485,7 +485,7 @@ free_bufs:
139 */
140 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
141 #ifdef CONFIG_HOTPLUG_CPU
142- put_online_cpus();
143+ lttng_cpus_read_unlock();
144 unregister_hotcpu_notifier(&chanb->cpu_hp_notifier);
145 #endif
146 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
147diff --git a/src/lib/ringbuffer/ring_buffer_frontend.c b/src/lib/ringbuffer/ring_buffer_frontend.c
148index e9056118..87a575d0 100644
149--- a/src/lib/ringbuffer/ring_buffer_frontend.c
150+++ b/src/lib/ringbuffer/ring_buffer_frontend.c
151@@ -48,6 +48,7 @@
152 #include <ringbuffer/iterator.h>
153 #include <ringbuffer/nohz.h>
154 #include <wrapper/atomic.h>
155+#include <wrapper/cpu.h>
156 #include <wrapper/kref.h>
157 #include <wrapper/percpu-defs.h>
158 #include <wrapper/timer.h>
159@@ -724,7 +725,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel
160 int cpu;
161
162 #ifdef CONFIG_HOTPLUG_CPU
163- get_online_cpus();
164+ lttng_cpus_read_lock();
165 chan->cpu_hp_enable = 0;
166 for_each_online_cpu(cpu) {
167 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
168@@ -732,7 +733,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel
169 lib_ring_buffer_stop_switch_timer(buf);
170 lib_ring_buffer_stop_read_timer(buf);
171 }
172- put_online_cpus();
173+ lttng_cpus_read_unlock();
174 unregister_cpu_notifier(&chan->cpu_hp_notifier);
175 #else
176 for_each_possible_cpu(cpu) {
177@@ -772,14 +773,14 @@ void lib_ring_buffer_set_quiescent_channel(struct lttng_kernel_ring_buffer_chann
178 const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
179
180 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
181- get_online_cpus();
182+ lttng_cpus_read_lock();
183 for_each_channel_cpu(cpu, chan) {
184 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
185 cpu);
186
187 lib_ring_buffer_set_quiescent(buf);
188 }
189- put_online_cpus();
190+ lttng_cpus_read_unlock();
191 } else {
192 struct lttng_kernel_ring_buffer *buf = chan->backend.buf;
193
194@@ -794,14 +795,14 @@ void lib_ring_buffer_clear_quiescent_channel(struct lttng_kernel_ring_buffer_cha
195 const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
196
197 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
198- get_online_cpus();
199+ lttng_cpus_read_lock();
200 for_each_channel_cpu(cpu, chan) {
201 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
202 cpu);
203
204 lib_ring_buffer_clear_quiescent(buf);
205 }
206- put_online_cpus();
207+ lttng_cpus_read_unlock();
208 } else {
209 struct lttng_kernel_ring_buffer *buf = chan->backend.buf;
210
211@@ -899,7 +900,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne
212 chan->cpu_hp_notifier.priority = 6;
213 register_cpu_notifier(&chan->cpu_hp_notifier);
214
215- get_online_cpus();
216+ lttng_cpus_read_lock();
217 for_each_online_cpu(cpu) {
218 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
219 cpu);
220@@ -909,7 +910,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne
221 spin_unlock(&per_cpu(ring_buffer_nohz_lock, cpu));
222 }
223 chan->cpu_hp_enable = 1;
224- put_online_cpus();
225+ lttng_cpus_read_unlock();
226 #else
227 for_each_possible_cpu(cpu) {
228 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
229diff --git a/src/lib/ringbuffer/ring_buffer_iterator.c b/src/lib/ringbuffer/ring_buffer_iterator.c
230index 25839af6..60c95ca6 100644
231--- a/src/lib/ringbuffer/ring_buffer_iterator.c
232+++ b/src/lib/ringbuffer/ring_buffer_iterator.c
233@@ -10,6 +10,7 @@
234 */
235
236 #include <ringbuffer/iterator.h>
237+#include <wrapper/cpu.h>
238 #include <wrapper/file.h>
239 #include <wrapper/uaccess.h>
240 #include <linux/jiffies.h>
241@@ -440,13 +441,13 @@ int channel_iterator_init(struct lttng_kernel_ring_buffer_channel *chan)
242 chan->hp_iter_notifier.priority = 10;
243 register_cpu_notifier(&chan->hp_iter_notifier);
244
245- get_online_cpus();
246+ lttng_cpus_read_lock();
247 for_each_online_cpu(cpu) {
248 buf = per_cpu_ptr(chan->backend.buf, cpu);
249 lib_ring_buffer_iterator_init(chan, buf);
250 }
251 chan->hp_iter_enable = 1;
252- put_online_cpus();
253+ lttng_cpus_read_unlock();
254 #else
255 for_each_possible_cpu(cpu) {
256 buf = per_cpu_ptr(chan->backend.buf, cpu);
257@@ -519,7 +520,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
258 CHAN_WARN_ON(chan, config->output != RING_BUFFER_ITERATOR);
259
260 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
261- get_online_cpus();
262+ lttng_cpus_read_lock();
263 /* Allow CPU hotplug to keep track of opened reader */
264 chan->iter.read_open = 1;
265 for_each_channel_cpu(cpu, chan) {
266@@ -529,7 +530,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
267 goto error;
268 buf->iter.read_open = 1;
269 }
270- put_online_cpus();
271+ lttng_cpus_read_unlock();
272 } else {
273 buf = channel_get_ring_buffer(config, chan, 0);
274 ret = lib_ring_buffer_iterator_open(buf);
275@@ -538,7 +539,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
276 error:
277 /* Error should always happen on CPU 0, hence no close is required. */
278 CHAN_WARN_ON(chan, cpu != 0);
279- put_online_cpus();
280+ lttng_cpus_read_unlock();
281 return ret;
282 }
283 EXPORT_SYMBOL_GPL(channel_iterator_open);
284@@ -550,7 +551,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan)
285 int cpu;
286
287 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
288- get_online_cpus();
289+ lttng_cpus_read_lock();
290 for_each_channel_cpu(cpu, chan) {
291 buf = channel_get_ring_buffer(config, chan, cpu);
292 if (buf->iter.read_open) {
293@@ -559,7 +560,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan)
294 }
295 }
296 chan->iter.read_open = 0;
297- put_online_cpus();
298+ lttng_cpus_read_unlock();
299 } else {
300 buf = channel_get_ring_buffer(config, chan, 0);
301 lib_ring_buffer_iterator_release(buf);
302diff --git a/src/lttng-context-perf-counters.c b/src/lttng-context-perf-counters.c
303index b0227d47..372f05e0 100644
304--- a/src/lttng-context-perf-counters.c
305+++ b/src/lttng-context-perf-counters.c
306@@ -16,6 +16,7 @@
307 #include <lttng/events.h>
308 #include <lttng/events-internal.h>
309 #include <ringbuffer/frontend_types.h>
310+#include <wrapper/cpu.h>
311 #include <wrapper/vmalloc.h>
312 #include <wrapper/perf.h>
313 #include <lttng/tracer.h>
314@@ -97,10 +98,10 @@ void lttng_destroy_perf_counter_ctx_field(void *priv)
315 {
316 int cpu;
317
318- get_online_cpus();
319+ lttng_cpus_read_lock();
320 for_each_online_cpu(cpu)
321 perf_event_release_kernel(events[cpu]);
322- put_online_cpus();
323+ lttng_cpus_read_unlock();
324 #ifdef CONFIG_HOTPLUG_CPU
325 unregister_cpu_notifier(&perf_field->nb);
326 #endif
327@@ -304,7 +305,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
328 perf_field->nb.priority = 0;
329 register_cpu_notifier(&perf_field->nb);
330 #endif
331- get_online_cpus();
332+ lttng_cpus_read_lock();
333 for_each_online_cpu(cpu) {
334 events[cpu] = wrapper_perf_event_create_kernel_counter(attr,
335 cpu, NULL, overflow_callback);
336@@ -317,7 +318,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
337 goto counter_busy;
338 }
339 }
340- put_online_cpus();
341+ lttng_cpus_read_unlock();
342 perf_field->hp_enable = 1;
343 }
344 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
345@@ -351,7 +352,7 @@ counter_error:
346 if (events[cpu] && !IS_ERR(events[cpu]))
347 perf_event_release_kernel(events[cpu]);
348 }
349- put_online_cpus();
350+ lttng_cpus_read_unlock();
351 #ifdef CONFIG_HOTPLUG_CPU
352 unregister_cpu_notifier(&perf_field->nb);
353 #endif
354diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c
355index 4dfbca0b..2b42783a 100644
356--- a/src/lttng-statedump-impl.c
357+++ b/src/lttng-statedump-impl.c
358@@ -23,7 +23,6 @@
359 #include <linux/file.h>
360 #include <linux/interrupt.h>
361 #include <linux/irqnr.h>
362-#include <linux/cpu.h>
363 #include <linux/netdevice.h>
364 #include <linux/inetdevice.h>
365 #include <linux/mm.h>
366@@ -34,6 +33,7 @@
367
368 #include <lttng/events.h>
369 #include <lttng/tracer.h>
370+#include <wrapper/cpu.h>
371 #include <wrapper/irqdesc.h>
372 #include <wrapper/fdtable.h>
373 #include <wrapper/namespace.h>
374@@ -770,7 +770,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session)
375 * is to guarantee that each CPU has been in a state where is was in
376 * syscall mode (i.e. not in a trap, an IRQ or a soft IRQ).
377 */
378- get_online_cpus();
379+ lttng_cpus_read_lock();
380 atomic_set(&kernel_threads_to_run, num_online_cpus());
381 for_each_online_cpu(cpu) {
382 INIT_DELAYED_WORK(&cpu_work[cpu], lttng_statedump_work_func);
383@@ -778,7 +778,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session)
384 }
385 /* Wait for all threads to run */
386 __wait_event(statedump_wq, (atomic_read(&kernel_threads_to_run) == 0));
387- put_online_cpus();
388+ lttng_cpus_read_unlock();
389 /* Our work is done */
390 trace_lttng_statedump_end(session);
391 return 0;
392--
3932.19.1
394
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch
deleted file mode 100644
index 5b5edc5319..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch
+++ /dev/null
@@ -1,829 +0,0 @@
1From c570be0da77e963d77bac099d468bc0cd5f1bd63 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 13 Sep 2021 14:16:22 -0400
4Subject: [PATCH 2/2] fix: Revert "Makefile: Enable -Wimplicit-fallthrough for
5 Clang" (v5.15)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Starting with v5.15, "-Wimplicit-fallthrough=5" was added to the build
11flags which requires the use of "__attribute__((__fallthrough__))" to
12annotate fallthrough case statements.
13
14See upstream commit by the man himself:
15
16 commit d936eb23874433caa3e3d841cfa16f5434b85dcf
17 Author: Linus Torvalds <torvalds@linux-foundation.org>
18 Date: Thu Jul 15 18:05:31 2021 -0700
19
20 Revert "Makefile: Enable -Wimplicit-fallthrough for Clang"
21
22 This reverts commit b7eb335e26a9c7f258c96b3962c283c379d3ede0.
23
24 It turns out that the problem with the clang -Wimplicit-fallthrough
25 warning is not about the kernel source code, but about clang itself, and
26 that the warning is unusable until clang fixes its broken ways.
27
28 In particular, when you enable this warning for clang, you not only get
29 warnings about implicit fallthroughs. You also get this:
30
31 warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
32
33 which is completely broken becasue it
34
35 (a) doesn't even tell you where the problem is (seriously: no line
36 numbers, no filename, no nothing).
37
38 (b) is fundamentally broken anyway, because there are perfectly valid
39 reasons to have a fallthrough statement even if it turns out that
40 it can perhaps not be reached.
41
42 In the kernel, an example of that second case is code in the scheduler:
43
44 switch (state) {
45 case cpuset:
46 if (IS_ENABLED(CONFIG_CPUSETS)) {
47 cpuset_cpus_allowed_fallback(p);
48 state = possible;
49 break;
50 }
51 fallthrough;
52 case possible:
53
54 where if CONFIG_CPUSETS is enabled you actually never hit the
55 fallthrough case at all. But that in no way makes the fallthrough
56 wrong.
57
58 So the warning is completely broken, and enabling it for clang is a very
59 bad idea.
60
61 In the meantime, we can keep the gcc option enabled, and make the gcc
62 build use
63
64 -Wimplicit-fallthrough=5
65
66 which means that we will at least continue to require a proper
67 fallthrough statement, and that gcc won't silently accept the magic
68 comment versions. Because gcc does this all correctly, and while the odd
69 "=5" part is kind of obscure, it's documented in [1]:
70
71 "-Wimplicit-fallthrough=5 doesn’t recognize any comments as
72 fallthrough comments, only attributes disable the warning"
73
74 so if clang ever fixes its bad behavior we can try enabling it there again.
75
76Upstream-Status: backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=c190d76e8c7b44d62b3651ab845b765c1b1f8104]
77
78Change-Id: Iea69849592fb69ac04fb9bb28efcd6b8dce8ba88
79Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
80Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
81---
82 include/counter/counter-api.h | 4 +-
83 include/lttng/events-internal.h | 11 ++-
84 include/wrapper/compiler_attributes.h | 34 +++++++
85 src/lib/counter/counter.c | 13 ++-
86 src/lttng-abi.c | 91 ++++++++++++------
87 src/lttng-bytecode-interpreter.c | 4 +-
88 src/lttng-bytecode-specialize.c | 5 +-
89 src/lttng-events.c | 129 +++++++++++++++++---------
90 src/lttng-string-utils.c | 3 +-
91 src/probes/lttng-kretprobes.c | 7 +-
92 10 files changed, 215 insertions(+), 86 deletions(-)
93 create mode 100644 include/wrapper/compiler_attributes.h
94
95diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h
96index fbc65818..c9f2b141 100644
97--- a/include/counter/counter-api.h
98+++ b/include/counter/counter-api.h
99@@ -15,6 +15,7 @@
100 #include <linux/bitops.h>
101 #include <counter/counter.h>
102 #include <counter/counter-internal.h>
103+#include <wrapper/compiler_attributes.h>
104 #include <wrapper/limits.h>
105
106 /*
107@@ -256,7 +257,8 @@ static __always_inline int lttng_counter_add(const struct lib_counter_config *co
108 const size_t *dimension_indexes, int64_t v)
109 {
110 switch (config->alloc) {
111- case COUNTER_ALLOC_PER_CPU: /* Fallthrough */
112+ case COUNTER_ALLOC_PER_CPU:
113+ lttng_fallthrough;
114 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
115 return __lttng_counter_add_percpu(config, counter, dimension_indexes, v);
116 case COUNTER_ALLOC_GLOBAL:
117diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h
118index cd560de8..ca2190c4 100644
119--- a/include/lttng/events-internal.h
120+++ b/include/lttng/events-internal.h
121@@ -8,6 +8,8 @@
122 #ifndef _LTTNG_EVENTS_INTERNAL_H
123 #define _LTTNG_EVENTS_INTERNAL_H
124
125+#include <wrapper/compiler_attributes.h>
126+
127 #include <lttng/events.h>
128
129 struct lttng_syscall_filter;
130@@ -561,9 +563,12 @@ static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kern
131 if (!type_integer)
132 return false;
133 switch (type_integer->size) {
134- case 8: /* Fall-through. */
135- case 16: /* Fall-through. */
136- case 32: /* Fall-through. */
137+ case 8:
138+ lttng_fallthrough;
139+ case 16:
140+ lttng_fallthrough;
141+ case 32:
142+ lttng_fallthrough;
143 case 64:
144 break;
145 default:
146diff --git a/include/wrapper/compiler_attributes.h b/include/wrapper/compiler_attributes.h
147new file mode 100644
148index 00000000..c2c96e76
149--- /dev/null
150+++ b/include/wrapper/compiler_attributes.h
151@@ -0,0 +1,34 @@
152+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
153+ *
154+ * wrapper/compiler_attributes.h
155+ *
156+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
157+ */
158+
159+#ifndef _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H
160+#define _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H
161+
162+#include <lttng/kernel-version.h>
163+
164+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0))
165+#include <linux/compiler_attributes.h>
166+#endif
167+
168+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0))
169+
170+/*
171+ * Use the kernel provided fallthrough attribute macro.
172+ */
173+#define lttng_fallthrough fallthrough
174+
175+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */
176+
177+/*
178+ * Fallback to the comment for kernels pre 5.15 that don't build with
179+ * '-Wimplicit-fallthrough=5'.
180+ */
181+#define lttng_fallthrough do {} while (0) /* fallthrough */
182+
183+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */
184+
185+#endif /* _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H */
186diff --git a/src/lib/counter/counter.c b/src/lib/counter/counter.c
187index a4500a0e..bf038aac 100644
188--- a/src/lib/counter/counter.c
189+++ b/src/lib/counter/counter.c
190@@ -11,6 +11,7 @@
191 #include <linux/cpumask.h>
192 #include <counter/counter.h>
193 #include <counter/counter-internal.h>
194+#include <wrapper/compiler_attributes.h>
195 #include <wrapper/vmalloc.h>
196 #include <wrapper/limits.h>
197
198@@ -324,7 +325,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config,
199 *underflow = false;
200
201 switch (config->alloc) {
202- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */
203+ case COUNTER_ALLOC_GLOBAL:
204+ lttng_fallthrough;
205 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
206 /* Read global counter. */
207 ret = lttng_counter_read(config, counter, dimension_indexes,
208@@ -342,7 +344,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config,
209 switch (config->alloc) {
210 case COUNTER_ALLOC_GLOBAL:
211 break;
212- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */
213+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
214+ lttng_fallthrough;
215 case COUNTER_ALLOC_PER_CPU:
216 //TODO: integrate with CPU hotplug and online cpus
217 for (cpu = 0; cpu < num_possible_cpus(); cpu++) {
218@@ -448,7 +451,8 @@ int lttng_counter_clear(const struct lib_counter_config *config,
219 int cpu, ret;
220
221 switch (config->alloc) {
222- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */
223+ case COUNTER_ALLOC_GLOBAL:
224+ lttng_fallthrough;
225 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
226 /* Clear global counter. */
227 ret = lttng_counter_clear_cpu(config, counter, dimension_indexes, -1);
228@@ -462,7 +466,8 @@ int lttng_counter_clear(const struct lib_counter_config *config,
229 switch (config->alloc) {
230 case COUNTER_ALLOC_GLOBAL:
231 break;
232- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */
233+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
234+ lttng_fallthrough;
235 case COUNTER_ALLOC_PER_CPU:
236 //TODO: integrate with CPU hotplug and online cpus
237 for (cpu = 0; cpu < num_possible_cpus(); cpu++) {
238diff --git a/src/lttng-abi.c b/src/lttng-abi.c
239index cc453894..eac1afd1 100644
240--- a/src/lttng-abi.c
241+++ b/src/lttng-abi.c
242@@ -34,6 +34,7 @@
243 #include <ringbuffer/vfs.h>
244 #include <ringbuffer/backend.h>
245 #include <ringbuffer/frontend.h>
246+#include <wrapper/compiler_attributes.h>
247 #include <wrapper/poll.h>
248 #include <wrapper/file.h>
249 #include <wrapper/kref.h>
250@@ -1332,7 +1333,8 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
251 */
252 return -ENOSYS;
253 }
254- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
255+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
256+ lttng_fallthrough;
257 case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
258 {
259 struct lttng_metadata_stream *stream = filp->private_data;
260@@ -1441,7 +1443,8 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
261 */
262 return -ENOSYS;
263 }
264- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
265+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
266+ lttng_fallthrough;
267 case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
268 {
269 struct lttng_metadata_stream *stream = filp->private_data;
270@@ -1758,8 +1761,10 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
271 switch (event_param->instrumentation) {
272 case LTTNG_KERNEL_ABI_SYSCALL:
273 switch (event_param->u.syscall.entryexit) {
274- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */
275- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */
276+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
277+ lttng_fallthrough;
278+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
279+ lttng_fallthrough;
280 case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
281 break;
282 default:
283@@ -1783,20 +1788,26 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
284 switch (event_param->u.kretprobe.entryexit) {
285 case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
286 break;
287- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */
288- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */
289+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
290+ lttng_fallthrough;
291+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
292+ lttng_fallthrough;
293 default:
294 return -EINVAL;
295 }
296 break;
297
298- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
299- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
300+ case LTTNG_KERNEL_ABI_TRACEPOINT:
301+ lttng_fallthrough;
302+ case LTTNG_KERNEL_ABI_KPROBE:
303+ lttng_fallthrough;
304 case LTTNG_KERNEL_ABI_UPROBE:
305 break;
306
307- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
308- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
309+ case LTTNG_KERNEL_ABI_FUNCTION:
310+ lttng_fallthrough;
311+ case LTTNG_KERNEL_ABI_NOOP:
312+ lttng_fallthrough;
313 default:
314 return -EINVAL;
315 }
316@@ -1830,18 +1841,23 @@ int lttng_abi_create_event(struct file *channel_file,
317 }
318
319 switch (event_param->instrumentation) {
320- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
321+ case LTTNG_KERNEL_ABI_TRACEPOINT:
322+ lttng_fallthrough;
323 case LTTNG_KERNEL_ABI_SYSCALL:
324 fops = &lttng_event_recorder_enabler_fops;
325 break;
326- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
327- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
328+ case LTTNG_KERNEL_ABI_KPROBE:
329+ lttng_fallthrough;
330+ case LTTNG_KERNEL_ABI_KRETPROBE:
331+ lttng_fallthrough;
332 case LTTNG_KERNEL_ABI_UPROBE:
333 fops = &lttng_event_recorder_event_fops;
334 break;
335
336- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
337- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
338+ case LTTNG_KERNEL_ABI_FUNCTION:
339+ lttng_fallthrough;
340+ case LTTNG_KERNEL_ABI_NOOP:
341+ lttng_fallthrough;
342 default:
343 return -EINVAL;
344 }
345@@ -1867,7 +1883,8 @@ int lttng_abi_create_event(struct file *channel_file,
346 goto event_error;
347
348 switch (event_param->instrumentation) {
349- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
350+ case LTTNG_KERNEL_ABI_TRACEPOINT:
351+ lttng_fallthrough;
352 case LTTNG_KERNEL_ABI_SYSCALL:
353 {
354 struct lttng_event_enabler *event_enabler;
355@@ -1887,8 +1904,10 @@ int lttng_abi_create_event(struct file *channel_file,
356 break;
357 }
358
359- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
360- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
361+ case LTTNG_KERNEL_ABI_KPROBE:
362+ lttng_fallthrough;
363+ case LTTNG_KERNEL_ABI_KRETPROBE:
364+ lttng_fallthrough;
365 case LTTNG_KERNEL_ABI_UPROBE:
366 {
367 struct lttng_kernel_event_recorder *event;
368@@ -1908,8 +1927,10 @@ int lttng_abi_create_event(struct file *channel_file,
369 break;
370 }
371
372- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
373- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
374+ case LTTNG_KERNEL_ABI_FUNCTION:
375+ lttng_fallthrough;
376+ case LTTNG_KERNEL_ABI_NOOP:
377+ lttng_fallthrough;
378 default:
379 ret = -EINVAL;
380 goto event_error;
381@@ -2043,18 +2064,23 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
382 }
383
384 switch (event_notifier_param->event.instrumentation) {
385- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
386+ case LTTNG_KERNEL_ABI_TRACEPOINT:
387+ lttng_fallthrough;
388 case LTTNG_KERNEL_ABI_SYSCALL:
389 fops = &lttng_event_notifier_enabler_fops;
390 break;
391- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
392- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
393+ case LTTNG_KERNEL_ABI_KPROBE:
394+ lttng_fallthrough;
395+ case LTTNG_KERNEL_ABI_KRETPROBE:
396+ lttng_fallthrough;
397 case LTTNG_KERNEL_ABI_UPROBE:
398 fops = &lttng_event_notifier_event_fops;
399 break;
400
401- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
402- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
403+ case LTTNG_KERNEL_ABI_FUNCTION:
404+ lttng_fallthrough;
405+ case LTTNG_KERNEL_ABI_NOOP:
406+ lttng_fallthrough;
407 default:
408 ret = -EINVAL;
409 goto inval_instr;
410@@ -2086,7 +2112,8 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
411 goto event_notifier_error;
412
413 switch (event_notifier_param->event.instrumentation) {
414- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
415+ case LTTNG_KERNEL_ABI_TRACEPOINT:
416+ lttng_fallthrough;
417 case LTTNG_KERNEL_ABI_SYSCALL:
418 {
419 struct lttng_event_notifier_enabler *enabler;
420@@ -2110,8 +2137,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
421 break;
422 }
423
424- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
425- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
426+ case LTTNG_KERNEL_ABI_KPROBE:
427+ lttng_fallthrough;
428+ case LTTNG_KERNEL_ABI_KRETPROBE:
429+ lttng_fallthrough;
430 case LTTNG_KERNEL_ABI_UPROBE:
431 {
432 struct lttng_kernel_event_notifier *event_notifier;
433@@ -2135,8 +2164,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
434 break;
435 }
436
437- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
438- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
439+ case LTTNG_KERNEL_ABI_FUNCTION:
440+ lttng_fallthrough;
441+ case LTTNG_KERNEL_ABI_NOOP:
442+ lttng_fallthrough;
443 default:
444 ret = -EINVAL;
445 goto event_notifier_error;
446diff --git a/src/lttng-bytecode-interpreter.c b/src/lttng-bytecode-interpreter.c
447index b46a23b7..a2a932c6 100644
448--- a/src/lttng-bytecode-interpreter.c
449+++ b/src/lttng-bytecode-interpreter.c
450@@ -7,6 +7,7 @@
451 * Copyright (C) 2010-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
452 */
453
454+#include <wrapper/compiler_attributes.h>
455 #include <wrapper/uaccess.h>
456 #include <wrapper/objtool.h>
457 #include <wrapper/types.h>
458@@ -421,7 +422,8 @@ static int dynamic_get_index(struct lttng_kernel_probe_ctx *lttng_probe_ctx,
459 }
460 break;
461 case LOAD_ROOT_CONTEXT:
462- case LOAD_ROOT_APP_CONTEXT: /* Fall-through */
463+ lttng_fallthrough;
464+ case LOAD_ROOT_APP_CONTEXT:
465 {
466 ret = context_get_index(lttng_probe_ctx,
467 &stack_top->u.ptr,
468diff --git a/src/lttng-bytecode-specialize.c b/src/lttng-bytecode-specialize.c
469index c4b9d04b..f8b5f19d 100644
470--- a/src/lttng-bytecode-specialize.c
471+++ b/src/lttng-bytecode-specialize.c
472@@ -8,6 +8,8 @@
473 */
474
475 #include <linux/slab.h>
476+#include <wrapper/compiler_attributes.h>
477+
478 #include <lttng/lttng-bytecode.h>
479 #include <lttng/align.h>
480 #include <lttng/events-internal.h>
481@@ -271,7 +273,8 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
482 }
483 case OBJECT_TYPE_STRUCT:
484 /* Only generated by the specialize phase. */
485- case OBJECT_TYPE_VARIANT: /* Fall-through */
486+ case OBJECT_TYPE_VARIANT:
487+ lttng_fallthrough;
488 default:
489 printk(KERN_WARNING "LTTng: bytecode: Unexpected get index type %d",
490 (int) stack_top->load.object_type);
491diff --git a/src/lttng-events.c b/src/lttng-events.c
492index e785fe4d..230e3934 100644
493--- a/src/lttng-events.c
494+++ b/src/lttng-events.c
495@@ -28,6 +28,7 @@
496 #include <linux/vmalloc.h>
497 #include <linux/dmi.h>
498
499+#include <wrapper/compiler_attributes.h>
500 #include <wrapper/uuid.h>
501 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
502 #include <wrapper/random.h>
503@@ -659,12 +660,14 @@ int lttng_event_enable(struct lttng_kernel_event_common *event)
504 goto end;
505 }
506 switch (event->priv->instrumentation) {
507- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
508+ case LTTNG_KERNEL_ABI_TRACEPOINT:
509+ lttng_fallthrough;
510 case LTTNG_KERNEL_ABI_SYSCALL:
511 ret = -EINVAL;
512 break;
513
514- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
515+ case LTTNG_KERNEL_ABI_KPROBE:
516+ lttng_fallthrough;
517 case LTTNG_KERNEL_ABI_UPROBE:
518 WRITE_ONCE(event->enabled, 1);
519 break;
520@@ -673,8 +676,10 @@ int lttng_event_enable(struct lttng_kernel_event_common *event)
521 ret = lttng_kretprobes_event_enable_state(event, 1);
522 break;
523
524- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
525- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
526+ case LTTNG_KERNEL_ABI_FUNCTION:
527+ lttng_fallthrough;
528+ case LTTNG_KERNEL_ABI_NOOP:
529+ lttng_fallthrough;
530 default:
531 WARN_ON_ONCE(1);
532 ret = -EINVAL;
533@@ -719,12 +724,14 @@ int lttng_event_disable(struct lttng_kernel_event_common *event)
534 goto end;
535 }
536 switch (event->priv->instrumentation) {
537- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
538+ case LTTNG_KERNEL_ABI_TRACEPOINT:
539+ lttng_fallthrough;
540 case LTTNG_KERNEL_ABI_SYSCALL:
541 ret = -EINVAL;
542 break;
543
544- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
545+ case LTTNG_KERNEL_ABI_KPROBE:
546+ lttng_fallthrough;
547 case LTTNG_KERNEL_ABI_UPROBE:
548 WRITE_ONCE(event->enabled, 0);
549 break;
550@@ -733,8 +740,10 @@ int lttng_event_disable(struct lttng_kernel_event_common *event)
551 ret = lttng_kretprobes_event_enable_state(event, 0);
552 break;
553
554- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
555- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
556+ case LTTNG_KERNEL_ABI_FUNCTION:
557+ lttng_fallthrough;
558+ case LTTNG_KERNEL_ABI_NOOP:
559+ lttng_fallthrough;
560 default:
561 WARN_ON_ONCE(1);
562 ret = -EINVAL;
563@@ -873,15 +882,20 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
564 event_name = event_desc->event_name;
565 break;
566
567- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
568- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
569- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
570+ case LTTNG_KERNEL_ABI_KPROBE:
571+ lttng_fallthrough;
572+ case LTTNG_KERNEL_ABI_UPROBE:
573+ lttng_fallthrough;
574+ case LTTNG_KERNEL_ABI_KRETPROBE:
575+ lttng_fallthrough;
576 case LTTNG_KERNEL_ABI_SYSCALL:
577 event_name = event_param->name;
578 break;
579
580- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
581- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
582+ case LTTNG_KERNEL_ABI_FUNCTION:
583+ lttng_fallthrough;
584+ case LTTNG_KERNEL_ABI_NOOP:
585+ lttng_fallthrough;
586 default:
587 WARN_ON_ONCE(1);
588 ret = -EINVAL;
589@@ -1093,8 +1107,10 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
590 WARN_ON_ONCE(!ret);
591 break;
592
593- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
594- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
595+ case LTTNG_KERNEL_ABI_FUNCTION:
596+ lttng_fallthrough;
597+ case LTTNG_KERNEL_ABI_NOOP:
598+ lttng_fallthrough;
599 default:
600 WARN_ON_ONCE(1);
601 ret = -EINVAL;
602@@ -1141,15 +1157,20 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
603 event_name = event_desc->event_name;
604 break;
605
606- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
607- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
608+ case LTTNG_KERNEL_ABI_KPROBE:
609+ lttng_fallthrough;
610+ case LTTNG_KERNEL_ABI_UPROBE:
611+ lttng_fallthrough;
612 case LTTNG_KERNEL_ABI_SYSCALL:
613 event_name = event_notifier_param->event.name;
614 break;
615
616- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
617- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
618- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
619+ case LTTNG_KERNEL_ABI_KRETPROBE:
620+ lttng_fallthrough;
621+ case LTTNG_KERNEL_ABI_FUNCTION:
622+ lttng_fallthrough;
623+ case LTTNG_KERNEL_ABI_NOOP:
624+ lttng_fallthrough;
625 default:
626 WARN_ON_ONCE(1);
627 ret = -EINVAL;
628@@ -1296,9 +1317,12 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
629 WARN_ON_ONCE(!ret);
630 break;
631
632- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
633- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
634- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
635+ case LTTNG_KERNEL_ABI_KRETPROBE:
636+ lttng_fallthrough;
637+ case LTTNG_KERNEL_ABI_FUNCTION:
638+ lttng_fallthrough;
639+ case LTTNG_KERNEL_ABI_NOOP:
640+ lttng_fallthrough;
641 default:
642 WARN_ON_ONCE(1);
643 ret = -EINVAL;
644@@ -1423,14 +1447,18 @@ void register_event(struct lttng_kernel_event_recorder *event_recorder)
645 ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
646 break;
647
648- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
649- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
650+ case LTTNG_KERNEL_ABI_KPROBE:
651+ lttng_fallthrough;
652+ case LTTNG_KERNEL_ABI_UPROBE:
653+ lttng_fallthrough;
654 case LTTNG_KERNEL_ABI_KRETPROBE:
655 ret = 0;
656 break;
657
658- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
659- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
660+ case LTTNG_KERNEL_ABI_FUNCTION:
661+ lttng_fallthrough;
662+ case LTTNG_KERNEL_ABI_NOOP:
663+ lttng_fallthrough;
664 default:
665 WARN_ON_ONCE(1);
666 }
667@@ -1481,7 +1509,8 @@ int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
668 ret = 0;
669 break;
670
671- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
672+ case LTTNG_KERNEL_ABI_FUNCTION:
673+ lttng_fallthrough;
674 default:
675 WARN_ON_ONCE(1);
676 }
677@@ -1512,14 +1541,18 @@ void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
678 ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
679 break;
680
681- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
682+ case LTTNG_KERNEL_ABI_KPROBE:
683+ lttng_fallthrough;
684 case LTTNG_KERNEL_ABI_UPROBE:
685 ret = 0;
686 break;
687
688- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
689- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
690- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
691+ case LTTNG_KERNEL_ABI_KRETPROBE:
692+ lttng_fallthrough;
693+ case LTTNG_KERNEL_ABI_FUNCTION:
694+ lttng_fallthrough;
695+ case LTTNG_KERNEL_ABI_NOOP:
696+ lttng_fallthrough;
697 default:
698 WARN_ON_ONCE(1);
699 }
700@@ -1559,9 +1592,12 @@ int _lttng_event_notifier_unregister(
701 ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
702 break;
703
704- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
705- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
706- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
707+ case LTTNG_KERNEL_ABI_KRETPROBE:
708+ lttng_fallthrough;
709+ case LTTNG_KERNEL_ABI_FUNCTION:
710+ lttng_fallthrough;
711+ case LTTNG_KERNEL_ABI_NOOP:
712+ lttng_fallthrough;
713 default:
714 WARN_ON_ONCE(1);
715 }
716@@ -1614,8 +1650,10 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event)
717 lttng_uprobes_destroy_event_private(event_recorder);
718 break;
719
720- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
721- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
722+ case LTTNG_KERNEL_ABI_FUNCTION:
723+ lttng_fallthrough;
724+ case LTTNG_KERNEL_ABI_NOOP:
725+ lttng_fallthrough;
726 default:
727 WARN_ON_ONCE(1);
728 }
729@@ -1647,9 +1685,12 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event)
730 lttng_uprobes_destroy_event_notifier_private(event_notifier);
731 break;
732
733- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
734- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
735- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
736+ case LTTNG_KERNEL_ABI_KRETPROBE:
737+ lttng_fallthrough;
738+ case LTTNG_KERNEL_ABI_FUNCTION:
739+ lttng_fallthrough;
740+ case LTTNG_KERNEL_ABI_NOOP:
741+ lttng_fallthrough;
742 default:
743 WARN_ON_ONCE(1);
744 }
745@@ -2713,7 +2754,8 @@ void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
746 int nr_filters = 0;
747
748 switch (event_recorder_priv->parent.instrumentation) {
749- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
750+ case LTTNG_KERNEL_ABI_TRACEPOINT:
751+ lttng_fallthrough;
752 case LTTNG_KERNEL_ABI_SYSCALL:
753 /* Enable events */
754 list_for_each_entry(enabler_ref,
755@@ -2807,7 +2849,8 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
756 int nr_filters = 0, nr_captures = 0;
757
758 switch (event_notifier_priv->parent.instrumentation) {
759- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
760+ case LTTNG_KERNEL_ABI_TRACEPOINT:
761+ lttng_fallthrough;
762 case LTTNG_KERNEL_ABI_SYSCALL:
763 /* Enable event_notifiers */
764 list_for_each_entry(enabler_ref,
765@@ -3877,7 +3920,7 @@ int print_escaped_ctf_string(struct lttng_kernel_session *session, const char *s
766 if (ret)
767 goto error;
768 /* We still print the current char */
769- /* Fallthrough */
770+ lttng_fallthrough;
771 default:
772 ret = lttng_metadata_printf(session, "%c", cur);
773 break;
774diff --git a/src/lttng-string-utils.c b/src/lttng-string-utils.c
775index d9447903..65946193 100644
776--- a/src/lttng-string-utils.c
777+++ b/src/lttng-string-utils.c
778@@ -4,6 +4,7 @@
779 */
780
781 #include <linux/types.h>
782+#include <wrapper/compiler_attributes.h>
783
784 #include <lttng/string-utils.h>
785
786@@ -302,7 +303,7 @@ retry:
787 p = pattern_get_char_at_cb(p_at,
788 pattern_get_char_at_cb_data);
789
790- /* Fall-through. */
791+ lttng_fallthrough;
792 default:
793 /*
794 * Default case which will compare the escaped
795diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c
796index 0fa6a1bf..1d0a5ecb 100644
797--- a/src/probes/lttng-kretprobes.c
798+++ b/src/probes/lttng-kretprobes.c
799@@ -14,6 +14,7 @@
800 #include <lttng/events.h>
801 #include <lttng/events-internal.h>
802 #include <ringbuffer/frontend_types.h>
803+#include <wrapper/compiler_attributes.h>
804 #include <wrapper/vmalloc.h>
805 #include <wrapper/irqflags.h>
806 #include <lttng/tracer.h>
807@@ -61,7 +62,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
808 return 0;
809 break;
810 }
811- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */
812+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
813+ lttng_fallthrough;
814 default:
815 WARN_ON_ONCE(1);
816 }
817@@ -90,7 +92,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
818 chan->ops->event_commit(&ctx);
819 break;
820 }
821- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */
822+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
823+ lttng_fallthrough;
824 default:
825 WARN_ON_ONCE(1);
826 }
827--
8282.19.1
829
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.1.bb
index 6dfde8dcad..b05cad6be7 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.1.bb
@@ -10,13 +10,11 @@ inherit module
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-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch \
14 file://0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch \
15 " 13 "
16# Use :append here so that the patch is applied also when using devupstream 14# Use :append here so that the patch is applied also when using devupstream
17SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" 15SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch"
18 16
19SRC_URI[sha256sum] = "5ebf2b3cd128b3a1c8afaea1e98d5a6f7f0676fd524fcf72361c34d9dc603356" 17SRC_URI[sha256sum] = "a7c86d91c9bbe66d27f025aa04b8cfc6d7785ed2fc7ef774930800ee44d7f343"
20 18
21export INSTALL_MOD_DIR="kernel/lttng-modules" 19export INSTALL_MOD_DIR="kernel/lttng-modules"
22 20