On Wed, Mar 23, 2022 at 01:05:27PM -0700, Erdem Aktas <erdemaktas@xxxxxxxxxx> wrote: > On Wed, Mar 23, 2022 at 10:55 AM Isaku Yamahata > <isaku.yamahata@xxxxxxxxx> wrote: > > > > On Tue, Mar 22, 2022 at 10:28:42AM -0700, > > Erdem Aktas <erdemaktas@xxxxxxxxxx> wrote: > > > > > On Fri, Mar 4, 2022 at 11:50 AM <isaku.yamahata@xxxxxxxxx> wrote: > > > > @@ -509,6 +512,37 @@ void tdx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) > > > > vcpu->kvm->vm_bugged = true; > > > > } > > > > > > > > +u64 __tdx_vcpu_run(hpa_t tdvpr, void *regs, u32 regs_mask); > > > > + > > > > +static noinstr void tdx_vcpu_enter_exit(struct kvm_vcpu *vcpu, > > > > + struct vcpu_tdx *tdx) > > > > +{ > > > > + guest_enter_irqoff(); > > > > + tdx->exit_reason.full = __tdx_vcpu_run(tdx->tdvpr.pa, vcpu->arch.regs, 0); > > > > + guest_exit_irqoff(); > > > > +} > > > > + > > > > +fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) > > > > +{ > > > > + struct vcpu_tdx *tdx = to_tdx(vcpu); > > > > + > > > > + if (unlikely(vcpu->kvm->vm_bugged)) { > > > > + tdx->exit_reason.full = TDX_NON_RECOVERABLE_VCPU; > > > > + return EXIT_FASTPATH_NONE; > > > > + } > > > > + > > > > + trace_kvm_entry(vcpu); > > > > + > > > > + tdx_vcpu_enter_exit(vcpu, tdx); > > > > + > > > > + vcpu->arch.regs_avail &= ~VMX_REGS_LAZY_LOAD_SET; > > > > + trace_kvm_exit(vcpu, KVM_ISA_VMX); > > > > + > > > > + if (tdx->exit_reason.error || tdx->exit_reason.non_recoverable) > > > > + return EXIT_FASTPATH_NONE; > > > > > > Looks like the above if statement has no effect. Just checking if this > > > is intentional. > > > > I'm not sure if I get your point. tdx->exit_reason is updated by the above > > tdx_cpu_enter_exit(). So it makes sense to check .error or .non_recoverable. > > -- > > Isaku Yamahata <isaku.yamahata@xxxxxxxxx> > > What I mean is, if there is an error, it returns EXIT_FASTPATH_NONE > but if there is no error, it still returns EXIT_FASTPATH_NONE. > > The code is like below, the if-statement might be there as a > placeholder to check errors but it has no impact on what is returned > from this function. > > if (tdx->exit_reason.error || tdx->exit_reason.non_recoverable) > return EXIT_FASTPATH_NONE; > return EXIT_FASTPATH_NONE; Got it. It doesn't make sense. I'll fix it with the next respin. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>