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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117202427.GC2751024@ls.amr.corp.intel.com>
Date:   Thu, 17 Nov 2022 12:24:27 -0800
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     Binbin Wu <binbin.wu@...ux.intel.com>
Cc:     isaku.yamahata@...el.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
        Paolo Bonzini <pbonzini@...hat.com>, erdemaktas@...gle.com,
        Sean Christopherson <seanjc@...gle.com>,
        Sagi Shahar <sagis@...gle.com>,
        David Matlack <dmatlack@...gle.com>
Subject: Re: [PATCH v10 076/108] KVM: TDX: handle vcpu migration over logical
 processor

On Tue, Nov 15, 2022 at 10:28:20AM +0800,
Binbin Wu <binbin.wu@...ux.intel.com> wrote:

> 
> On 10/30/2022 2:23 PM, isaku.yamahata@...el.com wrote:
> > From: Isaku Yamahata <isaku.yamahata@...el.com>
> > 
> > For vcpu migration, in the case of VMX, VCMS
> 
> typo, VMCS
> 
> 
> >   is flushed on the source pcpu,
> > and load it on the target pcpu.  There are corresponding TDX SEAMCALL APIs,
> > call them on vcpu migration.  The logic is mostly same as VMX except the
> > TDX SEAMCALLs are used.
> > 
> > When shutting down the machine, (VMX or TDX) vcpus needs to be shutdown on
> > each pcpu.  Do the similar for TDX with TDX SEAMCALL APIs.
> > 
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> > ---
> >   arch/x86/kvm/vmx/main.c    |  43 +++++++++++--
> >   arch/x86/kvm/vmx/tdx.c     | 121 +++++++++++++++++++++++++++++++++++++
> >   arch/x86/kvm/vmx/tdx.h     |   2 +
> >   arch/x86/kvm/vmx/x86_ops.h |   6 ++
> >   4 files changed, 168 insertions(+), 4 deletions(-)
> > 
> > 
> > @@ -176,6 +214,41 @@ static void tdx_reclaim_td_page(struct tdx_td_page *page)
> >   	}
> >   }
> > +static void tdx_flush_vp(void *arg)
> > +{
> > +	struct kvm_vcpu *vcpu = arg;
> > +	u64 err;
> > +
> > +	lockdep_assert_irqs_disabled();
> > +
> > +	/* Task migration can race with CPU offlining. */
> > +	if (vcpu->cpu != raw_smp_processor_id())
> > +		return;
> > +
> > +	/*
> > +	 * No need to do TDH_VP_FLUSH if the vCPU hasn't been initialized.  The
> > +	 * list tracking still needs to be updated so that it's correct if/when
> > +	 * the vCPU does get initialized.
> > +	 */
> > +	if (is_td_vcpu_created(to_tdx(vcpu))) {
> > +		err = tdh_vp_flush(to_tdx(vcpu)->tdvpr.pa);
> 
> Need to retry here if tdh.vp.flush fails due to tdx operand busy?
> 
> If such failure occurs, the next vp enter will fail after the vCPU migrated
> to another LP, how is it hanlded?


No need to retry.  TDX Resources needed for TDH.VP.FLUSH are, TDVPR as exclusive,
TDR as shared, and TDCS as shared.

This vp flush function is called when destructing vcpu/TD or vcpu migration.  No
other thread uses TDVPR in those cases.
-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ