[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220323224802.GA181823@private.email.ne.jp>
Date: Wed, 23 Mar 2022 15:48:02 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Erdem Aktas <erdemaktas@...gle.com>
Cc: Isaku Yamahata <isaku.yamahata@...il.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Jim Mattson <jmattson@...gle.com>,
Connor Kuehl <ckuehl@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Subject: Re: [RFC PATCH v5 064/104] KVM: TDX: Implement TDX vcpu enter/exit
path
On Wed, Mar 23, 2022 at 01:05:27PM -0700,
Erdem Aktas <erdemaktas@...gle.com> wrote:
> On Wed, Mar 23, 2022 at 10:55 AM Isaku Yamahata
> <isaku.yamahata@...il.com> wrote:
> >
> > On Tue, Mar 22, 2022 at 10:28:42AM -0700,
> > Erdem Aktas <erdemaktas@...gle.com> wrote:
> >
> > > On Fri, Mar 4, 2022 at 11:50 AM <isaku.yamahata@...el.com> 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@...il.com>
>
> 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@...il.com>
Powered by blists - more mailing lists