From 3589318286246274bdf7b659e798c9728bd9dd2b Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 18 Nov 2022 18:14:46 -0500 Subject: [PATCH] Drop support for kernels < 4.4 from kvm instrumentation Change-Id: I01297f0e1b3e0e1121f8b7222059ef32e634d137 Signed-off-by: Michael Jeanson --- .../events/arch/x86/kvm/mmutrace.h | 56 ++----------------- .../events/arch/x86/kvm/trace.h | 22 +------- include/instrumentation/events/kvm.h | 51 ----------------- 3 files changed, 5 insertions(+), 124 deletions(-) diff --git a/include/instrumentation/events/arch/x86/kvm/mmutrace.h b/include/instrumentation/events/arch/x86/kvm/mmutrace.h index e20cda20..4107b6ef 100644 --- a/include/instrumentation/events/arch/x86/kvm/mmutrace.h +++ b/include/instrumentation/events/arch/x86/kvm/mmutrace.h @@ -5,11 +5,7 @@ #include #include -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0)) #include -#else /* if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0)) */ -#include -#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,2,0)) */ #undef TRACE_SYSTEM #define TRACE_SYSTEM kvm_mmu @@ -23,7 +19,7 @@ ctf_integer(__u32, root_count, (sp)->root_count) \ ctf_integer(bool, unsync, (sp)->unsync) -#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) +#else #define LTTNG_KVM_MMU_PAGE_FIELDS \ ctf_integer(unsigned long, mmu_valid_gen, (sp)->mmu_valid_gen) \ @@ -32,17 +28,8 @@ ctf_integer(__u32, root_count, (sp)->root_count) \ ctf_integer(bool, unsync, (sp)->unsync) -#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) */ - -#define LTTNG_KVM_MMU_PAGE_FIELDS \ - ctf_integer(__u64, gfn, (sp)->gfn) \ - ctf_integer(__u32, role, (sp)->role.word) \ - ctf_integer(__u32, root_count, (sp)->root_count) \ - ctf_integer(bool, unsync, (sp)->unsync) - -#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) */ +#endif -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,6,0)) /* * A pagetable walk has started */ @@ -56,23 +43,6 @@ LTTNG_TRACEPOINT_EVENT( ctf_integer(__u32, pferr, pferr) ) ) -#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,6,0)) */ -/* - * A pagetable walk has started - */ -LTTNG_TRACEPOINT_EVENT( - kvm_mmu_pagetable_walk, - TP_PROTO(u64 addr, int write_fault, int user_fault, int fetch_fault), - TP_ARGS(addr, write_fault, user_fault, fetch_fault), - - TP_FIELDS( - ctf_integer_hex(__u64, addr, addr) - ctf_integer(__u32, pferr, - (!!write_fault << 1) | (!!user_fault << 2) - | (!!fetch_fault << 4)) - ) -) -#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,6,0)) */ /* We just walked a paging element */ LTTNG_TRACEPOINT_EVENT( @@ -181,7 +151,7 @@ LTTNG_TRACEPOINT_EVENT_MAP( ) ) -#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) +#else LTTNG_TRACEPOINT_EVENT_MAP( mark_mmio_spte, @@ -198,25 +168,7 @@ LTTNG_TRACEPOINT_EVENT_MAP( ctf_integer(unsigned int, gen, gen) ) ) - -#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) */ - -LTTNG_TRACEPOINT_EVENT_MAP( - mark_mmio_spte, - - kvm_mmu_mark_mmio_spte, - - TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access), - TP_ARGS(sptep, gfn, access), - - TP_FIELDS( - ctf_integer_hex(void *, sptep, sptep) - ctf_integer(gfn_t, gfn, gfn) - ctf_integer(unsigned, access, access) - ) -) - -#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) */ +#endif LTTNG_TRACEPOINT_EVENT_MAP( handle_mmio_page_fault, diff --git a/include/instrumentation/events/arch/x86/kvm/trace.h b/include/instrumentation/events/arch/x86/kvm/trace.h index 0d6c4e33..0bccea06 100644 --- a/include/instrumentation/events/arch/x86/kvm/trace.h +++ b/include/instrumentation/events/arch/x86/kvm/trace.h @@ -5,9 +5,7 @@ #include #include #include -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) #include -#endif #include #include #include <../arch/x86/kvm/lapic.h> @@ -546,21 +544,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_emulate_insn, kvm_x86_emulate_insn, TP_ARGS(vcpu, failed), TP_FIELDS( -#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,1,0)) - ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.decode.fetch.start) - ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) - ctf_integer(__u8, len, vcpu->arch.emulate_ctxt.decode.eip - - vcpu->arch.emulate_ctxt.decode.fetch.start) - ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.decode.fetch.data, 15) - ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode)) -#elif (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,17,0)) - ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.fetch.start) - ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS)) - ctf_integer(__u8, len, vcpu->arch.emulate_ctxt._eip - - 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)) +#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(5,7,0)) ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt._eip - (vcpu->arch.emulate_ctxt.fetch.ptr - vcpu->arch.emulate_ctxt.fetch.data)) @@ -608,7 +592,6 @@ LTTNG_TRACEPOINT_EVENT_MAP( ) ) -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) LTTNG_TRACEPOINT_EVENT_MAP(kvm_write_tsc_offset, kvm_x86_write_tsc_offset, TP_PROTO(unsigned int vcpu_id, __u64 previous_tsc_offset, __u64 next_tsc_offset), @@ -620,9 +603,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_write_tsc_offset, kvm_x86_write_tsc_offset, ctf_integer(__u64, next_tsc_offset, next_tsc_offset) ) ) -#endif -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) #ifdef CONFIG_X86_64 LTTNG_TRACEPOINT_EVENT_MAP(kvm_update_master_clock, kvm_x86_update_master_clock, @@ -653,7 +634,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_track_tsc, kvm_x86_track_tsc, ) #endif /* CONFIG_X86_64 */ -#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0) */ #endif /* LTTNG_TRACE_KVM_H */ diff --git a/include/instrumentation/events/kvm.h b/include/instrumentation/events/kvm.h index 3df38967..0311b446 100644 --- a/include/instrumentation/events/kvm.h +++ b/include/instrumentation/events/kvm.h @@ -18,14 +18,7 @@ LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit, ) ) -#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,6,0)) #if defined(__KVM_HAVE_IOAPIC) -#undef __KVM_HAVE_IRQ_LINE -#define __KVM_HAVE_IRQ_LINE -#endif -#endif - -#if defined(__KVM_HAVE_IRQ_LINE) LTTNG_TRACEPOINT_EVENT(kvm_set_irq, TP_PROTO(unsigned int gsi, int level, int irq_source_id), TP_ARGS(gsi, level, irq_source_id), @@ -36,9 +29,6 @@ LTTNG_TRACEPOINT_EVENT(kvm_set_irq, ctf_integer(int, irq_source_id, irq_source_id) ) ) -#endif - -#if defined(__KVM_HAVE_IOAPIC) LTTNG_TRACEPOINT_EVENT(kvm_ioapic_set_irq, TP_PROTO(__u64 e, int pin, bool coalesced), @@ -103,10 +93,6 @@ LTTNG_TRACEPOINT_EVENT(kvm_mmio, || LTTNG_DEBIAN_KERNEL_RANGE(4,14,13,0,1,0, 4,15,0,0,0,0) \ || LTTNG_KERNEL_RANGE(4,9,77, 4,10,0) \ || LTTNG_KERNEL_RANGE(4,4,112, 4,5,0) \ - || LTTNG_KERNEL_RANGE(4,1,50, 4,2,0) \ - || LTTNG_KERNEL_RANGE(3,16,52, 3,17,0) \ - || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,144, 3,14,0,0) \ - || LTTNG_KERNEL_RANGE(3,2,97, 3,3,0) \ || LTTNG_UBUNTU_KERNEL_RANGE(4,13,16,38, 4,14,0,0) \ || LTTNG_DEBIAN_KERNEL_RANGE(4,9,65,0,3,0, 4,10,0,0,0,0) \ || LTTNG_FEDORA_KERNEL_RANGE(4,14,13,300, 4,15,0,0)) @@ -152,9 +138,6 @@ LTTNG_TRACEPOINT_EVENT(kvm_fpu, ) ) -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,18,0) \ - || LTTNG_RHEL_KERNEL_RANGE(3,10,0,327,0,0, 3,11,0,0,0,0)) - LTTNG_TRACEPOINT_EVENT(kvm_age_page, TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref), TP_ARGS(gfn, level, slot, ref), @@ -168,21 +151,6 @@ LTTNG_TRACEPOINT_EVENT(kvm_age_page, ) ) -#else - -LTTNG_TRACEPOINT_EVENT(kvm_age_page, - TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref), - TP_ARGS(hva, slot, ref), - - TP_FIELDS( - ctf_integer(u64, hva, hva) - ctf_integer(u64, gfn, - slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT)) - ctf_integer(u8, referenced, ref) - ) -) -#endif - #ifdef CONFIG_KVM_ASYNC_PF LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class, @@ -236,9 +204,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_ready TP_ARGS(token, gva) ) -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0) \ - || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0)) - LTTNG_TRACEPOINT_EVENT( kvm_async_pf_completed, TP_PROTO(unsigned long address, u64 gva), @@ -250,22 +215,6 @@ LTTNG_TRACEPOINT_EVENT( ) ) -#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0)) */ - -LTTNG_TRACEPOINT_EVENT( - kvm_async_pf_completed, - TP_PROTO(unsigned long address, struct page *page, u64 gva), - TP_ARGS(address, page, gva), - - TP_FIELDS( - ctf_integer_hex(unsigned long, address, address) - ctf_integer(pfn_t, pfn, page ? page_to_pfn(page) : 0) - ctf_integer(u64, gva, gva) - ) -) - -#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0)) */ - #endif #endif /* LTTNG_TRACE_KVM_MAIN_H */ -- 2.34.1