Fix: build kvm probe on EL 8.4+
authorKienan Stewart <kstewart@efficios.com>
Fri, 22 Mar 2024 13:28:08 +0000 (09:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 26 Mar 2024 18:19:29 +0000 (14:19 -0400)
The lower value of the EL range, 240.15.1, corresponds to the first
import of EL r8 kernels into Rocky Linux's kernel staging repo.
The change may have been introduced in an earlier RHEL 8 kernel,
prior to the history of imports into Rocky.

Change-Id: Icefe472d43e28cc09746e9e046b12299609ebab1
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
instrumentation/events/lttng-module/arch/x86/kvm/trace.h
probes/Kbuild
probes/lttng-probe-kvm-x86-mmu.c

index 3116328f6557cb810b6078a939e404f21776f553..3ac3ddfe3f761d204c29592738f6f20a0790ffcf 100644 (file)
@@ -163,7 +163,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
        TP_ARGS(sp)
 )
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
 
 LTTNG_TRACEPOINT_EVENT_MAP(
        mark_mmio_spte,
@@ -253,7 +254,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(
                ctf_integer(int, ret, ret)
        )
 )
-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0))
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
 LTTNG_TRACEPOINT_EVENT_MAP(
        fast_page_fault,
 
index 9a2f466ad34ea9e97d3a26a076d52280a074d33d..45b0f4bf563b60f0aff3562b7f1b0f4a6c60d614 100644 (file)
@@ -8,6 +8,11 @@
 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 #include <asm/clocksource.h>
 #endif
+#include <linux/kvm_host.h>
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
+#include <kvm_emulate.h>
+#endif
 #include <lttng-kernel-version.h>
 #include <../arch/x86/kvm/lapic.h>
 #include <../arch/x86/kvm/kvm_cache_regs.h>
@@ -147,7 +152,8 @@ LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
 
        TP_code_post()
 )
-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0))
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,240,0,0, 4,19,0,0,0,0))
 LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
        TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
        TP_ARGS(exit_reason, vcpu, isa),
@@ -526,7 +532,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_emulate_insn, kvm_x86_emulate_insn,
                                - vcpu->arch.emulate_ctxt.fetch.start)
                ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15)
                ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
-#elif (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(5,7,0))
+#elif (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(5,7,0) && \
+       !LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
                ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt._eip -
                                (vcpu->arch.emulate_ctxt.fetch.ptr -
                                        vcpu->arch.emulate_ctxt.fetch.data))
@@ -535,6 +542,16 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_emulate_insn, kvm_x86_emulate_insn,
                                vcpu->arch.emulate_ctxt.fetch.data)
                ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15)
                ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
+#elif (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(5,18,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
+               ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt->_eip -
+                               (vcpu->arch.emulate_ctxt->fetch.ptr -
+                                       vcpu->arch.emulate_ctxt->fetch.data))
+               ctf_integer(__u32, csbase, kvm_x86_ops.get_segment_base(vcpu, VCPU_SREG_CS))
+               ctf_integer(__u8, len, vcpu->arch.emulate_ctxt->fetch.ptr -
+                               vcpu->arch.emulate_ctxt->fetch.data)
+               ctf_array(__u8, insn, vcpu->arch.emulate_ctxt->fetch.data, 15)
+               ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt->mode))
 #else
                ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt->_eip -
                                (vcpu->arch.emulate_ctxt->fetch.ptr -
index dfd0de12e116ea0e972df0c5fe909b9287ba4b13..d0e41b3e0f35e5e8cc6bcb335668dbd132b5d8f9 100644 (file)
@@ -41,7 +41,8 @@ ifneq ($(CONFIG_KVM),)
           kvm_dep_emulate_wildcard = $(wildcard $(kvm_dep_emulate))
           kvm_dep_emulate_check = $(shell \
           if [ \( $(VERSION) -ge 6 \
-             -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 7 \) \) -a \
+             -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 7 \) \
+             -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -eq 18 -a $(RHEL_API_VERSION) -ge 2400000 \) \) -a \
              -z "$(kvm_dep_emulate_wildcard)" ] ; then \
             echo "warn" ; \
           else \
index 3920f0dbdbc00898ac51a6bfa51f22b4e039ab15..bdbc983d041cc58191f857632530f431a39d1100 100644 (file)
  */
 #include <wrapper/tracepoint.h>
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
 #include <../../arch/x86/kvm/mmu/mmu_internal.h>
 #include <../../arch/x86/kvm/mmu/mmutrace.h>
 #else
 #include <../../arch/x86/kvm/mmutrace.h>
 #endif
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0) || \
+       LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
 #include <../arch/x86/kvm/mmu.h>
 #include <../arch/x86/kvm/mmu/spte.h>
 #endif
This page took 0.028555 seconds and 4 git commands to generate.