Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: lttng-modu...@packages.debian.org
Control: affects -1 + src:lttng-modules

[ Reason ]
Fix the dkms build of lttng-modules against the current bullseye kernel
5.10.0-22.

[ Impact ]
I'ts currently impossible to use the lttng kernel tracer with the latest
bullseye kernel.

[ Tests ]
Tested manually on a bullseye virtual machine.

[ Risks ]
Minimal, won't be more broken than it actually is.

[ Checklist ]
  [*] *all* changes are documented in the d/changelog
  [*] I reviewed all changes and I approve them
  [*] attach debdiff against the package in (old)stable
  [*] the issue is verified as fixed in unstable

[ Changes ]
Backport the minimum list of upstream patches to support building on
5.10.0-22.
diff -Nru lttng-modules-2.12.5/debian/changelog 
lttng-modules-2.12.5/debian/changelog
--- lttng-modules-2.12.5/debian/changelog       2021-02-17 17:12:39.000000000 
-0500
+++ lttng-modules-2.12.5/debian/changelog       2023-05-03 11:13:07.000000000 
-0400
@@ -1,3 +1,20 @@
+lttng-modules (2.12.5-1+deb11u1) bullseye; urgency=medium
+
+  * Fix build on linux 5.10.0-22 (Closes: #1035364)
+
+  [ Michael Jeanson ]
+  * [a952a3a] Adjust gbp.conf for bullseye stable update
+
+  [ Povilas Kanapickas ]
+  * [ab16ac0] Add patch to fix build on Linux 5.10.137..5.11
+  * [25013d7] Add patch to fix build on Linux 5.10.119..5.11
+
+  [ Michael Jeanson ]
+  * [90a214b] dkms: conditionnaly include lttng-probe-random.ko
+  * [be2eaa4] Add patch to fix build on Linux 5.10.163..5.11
+
+ -- Michael Jeanson <mjean...@debian.org>  Wed, 03 May 2023 11:13:07 -0400
+
 lttng-modules (2.12.5-1) unstable; urgency=medium
 
   * [8e0b514] New upstream version 2.12.5
diff -Nru lttng-modules-2.12.5/debian/gbp.conf 
lttng-modules-2.12.5/debian/gbp.conf
--- lttng-modules-2.12.5/debian/gbp.conf        2021-02-17 17:12:39.000000000 
-0500
+++ lttng-modules-2.12.5/debian/gbp.conf        2023-05-01 15:01:42.000000000 
-0400
@@ -1,3 +1,3 @@
 [DEFAULT]
-upstream-branch=upstream/latest
-debian-branch=debian/sid
+upstream-branch=upstream/stable-2.12.5
+debian-branch=debian/bullseye
diff -Nru lttng-modules-2.12.5/debian/lttng-modules-dkms.dkms.in 
lttng-modules-2.12.5/debian/lttng-modules-dkms.dkms.in
--- lttng-modules-2.12.5/debian/lttng-modules-dkms.dkms.in      2021-02-17 
17:12:39.000000000 -0500
+++ lttng-modules-2.12.5/debian/lttng-modules-dkms.dkms.in      2023-05-01 
15:07:32.000000000 -0400
@@ -169,10 +169,12 @@
 DEST_MODULE_LOCATION[$i]="/extra/probes"
 i=$((i+1))
 
-BUILT_MODULE_NAME[$i]="lttng-probe-random"
-BUILT_MODULE_LOCATION[$i]="probes/"
-DEST_MODULE_LOCATION[$i]="/extra/probes"
-i=$((i+1))
+if [ -f "$kernel_source_dir/include/trace/events/random.h" ]; then
+    BUILT_MODULE_NAME[$i]="lttng-probe-random"
+    BUILT_MODULE_LOCATION[$i]="probes/"
+    DEST_MODULE_LOCATION[$i]="/extra/probes"
+    i=$((i+1))
+fi
 
 BUILT_MODULE_NAME[$i]="lttng-probe-rcu"
 BUILT_MODULE_LOCATION[$i]="probes/"
diff -Nru 
lttng-modules-2.12.5/debian/patches/fix-adjust-range-v5.10.137-in-block-probe.patch
 
lttng-modules-2.12.5/debian/patches/fix-adjust-range-v5.10.137-in-block-probe.patch
--- 
lttng-modules-2.12.5/debian/patches/fix-adjust-range-v5.10.137-in-block-probe.patch
 1969-12-31 19:00:00.000000000 -0500
+++ 
lttng-modules-2.12.5/debian/patches/fix-adjust-range-v5.10.137-in-block-probe.patch
 2023-05-01 15:04:13.000000000 -0400
@@ -0,0 +1,92 @@
+From bee932ee7580bfa50e58cf4bb1e1bf98a0a80b15 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Mon, 22 Aug 2022 14:16:27 -0400
+Subject: [PATCH] fix: adjust range v5.10.137 in block probe
+
+See upstream commit, backported in v5.10.137 :
+
+commit 1cb3032406423b25aa984854b4d78e0100d292dd
+Author: Christoph Hellwig <h...@lst.de>
+Date:   Thu Dec 3 17:21:39 2020 +0100
+
+block: remove the request_queue to argument request based
+tracepoints
+
+    [ Upstream commit a54895fa057c67700270777f7661d8d3c7fda88a ]
+
+    The request_queue can trivially be derived from the request.
+
+Change-Id: I01f96a437641421faf993b4b031171c372bd0374
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/block.h | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/block.h 
b/instrumentation/events/lttng-module/block.h
+index 4212b048..9eb77e7a 100644
+--- a/instrumentation/events/lttng-module/block.h
++++ b/instrumentation/events/lttng-module/block.h
+@@ -266,7 +266,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, 
block_rq_abort,
+ )
+ #endif
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ /**
+  * block_rq_requeue - place block IO request back on a queue
+  * @rq: block IO operation request
+@@ -458,7 +459,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, 
block_rq_complete,
+ 
+ #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= 
LTTNG_KERNEL_VERSION(3,15,0)) */
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ LTTNG_TRACEPOINT_EVENT_CLASS(block_rq,
+ 
+       TP_PROTO(struct request *rq),
+@@ -593,7 +595,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS_CODE(block_rq,
+ )
+ #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= 
LTTNG_KERNEL_VERSION(4,11,0)) */
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ /**
+  * block_rq_insert - insert block operation request into queue
+  * @rq: block IO operation request
+@@ -628,7 +631,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_insert,
+ )
+ #endif
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ /**
+  * block_rq_issue - issue pending block IO request operation to device driver
+  * @rq: block IO operation operation request
+@@ -659,7 +663,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq, block_rq_issue,
+ )
+ #endif
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ /**
+  * block_rq_merge - merge request with another one in the elevator
+  * @rq: block IO operation operation request
+@@ -1450,7 +1455,8 @@ LTTNG_TRACEPOINT_EVENT(block_bio_remap,
+ )
+ #endif
+ 
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,10,137, 5,11,0))
+ /**
+  * block_rq_remap - map request for a block operation request
+  * @rq: block IO operation request
+-- 
+2.39.2
+
diff -Nru 
lttng-modules-2.12.5/debian/patches/fix-jbd2-use-the-correct-print-format.patch 
lttng-modules-2.12.5/debian/patches/fix-jbd2-use-the-correct-print-format.patch
--- 
lttng-modules-2.12.5/debian/patches/fix-jbd2-use-the-correct-print-format.patch 
    1969-12-31 19:00:00.000000000 -0500
+++ 
lttng-modules-2.12.5/debian/patches/fix-jbd2-use-the-correct-print-format.patch 
    2023-05-03 11:05:15.000000000 -0400
@@ -0,0 +1,155 @@
+From f2adaa3a1c0b99966f736ec45d5cb6c77e519787 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Thu, 12 Jan 2023 13:52:22 -0500
+Subject: [PATCH] fix: jbd2: use the correct print format
+
+See upstream commit :
+
+  commit d87a7b4c77a997d5388566dd511ca8e6b8e8a0a8
+  Author: Bixuan Cui <cuibix...@linux.alibaba.com>
+  Date:   Tue Oct 11 19:33:44 2022 +0800
+
+    jbd2: use the correct print format
+
+    The print format error was found when using ftrace event:
+        <...>-1406 [000] .... 23599442.895823: jbd2_end_commit: dev 252,8 
transaction -1866216965 sync 0 head -1866217368
+        <...>-1406 [000] .... 23599442.896299: jbd2_start_commit: dev 252,8 
transaction -1866216964 sync 0
+
+    Use the correct print format for transaction, head and tid.
+
+Change-Id: Ic053f0e0c1e24ebc75bae51d07696aaa5e1c0094
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/jbd2.h | 80 ++++++++++++++++++++++
+ 1 file changed, 80 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/jbd2.h 
b/instrumentation/events/lttng-module/jbd2.h
+index 46563a94..7374b150 100644
+--- a/instrumentation/events/lttng-module/jbd2.h
++++ b/instrumentation/events/lttng-module/jbd2.h
+@@ -27,6 +27,24 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint,
+       )
+ )
+ 
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
++      || LTTNG_KERNEL_RANGE(5,10,163, 5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,15,87, 5,16,0) \
++      || LTTNG_KERNEL_RANGE(6,0,18, 6,1,0) \
++      || LTTNG_KERNEL_RANGE(6,1,4, 6,2,0))
++LTTNG_TRACEPOINT_EVENT_CLASS(jbd2_commit,
++
++      TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
++
++      TP_ARGS(journal, commit_transaction),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev)
++              ctf_integer(char, sync_commit, 
commit_transaction->t_synchronous_commit)
++              ctf_integer(tid_t, transaction, commit_transaction->t_tid)
++      )
++)
++#else
+ LTTNG_TRACEPOINT_EVENT_CLASS(jbd2_commit,
+ 
+       TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
+@@ -39,6 +57,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(jbd2_commit,
+               ctf_integer(int, transaction, commit_transaction->t_tid)
+       )
+ )
++#endif
+ 
+ LTTNG_TRACEPOINT_EVENT_INSTANCE(jbd2_commit, jbd2_start_commit,
+ 
+@@ -77,6 +96,24 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(jbd2_commit, 
jbd2_drop_transaction,
+ )
+ #endif
+ 
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
++      || LTTNG_KERNEL_RANGE(5,10,163, 5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,15,87, 5,16,0) \
++      || LTTNG_KERNEL_RANGE(6,0,18, 6,1,0) \
++      || LTTNG_KERNEL_RANGE(6,1,4, 6,2,0))
++LTTNG_TRACEPOINT_EVENT(jbd2_end_commit,
++      TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
++
++      TP_ARGS(journal, commit_transaction),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev, journal->j_fs_dev->bd_dev)
++              ctf_integer(char, sync_commit, 
commit_transaction->t_synchronous_commit)
++              ctf_integer(tid_t, transaction, commit_transaction->t_tid)
++              ctf_integer(tid_t, head, journal->j_tail_sequence)
++      )
++)
++#else
+ LTTNG_TRACEPOINT_EVENT(jbd2_end_commit,
+       TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
+ 
+@@ -89,6 +126,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_end_commit,
+               ctf_integer(int, head, journal->j_tail_sequence)
+       )
+ )
++#endif
+ 
+ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data,
+       TP_PROTO(struct inode *inode),
+@@ -101,6 +139,47 @@ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data,
+       )
+ )
+ 
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
++      || LTTNG_KERNEL_RANGE(5,10,163, 5,11,0) \
++      || LTTNG_KERNEL_RANGE(5,15,87, 5,16,0) \
++      || LTTNG_KERNEL_RANGE(6,0,18, 6,1,0) \
++      || LTTNG_KERNEL_RANGE(6,1,4, 6,2,0))
++LTTNG_TRACEPOINT_EVENT(jbd2_run_stats,
++      TP_PROTO(dev_t dev, tid_t tid,
++               struct transaction_run_stats_s *stats),
++
++      TP_ARGS(dev, tid, stats),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev, dev)
++              ctf_integer(tid_t, tid, tid)
++              ctf_integer(unsigned long, wait, stats->rs_wait)
++              ctf_integer(unsigned long, running, stats->rs_running)
++              ctf_integer(unsigned long, locked, stats->rs_locked)
++              ctf_integer(unsigned long, flushing, stats->rs_flushing)
++              ctf_integer(unsigned long, logging, stats->rs_logging)
++              ctf_integer(__u32, handle_count, stats->rs_handle_count)
++              ctf_integer(__u32, blocks, stats->rs_blocks)
++              ctf_integer(__u32, blocks_logged, stats->rs_blocks_logged)
++      )
++)
++
++LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint_stats,
++      TP_PROTO(dev_t dev, tid_t tid,
++               struct transaction_chp_stats_s *stats),
++
++      TP_ARGS(dev, tid, stats),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev, dev)
++              ctf_integer(tid_t, tid, tid)
++              ctf_integer(unsigned long, chp_time, stats->cs_chp_time)
++              ctf_integer(__u32, forced_to_close, stats->cs_forced_to_close)
++              ctf_integer(__u32, written, stats->cs_written)
++              ctf_integer(__u32, dropped, stats->cs_dropped)
++      )
++)
++#else
+ LTTNG_TRACEPOINT_EVENT(jbd2_run_stats,
+       TP_PROTO(dev_t dev, unsigned long tid,
+                struct transaction_run_stats_s *stats),
+@@ -136,6 +215,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint_stats,
+               ctf_integer(__u32, dropped, stats->cs_dropped)
+       )
+ )
++#endif
+ 
+ #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
+ LTTNG_TRACEPOINT_EVENT(jbd2_update_log_tail,
+-- 
+2.39.2
+
diff -Nru 
lttng-modules-2.12.5/debian/patches/fix-random-tracepoints-removed-in-stable-kernels.patch
 
lttng-modules-2.12.5/debian/patches/fix-random-tracepoints-removed-in-stable-kernels.patch
--- 
lttng-modules-2.12.5/debian/patches/fix-random-tracepoints-removed-in-stable-kernels.patch
  1969-12-31 19:00:00.000000000 -0500
+++ 
lttng-modules-2.12.5/debian/patches/fix-random-tracepoints-removed-in-stable-kernels.patch
  2023-05-01 15:04:22.000000000 -0400
@@ -0,0 +1,46 @@
+From 5158edfacb9779ce3922bf1698d54cfc63be901d Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Tue, 31 May 2022 15:24:48 -0400
+Subject: [PATCH] fix: 'random' tracepoints removed in stable kernels
+
+The upstream commit 14c174633f349cb41ea90c2c0aaddac157012f74 removing
+the 'random' tracepoints is being backported to multiple stable kernel
+branches, I don't see how that qualifies as a fix but here we are.
+
+Use the presence of 'include/trace/events/random.h' in the kernel source
+tree instead of the rather tortuous version check to determine if we
+need to build 'lttng-probe-random.ko'.
+
+Change-Id: I8f5f2f4c9e09c61127c49c7949b22dd3fab0460d
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ probes/Kbuild | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/probes/Kbuild b/probes/Kbuild
+index 18766855..4db634ab 100644
+--- a/probes/Kbuild
++++ b/probes/Kbuild
+@@ -187,13 +187,11 @@ ifneq ($(CONFIG_FRAME_WARN),0)
+   CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
+ endif
+ 
+-obj-$(CONFIG_LTTNG) +=  $(shell \
+-    if [ $(VERSION) -ge 4 \
+-      -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
+-      -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
+-      -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
+-      -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) 
] ; then \
+-      echo "lttng-probe-random.o" ; fi;)
++# Introduced in v3.6, remove in v5.18
++random_dep = $(srctree)/include/trace/events/random.h
++ifneq ($(wildcard $(random_dep)),)
++  obj-$(CONFIG_LTTNG) += lttng-probe-random.o
++endif
+ 
+ obj-$(CONFIG_LTTNG) +=  $(shell \
+   if [ $(VERSION) -ge 4 \
+-- 
+2.39.2
+
diff -Nru lttng-modules-2.12.5/debian/patches/series 
lttng-modules-2.12.5/debian/patches/series
--- lttng-modules-2.12.5/debian/patches/series  2021-02-17 17:12:39.000000000 
-0500
+++ lttng-modules-2.12.5/debian/patches/series  2023-05-03 11:06:09.000000000 
-0400
@@ -1 +1,4 @@
 fix-linux-rt-4.9-sched.patch
+fix-adjust-range-v5.10.137-in-block-probe.patch
+fix-random-tracepoints-removed-in-stable-kernels.patch
+fix-jbd2-use-the-correct-print-format.patch

Reply via email to