[PATCH 1/2] KVM: x86: Introudce trace_kvm_vmx_debug()

From: Yao Yuan
Date: Wed Jul 03 2024 - 21:59:55 EST


debug only common trace.

Signed-off-by: Yao Yuan <yuan.yao@xxxxxxxxx>
---
arch/x86/kvm/trace.h | 28 ++++++++++++++++++++++++++++
arch/x86/kvm/x86.c | 1 +
2 files changed, 29 insertions(+)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index d3aeffd6ae75..7b9eb23d71d3 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -34,6 +34,34 @@ TRACE_EVENT(kvm_entry,
__entry->immediate_exit ? "[immediate exit]" : "")
);

+TRACE_EVENT(kvm_vmx_debug,
+ TP_PROTO(unsigned long n, unsigned long a0,
+ unsigned long a1,
+ unsigned long a2,
+ unsigned long a3),
+ TP_ARGS(n, a0, a1, a2, a3),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, n )
+ __field( unsigned long, a0 )
+ __field( unsigned long, a1 )
+ __field( unsigned long, a2 )
+ __field( unsigned long, a3 )
+ ),
+
+ TP_fast_assign(
+ __entry->n = n;
+ __entry->a0 = a0;
+ __entry->a1 = a1;
+ __entry->a2 = a2;
+ __entry->a3 = a3;
+ ),
+
+ TP_printk("kvm_vmx_debug: %ld, a0:0x%lx a1:0x%lx a2:0x%lx a3:0x%lx",
+ __entry->n, __entry->a0, __entry->a1, __entry->a2, __entry->a3)
+);
+
+
/*
* Tracepoint for hypercall.
*/
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 994743266480..6d1972d6c988 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -14036,6 +14036,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_enter);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_rmp_fault);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmx_debug);

static int __init kvm_x86_init(void)
{
--
2.27.0

Patch 02: