[PATCH 3/3] KVM: VMX: Dump the secondary VM-exit controls in dump_vmcs()
From: Sohil Mehta
Date: Wed Nov 25 2026 - 21:31:13 EST
From: "Xin Li (Intel)" <xin@xxxxxxxxx>
KVM now activates the secondary VM-exit controls whenever hardware
supports them. Print them next to the primary VM-exit controls in the
VMCS dump to help debug failed VM-entries.
While at it, give the entry and exit controls the 0x prefix that the
execution control fields already have.
Signed-off-by: Xin Li (Intel) <xin@xxxxxxxxx>
Signed-off-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
---
v1:
- New patch, split out of FRED KVM v10 series so that the dump covers
the field this series adds.
---
arch/x86/kvm/vmx/vmx.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index d35bad8b29a7..7291c2916ff6 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6493,7 +6493,7 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
struct vcpu_vmx *vmx = to_vmx(vcpu);
u32 vmentry_ctl, vmexit_ctl;
u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control;
- u64 tertiary_exec_control;
+ u64 tertiary_exec_control, secondary_vmexit_ctl;
unsigned long cr4;
int efer_slot;
@@ -6518,6 +6518,11 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
else
tertiary_exec_control = 0;
+ if (cpu_has_secondary_vmexit_ctrls())
+ secondary_vmexit_ctl = vmcs_read64(SECONDARY_VM_EXIT_CONTROLS);
+ else
+ secondary_vmexit_ctl = 0;
+
pr_err("VMCS %p, last attempted VM-entry on CPU %d\n",
vmx->loaded_vmcs->vmcs, vcpu->arch.last_vmentry_cpu);
pr_err("*** Guest State ***\n");
@@ -6626,8 +6631,10 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
pr_err("*** Control State ***\n");
pr_err("CPUBased=0x%08x SecondaryExec=0x%08x TertiaryExec=0x%016llx\n",
cpu_based_exec_ctrl, secondary_exec_control, tertiary_exec_control);
- pr_err("PinBased=0x%08x EntryControls=%08x ExitControls=%08x\n",
- pin_based_exec_ctrl, vmentry_ctl, vmexit_ctl);
+ pr_err("PinBased=0x%08x EntryControls=0x%08x\n",
+ pin_based_exec_ctrl, vmentry_ctl);
+ pr_err("ExitControls=0x%08x SecondaryExitControls=0x%016llx\n",
+ vmexit_ctl, secondary_vmexit_ctl);
pr_err("ExceptionBitmap=%08x PFECmask=%08x PFECmatch=%08x\n",
vmcs_read32(EXCEPTION_BITMAP),
vmcs_read32(PAGE_FAULT_ERROR_CODE_MASK),
--
2.43.0