[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <528c5307-4006-4122-b333-331084d7b55b@linux.intel.com>
Date: Tue, 13 Aug 2024 16:37:10 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
Cc: seanjc@...gle.com, pbonzini@...hat.com, kvm@...r.kernel.org,
kai.huang@...el.com, isaku.yamahata@...il.com,
tony.lindgren@...ux.intel.com, xiaoyao.li@...el.com,
linux-kernel@...r.kernel.org, Isaku Yamahata <isaku.yamahata@...el.com>
Subject: Re: [PATCH 16/25] KVM: TDX: Don't offline the last cpu of one package
when there's TDX guest
On 8/13/2024 6:48 AM, Rick Edgecombe wrote:
> From: Isaku Yamahata <isaku.yamahata@...el.com>
>
> Destroying TDX guest requires there's at least one cpu online for each
> package, because reclaiming the TDX KeyID of the guest (as part of the
> teardown process) requires to call some SEAMCALL (on any cpu) on all
> packages.
>
> Do not offline the last cpu of one package when there's any TDX guest
> running, otherwise KVM may not be able to teardown TDX guest resulting
> in leaking of TDX KeyID and other resources like TDX guest control
> structure pages.
>
> Add a tdx_arch_offline_cpu() and call it in kvm_offline_cpu() to provide
> a placeholder for TDX specific check. The default __weak version simply
> returns 0 (allow to offline) so other ARCHs are not impacted. Implement
> the x86 version, which calls a new 'kvm_x86_ops::offline_cpu()' callback.
> Implement the TDX version 'offline_cpu()' to prevent the cpu from going
> offline if it is the last cpu on the package.
This part is stale.
Now, it's using TDX's own hotplug state callbacks instead of hooking
into KVM's.
>
[...]
> +
> static void __do_tdx_cleanup(void)
> {
> /*
> @@ -946,7 +982,7 @@ static int __init __do_tdx_bringup(void)
> */
> r = cpuhp_setup_state_cpuslocked(CPUHP_AP_ONLINE_DYN,
> "kvm/cpu/tdx:online",
> - tdx_online_cpu, NULL);
> + tdx_online_cpu, tdx_offline_cpu);
> if (r < 0)
> return r;
>
Powered by blists - more mailing lists