[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0gGBnTcFzY99/iG@yzhao56-desk.sh.intel.com>
Date: Thu, 28 Nov 2024 13:56:22 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Adrian Hunter <adrian.hunter@...el.com>
CC: Binbin Wu <binbin.wu@...ux.intel.com>, Xiaoyao Li <xiaoyao.li@...el.com>,
<pbonzini@...hat.com>, <seanjc@...gle.com>, <kvm@...r.kernel.org>,
<dave.hansen@...ux.intel.com>, <rick.p.edgecombe@...el.com>,
<kai.huang@...el.com>, <reinette.chatre@...el.com>,
<tony.lindgren@...ux.intel.com>, <dmatlack@...gle.com>,
<isaku.yamahata@...el.com>, <nik.borisov@...e.com>,
<linux-kernel@...r.kernel.org>, <x86@...nel.org>, <chao.gao@...el.com>,
<weijiang.yang@...el.com>
Subject: Re: [PATCH 2/7] KVM: TDX: Implement TDX vcpu enter/exit path
On Fri, Nov 22, 2024 at 04:33:27PM +0200, Adrian Hunter wrote:
> On 22/11/24 07:56, Binbin Wu wrote:
> >
> >
> >
> > On 11/22/2024 1:23 PM, Xiaoyao Li wrote:
> > [...]
> >>> +
> >>> +fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
> >>> +{
> >>> + struct vcpu_tdx *tdx = to_tdx(vcpu);
> >>> +
> >>> + /* TDX exit handle takes care of this error case. */
> >>> + if (unlikely(tdx->state != VCPU_TD_STATE_INITIALIZED)) {
> >>> + /* Set to avoid collision with EXIT_REASON_EXCEPTION_NMI. */
> >>
> >> It seems the check fits better in tdx_vcpu_pre_run().
> >
> > Indeed, it's cleaner to move the check to vcpu_pre_run.
> > Then no need to set the value to vp_enter_ret, and the comments are not
> > needed.
>
> And we can take out the same check in tdx_handle_exit()
> because it won't get there if ->vcpu_pre_run() fails.
And also check for TD_STATE_RUNNABLE in tdx_vcpu_pre_run()?
> >
> >>
> >> And without the patch of how TDX handles Exit (i.e., how deal with vp_enter_ret), it's hard to review this comment.
> >>
> >>> + tdx->vp_enter_ret = TDX_SW_ERROR;
> >>> + return EXIT_FASTPATH_NONE;
> >>> + }
> >>> +
> >>> + trace_kvm_entry(vcpu, force_immediate_exit);
> >>> +
> >>> + tdx_vcpu_enter_exit(vcpu);
> >>> +
> >>> + vcpu->arch.regs_avail &= ~VMX_REGS_LAZY_LOAD_SET;
> >>> + trace_kvm_exit(vcpu, KVM_ISA_VMX);
> >>> +
> >>> + return EXIT_FASTPATH_NONE;
> >>> +}
> >>> +
> > [...]
>
Powered by blists - more mailing lists