lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRwFEAAfvdgP6O6d@tlindgre-MOBL1>
Date: Tue, 18 Nov 2025 07:33:04 +0200
From: Tony Lindgren <tony.lindgren@...ux.intel.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Rick P Edgecombe <rick.p.edgecombe@...el.com>,
	Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, Jon Kohler <jon@...anix.com>
Subject: Re: [PATCH 2/4] KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside
 of the fastpath

On Mon, Nov 17, 2025 at 07:47:49AM -0800, Sean Christopherson wrote:
> On Mon, Nov 17, 2025, Tony Lindgren wrote:
> > 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.
> 
> Ugh, once you see it, it's obvious.  Sorry :-(
> 
> I'll drop the entire series and send a v2.  There's only one other patch that I
> already sent the "thank you" for, so I think it's worth unwinding to avoid
> breaking bisection for TDX (and because the diff can be very different).

OK thanks.
 
> Lightly tested, but I think this patch can instead be:
> 
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 163f854a39f2..6d41d2fc8043 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -1063,9 +1063,6 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags)
>         if (unlikely((tdx->vp_enter_ret & TDX_SW_ERROR) == TDX_SW_ERROR))
>                 return EXIT_FASTPATH_NONE;
>  
> -       if (unlikely(vmx_get_exit_reason(vcpu).basic == EXIT_REASON_MCE_DURING_VMENTRY))
> -               kvm_machine_check();
> -
>         trace_kvm_exit(vcpu, KVM_ISA_VMX);
>  
>         if (unlikely(tdx_failed_vmentry(vcpu)))
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index d98107a7bdaa..d1117da5463f 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7035,10 +7035,19 @@ void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu)
>         if (to_vt(vcpu)->emulation_required)
>                 return;
>  
> -       if (vmx_get_exit_reason(vcpu).basic == EXIT_REASON_EXTERNAL_INTERRUPT)
> +       switch (vmx_get_exit_reason(vcpu).basic) {
> +       case EXIT_REASON_EXTERNAL_INTERRUPT:
>                 handle_external_interrupt_irqoff(vcpu, vmx_get_intr_info(vcpu));
> -       else if (vmx_get_exit_reason(vcpu).basic == EXIT_REASON_EXCEPTION_NMI)
> +               break;
> +       case EXIT_REASON_EXCEPTION_NMI:
>                 handle_exception_irqoff(vcpu, vmx_get_intr_info(vcpu));
> +               break;
> +       case EXIT_REASON_MCE_DURING_VMENTRY:
> +               kvm_machine_check();
> +               break;
> +       default:
> +               break;
> +       }
>  }
>  
>  /*
> @@ -7501,9 +7510,6 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags)
>         if (unlikely(vmx->fail))
>                 return EXIT_FASTPATH_NONE;
>  
> -       if (unlikely((u16)vmx_get_exit_reason(vcpu).basic == EXIT_REASON_MCE_DURING_VMENTRY))
> -               kvm_machine_check();
> -
>         trace_kvm_exit(vcpu, KVM_ISA_VMX);
>  
>         if (unlikely(vmx_get_exit_reason(vcpu).failed_vmentry))

Looks good to me.

Regards,

Tony

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ