KVM: VMX: Print VM-instruction error when it may be helpful
authorDavid Matlack <dmatlack@google.com>
Tue, 10 May 2022 22:40:34 +0000 (15:40 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 25 May 2022 09:23:39 +0000 (05:23 -0400)
Include the value of the "VM-instruction error" field from the current
VMCS (if any) in the error message for VMCLEAR and VMPTRLD, since each
of these instructions may result in more than one VM-instruction
error. Previously, this field was only reported for VMWRITE errors.

Signed-off-by: David Matlack <dmatlack@google.com>
[Rebased and refactored code; dropped the error number for INVVPID and
INVEPT; reworded commit message.]
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220510224035.1792952-1-jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index f5aeade..673ba5c 100644 (file)
@@ -392,12 +392,14 @@ noinline void vmwrite_error(unsigned long field, unsigned long value)
 
 noinline void vmclear_error(struct vmcs *vmcs, u64 phys_addr)
 {
-       vmx_insn_failed("kvm: vmclear failed: %p/%llx\n", vmcs, phys_addr);
+       vmx_insn_failed("kvm: vmclear failed: %p/%llx err=%u\n",
+                       vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
 }
 
 noinline void vmptrld_error(struct vmcs *vmcs, u64 phys_addr)
 {
-       vmx_insn_failed("kvm: vmptrld failed: %p/%llx\n", vmcs, phys_addr);
+       vmx_insn_failed("kvm: vmptrld failed: %p/%llx err=%u\n",
+                       vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR));
 }
 
 noinline void invvpid_error(unsigned long ext, u16 vpid, gva_t gva)