KVM: SVM: Add tracepoint for injected #vmexit
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 9 Oct 2009 14:08:29 +0000 (16:08 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 3 Dec 2009 07:32:15 +0000 (09:32 +0200)
This patch adds a tracepoint for a nested #vmexit that gets
re-injected to the guest.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/trace.h
arch/x86/kvm/x86.c

index edf6e8b2b84ef32c124bc35448110b99ae52d82e..369eeb86e87cf446e7c172e27f2d172a702da721 100644 (file)
@@ -1592,6 +1592,12 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
        struct vmcb *hsave = svm->nested.hsave;
        struct vmcb *vmcb = svm->vmcb;
 
+       trace_kvm_nested_vmexit_inject(vmcb->control.exit_code,
+                                      vmcb->control.exit_info_1,
+                                      vmcb->control.exit_info_2,
+                                      vmcb->control.exit_int_info,
+                                      vmcb->control.exit_int_info_err);
+
        nested_vmcb = nested_svm_map(svm, svm->nested.vmcb, KM_USER0);
        if (!nested_vmcb)
                return 1;
index a7eb6299a261a7a42b225fbc48b069658e1f3061..4d6bb5ee39b54b6ee597d4f01b1d468ee004e3ff 100644 (file)
@@ -418,6 +418,39 @@ TRACE_EVENT(kvm_nested_vmexit,
                  __entry->exit_int_info, __entry->exit_int_info_err)
 );
 
+/*
+ * Tracepoint for #VMEXIT reinjected to the guest
+ */
+TRACE_EVENT(kvm_nested_vmexit_inject,
+           TP_PROTO(__u32 exit_code,
+                    __u64 exit_info1, __u64 exit_info2,
+                    __u32 exit_int_info, __u32 exit_int_info_err),
+           TP_ARGS(exit_code, exit_info1, exit_info2,
+                   exit_int_info, exit_int_info_err),
+
+       TP_STRUCT__entry(
+               __field(        __u32,          exit_code               )
+               __field(        __u64,          exit_info1              )
+               __field(        __u64,          exit_info2              )
+               __field(        __u32,          exit_int_info           )
+               __field(        __u32,          exit_int_info_err       )
+       ),
+
+       TP_fast_assign(
+               __entry->exit_code              = exit_code;
+               __entry->exit_info1             = exit_info1;
+               __entry->exit_info2             = exit_info2;
+               __entry->exit_int_info          = exit_int_info;
+               __entry->exit_int_info_err      = exit_int_info_err;
+       ),
+
+       TP_printk("reason: %s ext_inf1: 0x%016llx "
+                 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x\n",
+                 ftrace_print_symbols_seq(p, __entry->exit_code,
+                                          kvm_x86_ops->exit_reasons_str),
+               __entry->exit_info1, __entry->exit_info2,
+               __entry->exit_int_info, __entry->exit_int_info_err)
+);
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
index 192d58efc6dce8a027de4e0dd4570b0747c90821..a522d9ba81b32a69e33999e66ccf64416574e1a0 100644 (file)
@@ -4986,3 +4986,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_msr);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_cr);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmrun);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit_inject);