Followup-For: Bug #1035364
Control: tag -1 + patch

Attached is a patch which is a collection of several commits from the
upstream stable-2.12 branch to restore compatibility with the Linux 5.10
LTS kernel in bullseye.


Andreas
>From eb69797441ee560f51be5ec1621e34eb9c7df123 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Fri, 12 May 2023 14:46:53 +0200
Subject: [PATCH] cherry-pick upstream fixes for Linux 5.10 LTS support

---
 debian/changelog                              |   7 +
 debian/gbp.conf                               |   2 +-
 debian/lttng-modules-dkms.dkms.in             |   2 +
 ...call-blk_status_to_errno-in-blk_upda.patch |  58 +++++++
 ...-the-rq_disk-field-in-struct-request.patch | 155 ++++++++++++++++++
 ...ndom-remove-unused-tracepoints-v5.18.patch |  45 +++++
 ...emove-unused-tracepoints-v5.10-v5.15.patch |  44 +++++
 ...racepoints-removed-in-stable-kernels.patch |  50 ++++++
 ...djust-range-v5.10.137-in-block-probe.patch |  91 ++++++++++
 ...ix-jbd2-use-the-correct-print-format.patch | 152 +++++++++++++++++
 ...e-the-correct-print-format-v5.10.163.patch |  57 +++++++
 ...7-fix-jbd2-upper-bound-for-v5.10.163.patch |  48 ++++++
 debian/patches/series                         |   9 +
 13 files changed, 719 insertions(+), 1 deletion(-)
 create mode 100644 
debian/patches/0034-fix-block-don-t-call-blk_status_to_errno-in-blk_upda.patch
 create mode 100644 
debian/patches/0039-fix-block-remove-the-rq_disk-field-in-struct-request.patch
 create mode 100644 
debian/patches/0051-fix-random-remove-unused-tracepoints-v5.18.patch
 create mode 100644 
debian/patches/0052-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch
 create mode 100644 
debian/patches/0053-fix-random-tracepoints-removed-in-stable-kernels.patch
 create mode 100644 
debian/patches/0059-fix-adjust-range-v5.10.137-in-block-probe.patch
 create mode 100644 
debian/patches/0074-fix-jbd2-use-the-correct-print-format.patch
 create mode 100644 
debian/patches/0076-fix-jbd2-use-the-correct-print-format-v5.10.163.patch
 create mode 100644 debian/patches/0077-fix-jbd2-upper-bound-for-v5.10.163.patch

diff --git a/debian/changelog b/debian/changelog
index 5140940..8be1997 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+lttng-modules (2.12.5-1+deb11u1) bullseye; urgency=medium
+
+  * Cherry-pick upstream fixes for Linux 5.10 LTS support from 2.12.7, 2.12.8,
+    2.12.9, 2.12.11, 2.12.12, 2.12.13.  (Closes: #1035364)
+
+ -- Andreas Beckmann <a...@debian.org>  Fri, 12 May 2023 14:41:40 +0200
+
 lttng-modules (2.12.5-1) unstable; urgency=medium
 
   * [8e0b514] New upstream version 2.12.5
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 2236634..ac5b4ec 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,3 +1,3 @@
 [DEFAULT]
 upstream-branch=upstream/latest
-debian-branch=debian/sid
+debian-branch=debian/bullseye
diff --git a/debian/lttng-modules-dkms.dkms.in 
b/debian/lttng-modules-dkms.dkms.in
index e97ec7d..fa75167 100644
--- a/debian/lttng-modules-dkms.dkms.in
+++ b/debian/lttng-modules-dkms.dkms.in
@@ -169,10 +169,12 @@ 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 --git 
a/debian/patches/0034-fix-block-don-t-call-blk_status_to_errno-in-blk_upda.patch
 
b/debian/patches/0034-fix-block-don-t-call-blk_status_to_errno-in-blk_upda.patch
new file mode 100644
index 0000000..4923336
--- /dev/null
+++ 
b/debian/patches/0034-fix-block-don-t-call-blk_status_to_errno-in-blk_upda.patch
@@ -0,0 +1,58 @@
+From 42a03cb282877dbefbf7da733d71131fa0f83ae0 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Tue, 14 Dec 2021 15:13:20 -0500
+Subject: [PATCH 34/87] fix: block: don't call blk_status_to_errno in
+ blk_update_request (v5.16)
+
+See upstream commit :
+
+  commit 8a7d267b4a2c71a5ff5dd9046abea7117c7d0ac2
+  Author: Christoph Hellwig <h...@lst.de>
+  Date:   Mon Oct 18 10:45:18 2021 +0200
+
+    block: don't call blk_status_to_errno in blk_update_request
+
+    We only need to call it to resolve the blk_status_t -> errno mapping for
+    tracing, so move the conversion into the tracepoints that are not called
+    at all when tracing isn't enabled.
+
+Change-Id: Ic556cee1d82e44a93a1467f55d45b6e17a48d387
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/block.h | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/instrumentation/events/lttng-module/block.h 
b/instrumentation/events/lttng-module/block.h
+index c78de802..edd433e8 100644
+--- a/instrumentation/events/lttng-module/block.h
++++ b/instrumentation/events/lttng-module/block.h
+@@ -380,7 +380,24 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, 
block_rq_requeue,
+  * do for the request. If @rq->bio is non-NULL then there is
+  * additional work required to complete the request.
+  */
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
++LTTNG_TRACEPOINT_EVENT(block_rq_complete,
++
++      TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
++
++      TP_ARGS(rq, error, nr_bytes),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev,
++                      rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
++              ctf_integer(sector_t, sector, blk_rq_pos(rq))
++              ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
++              ctf_integer(int, error, blk_status_to_errno(error))
++              blk_rwbs_ctf_integer(unsigned int, rwbs,
++                      lttng_req_op(rq), lttng_req_rw(rq), nr_bytes)
++      )
++)
++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,12,0))
+ LTTNG_TRACEPOINT_EVENT(block_rq_complete,
+ 
+       TP_PROTO(struct request *rq, int error, unsigned int nr_bytes),
+-- 
+2.20.1
+
diff --git 
a/debian/patches/0039-fix-block-remove-the-rq_disk-field-in-struct-request.patch
 
b/debian/patches/0039-fix-block-remove-the-rq_disk-field-in-struct-request.patch
new file mode 100644
index 0000000..2eb90a8
--- /dev/null
+++ 
b/debian/patches/0039-fix-block-remove-the-rq_disk-field-in-struct-request.patch
@@ -0,0 +1,155 @@
+From eef478c9817f9525206304642f5f268c58f70ebc Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Sun, 23 Jan 2022 13:11:47 -0500
+Subject: [PATCH 39/87] fix: block: remove the ->rq_disk field in struct
+ request (v5.17)
+
+See upstream commit :
+
+  commit f3fa33acca9f0058157214800f68b10d8e71ab7a
+  Author: Christoph Hellwig <h...@lst.de>
+  Date:   Fri Nov 26 13:18:00 2021 +0100
+
+    block: remove the ->rq_disk field in struct request
+
+    Just use the disk attached to the request_queue instead.
+
+    Link: https://lore.kernel.org/r/20211126121802.2090656-4-...@lst.de
+
+Change-Id: I24263be519d1b51f4b00bd95f14a9aeb8457889a
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/block.h | 95 ++++++++++++++++++++-
+ 1 file changed, 91 insertions(+), 4 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/block.h 
b/instrumentation/events/lttng-module/block.h
+index edd433e8..25539673 100644
+--- a/instrumentation/events/lttng-module/block.h
++++ b/instrumentation/events/lttng-module/block.h
+@@ -310,7 +310,31 @@ 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,17,0))
++/**
++ * block_rq_requeue - place block IO request back on a queue
++ * @rq: block IO operation request
++ *
++ * The block operation request @rq is being placed back into queue
++ * @q.  For some reason the request was not completed and needs to be
++ * put back in the queue.
++ */
++LTTNG_TRACEPOINT_EVENT(block_rq_requeue,
++
++      TP_PROTO(struct request *rq),
++
++      TP_ARGS(rq),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev,
++                      rq->q->disk ? disk_devt(rq->q->disk) : 0)
++              ctf_integer(sector_t, sector, blk_rq_trace_sector(rq))
++              ctf_integer(unsigned int, nr_sector, 
blk_rq_trace_nr_sectors(rq))
++              blk_rwbs_ctf_integer(unsigned int, rwbs,
++                      lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
++      )
++)
++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
+ /**
+  * block_rq_requeue - place block IO request back on a queue
+  * @rq: block IO operation request
+@@ -380,7 +404,24 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, 
block_rq_requeue,
+  * do for the request. If @rq->bio is non-NULL then there is
+  * additional work required to complete the request.
+  */
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
++LTTNG_TRACEPOINT_EVENT(block_rq_complete,
++
++      TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
++
++      TP_ARGS(rq, error, nr_bytes),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev,
++                      rq->q->disk ? disk_devt(rq->q->disk) : 0)
++              ctf_integer(sector_t, sector, blk_rq_pos(rq))
++              ctf_integer(unsigned int, nr_sector, nr_bytes >> 9)
++              ctf_integer(int, error, blk_status_to_errno(error))
++              blk_rwbs_ctf_integer(unsigned int, rwbs,
++                      lttng_req_op(rq), lttng_req_rw(rq), nr_bytes)
++      )
++)
++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
+ LTTNG_TRACEPOINT_EVENT(block_rq_complete,
+ 
+       TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
+@@ -519,7 +560,26 @@ 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,17,0))
++LTTNG_TRACEPOINT_EVENT_CLASS(block_rq,
++
++      TP_PROTO(struct request *rq),
++
++      TP_ARGS(rq),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev,
++                      rq->q->disk ? disk_devt(rq->q->disk) : 0)
++              ctf_integer(sector_t, sector, blk_rq_trace_sector(rq))
++              ctf_integer(unsigned int, nr_sector, 
blk_rq_trace_nr_sectors(rq))
++              ctf_integer(unsigned int, bytes, blk_rq_bytes(rq))
++              ctf_integer(pid_t, tid, current->pid)
++              blk_rwbs_ctf_integer(unsigned int, rwbs,
++                      lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
++              ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
++      )
++)
++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
+ LTTNG_TRACEPOINT_EVENT_CLASS(block_rq,
+ 
+       TP_PROTO(struct request *rq),
+@@ -1513,7 +1573,34 @@ 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,17,0))
++/**
++ * block_rq_remap - map request for a block operation request
++ * @rq: block IO operation request
++ * @dev: device for the operation
++ * @from: original sector for the operation
++ *
++ * The block operation request @rq in @q has been remapped.  The block
++ * operation request @rq holds the current information and @from hold
++ * the original sector.
++ */
++LTTNG_TRACEPOINT_EVENT(block_rq_remap,
++
++      TP_PROTO(struct request *rq, dev_t dev, sector_t from),
++
++      TP_ARGS(rq, dev, from),
++
++      TP_FIELDS(
++              ctf_integer(dev_t, dev, disk_devt(rq->q->disk))
++              ctf_integer(sector_t, sector, blk_rq_pos(rq))
++              ctf_integer(unsigned int, nr_sector, blk_rq_sectors(rq))
++              ctf_integer(dev_t, old_dev, dev)
++              ctf_integer(sector_t, old_sector, from)
++              blk_rwbs_ctf_integer(unsigned int, rwbs,
++                      lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
++      )
++)
++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
+ /**
+  * block_rq_remap - map request for a block operation request
+  * @rq: block IO operation request
+-- 
+2.20.1
+
diff --git 
a/debian/patches/0051-fix-random-remove-unused-tracepoints-v5.18.patch 
b/debian/patches/0051-fix-random-remove-unused-tracepoints-v5.18.patch
new file mode 100644
index 0000000..3bc7d44
--- /dev/null
+++ b/debian/patches/0051-fix-random-remove-unused-tracepoints-v5.18.patch
@@ -0,0 +1,45 @@
+From a9bda5a02ba444b1dcd80c8326cf5a0d1be535fa Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Mon, 4 Apr 2022 14:33:42 -0400
+Subject: [PATCH 51/87] fix: random: remove unused tracepoints (v5.18)
+
+See upstream commit :
+
+  commit 14c174633f349cb41ea90c2c0aaddac157012f74
+  Author: Jason A. Donenfeld <ja...@zx2c4.com>
+  Date:   Thu Feb 10 16:40:44 2022 +0100
+
+    random: remove unused tracepoints
+
+    These explicit tracepoints aren't really used and show sign of aging.
+    It's work to keep these up to date, and before I attempted to keep them
+    up to date, they weren't up to date, which indicates that they're not
+    really used. These days there are better ways of introspecting anyway.
+
+Change-Id: I3b8c3e2732e7efdd76ce63204ac53a48784d0df6
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ probes/Kbuild | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/probes/Kbuild b/probes/Kbuild
+index 18766855..e4177acf 100644
+--- a/probes/Kbuild
++++ b/probes/Kbuild
+@@ -187,8 +187,11 @@ ifneq ($(CONFIG_FRAME_WARN),0)
+   CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
+ endif
+ 
++# Introduced in v3.6, remove in v5.18
+ obj-$(CONFIG_LTTNG) +=  $(shell \
+-    if [ $(VERSION) -ge 4 \
++    if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 
18 \) \) \) \
++      -a \
++      $(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 \) \
+-- 
+2.20.1
+
diff --git 
a/debian/patches/0052-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch 
b/debian/patches/0052-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch
new file mode 100644
index 0000000..d00a975
--- /dev/null
+++ b/debian/patches/0052-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch
@@ -0,0 +1,44 @@
+From a16f3f135705ac061bf93bbf3d1f885fe49f83c6 Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe...@windriver.com>
+Date: Thu, 2 Jun 2022 06:36:08 +0000
+Subject: [PATCH 52/87] fix: random: remove unused tracepoints (v5.10, v5.15)
+
+The following kernel commit has been back ported to v5.10.119 and v5.15.44.
+
+commit 14c174633f349cb41ea90c2c0aaddac157012f74
+Author: Jason A. Donenfeld <ja...@zx2c4.com>
+Date:   Thu Feb 10 16:40:44 2022 +0100
+
+  random: remove unused tracepoints
+
+  These explicit tracepoints aren't really used and show sign of aging.
+  It's work to keep these up to date, and before I attempted to keep them
+  up to date, they weren't up to date, which indicates that they're not
+  really used. These days there are better ways of introspecting anyway.
+
+Signed-off-by: He Zhe <zhe...@windriver.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+Change-Id: I0b7eb8aa78b5bd2039e20ae3e1da4c5eb9018789
+---
+ probes/Kbuild | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/probes/Kbuild b/probes/Kbuild
+index e4177acf..ccaa9f5e 100644
+--- a/probes/Kbuild
++++ b/probes/Kbuild
+@@ -189,7 +189,10 @@ endif
+ 
+ # Introduced in v3.6, remove in v5.18
+ obj-$(CONFIG_LTTNG) +=  $(shell \
+-    if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 
18 \) \) \) \
++    if [ \( ! \( $(VERSION) -ge 6 \
++      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \
++      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 15 -a $(SUBLEVEL) -ge 44 \) 
\
++      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 10 -a $(SUBLEVEL) -ge 119\) 
\) \) \
+       -a \
+       $(VERSION) -ge 4 \
+       -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
+-- 
+2.20.1
+
diff --git 
a/debian/patches/0053-fix-random-tracepoints-removed-in-stable-kernels.patch 
b/debian/patches/0053-fix-random-tracepoints-removed-in-stable-kernels.patch
new file mode 100644
index 0000000..0875a13
--- /dev/null
+++ b/debian/patches/0053-fix-random-tracepoints-removed-in-stable-kernels.patch
@@ -0,0 +1,50 @@
+From 5b3fb979c7f3c5ab12f2489f71d9617624f7cc2d Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Tue, 31 May 2022 15:24:48 -0400
+Subject: [PATCH 53/87] 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 | 16 ++++------------
+ 1 file changed, 4 insertions(+), 12 deletions(-)
+
+diff --git a/probes/Kbuild b/probes/Kbuild
+index ccaa9f5e..4db634ab 100644
+--- a/probes/Kbuild
++++ b/probes/Kbuild
+@@ -188,18 +188,10 @@ ifneq ($(CONFIG_FRAME_WARN),0)
+ endif
+ 
+ # Introduced in v3.6, remove in v5.18
+-obj-$(CONFIG_LTTNG) +=  $(shell \
+-    if [ \( ! \( $(VERSION) -ge 6 \
+-      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \
+-      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 15 -a $(SUBLEVEL) -ge 44 \) 
\
+-      -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 10 -a $(SUBLEVEL) -ge 119\) 
\) \) \
+-      -a \
+-      $(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;)
++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.20.1
+
diff --git 
a/debian/patches/0059-fix-adjust-range-v5.10.137-in-block-probe.patch 
b/debian/patches/0059-fix-adjust-range-v5.10.137-in-block-probe.patch
new file mode 100644
index 0000000..feac1c4
--- /dev/null
+++ b/debian/patches/0059-fix-adjust-range-v5.10.137-in-block-probe.patch
@@ -0,0 +1,91 @@
+From 9f7df0f1867273244e62e14e68e20e03db4902ca Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Mon, 22 Aug 2022 14:16:27 -0400
+Subject: [PATCH 59/87] 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 25539673..94225b9e 100644
+--- a/instrumentation/events/lttng-module/block.h
++++ b/instrumentation/events/lttng-module/block.h
+@@ -334,7 +334,8 @@ LTTNG_TRACEPOINT_EVENT(block_rq_requeue,
+                       lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
+       )
+ )
+-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#elif (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
+@@ -579,7 +580,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_rq,
+               ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
+       )
+ )
+-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#elif (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),
+@@ -714,7 +716,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
+@@ -749,7 +752,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
+@@ -780,7 +784,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
+@@ -1600,7 +1605,8 @@ LTTNG_TRACEPOINT_EVENT(block_rq_remap,
+                       lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
+       )
+ )
+-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0))
++#elif (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.20.1
+
diff --git a/debian/patches/0074-fix-jbd2-use-the-correct-print-format.patch 
b/debian/patches/0074-fix-jbd2-use-the-correct-print-format.patch
new file mode 100644
index 0000000..258736d
--- /dev/null
+++ b/debian/patches/0074-fix-jbd2-use-the-correct-print-format.patch
@@ -0,0 +1,152 @@
+From 38b4e82d9f77265f80ea77f809eb354ff6c0f6e4 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Thu, 12 Jan 2023 13:52:22 -0500
+Subject: [PATCH 74/87] 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 | 77 ++++++++++++++++++++++
+ 1 file changed, 77 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/jbd2.h 
b/instrumentation/events/lttng-module/jbd2.h
+index 46563a94..cb1fc4cf 100644
+--- a/instrumentation/events/lttng-module/jbd2.h
++++ b/instrumentation/events/lttng-module/jbd2.h
+@@ -27,6 +27,23 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint,
+       )
+ )
+ 
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,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 +56,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 +95,23 @@ 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,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 +124,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 +137,46 @@ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data,
+       )
+ )
+ 
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,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 +212,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.20.1
+
diff --git 
a/debian/patches/0076-fix-jbd2-use-the-correct-print-format-v5.10.163.patch 
b/debian/patches/0076-fix-jbd2-use-the-correct-print-format-v5.10.163.patch
new file mode 100644
index 0000000..f94d665
--- /dev/null
+++ b/debian/patches/0076-fix-jbd2-use-the-correct-print-format-v5.10.163.patch
@@ -0,0 +1,57 @@
+From 9874ec562e299f8abe680c89c810d8c2d5cec0aa Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Tue, 17 Jan 2023 11:03:12 -0500
+Subject: [PATCH 76/87] fix: jbd2: use the correct print format (v5.10.163)
+
+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: I7601f5cbb86495c2607be7b11e02724c90b3ebf9
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/jbd2.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/jbd2.h 
b/instrumentation/events/lttng-module/jbd2.h
+index cb1fc4cf..4295f20f 100644
+--- a/instrumentation/events/lttng-module/jbd2.h
++++ b/instrumentation/events/lttng-module/jbd2.h
+@@ -28,6 +28,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint,
+ )
+ 
+ #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
++      || LTTNG_KERNEL_RANGE(5,10,163, 6,0,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))
+@@ -96,6 +97,7 @@ 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, 6,0,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))
+@@ -138,6 +140,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data,
+ )
+ 
+ #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
++      || LTTNG_KERNEL_RANGE(5,10,163, 6,0,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))
+-- 
+2.20.1
+
diff --git a/debian/patches/0077-fix-jbd2-upper-bound-for-v5.10.163.patch 
b/debian/patches/0077-fix-jbd2-upper-bound-for-v5.10.163.patch
new file mode 100644
index 0000000..bebcb2e
--- /dev/null
+++ b/debian/patches/0077-fix-jbd2-upper-bound-for-v5.10.163.patch
@@ -0,0 +1,48 @@
+From c6711d1e6ab28d6da7637413a10fd8de67fd1de2 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjean...@efficios.com>
+Date: Tue, 17 Jan 2023 12:16:04 -0500
+Subject: [PATCH 77/87] fix: jbd2 upper bound for v5.10.163
+
+Use the correct upper bound of 5,11,0.
+
+Change-Id: I435b44b940c7346ed8c3ef0d445365ed156702d0
+Signed-off-by: Michael Jeanson <mjean...@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
+---
+ instrumentation/events/lttng-module/jbd2.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/jbd2.h 
b/instrumentation/events/lttng-module/jbd2.h
+index 4295f20f..7374b150 100644
+--- a/instrumentation/events/lttng-module/jbd2.h
++++ b/instrumentation/events/lttng-module/jbd2.h
+@@ -28,7 +28,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_checkpoint,
+ )
+ 
+ #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
+-      || LTTNG_KERNEL_RANGE(5,10,163, 6,0,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))
+@@ -97,7 +97,7 @@ 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, 6,0,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))
+@@ -140,7 +140,7 @@ LTTNG_TRACEPOINT_EVENT(jbd2_submit_inode_data,
+ )
+ 
+ #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,2,0) \
+-      || LTTNG_KERNEL_RANGE(5,10,163, 6,0,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))
+-- 
+2.20.1
+
diff --git a/debian/patches/series b/debian/patches/series
index ada1602..070cb9a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,10 @@
+0034-fix-block-don-t-call-blk_status_to_errno-in-blk_upda.patch
+0039-fix-block-remove-the-rq_disk-field-in-struct-request.patch
+0051-fix-random-remove-unused-tracepoints-v5.18.patch
+0052-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch
+0053-fix-random-tracepoints-removed-in-stable-kernels.patch
+0059-fix-adjust-range-v5.10.137-in-block-probe.patch
+0074-fix-jbd2-use-the-correct-print-format.patch
+0076-fix-jbd2-use-the-correct-print-format-v5.10.163.patch
+0077-fix-jbd2-upper-bound-for-v5.10.163.patch
 fix-linux-rt-4.9-sched.patch
-- 
2.20.1

Reply via email to