All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB
@ 2021-06-21 22:16 Jim Mattson
  2021-06-22 16:38 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Mattson @ 2021-06-21 22:16 UTC (permalink / raw)
  To: kvm, pbonzini; +Cc: Jim Mattson

Failed VM-entry is often due to a faulty core. To help identify bad
cores, print the id of the last logical processor that attempted
VM-entry whenever dumping a VMCS or VMCB.

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/svm/svm.c | 2 ++
 arch/x86/kvm/vmx/vmx.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 12c06ea28f5c..af9e9db1121e 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3132,6 +3132,8 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
 		return;
 	}
 
+	pr_err("VMCB %llx, last attempted VMRUN on CPU %d\n",
+	       svm->current_vmcb->pa, vcpu->arch.last_vmentry_cpu);
 	pr_err("VMCB Control Area:\n");
 	pr_err("%-20s%04x\n", "cr_read:", control->intercepts[INTERCEPT_CR] & 0xffff);
 	pr_err("%-20s%04x\n", "cr_write:", control->intercepts[INTERCEPT_CR] >> 16);
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index ab6f682645d7..94c7375eb75c 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -5724,6 +5724,8 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
 	if (cpu_has_secondary_exec_ctrls())
 		secondary_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
 
+	pr_err("VMCS %llx, last attempted VM-entry on CPU %d\n",
+	       vmx->loaded_vmcs->vmcs, vcpu->arch.last_vmentry_cpu);
 	pr_err("*** Guest State ***\n");
 	pr_err("CR0: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n",
 	       vmcs_readl(GUEST_CR0), vmcs_readl(CR0_READ_SHADOW),
-- 
2.32.0.288.g62a8d224e6-goog


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

* Re: [PATCH] KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB
  2021-06-21 22:16 [PATCH] KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB Jim Mattson
@ 2021-06-22 16:38 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-06-22 16:38 UTC (permalink / raw)
  To: Jim Mattson, kvm

On 22/06/21 00:16, Jim Mattson wrote:
> Failed VM-entry is often due to a faulty core. To help identify bad
> cores, print the id of the last logical processor that attempted
> VM-entry whenever dumping a VMCS or VMCB.
> 
> Signed-off-by: Jim Mattson <jmattson@google.com>
> ---
>   arch/x86/kvm/svm/svm.c | 2 ++
>   arch/x86/kvm/vmx/vmx.c | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 12c06ea28f5c..af9e9db1121e 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3132,6 +3132,8 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
>   		return;
>   	}
>   
> +	pr_err("VMCB %llx, last attempted VMRUN on CPU %d\n",
> +	       svm->current_vmcb->pa, vcpu->arch.last_vmentry_cpu);
>   	pr_err("VMCB Control Area:\n");
>   	pr_err("%-20s%04x\n", "cr_read:", control->intercepts[INTERCEPT_CR] & 0xffff);
>   	pr_err("%-20s%04x\n", "cr_write:", control->intercepts[INTERCEPT_CR] >> 16);
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index ab6f682645d7..94c7375eb75c 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -5724,6 +5724,8 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
>   	if (cpu_has_secondary_exec_ctrls())
>   		secondary_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
>   
> +	pr_err("VMCS %llx, last attempted VM-entry on CPU %d\n",
> +	       vmx->loaded_vmcs->vmcs, vcpu->arch.last_vmentry_cpu);
>   	pr_err("*** Guest State ***\n");
>   	pr_err("CR0: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n",
>   	       vmcs_readl(GUEST_CR0), vmcs_readl(CR0_READ_SHADOW),
> 

Queued, thanks.

Paolo


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

end of thread, other threads:[~2021-06-22 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 22:16 [PATCH] KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB Jim Mattson
2021-06-22 16:38 ` Paolo Bonzini

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.