From: David Matlack <dmatlack@xxxxxxxxxx> Include the value of the "VM-instruction error" field from the current VMCS (if any) in the error message whenever a VMX instruction (other than VMREAD) fails. Previously, this field was only reported for VMWRITE errors. (Omit the "VM-instruction error" field for VMREAD to avoid potentially infinite recursion.) Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx> [Rebased and refactored code; reworded commit message.] Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx> --- arch/x86/kvm/vmx/vmx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d58b763df855..c7d2d60fd35b 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -392,24 +392,26 @@ 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=%d\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=%d\n", + vmcs, phys_addr, vmcs_read32(VM_INSTRUCTION_ERROR)); } noinline void invvpid_error(unsigned long ext, u16 vpid, gva_t gva) { - vmx_insn_failed("kvm: invvpid failed: ext=0x%lx vpid=%u gva=0x%lx\n", - ext, vpid, gva); + vmx_insn_failed("kvm: invvpid failed: ext=0x%lx vpid=%u gva=0x%lx err=%d\n", + ext, vpid, gva, vmcs_read32(VM_INSTRUCTION_ERROR)); } noinline void invept_error(unsigned long ext, u64 eptp, gpa_t gpa) { - vmx_insn_failed("kvm: invept failed: ext=0x%lx eptp=%llx gpa=0x%llx\n", - ext, eptp, gpa); + vmx_insn_failed("kvm: invept failed: ext=0x%lx eptp=%llx gpa=0x%llx err=%d\n", + ext, eptp, gpa, vmcs_read32(VM_INSTRUCTION_ERROR)); } static DEFINE_PER_CPU(struct vmcs *, vmxarea); -- 2.36.0.512.ge40c2bad7a-goog