[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z2ONGJ/Q1IEWkL8T@yzhao56-desk.sh.intel.com>
Date: Thu, 19 Dec 2024 11:03:52 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: <pbonzini@...hat.com>, <kvm@...r.kernel.org>,
<dave.hansen@...ux.intel.com>, <rick.p.edgecombe@...el.com>,
<kai.huang@...el.com>, <adrian.hunter@...el.com>,
<reinette.chatre@...el.com>, <xiaoyao.li@...el.com>,
<tony.lindgren@...el.com>, <binbin.wu@...ux.intel.com>,
<dmatlack@...gle.com>, <isaku.yamahata@...el.com>,
<isaku.yamahata@...il.com>, <nik.borisov@...e.com>,
<linux-kernel@...r.kernel.org>, <x86@...nel.org>
Subject: Re: [RFC PATCH 2/2] KVM: TDX: Kick off vCPUs when SEAMCALL is busy
during TD page removal
On Wed, Dec 18, 2024 at 06:39:29PM -0800, Sean Christopherson wrote:
> On Thu, Dec 19, 2024, Yan Zhao wrote:
> > On Wed, Dec 18, 2024 at 08:10:48AM -0800, Sean Christopherson wrote:
> > > On Wed, Dec 18, 2024, Yan Zhao wrote:
> > > > > Anyways, I don't see any reason to make this an arch specific request.
> > > > After making it non-arch specific, probably we need an atomic counter for the
> > > > start/stop requests in the common helpers. So I just made it TDX-specific to
> > > > keep it simple in the RFC.
> > >
> > > Oh, right. I didn't consider the complications with multiple users. Hrm.
> > >
> > > Actually, this doesn't need to be a request. KVM_REQ_OUTSIDE_GUEST_MODE will
> > > forces vCPUs to exit, at which point tdx_vcpu_run() can return immediately with
> > > EXIT_FASTPATH_EXIT_HANDLED, which is all that kvm_vcpu_exit_request() does. E.g.
> > > have the zap side set wait_for_sept_zap before blasting the request to all vCPU,
> > Hmm, the wait_for_sept_zap also needs to be set and unset in all vCPUs except
> > the current one.
>
> Why can't it be a VM-wide flag? The current vCPU isn't going to do VP.ENTER, is
> it? If it is, I've definitely missed something :-)
Ah, right. You are not missing anything. I just forgot it can be a VM-wide flag....
Sorry.
>
> > > /* TDX exit handle takes care of this error case. */
> > > if (unlikely(tdx->state != VCPU_TD_STATE_INITIALIZED)) {
> > > tdx->vp_enter_ret = TDX_SW_ERROR;
> > > @@ -921,6 +924,9 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
> > > return EXIT_FASTPATH_NONE;
> > > }
> > >
> > > + if (unlikely(to_kvm_tdx(vcpu->kvm)->wait_for_sept_zap))
> > > + return EXIT_FASTPATH_EXIT_HANDLED;
> > > +
> > > trace_kvm_entry(vcpu, force_immediate_exit);
> > >
> > > if (pi_test_on(&tdx->pi_desc)) {
> > Thanks for this suggestion.
> > But what's the advantage of this checking wait_for_sept_zap approach?
> > Is it to avoid introducing an arch specific request?
>
> Yes, and unless I've missed something, "releasing" vCPUs can be done by clearing
> a single variable.
Right. Will do in this way in the next version.
Powered by blists - more mailing lists