Re: [RFC PATCH 3/4] KVM: x86/tdx: Do VMXON and TDX-Module initialization during tdx_init()

From: Edgecombe, Rick P

Date: Tue Oct 14 2025 - 15:45:05 EST


On Tue, 2025-10-14 at 16:35 +0800, Chao Gao wrote:
> Is it a good idea to consolidate the two tdx_offline_cpu() functions, i.e.,
> integrate KVM's version into x86 core?

+1

It fixes a bug too. Currently in __tdx_td_init() if misc_cg_try_charge() fails,
it will decrement nr_configured_hkid in the error path before it got
incremented.

And the cgroups stuff that got plucked from the past seems to have the same
problem. Ideally we could move MISC_CG_RES_TDX accounting too with this change
because it also fits, and it would fix that too.