[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d7141b1-1d76-4e67-60d2-471a524c372e@intel.com>
Date: Mon, 13 Feb 2023 14:28:43 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"Brown, Len" <len.brown@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"Gao, Chao" <chao.gao@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>
Subject: Re: [PATCH v9 07/18] x86/virt/tdx: Do TDX module per-cpu
initialization
On 2/13/23 13:13, Huang, Kai wrote:
> Perhaps I didn't explain clearly in the comment. Below is the updated one:
>
> /*
> * 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 w/o doing per-cpu initialization.
> *
> * For example, a new CPU can become online when KVM is
> * unloaded, in which case tdx_cpu_enable() is not called since
> * KVM's CPU online callback has been removed.
> *
> * 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.
> */
This is voodoo.
I want a TDX-specific hotplug CPU handler. Period. Please make that
happen. Put that code in this patch. That handler should:
1. Run after the KVM handler (if present)
2. See if VMX is on
3. If VMX is on:
3a. Run smp_func_module_lp_init(), else
3b. Mark the CPU as needing smp_func_module_lp_init()
Then, in the 'case TDX_MODULE_INITIALIZED:', you call a function to
iterate over the cpumask that was generated in 3b.
That makes the handoff *EXPLICIT*. You know exactly which CPUs need
what done to them. A CPU hotplug either explicitly involves doing the
work to make TDX work on the CPU, or explicitly defers the work to a
specific later time in a specific later piece of code.
Powered by blists - more mailing lists