Skip to contentSkip to conversation

KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB

PATCH Applied Jim Mattson 2 participants 2 messages Jun 21, 2021 – Jun 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: Print CPU of last attempted VM-entry when dumping VMCS/VMCB

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.

---
 arch/x86/kvm/svm/svm.c | 2 ++
 arch/x86/kvm/vmx/vmx.c | 2 ++
 2 files changed, 4 insertions(+)
arch/x86/kvm/svm/svm.c +2 -0
index 12c06ea28f5c..af9e9db1121e 100644
@@ -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);
arch/x86/kvm/vmx/vmx.c +2 -0
index ab6f682645d7..94c7375eb75c 100644
@@ -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),
Signature · 1 line
2.32.0.288.g62a8d224e6-goog
maintainer Applied
#1 lore raw
Quoted 29 lines · 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.

---
  arch/x86/kvm/svm/svm.c | 2 ++
  arch/x86/kvm/vmx/vmx.c | 2 ++
  2 files changed, 4 insertions(+)
arch/x86/kvm/svm/svm.c +2 -0
index 12c06ea28f5c..af9e9db1121e 100644
@@ -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);
arch/x86/kvm/vmx/vmx.c +0 -0
index ab6f682645d7..94c7375eb75c 100644

arch/x86/kvm/vmx/vmx.c void dump_vmcs(struct kvm_vcpu *vcpu) · line 5731

Quoted 8 lines
arch/x86/kvm/vmx/vmx.c +2 -0
@@ -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