Skip to contentSkip to conversation

Fix: Update btrfs instrumentation for v4.15

PATCH New Michael Jeanson 2 participants 4 messages Jan 9, 2018 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/3 Update kvm instrumentation for debian kernel 4.9.65-3

---
 instrumentation/events/lttng-module/kvm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
instrumentation/events/lttng-module/kvm.h +2 -1
index ea63e88..d9d0300 100644
@@ -86,7 +86,8 @@ LTTNG_TRACEPOINT_EVENT(kvm_ack_irq,
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) \
 	|| LTTNG_KERNEL_RANGE(3,16,52, 3,17,0) \
-	|| LTTNG_KERNEL_RANGE(3,2,97, 3,3,0))
+	|| LTTNG_KERNEL_RANGE(3,2,97, 3,3,0) \
+	|| LTTNG_DEBIAN_KERNEL_RANGE(4,9,65,0,3,0, 4,10,0,0,0,0))
 
 LTTNG_TRACEPOINT_EVENT(kvm_mmio,
 	TP_PROTO(int type, int len, u64 gpa, void *val),
Signature · 6 lines
2.7.4

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#2 lore raw

PATCH 3/3 Fix: Update btrfs instrumentation for v4.15

In reply to a message not in the archive

See upstream commit:

commit d278850eff3053ef166cf64c16f798dfe36278a2
Author: Josef Bacik <[email protected]>
Date: Fri Sep 29 15:43:57 2017 -0400

btrfs: remove delayed_ref_node from ref_head

This is just excessive information in the ref_head, and makes the code complicated. It is a relic from when we had the heads and the refs in the same tree, which is no longer the case. With this removal I've cleaned up a bunch of the cruft around this old assumption as well.

---
 instrumentation/events/lttng-module/btrfs.h | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
instrumentation/events/lttng-module/btrfs.h +17 -1
index b529e8e..7901f05 100644
@@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
 	)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+
+	TP_PROTO(struct btrfs_fs_info *fs_info,
+		 struct btrfs_delayed_ref_head *head_ref,
+		 int action),
+
+	TP_ARGS(fs_info, head_ref, action),
+
+	TP_FIELDS(
+		ctf_integer(u64, bytenr, head_ref->bytenr)
+		ctf_integer(u64, num_bytes, head_ref->num_bytes)
+		ctf_integer(int, action, action)
+		ctf_integer(int, is_data, head_ref->is_data)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
 
 	TP_PROTO(struct btrfs_fs_info *fs_info,
Signature · 6 lines
2.7.4

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 6 lines · ----- On Jan 9, 2018, at 3:43 PM, Michael Jeanson [email protected] wrote:

See upstream commit:

commit d278850eff3053ef166cf64c16f798dfe36278a2
Author: Josef Bacik <[email protected]>
Date: Fri Sep 29 15:43:57 2017 -0400

Quoted 6 lines

btrfs: remove delayed_ref_node from ref_head

This is just excessive information in the ref_head, and makes the code complicated. It is a relic from when we had the heads and the refs in the same tree, which is no longer the case. With this removal I've cleaned up a bunch of the cruft around this old assumption as well.

In 3.12, this becomes a DECLARE_EVENT_CLASS with associated DEFINE_EVENT using the class. Example code snippet from a 4.15-rc kernel:

DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,

        TP_PROTO(const struct btrfs_fs_info *fs_info,
                 const struct btrfs_delayed_ref_head *head_ref,
                 int action),

        TP_ARGS(fs_info, head_ref, action),

        TP_STRUCT__entry_btrfs(
                __field(        u64,  bytenr            )
                __field(        u64,  num_bytes         )
                __field(        int,  action            )
                __field(        int,  is_data           )
        ),

        TP_fast_assign_btrfs(fs_info,
                __entry->bytenr         = head_ref->bytenr;
                __entry->num_bytes      = head_ref->num_bytes;
                __entry->action         = action;
                __entry->is_data        = head_ref->is_data;
        ),

        TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
                  (unsigned long long)__entry->bytenr,
                  (unsigned long long)__entry->num_bytes,
                  show_ref_action(__entry->action),
                  __entry->is_data)

);

DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,

TP_PROTO(const struct btrfs_fs_info *fs_info,
const struct btrfs_delayed_ref_head *head_ref, int action),

TP_ARGS(fs_info, head_ref, action)
);

DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,

TP_PROTO(const struct btrfs_fs_info *fs_info,
const struct btrfs_delayed_ref_head *head_ref, int action),

TP_ARGS(fs_info, head_ref, action)
);

It appears that this instrumentation has not been hooked on any actual tracepoint for quite some time in lttng-modules.

We should adapt the lttng-modules instrumentation accordingly. I would not be surprised that the 4.8.0 kernel version range is also incorrect:
it should apply to the "new" events based on the tracepoint class.

Thanks,

Mathieu

Quoted 38 lines

---
instrumentation/events/lttng-module/btrfs.h | 18 +++++++++++++++++-

1 file changed, 17 insertions(+), 1 deletion(-)
instrumentation/events/lttng-module/btrfs.h +17 -2
index b529e8e..7901f05 100644
@@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
 	)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+
+	TP_PROTO(struct btrfs_fs_info *fs_info,
+		 struct btrfs_delayed_ref_head *head_ref,
+		 int action),
+
+	TP_ARGS(fs_info, head_ref, action),
+
+	TP_FIELDS(
+		ctf_integer(u64, bytenr, head_ref->bytenr)
+		ctf_integer(u64, num_bytes, head_ref->num_bytes)
+		ctf_integer(int, action, action)
+		ctf_integer(int, is_data, head_ref->is_data)
+	)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
 
 	TP_PROTO(struct btrfs_fs_info *fs_info,
--

2.7.4

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#5 lore raw

Re: [PATCH lttng-modules 1/3] Fix: debian kernel version parsing

In reply to a message not in the archive

Merged patches 1 and 2 into master, 2.10, 2.9.

Patch 3 needs work, as detailed in a separate email.

Thanks,

Mathieu

Quoted 68 lines · ----- On Jan 9, 2018, at 3:43 PM, Michael Jeanson [email protected] wrote:

The debian version script only worked for ckt kernels and that was fine until now because we only had checks for those versions in the code.

ckt (Canonical Kernel Team) kernels were used for a while during the jessie cycle, their versionning is a bit different. They track the upstream vanilla stable updates but they don't update the minor version number and instead add an additionnal -cktX. They were all 3.16.7-cktX and after a while the version switched back to upstream style at 3.16.36.

Knowing that, we can compare regular debian and ckt kernel versions using this scheme :

MAJOR.PATCHLEVEL.SUBLEVEL.CKT.DEBABI.DEBPATCH

And setting CKT to zero for non-ckt kernels.

---
abi-debian-version.sh | 18 ++++++++++--------

1 file changed, 10 insertions(+), 8 deletions(-)
abi-debian-version.sh +0 -0
index 310d6a8..36da212 100755
@@ -12,24 +12,26 @@ fi
 
 # Assuming KPATH is the target kernel headers directory

DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' ${KPATH}/include/generated/package.h)
+
# Ignore backports part
DEB_PACKAGE_VERSION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/~(bpo|deb).*//')

abi-debian-version.sh +7 -0
+
+# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
+# cycle, their versionning is a bit different. They track the upstream vanilla
+# stable updates but they don't update the minor version number and instead add
+# an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
+# switched back to upstream style at 3.16.36.
+

# Get -ckt update number, if present KERNEL_CKT_UPDATE=$(echo ${DEB_PACKAGE_VERSION} | sed -rn 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')

abi-debian-version.sh +1 -7
-
-# Only care about the rest if it is a -ckt kernel, making sure we do not
-# clash with older Debian kernels (e.g. Debian 3.2.65-1+deb7u2).
-if [ -z "${KERNEL_CKT_UPDATE}" ]; then
-	echo 0
-	exit 0
-fi
+test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0

# Get package revision
DEB_PACKAGE_REVISION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/.*-([^-]+)$/\1/') # Get non-sec update number
DEB_PACKAGE_REVISION_BASE=$(echo ${DEB_PACKAGE_REVISION} | sed -r 's/^([0-9]+).*/\1/')
# Get security update number, if present -DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 's/.*\+(squeeze|deb[0-9])+u([0-9]+)$/\1/p') +DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0 # Combine all update numbers into one DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 10000 + DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
--
2.7.4

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev