[PATCH 5/9] KVM: VMX: Dump VMCS on unexpected #VE

From: Sean Christopherson
Date: Fri May 17 2024 - 20:06:11 EST


Dump the VMCS on an unexpected #VE, otherwise it's practically impossible
to figure out why the #VE occurred.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 51b2cd13250a..0c68643d982b 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -5217,8 +5217,10 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
if (is_invalid_opcode(intr_info))
return handle_ud(vcpu);

- if (KVM_BUG_ON(is_ve_fault(intr_info), vcpu->kvm))
+ if (KVM_BUG_ON(is_ve_fault(intr_info), vcpu->kvm)) {
+ dump_vmcs(vcpu);
return -EIO;
+ }

error_code = 0;
if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
--
2.45.0.215.g3402c0e53f-goog