[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+uW4q//sIw+qQ+a@hirez.programming.kicks-ass.net>
Date: Tue, 14 Feb 2023 15:12:50 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Kai Huang <kai.huang@...el.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, linux-mm@...ck.org, tglx@...utronix.de,
seanjc@...gle.com, pbonzini@...hat.com, dan.j.williams@...el.com,
rafael.j.wysocki@...el.com, kirill.shutemov@...ux.intel.com,
ying.huang@...el.com, reinette.chatre@...el.com,
len.brown@...el.com, tony.luck@...el.com, ak@...ux.intel.com,
isaku.yamahata@...el.com, chao.gao@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, david@...hat.com,
bagasdotme@...il.com, sagis@...gle.com, imammedo@...hat.com
Subject: Re: [PATCH v9 07/18] x86/virt/tdx: Do TDX module per-cpu
initialization
On Mon, Feb 13, 2023 at 10:07:30AM -0800, Dave Hansen wrote:
> On 2/13/23 03:59, Kai Huang wrote:
> > @@ -247,8 +395,17 @@ int tdx_enable(void)
> > ret = __tdx_enable();
> > break;
> > case TDX_MODULE_INITIALIZED:
> > - /* Already initialized, great, tell the caller. */
> > - ret = 0;
> > + /*
> > + * The previous call of __tdx_enable() may only have
> > + * initialized part of present cpus during module
> > + * initialization, and new cpus may have become online
> > + * since then.
> > + *
> > + * To make sure all online cpus are TDX-runnable, always
> > + * do per-cpu initialization for all online cpus here
> > + * even the module has been initialized.
> > + */
> > + ret = __tdx_enable_online_cpus();
>
> I'm missing something here. CPUs get initialized through either:
>
> 1. __tdx_enable(), for the CPUs around at the time
> 2. tdx_cpu_online(), for hotplugged CPUs after __tdx_enable()
>
> But, this is a third class. CPUs that came online after #1, but which
> got missed by #2. How can that happen?
offline CPUs, start TDX crap, online CPUs.
Powered by blists - more mailing lists