diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules')
9 files changed, 476 insertions, 1224 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-kfree_skb-changed-in-6.11-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-kfree_skb-changed-in-6.11-rc1.patch new file mode 100644 index 0000000000..36bf697c51 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-kfree_skb-changed-in-6.11-rc1.patch @@ -0,0 +1,62 @@ +From a06c63b0360cbe1a7c8073461b9cf088234875f7 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:01:18 +0000 +Subject: [PATCH] Fix: kfree_skb changed in 6.11-rc1 + +See upstream commit: + + commit c53795d48ee8f385c6a9e394651e7ee914baaeba + Author: Yan Zhai <yan@cloudflare.com> + Date: Mon Jun 17 11:09:04 2024 -0700 + + net: add rx_sk to trace_kfree_skb + + skb does not include enough information to find out receiving + sockets/services and netns/containers on packet drops. In theory + skb->dev tells about netns, but it can get cleared/reused, e.g. by TCP + stack for OOO packet lookup. Similarly, skb->sk often identifies a local + sender, and tells nothing about a receiver. + + Allow passing an extra receiving socket to the tracepoint to improve + the visibility on receiving drops. + +Upstream-Status: Backport + +Change-Id: I33c8ce1a48006456f198ab1592f733b55be01016 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/skb.h | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/include/instrumentation/events/skb.h b/include/instrumentation/events/skb.h +index 9f1047c..5556ab6 100644 +--- a/include/instrumentation/events/skb.h ++++ b/include/instrumentation/events/skb.h +@@ -40,7 +40,25 @@ LTTNG_TRACEPOINT_ENUM(skb_drop_reason, + ) + #endif + +-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \ ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,11,0)) ++LTTNG_TRACEPOINT_EVENT_MAP(kfree_skb, ++ ++ skb_kfree, ++ ++ TP_PROTO(struct sk_buff *skb, void *location, ++ enum skb_drop_reason reason, struct sock *rx_sk), ++ ++ TP_ARGS(skb, location, reason, rx_sk), ++ ++ TP_FIELDS( ++ ctf_integer_hex(void *, skbaddr, skb) ++ ctf_integer_hex(void *, location, location) ++ ctf_integer_network(unsigned short, protocol, skb->protocol) ++ ctf_enum(skb_drop_reason, uint8_t, reason, reason) ++ ctf_integer_hex(void *, rx_skaddr, rx_sk) ++ ) ++) ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \ + || LTTNG_KERNEL_RANGE(5,15,58, 5,16,0) \ + || LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0) \ + || LTTNG_RHEL_KERNEL_RANGE(4,18,0,477,10,1, 4,19,0,0,0,0)) 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 08ad2ddaa8..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch +++ /dev/null @@ -1,394 +0,0 @@ -From 8be4c8a38ee1e297578e094a6e4c143ec5259aba Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 13 Sep 2021 12:00:38 -0400 -Subject: [PATCH 1/2] fix: cpu/hotplug: Remove deprecated CPU-hotplug - functions. (v5.15) - -The CPU-hotplug functions get|put_online_cpus() were deprecated in v4.13 -and removed in v5.15. - -See upstream commits : - -commit 8c854303ce0e38e5bbedd725ff39da7e235865d8 -Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> -Date: Tue Aug 3 16:16:21 2021 +0200 - - cpu/hotplug: Remove deprecated CPU-hotplug functions. - - No users in tree use the deprecated CPU-hotplug functions anymore. - - Remove them. - -Introduced in v4.13 : - - commit 8f553c498e1772cccb39a114da4a498d22992758 - Author: Thomas Gleixner <tglx@linutronix.de> - Date: Wed May 24 10:15:12 2017 +0200 - - cpu/hotplug: Provide cpus_read|write_[un]lock() - - The counting 'rwsem' hackery of get|put_online_cpus() is going to be - replaced by percpu rwsem. - - Rename the functions to make it clear that it's locking and not some - refcount style interface. These new functions will be used for the - preparatory patches which make the code ready for the percpu rwsem - conversion. - - Rename all instances in the cpu hotplug code while at it. - -Upstream-Status: Backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=ffcc873470121ef1ebb110df3d9038a38d9cb7cb] - -Change-Id: I5a37cf5afc075a402b7347989fac637dfa60a1ed -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - include/wrapper/cpu.h | 44 +++++++++++++++++++++++ - src/lib/ringbuffer/ring_buffer_backend.c | 8 ++--- - src/lib/ringbuffer/ring_buffer_frontend.c | 17 ++++----- - src/lib/ringbuffer/ring_buffer_iterator.c | 15 ++++---- - src/lttng-context-perf-counters.c | 11 +++--- - src/lttng-statedump-impl.c | 6 ++-- - 6 files changed, 74 insertions(+), 27 deletions(-) - create mode 100644 include/wrapper/cpu.h - -diff --git a/include/wrapper/cpu.h b/include/wrapper/cpu.h -new file mode 100644 -index 00000000..cbee1962 ---- /dev/null -+++ b/include/wrapper/cpu.h -@@ -0,0 +1,44 @@ -+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) -+ * -+ * wrapper/cpu.h -+ * -+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com> -+ */ -+ -+#ifndef _LTTNG_WRAPPER_CPU_H -+#define _LTTNG_WRAPPER_CPU_H -+ -+#include <linux/cpu.h> -+#include <lttng/kernel-version.h> -+ -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0)) -+ -+static inline -+void lttng_cpus_read_lock(void) -+{ -+ cpus_read_lock(); -+} -+ -+static inline -+void lttng_cpus_read_unlock(void) -+{ -+ cpus_read_unlock(); -+} -+ -+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */ -+ -+static inline -+void lttng_cpus_read_lock(void) -+{ -+ get_online_cpus(); -+} -+ -+static inline -+void lttng_cpus_read_unlock(void) -+{ -+ put_online_cpus(); -+} -+ -+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */ -+ -+#endif /* _LTTNG_WRAPPER_CPU_H */ -diff --git a/src/lib/ringbuffer/ring_buffer_backend.c b/src/lib/ringbuffer/ring_buffer_backend.c -index 26efb2bc..9a339be0 100644 ---- a/src/lib/ringbuffer/ring_buffer_backend.c -+++ b/src/lib/ringbuffer/ring_buffer_backend.c -@@ -12,10 +12,10 @@ - #include <linux/delay.h> - #include <linux/errno.h> - #include <linux/slab.h> --#include <linux/cpu.h> - #include <linux/mm.h> - #include <linux/vmalloc.h> - -+#include <wrapper/cpu.h> - #include <wrapper/mm.h> - #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */ - #include <ringbuffer/config.h> -@@ -445,14 +445,14 @@ int channel_backend_init(struct channel_backend *chanb, - chanb->cpu_hp_notifier.priority = 5; - register_hotcpu_notifier(&chanb->cpu_hp_notifier); - -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_online_cpu(i) { - ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i), - chanb, i); - if (ret) - goto free_bufs; /* cpu hotplug locked */ - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - #else - for_each_possible_cpu(i) { - ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i), -@@ -485,7 +485,7 @@ free_bufs: - */ - #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */ - #ifdef CONFIG_HOTPLUG_CPU -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - unregister_hotcpu_notifier(&chanb->cpu_hp_notifier); - #endif - #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */ -diff --git a/src/lib/ringbuffer/ring_buffer_frontend.c b/src/lib/ringbuffer/ring_buffer_frontend.c -index e9056118..87a575d0 100644 ---- a/src/lib/ringbuffer/ring_buffer_frontend.c -+++ b/src/lib/ringbuffer/ring_buffer_frontend.c -@@ -48,6 +48,7 @@ - #include <ringbuffer/iterator.h> - #include <ringbuffer/nohz.h> - #include <wrapper/atomic.h> -+#include <wrapper/cpu.h> - #include <wrapper/kref.h> - #include <wrapper/percpu-defs.h> - #include <wrapper/timer.h> -@@ -724,7 +725,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel - int cpu; - - #ifdef CONFIG_HOTPLUG_CPU -- get_online_cpus(); -+ lttng_cpus_read_lock(); - chan->cpu_hp_enable = 0; - for_each_online_cpu(cpu) { - struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, -@@ -732,7 +733,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel - lib_ring_buffer_stop_switch_timer(buf); - lib_ring_buffer_stop_read_timer(buf); - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - unregister_cpu_notifier(&chan->cpu_hp_notifier); - #else - for_each_possible_cpu(cpu) { -@@ -772,14 +773,14 @@ void lib_ring_buffer_set_quiescent_channel(struct lttng_kernel_ring_buffer_chann - const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config; - - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_channel_cpu(cpu, chan) { - struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, - cpu); - - lib_ring_buffer_set_quiescent(buf); - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - } else { - struct lttng_kernel_ring_buffer *buf = chan->backend.buf; - -@@ -794,14 +795,14 @@ void lib_ring_buffer_clear_quiescent_channel(struct lttng_kernel_ring_buffer_cha - const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config; - - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_channel_cpu(cpu, chan) { - struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, - cpu); - - lib_ring_buffer_clear_quiescent(buf); - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - } else { - struct lttng_kernel_ring_buffer *buf = chan->backend.buf; - -@@ -899,7 +900,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne - chan->cpu_hp_notifier.priority = 6; - register_cpu_notifier(&chan->cpu_hp_notifier); - -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_online_cpu(cpu) { - struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, - cpu); -@@ -909,7 +910,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne - spin_unlock(&per_cpu(ring_buffer_nohz_lock, cpu)); - } - chan->cpu_hp_enable = 1; -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - #else - for_each_possible_cpu(cpu) { - struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, -diff --git a/src/lib/ringbuffer/ring_buffer_iterator.c b/src/lib/ringbuffer/ring_buffer_iterator.c -index 25839af6..60c95ca6 100644 ---- a/src/lib/ringbuffer/ring_buffer_iterator.c -+++ b/src/lib/ringbuffer/ring_buffer_iterator.c -@@ -10,6 +10,7 @@ - */ - - #include <ringbuffer/iterator.h> -+#include <wrapper/cpu.h> - #include <wrapper/file.h> - #include <wrapper/uaccess.h> - #include <linux/jiffies.h> -@@ -440,13 +441,13 @@ int channel_iterator_init(struct lttng_kernel_ring_buffer_channel *chan) - chan->hp_iter_notifier.priority = 10; - register_cpu_notifier(&chan->hp_iter_notifier); - -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_online_cpu(cpu) { - buf = per_cpu_ptr(chan->backend.buf, cpu); - lib_ring_buffer_iterator_init(chan, buf); - } - chan->hp_iter_enable = 1; -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - #else - for_each_possible_cpu(cpu) { - buf = per_cpu_ptr(chan->backend.buf, cpu); -@@ -519,7 +520,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan) - CHAN_WARN_ON(chan, config->output != RING_BUFFER_ITERATOR); - - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { -- get_online_cpus(); -+ lttng_cpus_read_lock(); - /* Allow CPU hotplug to keep track of opened reader */ - chan->iter.read_open = 1; - for_each_channel_cpu(cpu, chan) { -@@ -529,7 +530,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan) - goto error; - buf->iter.read_open = 1; - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - } else { - buf = channel_get_ring_buffer(config, chan, 0); - ret = lib_ring_buffer_iterator_open(buf); -@@ -538,7 +539,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan) - error: - /* Error should always happen on CPU 0, hence no close is required. */ - CHAN_WARN_ON(chan, cpu != 0); -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - return ret; - } - EXPORT_SYMBOL_GPL(channel_iterator_open); -@@ -550,7 +551,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan) - int cpu; - - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_channel_cpu(cpu, chan) { - buf = channel_get_ring_buffer(config, chan, cpu); - if (buf->iter.read_open) { -@@ -559,7 +560,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan) - } - } - chan->iter.read_open = 0; -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - } else { - buf = channel_get_ring_buffer(config, chan, 0); - lib_ring_buffer_iterator_release(buf); -diff --git a/src/lttng-context-perf-counters.c b/src/lttng-context-perf-counters.c -index b0227d47..372f05e0 100644 ---- a/src/lttng-context-perf-counters.c -+++ b/src/lttng-context-perf-counters.c -@@ -16,6 +16,7 @@ - #include <lttng/events.h> - #include <lttng/events-internal.h> - #include <ringbuffer/frontend_types.h> -+#include <wrapper/cpu.h> - #include <wrapper/vmalloc.h> - #include <wrapper/perf.h> - #include <lttng/tracer.h> -@@ -97,10 +98,10 @@ void lttng_destroy_perf_counter_ctx_field(void *priv) - { - int cpu; - -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_online_cpu(cpu) - perf_event_release_kernel(events[cpu]); -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - #ifdef CONFIG_HOTPLUG_CPU - unregister_cpu_notifier(&perf_field->nb); - #endif -@@ -304,7 +305,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, - perf_field->nb.priority = 0; - register_cpu_notifier(&perf_field->nb); - #endif -- get_online_cpus(); -+ lttng_cpus_read_lock(); - for_each_online_cpu(cpu) { - events[cpu] = wrapper_perf_event_create_kernel_counter(attr, - cpu, NULL, overflow_callback); -@@ -317,7 +318,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, - goto counter_busy; - } - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - perf_field->hp_enable = 1; - } - #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */ -@@ -351,7 +352,7 @@ counter_error: - if (events[cpu] && !IS_ERR(events[cpu])) - perf_event_release_kernel(events[cpu]); - } -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - #ifdef CONFIG_HOTPLUG_CPU - unregister_cpu_notifier(&perf_field->nb); - #endif -diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c -index 4dfbca0b..2b42783a 100644 ---- a/src/lttng-statedump-impl.c -+++ b/src/lttng-statedump-impl.c -@@ -23,7 +23,6 @@ - #include <linux/file.h> - #include <linux/interrupt.h> - #include <linux/irqnr.h> --#include <linux/cpu.h> - #include <linux/netdevice.h> - #include <linux/inetdevice.h> - #include <linux/mm.h> -@@ -34,6 +33,7 @@ - - #include <lttng/events.h> - #include <lttng/tracer.h> -+#include <wrapper/cpu.h> - #include <wrapper/irqdesc.h> - #include <wrapper/fdtable.h> - #include <wrapper/namespace.h> -@@ -770,7 +770,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session) - * is to guarantee that each CPU has been in a state where is was in - * syscall mode (i.e. not in a trap, an IRQ or a soft IRQ). - */ -- get_online_cpus(); -+ lttng_cpus_read_lock(); - atomic_set(&kernel_threads_to_run, num_online_cpus()); - for_each_online_cpu(cpu) { - INIT_DELAYED_WORK(&cpu_work[cpu], lttng_statedump_work_func); -@@ -778,7 +778,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session) - } - /* Wait for all threads to run */ - __wait_event(statedump_wq, (atomic_read(&kernel_threads_to_run) == 0)); -- put_online_cpus(); -+ lttng_cpus_read_unlock(); - /* Our work is done */ - trace_lttng_statedump_end(session); - return 0; --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch index 76a5787c37..4911982461 100644 --- a/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch @@ -1,4 +1,4 @@ -From 878f89b6136ff7b870a19e04901cc6f316bbe10a Mon Sep 17 00:00:00 2001 +From 60d423945bd4f4c4b7bfc6f29da9231152d05690 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield <bruce.ashfield@gmail.com> Date: Sat, 15 May 2021 10:26:38 -0400 Subject: [PATCH] src/Kbuild: change missing CONFIG_TRACEPOINTS to warning diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ext4_da_reserve_space-changed-in-6.11-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ext4_da_reserve_space-changed-in-6.11-rc1.patch new file mode 100644 index 0000000000..e62717baeb --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-ext4_da_reserve_space-changed-in-6.11-rc1.patch @@ -0,0 +1,55 @@ +From bfb177d2745d19cb56a27c438f4925d6397fbf0b Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:08:32 +0000 +Subject: [PATCH] Fix: ext4_da_reserve_space changed in 6.11-rc1 + +See upstream commit: + + commit 0d66b23d79c750276f791411d81a524549a64852 + Author: Zhang Yi <yi.zhang@huawei.com> + Date: Fri May 17 20:40:02 2024 +0800 + + ext4: make ext4_da_reserve_space() reserve multi-clusters + + Add 'nr_resv' parameter to ext4_da_reserve_space(), which indicates the + number of clusters wants to reserve, make it reserve multiple clusters + at a time. + +Upstream-Status: Backport + +Change-Id: Ib1ce8c3023d53a6d22ec444a435fdb3c871f64c5 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/ext4.h | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/include/instrumentation/events/ext4.h b/include/instrumentation/events/ext4.h +index 4131803..9f1d4b1 100644 +--- a/include/instrumentation/events/ext4.h ++++ b/include/instrumentation/events/ext4.h +@@ -821,7 +821,23 @@ LTTNG_TRACEPOINT_EVENT(ext4_da_update_reserve_space, + ) + #endif + +-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0)) ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,11,0)) ++LTTNG_TRACEPOINT_EVENT(ext4_da_reserve_space, ++ TP_PROTO(struct inode *inode, int nr_resv), ++ ++ TP_ARGS(inode, nr_resv), ++ ++ TP_FIELDS( ++ ctf_integer(dev_t, dev, inode->i_sb->s_dev) ++ ctf_integer(ino_t, ino, inode->i_ino) ++ ctf_integer(__u64, i_blocks, inode->i_blocks) ++ ctf_integer(__u64, nr_resv, nr_resv) ++ ctf_integer(int, reserved_data_blocks, ++ EXT4_I(inode)->i_reserved_data_blocks) ++ ctf_integer(TP_MODE_T, mode, inode->i_mode) ++ ) ++) ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0)) + LTTNG_TRACEPOINT_EVENT(ext4_da_reserve_space, + TP_PROTO(struct inode *inode), + 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 14185efa40..0000000000 --- a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch +++ /dev/null @@ -1,829 +0,0 @@ -From c570be0da77e963d77bac099d468bc0cd5f1bd63 Mon Sep 17 00:00:00 2001 -From: Michael Jeanson <mjeanson@efficios.com> -Date: Mon, 13 Sep 2021 14:16:22 -0400 -Subject: [PATCH 2/2] fix: Revert "Makefile: Enable -Wimplicit-fallthrough for - Clang" (v5.15) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Starting with v5.15, "-Wimplicit-fallthrough=5" was added to the build -flags which requires the use of "__attribute__((__fallthrough__))" to -annotate fallthrough case statements. - -See upstream commit by the man himself: - - commit d936eb23874433caa3e3d841cfa16f5434b85dcf - Author: Linus Torvalds <torvalds@linux-foundation.org> - Date: Thu Jul 15 18:05:31 2021 -0700 - - Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" - - This reverts commit b7eb335e26a9c7f258c96b3962c283c379d3ede0. - - It turns out that the problem with the clang -Wimplicit-fallthrough - warning is not about the kernel source code, but about clang itself, and - that the warning is unusable until clang fixes its broken ways. - - In particular, when you enable this warning for clang, you not only get - warnings about implicit fallthroughs. You also get this: - - warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough] - - which is completely broken becasue it - - (a) doesn't even tell you where the problem is (seriously: no line - numbers, no filename, no nothing). - - (b) is fundamentally broken anyway, because there are perfectly valid - reasons to have a fallthrough statement even if it turns out that - it can perhaps not be reached. - - In the kernel, an example of that second case is code in the scheduler: - - switch (state) { - case cpuset: - if (IS_ENABLED(CONFIG_CPUSETS)) { - cpuset_cpus_allowed_fallback(p); - state = possible; - break; - } - fallthrough; - case possible: - - where if CONFIG_CPUSETS is enabled you actually never hit the - fallthrough case at all. But that in no way makes the fallthrough - wrong. - - So the warning is completely broken, and enabling it for clang is a very - bad idea. - - In the meantime, we can keep the gcc option enabled, and make the gcc - build use - - -Wimplicit-fallthrough=5 - - which means that we will at least continue to require a proper - fallthrough statement, and that gcc won't silently accept the magic - comment versions. Because gcc does this all correctly, and while the odd - "=5" part is kind of obscure, it's documented in [1]: - - "-Wimplicit-fallthrough=5 doesn’t recognize any comments as - fallthrough comments, only attributes disable the warning" - - so if clang ever fixes its bad behavior we can try enabling it there again. - -Upstream-Status: Backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=c190d76e8c7b44d62b3651ab845b765c1b1f8104] - -Change-Id: Iea69849592fb69ac04fb9bb28efcd6b8dce8ba88 -Signed-off-by: Michael Jeanson <mjeanson@efficios.com> -Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> ---- - include/counter/counter-api.h | 4 +- - include/lttng/events-internal.h | 11 ++- - include/wrapper/compiler_attributes.h | 34 +++++++ - src/lib/counter/counter.c | 13 ++- - src/lttng-abi.c | 91 ++++++++++++------ - src/lttng-bytecode-interpreter.c | 4 +- - src/lttng-bytecode-specialize.c | 5 +- - src/lttng-events.c | 129 +++++++++++++++++--------- - src/lttng-string-utils.c | 3 +- - src/probes/lttng-kretprobes.c | 7 +- - 10 files changed, 215 insertions(+), 86 deletions(-) - create mode 100644 include/wrapper/compiler_attributes.h - -diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h -index fbc65818..c9f2b141 100644 ---- a/include/counter/counter-api.h -+++ b/include/counter/counter-api.h -@@ -15,6 +15,7 @@ - #include <linux/bitops.h> - #include <counter/counter.h> - #include <counter/counter-internal.h> -+#include <wrapper/compiler_attributes.h> - #include <wrapper/limits.h> - - /* -@@ -256,7 +257,8 @@ static __always_inline int lttng_counter_add(const struct lib_counter_config *co - const size_t *dimension_indexes, int64_t v) - { - switch (config->alloc) { -- case COUNTER_ALLOC_PER_CPU: /* Fallthrough */ -+ case COUNTER_ALLOC_PER_CPU: -+ lttng_fallthrough; - case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: - return __lttng_counter_add_percpu(config, counter, dimension_indexes, v); - case COUNTER_ALLOC_GLOBAL: -diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h -index cd560de8..ca2190c4 100644 ---- a/include/lttng/events-internal.h -+++ b/include/lttng/events-internal.h -@@ -8,6 +8,8 @@ - #ifndef _LTTNG_EVENTS_INTERNAL_H - #define _LTTNG_EVENTS_INTERNAL_H - -+#include <wrapper/compiler_attributes.h> -+ - #include <lttng/events.h> - - struct lttng_syscall_filter; -@@ -561,9 +563,12 @@ static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kern - if (!type_integer) - return false; - switch (type_integer->size) { -- case 8: /* Fall-through. */ -- case 16: /* Fall-through. */ -- case 32: /* Fall-through. */ -+ case 8: -+ lttng_fallthrough; -+ case 16: -+ lttng_fallthrough; -+ case 32: -+ lttng_fallthrough; - case 64: - break; - default: -diff --git a/include/wrapper/compiler_attributes.h b/include/wrapper/compiler_attributes.h -new file mode 100644 -index 00000000..c2c96e76 ---- /dev/null -+++ b/include/wrapper/compiler_attributes.h -@@ -0,0 +1,34 @@ -+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) -+ * -+ * wrapper/compiler_attributes.h -+ * -+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com> -+ */ -+ -+#ifndef _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H -+#define _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H -+ -+#include <lttng/kernel-version.h> -+ -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0)) -+#include <linux/compiler_attributes.h> -+#endif -+ -+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0)) -+ -+/* -+ * Use the kernel provided fallthrough attribute macro. -+ */ -+#define lttng_fallthrough fallthrough -+ -+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */ -+ -+/* -+ * Fallback to the comment for kernels pre 5.15 that don't build with -+ * '-Wimplicit-fallthrough=5'. -+ */ -+#define lttng_fallthrough do {} while (0) /* fallthrough */ -+ -+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */ -+ -+#endif /* _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H */ -diff --git a/src/lib/counter/counter.c b/src/lib/counter/counter.c -index a4500a0e..bf038aac 100644 ---- a/src/lib/counter/counter.c -+++ b/src/lib/counter/counter.c -@@ -11,6 +11,7 @@ - #include <linux/cpumask.h> - #include <counter/counter.h> - #include <counter/counter-internal.h> -+#include <wrapper/compiler_attributes.h> - #include <wrapper/vmalloc.h> - #include <wrapper/limits.h> - -@@ -324,7 +325,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config, - *underflow = false; - - switch (config->alloc) { -- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */ -+ case COUNTER_ALLOC_GLOBAL: -+ lttng_fallthrough; - case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: - /* Read global counter. */ - ret = lttng_counter_read(config, counter, dimension_indexes, -@@ -342,7 +344,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config, - switch (config->alloc) { - case COUNTER_ALLOC_GLOBAL: - break; -- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */ -+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: -+ lttng_fallthrough; - case COUNTER_ALLOC_PER_CPU: - //TODO: integrate with CPU hotplug and online cpus - for (cpu = 0; cpu < num_possible_cpus(); cpu++) { -@@ -448,7 +451,8 @@ int lttng_counter_clear(const struct lib_counter_config *config, - int cpu, ret; - - switch (config->alloc) { -- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */ -+ case COUNTER_ALLOC_GLOBAL: -+ lttng_fallthrough; - case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: - /* Clear global counter. */ - ret = lttng_counter_clear_cpu(config, counter, dimension_indexes, -1); -@@ -462,7 +466,8 @@ int lttng_counter_clear(const struct lib_counter_config *config, - switch (config->alloc) { - case COUNTER_ALLOC_GLOBAL: - break; -- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */ -+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: -+ lttng_fallthrough; - case COUNTER_ALLOC_PER_CPU: - //TODO: integrate with CPU hotplug and online cpus - for (cpu = 0; cpu < num_possible_cpus(); cpu++) { -diff --git a/src/lttng-abi.c b/src/lttng-abi.c -index cc453894..eac1afd1 100644 ---- a/src/lttng-abi.c -+++ b/src/lttng-abi.c -@@ -34,6 +34,7 @@ - #include <ringbuffer/vfs.h> - #include <ringbuffer/backend.h> - #include <ringbuffer/frontend.h> -+#include <wrapper/compiler_attributes.h> - #include <wrapper/poll.h> - #include <wrapper/file.h> - #include <wrapper/kref.h> -@@ -1332,7 +1333,8 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp, - */ - return -ENOSYS; - } -- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */ -+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH: - { - struct lttng_metadata_stream *stream = filp->private_data; -@@ -1441,7 +1443,8 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp, - */ - return -ENOSYS; - } -- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */ -+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH: - { - struct lttng_metadata_stream *stream = filp->private_data; -@@ -1758,8 +1761,10 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param) - switch (event_param->instrumentation) { - case LTTNG_KERNEL_ABI_SYSCALL: - switch (event_param->u.syscall.entryexit) { -- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */ -- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT: - break; - default: -@@ -1783,20 +1788,26 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param) - switch (event_param->u.kretprobe.entryexit) { - case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT: - break; -- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */ -- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT: -+ lttng_fallthrough; - default: - return -EINVAL; - } - break; - -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - return -EINVAL; - } -@@ -1830,18 +1841,23 @@ int lttng_abi_create_event(struct file *channel_file, - } - - switch (event_param->instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - fops = <tng_event_recorder_enabler_fops; - break; -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - fops = <tng_event_recorder_event_fops; - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - return -EINVAL; - } -@@ -1867,7 +1883,8 @@ int lttng_abi_create_event(struct file *channel_file, - goto event_error; - - switch (event_param->instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - { - struct lttng_event_enabler *event_enabler; -@@ -1887,8 +1904,10 @@ int lttng_abi_create_event(struct file *channel_file, - break; - } - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - { - struct lttng_kernel_event_recorder *event; -@@ -1908,8 +1927,10 @@ int lttng_abi_create_event(struct file *channel_file, - break; - } - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - ret = -EINVAL; - goto event_error; -@@ -2043,18 +2064,23 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, - } - - switch (event_notifier_param->event.instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - fops = <tng_event_notifier_enabler_fops; - break; -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - fops = <tng_event_notifier_event_fops; - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - ret = -EINVAL; - goto inval_instr; -@@ -2086,7 +2112,8 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, - goto event_notifier_error; - - switch (event_notifier_param->event.instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - { - struct lttng_event_notifier_enabler *enabler; -@@ -2110,8 +2137,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, - break; - } - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - { - struct lttng_kernel_event_notifier *event_notifier; -@@ -2135,8 +2164,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, - break; - } - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - ret = -EINVAL; - goto event_notifier_error; -diff --git a/src/lttng-bytecode-interpreter.c b/src/lttng-bytecode-interpreter.c -index b46a23b7..a2a932c6 100644 ---- a/src/lttng-bytecode-interpreter.c -+++ b/src/lttng-bytecode-interpreter.c -@@ -7,6 +7,7 @@ - * Copyright (C) 2010-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - */ - -+#include <wrapper/compiler_attributes.h> - #include <wrapper/uaccess.h> - #include <wrapper/objtool.h> - #include <wrapper/types.h> -@@ -421,7 +422,8 @@ static int dynamic_get_index(struct lttng_kernel_probe_ctx *lttng_probe_ctx, - } - break; - case LOAD_ROOT_CONTEXT: -- case LOAD_ROOT_APP_CONTEXT: /* Fall-through */ -+ lttng_fallthrough; -+ case LOAD_ROOT_APP_CONTEXT: - { - ret = context_get_index(lttng_probe_ctx, - &stack_top->u.ptr, -diff --git a/src/lttng-bytecode-specialize.c b/src/lttng-bytecode-specialize.c -index c4b9d04b..f8b5f19d 100644 ---- a/src/lttng-bytecode-specialize.c -+++ b/src/lttng-bytecode-specialize.c -@@ -8,6 +8,8 @@ - */ - - #include <linux/slab.h> -+#include <wrapper/compiler_attributes.h> -+ - #include <lttng/lttng-bytecode.h> - #include <lttng/align.h> - #include <lttng/events-internal.h> -@@ -271,7 +273,8 @@ static int specialize_get_index(struct bytecode_runtime *runtime, - } - case OBJECT_TYPE_STRUCT: - /* Only generated by the specialize phase. */ -- case OBJECT_TYPE_VARIANT: /* Fall-through */ -+ case OBJECT_TYPE_VARIANT: -+ lttng_fallthrough; - default: - printk(KERN_WARNING "LTTng: bytecode: Unexpected get index type %d", - (int) stack_top->load.object_type); -diff --git a/src/lttng-events.c b/src/lttng-events.c -index e785fe4d..230e3934 100644 ---- a/src/lttng-events.c -+++ b/src/lttng-events.c -@@ -28,6 +28,7 @@ - #include <linux/vmalloc.h> - #include <linux/dmi.h> - -+#include <wrapper/compiler_attributes.h> - #include <wrapper/uuid.h> - #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */ - #include <wrapper/random.h> -@@ -659,12 +660,14 @@ int lttng_event_enable(struct lttng_kernel_event_common *event) - goto end; - } - switch (event->priv->instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - ret = -EINVAL; - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - WRITE_ONCE(event->enabled, 1); - break; -@@ -673,8 +676,10 @@ int lttng_event_enable(struct lttng_kernel_event_common *event) - ret = lttng_kretprobes_event_enable_state(event, 1); - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -719,12 +724,14 @@ int lttng_event_disable(struct lttng_kernel_event_common *event) - goto end; - } - switch (event->priv->instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - ret = -EINVAL; - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - WRITE_ONCE(event->enabled, 0); - break; -@@ -733,8 +740,10 @@ int lttng_event_disable(struct lttng_kernel_event_common *event) - ret = lttng_kretprobes_event_enable_state(event, 0); - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -873,15 +882,20 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l - event_name = event_desc->event_name; - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_UPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - event_name = event_param->name; - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -1093,8 +1107,10 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l - WARN_ON_ONCE(!ret); - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -1141,15 +1157,20 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create( - event_name = event_desc->event_name; - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_UPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - event_name = event_notifier_param->event.name; - break; - -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -1296,9 +1317,12 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create( - WARN_ON_ONCE(!ret); - break; - -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; -@@ -1423,14 +1447,18 @@ void register_event(struct lttng_kernel_event_recorder *event_recorder) - ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder); - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_UPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_KRETPROBE: - ret = 0; - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -1481,7 +1509,8 @@ int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder) - ret = 0; - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -1512,14 +1541,18 @@ void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier) - ret = lttng_syscall_filter_enable_event_notifier(event_notifier); - break; - -- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KPROBE: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_UPROBE: - ret = 0; - break; - -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -1559,9 +1592,12 @@ int _lttng_event_notifier_unregister( - ret = lttng_syscall_filter_disable_event_notifier(event_notifier); - break; - -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -1614,8 +1650,10 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event) - lttng_uprobes_destroy_event_private(event_recorder); - break; - -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -1647,9 +1685,12 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event) - lttng_uprobes_destroy_event_notifier_private(event_notifier); - break; - -- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ -- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */ -- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_KRETPROBE: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_FUNCTION: -+ lttng_fallthrough; -+ case LTTNG_KERNEL_ABI_NOOP: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -2713,7 +2754,8 @@ void lttng_session_sync_event_enablers(struct lttng_kernel_session *session) - int nr_filters = 0; - - switch (event_recorder_priv->parent.instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - /* Enable events */ - list_for_each_entry(enabler_ref, -@@ -2807,7 +2849,8 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group - int nr_filters = 0, nr_captures = 0; - - switch (event_notifier_priv->parent.instrumentation) { -- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */ -+ case LTTNG_KERNEL_ABI_TRACEPOINT: -+ lttng_fallthrough; - case LTTNG_KERNEL_ABI_SYSCALL: - /* Enable event_notifiers */ - list_for_each_entry(enabler_ref, -@@ -3877,7 +3920,7 @@ int print_escaped_ctf_string(struct lttng_kernel_session *session, const char *s - if (ret) - goto error; - /* We still print the current char */ -- /* Fallthrough */ -+ lttng_fallthrough; - default: - ret = lttng_metadata_printf(session, "%c", cur); - break; -diff --git a/src/lttng-string-utils.c b/src/lttng-string-utils.c -index d9447903..65946193 100644 ---- a/src/lttng-string-utils.c -+++ b/src/lttng-string-utils.c -@@ -4,6 +4,7 @@ - */ - - #include <linux/types.h> -+#include <wrapper/compiler_attributes.h> - - #include <lttng/string-utils.h> - -@@ -302,7 +303,7 @@ retry: - p = pattern_get_char_at_cb(p_at, - pattern_get_char_at_cb_data); - -- /* Fall-through. */ -+ lttng_fallthrough; - default: - /* - * Default case which will compare the escaped -diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c -index 0fa6a1bf..1d0a5ecb 100644 ---- a/src/probes/lttng-kretprobes.c -+++ b/src/probes/lttng-kretprobes.c -@@ -14,6 +14,7 @@ - #include <lttng/events.h> - #include <lttng/events-internal.h> - #include <ringbuffer/frontend_types.h> -+#include <wrapper/compiler_attributes.h> - #include <wrapper/vmalloc.h> - #include <wrapper/irqflags.h> - #include <lttng/tracer.h> -@@ -61,7 +62,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, - return 0; - break; - } -- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */ -+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } -@@ -90,7 +92,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, - chan->ops->event_commit(&ctx); - break; - } -- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */ -+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: -+ lttng_fallthrough; - default: - WARN_ON_ONCE(1); - } --- -2.19.1 - diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-orig_start-removed-from-btrfs_get_extent-in-6.11.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-orig_start-removed-from-btrfs_get_extent-in-6.11.patch new file mode 100644 index 0000000000..4d06ec76e7 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-orig_start-removed-from-btrfs_get_extent-in-6.11.patch @@ -0,0 +1,64 @@ +From 1e4cc8d271117af9262e28a5dd19790a0917818c Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:11:36 +0000 +Subject: [PATCH] Fix: orig_start removed from btrfs_get_extent in 6.11-rc1 + +See upstream commit: + + commit 4aa7b5d1784f510c0f42afc1d74efb41947221d7 + Author: Qu Wenruo <wqu@suse.com> + Date: Tue Apr 30 07:53:04 2024 +0930 + + btrfs: remove extent_map::orig_start member + + Since we have extent_map::offset, the old extent_map::orig_start is just + extent_map::start - extent_map::offset for non-hole/inline extents. + + And since the new extent_map::offset is already verified by + validate_extent_map() while the old orig_start is not, let's just remove + the old member from all call sites. + +Upstream-Status: Backport + +Change-Id: I025a30d49b3e3ddc37d7846acc191ebbdf2ff19e +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/btrfs.h | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h +index c0c746e..dfad19c 100644 +--- a/include/instrumentation/events/btrfs.h ++++ b/include/instrumentation/events/btrfs.h +@@ -177,7 +177,29 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict, + ) + #endif + +-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,8,0)) ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,11,0)) ++ ++LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, ++ ++ TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, ++ const struct extent_map *map), ++ ++ TP_ARGS(root, inode, map), ++ ++ TP_FIELDS( ++ ctf_integer(u64, root_objectid, root->root_key.objectid) ++ ctf_integer(u64, ino, btrfs_ino(inode)) ++ ctf_integer(u64, start, map->start) ++ ctf_integer(u64, len, map->len) ++ ctf_integer(u64, block_start, map->block_start) ++ ctf_integer(u64, block_len, map->block_len) ++ ctf_integer(unsigned int, flags, map->flags) ++ ctf_integer(int, refs, refcount_read(&map->refs)) ++ ctf_integer(unsigned int, compress_type, extent_map_compression(map)) ++ ) ++) ++ ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,8,0)) + + LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, + diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-block_len-removed-frmo-btrfs_get_extent-in-6.11-.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-block_len-removed-frmo-btrfs_get_extent-in-6.11-.patch new file mode 100644 index 0000000000..c9f48e2f2b --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-Fix-block_len-removed-frmo-btrfs_get_extent-in-6.11-.patch @@ -0,0 +1,44 @@ +From 974125ab11a7f0b4df5658cdac26dc5cf9fdbc87 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:12:47 +0000 +Subject: [PATCH] Fix: block_len removed frmo btrfs_get_extent in 6.11-rc1 + +See upstream commit: + + commit e28b851ed9b232c3b84cb8d0fedbdfa8ca881386 + Author: Qu Wenruo <wqu@suse.com> + Date: Tue Apr 30 07:53:05 2024 +0930 + + btrfs: remove extent_map::block_len member + + The extent_map::block_len is either extent_map::len (non-compressed + extent) or extent_map::disk_num_bytes (compressed extent). + + Since we already have sanity checks to do the cross-checks between the + new and old members, we can drop the old extent_map::block_len now. + + For most call sites, they can manually select extent_map::len or + extent_map::disk_num_bytes, since most if not all of them have checked + if the extent is compressed. + +Upstream-Status: Backport + +Change-Id: Ib03fc685b4e876bf4e53afdd28ca9826342a0e4e +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/btrfs.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h +index dfad19c..28320d8 100644 +--- a/include/instrumentation/events/btrfs.h ++++ b/include/instrumentation/events/btrfs.h +@@ -192,7 +192,6 @@ LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, + ctf_integer(u64, start, map->start) + ctf_integer(u64, len, map->len) + ctf_integer(u64, block_start, map->block_start) +- ctf_integer(u64, block_len, map->block_len) + ctf_integer(unsigned int, flags, map->flags) + ctf_integer(int, refs, refcount_read(&map->refs)) + ctf_integer(unsigned int, compress_type, extent_map_compression(map)) diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-Fix-block_start-removed-from-btrfs_get_extent-in-6.1.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-Fix-block_start-removed-from-btrfs_get_extent-in-6.1.patch new file mode 100644 index 0000000000..86c72cc650 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-Fix-block_start-removed-from-btrfs_get_extent-in-6.1.patch @@ -0,0 +1,50 @@ +From b845e79532c9c28c0108bf556171093236460251 Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:14:24 +0000 +Subject: [PATCH] Fix: block_start removed from btrfs_get_extent in 6.11-rc1 + +See upstream commit: + + commit c77a8c61002e91d859e118008fd495efbe1d9373 + Author: Qu Wenruo <wqu@suse.com> + Date: Tue Apr 30 07:53:06 2024 +0930 + + btrfs: remove extent_map::block_start member + + The member extent_map::block_start can be calculated from + extent_map::disk_bytenr + extent_map::offset for regular extents. + And otherwise just extent_map::disk_bytenr. + + And this is already validated by the validate_extent_map(). Now we can + remove the member. + + However there is a special case in btrfs_create_dio_extent() where we + for NOCOW/PREALLOC ordered extents cannot directly use the resulting + btrfs_file_extent, as btrfs_split_ordered_extent() cannot handle them + yet. + + So for that call site, we pass file_extent->disk_bytenr + + file_extent->num_bytes as disk_bytenr for the ordered extent, and 0 for + offset. + +Upstream-Status: Backport + +Change-Id: I2e3245bb0d1f5263e902659aa05848d5e231909b +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/btrfs.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h +index 28320d8..8fb6866 100644 +--- a/include/instrumentation/events/btrfs.h ++++ b/include/instrumentation/events/btrfs.h +@@ -191,7 +191,6 @@ LTTNG_TRACEPOINT_EVENT(btrfs_get_extent, + ctf_integer(u64, ino, btrfs_ino(inode)) + ctf_integer(u64, start, map->start) + ctf_integer(u64, len, map->len) +- ctf_integer(u64, block_start, map->block_start) + ctf_integer(unsigned int, flags, map->flags) + ctf_integer(int, refs, refcount_read(&map->refs)) + ctf_integer(unsigned int, compress_type, extent_map_compression(map)) diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-Fix-scsi-sd-Atomic-write-support-added-in-6.11-rc1.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-Fix-scsi-sd-Atomic-write-support-added-in-6.11-rc1.patch new file mode 100644 index 0000000000..2745e6444a --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-Fix-scsi-sd-Atomic-write-support-added-in-6.11-rc1.patch @@ -0,0 +1,200 @@ +From d0797fe4bce357d419d2f1f8a3cfe2f8e71ebfdb Mon Sep 17 00:00:00 2001 +From: Kienan Stewart <kstewart@efficios.com> +Date: Mon, 29 Jul 2024 14:23:02 +0000 +Subject: [PATCH] Fix: scsi: sd: Atomic write support added in 6.11-rc1 + +See upstream commit: + + commit bf4ae8f2e6407a779c0368eb0f3e047a8333be17 + Author: John Garry <john.g.garry@oracle.com> + Date: Thu Jun 20 12:53:57 2024 +0000 + + scsi: sd: Atomic write support + + Support is divided into two main areas: + - reading VPD pages and setting sdev request_queue limits + - support WRITE ATOMIC (16) command and tracing + + The relevant block limits VPD page need to be read to allow the block layer + request_queue atomic write limits to be set. These VPD page limits are + described in sbc4r22 section 6.6.4 - Block limits VPD page. + + There are five limits of interest: + - MAXIMUM ATOMIC TRANSFER LENGTH + - ATOMIC ALIGNMENT + - ATOMIC TRANSFER LENGTH GRANULARITY + - MAXIMUM ATOMIC TRANSFER LENGTH WITH BOUNDARY + - MAXIMUM ATOMIC BOUNDARY SIZE + + MAXIMUM ATOMIC TRANSFER LENGTH is the maximum length for a WRITE ATOMIC + (16) command. It will not be greater than the device MAXIMUM TRANSFER + LENGTH. + + ATOMIC ALIGNMENT and ATOMIC TRANSFER LENGTH GRANULARITY are the minimum + alignment and length values for an atomic write in terms of logical blocks. + + Unlike NVMe, SCSI does not specify an LBA space boundary, but does specify + a per-IO boundary granularity. The maximum boundary size is specified in + MAXIMUM ATOMIC BOUNDARY SIZE. When used, this boundary value is set in the + WRITE ATOMIC (16) ATOMIC BOUNDARY field - layout for the WRITE_ATOMIC_16 + command can be found in sbc4r22 section 5.48. This boundary value is the + granularity size at which the device may atomically write the data. A value + of zero in WRITE ATOMIC (16) ATOMIC BOUNDARY field means that all data must + be atomically written together. + + MAXIMUM ATOMIC TRANSFER LENGTH WITH BOUNDARY is the maximum atomic write + length if a non-zero boundary value is set. + + For atomic write support, the WRITE ATOMIC (16) boundary is not of much + interest, as the block layer expects each request submitted to be executed + be atomically written together. + + MAXIMUM ATOMIC TRANSFER LENGTH WITH BOUNDARY is the maximum atomic write + length if a non-zero boundary value is set. + + For atomic write support, the WRITE ATOMIC (16) boundary is not of much + interest, as the block layer expects each request submitted to be executed + atomically. However, the SCSI spec does leave itself open to a quirky + scenario where MAXIMUM ATOMIC TRANSFER LENGTH is zero, yet MAXIMUM ATOMIC + TRANSFER LENGTH WITH BOUNDARY and MAXIMUM ATOMIC BOUNDARY SIZE are both + non-zero. This case will be supported. + + To set the block layer request_queue atomic write capabilities, sanitize + the VPD page limits and set limits as follows: + - atomic_write_unit_min is derived from granularity and alignment values. + If no granularity value is not set, use physical block size + - atomic_write_unit_max is derived from MAXIMUM ATOMIC TRANSFER LENGTH. In + the scenario where MAXIMUM ATOMIC TRANSFER LENGTH is zero and boundary + limits are non-zero, use MAXIMUM ATOMIC BOUNDARY SIZE for + atomic_write_unit_max. New flag scsi_disk.use_atomic_write_boundary is + set for this scenario. + - atomic_write_boundary_bytes is set to zero always + + SCSI also supports a WRITE ATOMIC (32) command, which is for type 2 + protection enabled. This is not going to be supported now, so check for + T10_PI_TYPE2_PROTECTION when setting any request_queue limits. + + To handle an atomic write request, add support for WRITE ATOMIC (16) + command in handler sd_setup_atomic_cmnd(). Flag use_atomic_write_boundary + is checked here for encoding ATOMIC BOUNDARY field. + + Trace info is also added for WRITE_ATOMIC_16 command. + +Upstream-Status: Backport + +Change-Id: Ie072002fe2184615c72531ac081a324ef18cfb03 +Signed-off-by: Kienan Stewart <kstewart@efficios.com> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> +--- + include/instrumentation/events/scsi.h | 98 ++++++++++++++++++++++++++- + 1 file changed, 97 insertions(+), 1 deletion(-) + +diff --git a/include/instrumentation/events/scsi.h b/include/instrumentation/events/scsi.h +index 52c0ebd..54ba3ee 100644 +--- a/include/instrumentation/events/scsi.h ++++ b/include/instrumentation/events/scsi.h +@@ -16,7 +16,103 @@ + + #define scsi_opcode_name(opcode) { opcode, #opcode } + +-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,7,0) \ ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,11,0)) ++ ++#define show_opcode_name(val) \ ++ __print_symbolic(val, \ ++ scsi_opcode_name(TEST_UNIT_READY), \ ++ scsi_opcode_name(REZERO_UNIT), \ ++ scsi_opcode_name(REQUEST_SENSE), \ ++ scsi_opcode_name(FORMAT_UNIT), \ ++ scsi_opcode_name(READ_BLOCK_LIMITS), \ ++ scsi_opcode_name(REASSIGN_BLOCKS), \ ++ scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \ ++ scsi_opcode_name(READ_6), \ ++ scsi_opcode_name(WRITE_6), \ ++ scsi_opcode_name(SEEK_6), \ ++ scsi_opcode_name(READ_REVERSE), \ ++ scsi_opcode_name(WRITE_FILEMARKS), \ ++ scsi_opcode_name(SPACE), \ ++ scsi_opcode_name(INQUIRY), \ ++ scsi_opcode_name(RECOVER_BUFFERED_DATA), \ ++ scsi_opcode_name(MODE_SELECT), \ ++ scsi_opcode_name(RESERVE), \ ++ scsi_opcode_name(RELEASE), \ ++ scsi_opcode_name(COPY), \ ++ scsi_opcode_name(ERASE), \ ++ scsi_opcode_name(MODE_SENSE), \ ++ scsi_opcode_name(START_STOP), \ ++ scsi_opcode_name(RECEIVE_DIAGNOSTIC), \ ++ scsi_opcode_name(SEND_DIAGNOSTIC), \ ++ scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \ ++ scsi_opcode_name(SET_WINDOW), \ ++ scsi_opcode_name(READ_CAPACITY), \ ++ scsi_opcode_name(READ_10), \ ++ scsi_opcode_name(WRITE_10), \ ++ scsi_opcode_name(SEEK_10), \ ++ scsi_opcode_name(POSITION_TO_ELEMENT), \ ++ scsi_opcode_name(WRITE_VERIFY), \ ++ scsi_opcode_name(VERIFY), \ ++ scsi_opcode_name(SEARCH_HIGH), \ ++ scsi_opcode_name(SEARCH_EQUAL), \ ++ scsi_opcode_name(SEARCH_LOW), \ ++ scsi_opcode_name(SET_LIMITS), \ ++ scsi_opcode_name(PRE_FETCH), \ ++ scsi_opcode_name(READ_POSITION), \ ++ scsi_opcode_name(SYNCHRONIZE_CACHE), \ ++ scsi_opcode_name(LOCK_UNLOCK_CACHE), \ ++ scsi_opcode_name(READ_DEFECT_DATA), \ ++ scsi_opcode_name(MEDIUM_SCAN), \ ++ scsi_opcode_name(COMPARE), \ ++ scsi_opcode_name(COPY_VERIFY), \ ++ scsi_opcode_name(WRITE_BUFFER), \ ++ scsi_opcode_name(READ_BUFFER), \ ++ scsi_opcode_name(UPDATE_BLOCK), \ ++ scsi_opcode_name(READ_LONG), \ ++ scsi_opcode_name(WRITE_LONG), \ ++ scsi_opcode_name(CHANGE_DEFINITION), \ ++ scsi_opcode_name(WRITE_SAME), \ ++ scsi_opcode_name(UNMAP), \ ++ scsi_opcode_name(READ_TOC), \ ++ scsi_opcode_name(LOG_SELECT), \ ++ scsi_opcode_name(LOG_SENSE), \ ++ scsi_opcode_name(XDWRITEREAD_10), \ ++ scsi_opcode_name(MODE_SELECT_10), \ ++ scsi_opcode_name(RESERVE_10), \ ++ scsi_opcode_name(RELEASE_10), \ ++ scsi_opcode_name(MODE_SENSE_10), \ ++ scsi_opcode_name(PERSISTENT_RESERVE_IN), \ ++ scsi_opcode_name(PERSISTENT_RESERVE_OUT), \ ++ scsi_opcode_name(VARIABLE_LENGTH_CMD), \ ++ scsi_opcode_name(REPORT_LUNS), \ ++ scsi_opcode_name(MAINTENANCE_IN), \ ++ scsi_opcode_name(MAINTENANCE_OUT), \ ++ scsi_opcode_name(MOVE_MEDIUM), \ ++ scsi_opcode_name(EXCHANGE_MEDIUM), \ ++ scsi_opcode_name(READ_12), \ ++ scsi_opcode_name(WRITE_12), \ ++ scsi_opcode_name(WRITE_VERIFY_12), \ ++ scsi_opcode_name(SEARCH_HIGH_12), \ ++ scsi_opcode_name(SEARCH_EQUAL_12), \ ++ scsi_opcode_name(SEARCH_LOW_12), \ ++ scsi_opcode_name(READ_ELEMENT_STATUS), \ ++ scsi_opcode_name(SEND_VOLUME_TAG), \ ++ scsi_opcode_name(WRITE_LONG_2), \ ++ scsi_opcode_name(READ_16), \ ++ scsi_opcode_name(WRITE_16), \ ++ scsi_opcode_name(VERIFY_16), \ ++ scsi_opcode_name(WRITE_SAME_16), \ ++ scsi_opcode_name(ZBC_OUT), \ ++ scsi_opcode_name(ZBC_IN), \ ++ scsi_opcode_name(SERVICE_ACTION_IN_16), \ ++ scsi_opcode_name(READ_32), \ ++ scsi_opcode_name(WRITE_32), \ ++ scsi_opcode_name(WRITE_SAME_32), \ ++ scsi_opcode_name(ATA_16), \ ++ scsi_opcode_name(WRITE_ATOMIC_16), \ ++ scsi_opcode_name(ATA_12)) ++ ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,7,0) \ + || LTTNG_SLE_KERNEL_RANGE(4,4,9,36,0,0, 4,5,0,0,0,0)) + + #define show_opcode_name(val) \ |