Commit 2c4c4132 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: Print symbolic names of VMX VM-Exit flags in traces

Use __print_flags() to display the names of VMX flags in VM-Exit traces
and strip the flags when printing the basic exit reason, e.g. so that a
failed VM-Entry due to invalid guest state gets recorded as
"INVALID_STATE FAILED_VMENTRY" instead of "0x80000021".

Opportunstically fix misaligned variables in the kvm_exit and
kvm_nested_vmexit_inject tracepoints.
Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200508235348.19427-3-sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent dcf068da
...@@ -150,6 +150,9 @@ ...@@ -150,6 +150,9 @@
{ EXIT_REASON_UMWAIT, "UMWAIT" }, \ { EXIT_REASON_UMWAIT, "UMWAIT" }, \
{ EXIT_REASON_TPAUSE, "TPAUSE" } { EXIT_REASON_TPAUSE, "TPAUSE" }
#define VMX_EXIT_REASON_FLAGS \
{ VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" }
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
......
...@@ -225,6 +225,14 @@ TRACE_EVENT(kvm_apic, ...@@ -225,6 +225,14 @@ TRACE_EVENT(kvm_apic,
#define KVM_ISA_VMX 1 #define KVM_ISA_VMX 1
#define KVM_ISA_SVM 2 #define KVM_ISA_SVM 2
#define kvm_print_exit_reason(exit_reason, isa) \
(isa == KVM_ISA_VMX) ? \
__print_symbolic(exit_reason & 0xffff, VMX_EXIT_REASONS) : \
__print_symbolic(exit_reason, SVM_EXIT_REASONS), \
(isa == KVM_ISA_VMX && exit_reason & ~0xffff) ? " " : "", \
(isa == KVM_ISA_VMX) ? \
__print_flags(exit_reason & ~0xffff, " ", VMX_EXIT_REASON_FLAGS) : ""
/* /*
* Tracepoint for kvm guest exit: * Tracepoint for kvm guest exit:
*/ */
...@@ -250,11 +258,9 @@ TRACE_EVENT(kvm_exit, ...@@ -250,11 +258,9 @@ TRACE_EVENT(kvm_exit,
&__entry->info2); &__entry->info2);
), ),
TP_printk("vcpu %u reason %s rip 0x%lx info %llx %llx", TP_printk("vcpu %u reason %s%s%s rip 0x%lx info %llx %llx",
__entry->vcpu_id, __entry->vcpu_id,
(__entry->isa == KVM_ISA_VMX) ? kvm_print_exit_reason(__entry->exit_reason, __entry->isa),
__print_symbolic(__entry->exit_reason, VMX_EXIT_REASONS) :
__print_symbolic(__entry->exit_reason, SVM_EXIT_REASONS),
__entry->guest_rip, __entry->info1, __entry->info2) __entry->guest_rip, __entry->info1, __entry->info2)
); );
...@@ -588,12 +594,10 @@ TRACE_EVENT(kvm_nested_vmexit, ...@@ -588,12 +594,10 @@ TRACE_EVENT(kvm_nested_vmexit,
__entry->exit_int_info_err = exit_int_info_err; __entry->exit_int_info_err = exit_int_info_err;
__entry->isa = isa; __entry->isa = isa;
), ),
TP_printk("rip: 0x%016llx reason: %s ext_inf1: 0x%016llx " TP_printk("rip: 0x%016llx reason: %s%s%s ext_inf1: 0x%016llx "
"ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
__entry->rip, __entry->rip,
(__entry->isa == KVM_ISA_VMX) ? kvm_print_exit_reason(__entry->exit_code, __entry->isa),
__print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) :
__print_symbolic(__entry->exit_code, SVM_EXIT_REASONS),
__entry->exit_info1, __entry->exit_info2, __entry->exit_info1, __entry->exit_info2,
__entry->exit_int_info, __entry->exit_int_info_err) __entry->exit_int_info, __entry->exit_int_info_err)
); );
...@@ -626,11 +630,9 @@ TRACE_EVENT(kvm_nested_vmexit_inject, ...@@ -626,11 +630,9 @@ TRACE_EVENT(kvm_nested_vmexit_inject,
__entry->isa = isa; __entry->isa = isa;
), ),
TP_printk("reason: %s ext_inf1: 0x%016llx " TP_printk("reason: %s%s%s ext_inf1: 0x%016llx "
"ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
(__entry->isa == KVM_ISA_VMX) ? kvm_print_exit_reason(__entry->exit_code, __entry->isa),
__print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) :
__print_symbolic(__entry->exit_code, SVM_EXIT_REASONS),
__entry->exit_info1, __entry->exit_info2, __entry->exit_info1, __entry->exit_info2,
__entry->exit_int_info, __entry->exit_int_info_err) __entry->exit_int_info, __entry->exit_int_info_err)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment