All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: VMX: Print VM-instruction error when it may be helpful
@ 2022-05-08  4:02 Jim Mattson
  2022-05-10 16:27 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Mattson @ 2022-05-08  4:02 UTC (permalink / raw)
  To: kvm, pbonzini, seanjc; +Cc: David Matlack, Jim Mattson

From: David Matlack <dmatlack@google.com>

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>
---
 arch/x86/kvm/vmx/vmx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index d58b763df855..a25da991da07 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -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=%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)
-- 
2.36.0.512.ge40c2bad7a-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] KVM: VMX: Print VM-instruction error when it may be helpful
  2022-05-08  4:02 [PATCH v2] KVM: VMX: Print VM-instruction error when it may be helpful Jim Mattson
@ 2022-05-10 16:27 ` Sean Christopherson
  2022-05-10 22:24   ` Jim Mattson
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2022-05-10 16:27 UTC (permalink / raw)
  To: Jim Mattson; +Cc: kvm, pbonzini, David Matlack

On Sat, May 07, 2022, Jim Mattson wrote:
> From: David Matlack <dmatlack@google.com>
> 
> 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>
> ---
>  arch/x86/kvm/vmx/vmx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index d58b763df855..a25da991da07 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -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=%d\n",

I highly doubt it will ever matter, but arguably this should be %u, not %d.

> +			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)
> -- 
> 2.36.0.512.ge40c2bad7a-goog
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] KVM: VMX: Print VM-instruction error when it may be helpful
  2022-05-10 16:27 ` Sean Christopherson
@ 2022-05-10 22:24   ` Jim Mattson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Mattson @ 2022-05-10 22:24 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, pbonzini, David Matlack

On Tue, May 10, 2022 at 9:27 AM Sean Christopherson <seanjc@google.com> wrote:

> >  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",
>
> I highly doubt it will ever matter, but arguably this should be %u, not %d.
>

:-@

Okay; I will send out a V3, along with a separate patch to fix VMWRITE.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-10 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08  4:02 [PATCH v2] KVM: VMX: Print VM-instruction error when it may be helpful Jim Mattson
2022-05-10 16:27 ` Sean Christopherson
2022-05-10 22:24   ` Jim Mattson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.