[lttng-dev] [PATCH] Compile fixes for RHEL 9.3 kernels

Martin Hicks martin at sr-research.com
Fri Jan 26 12:18:33 EST 2024


I'm not sure when some of these changes were backported, but the
unmodified lttng-modules compiles vs. 5.14.0-162.23.1

This disables the kmem and compaction modules.  I don't believe getting
these to compile will be easy, as the required struct declarations are
in vmlinux.h, and haven't been moved into mm/internal.h and mm/slab.h in
the RHEL sources.

Signed-off-by: Martin Hicks <martin at sr-research.com>
---
 include/instrumentation/events/compaction.h |  3 ++-
 include/instrumentation/events/jbd2.h       |  3 ++-
 include/instrumentation/events/kmem.h       | 12 +++++++++---
 include/instrumentation/events/skb.h        |  3 ++-
 include/wrapper/kprobes.h                   |  3 ++-
 src/lttng-statedump-impl.c                  |  3 ++-
 src/probes/Kbuild                           |  6 ++++--
 7 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
index 31d0a422..7d0c2623 100644
--- a/include/instrumentation/events/compaction.h
+++ b/include/instrumentation/events/compaction.h
@@ -54,7 +54,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
 	TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
 )
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
+    LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
 
 	compaction_migratepages,
diff --git a/include/instrumentation/events/jbd2.h b/include/instrumentation/events/jbd2.h
index b00777fa..eccac06d 100644
--- a/include/instrumentation/events/jbd2.h
+++ b/include/instrumentation/events/jbd2.h
@@ -237,7 +237,8 @@ LTTNG_TRACEPOINT_EVENT(jbd2_update_log_tail,
 	)
 )
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0) || \
+     LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
 
 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
 LTTNG_TRACEPOINT_ENUM(req_op,
diff --git a/include/instrumentation/events/kmem.h b/include/instrumentation/events/kmem.h
index dd22192f..f2e2d11d 100644
--- a/include/instrumentation/events/kmem.h
+++ b/include/instrumentation/events/kmem.h
@@ -61,7 +61,9 @@ LTTNG_TRACEPOINT_EVENT(kmem_cache_alloc,
 			(s->flags & SLAB_ACCOUNT)) : false)
 	)
 )
-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0))
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0) || \
+	LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
+
 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc,
 
 	TP_PROTO(unsigned long call_site,
@@ -141,7 +143,9 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc,
 )
 #endif
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0) || \
+	LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
+
 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node,
 
 	TP_PROTO(unsigned long call_site,
@@ -359,7 +363,9 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
 	)
 )
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0) || \
+	LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
+
 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
 
 	TP_PROTO(struct page *page, unsigned int order, int migratetype,
diff --git a/include/instrumentation/events/skb.h b/include/instrumentation/events/skb.h
index 08704b98..9e32aa6e 100644
--- a/include/instrumentation/events/skb.h
+++ b/include/instrumentation/events/skb.h
@@ -77,7 +77,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(kfree_skb,
 )
 #endif
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,3,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,3,0) || \
+    LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
 LTTNG_TRACEPOINT_EVENT_MAP(consume_skb,
 
 	skb_consume,
diff --git a/include/wrapper/kprobes.h b/include/wrapper/kprobes.h
index 51d32b7c..d906bcba 100644
--- a/include/wrapper/kprobes.h
+++ b/include/wrapper/kprobes.h
@@ -30,7 +30,8 @@ struct kretprobe *lttng_get_kretprobe(struct kretprobe_instance *ri)
 #endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) */
 
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
+    LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
 static inline
 unsigned long lttng_get_kretprobe_retaddr(struct kretprobe_instance *ri)
 {
diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c
index 22e3628b..0b09027a 100644
--- a/src/lttng-statedump-impl.c
+++ b/src/lttng-statedump-impl.c
@@ -191,7 +191,8 @@ enum lttng_process_status {
 };
 
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0) || \
+    LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
 
 #define LTTNG_PART_STRUCT_TYPE struct block_device
 
diff --git a/src/probes/Kbuild b/src/probes/Kbuild
index 73a15844..71ad8e4c 100644
--- a/src/probes/Kbuild
+++ b/src/probes/Kbuild
@@ -15,7 +15,8 @@ kmem_dep = $(srctree)/mm/slab.h
 kmem_dep_wildcard = $(wildcard $(kmem_dep))
 kmem_dep_check = $(shell \
 if [ \( $(VERSION) -ge 7 \
-   -o \( $(VERSION) -eq 6 -a $(PATCHLEVEL) -ge 0 \) \) -a \
+   -o \( $(VERSION) -eq 6 -a $(PATCHLEVEL) -ge 0 \) \
+   -o \( $(RHEL_API_VERSION) -gt 1622301 \) \) -a \
    -z "$(kmem_dep_wildcard)" ] ; then \
   echo "warn" ; \
 else \
@@ -166,7 +167,8 @@ ifneq ($(CONFIG_COMPACTION),)
   compaction_dep_wildcard = $(wildcard $(compaction_dep))
   compaction_dep_check = $(shell \
   if [ \( $(VERSION) -ge 6 \
-     -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) -a \
+     -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \
+     -o \( $(RHEL_API_VERSION) -gt 1622301 \) \) -a \
      -z "$(compaction_dep_wildcard)" ] ; then \
     echo "warn" ; \
   else \
-- 
2.39.3



More information about the lttng-dev mailing list