Re: [PATCH 2/4] KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath

From: Tony Lindgren
Date: Mon Nov 17 2025 - 07:41:52 EST


Hi,

On Thu, Oct 30, 2025 at 03:42:44PM -0700, Sean Christopherson wrote:
> --- a/arch/x86/kvm/vmx/main.c
> +++ b/arch/x86/kvm/vmx/main.c
> @@ -608,6 +608,17 @@ static void vt_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa,
> vmx_load_mmu_pgd(vcpu, root_hpa, pgd_level);
> }
>
> +static void vt_handle_exit_irqoff(struct kvm_vcpu *vcpu)
> +{
> + if (unlikely((u16)vmx_get_exit_reason(vcpu).basic == EXIT_REASON_MCE_DURING_VMENTRY))
> + kvm_machine_check();
> +
> + if (is_td_vcpu(vcpu))
> + return;
> +
> + return vmx_handle_exit_irqoff(vcpu);
> +}

I bisected kvm-x86/next down to this change for a TDX guest not booting
and host producing errors like:

watchdog: CPU118: Watchdog detected hard LOCKUP on cpu 118

Dropping the is_td_vcpu(vcpu) check above fixes the issue. Earlier the
call for vmx_handle_exit_irqoff() was unconditional.

Probably the (u16) cast above can be dropped too? It was never used for
TDX looking at the patch.

Regards,

Tony