Re: [PATCH v4 08/17] KVM: TDX: Adjust the topup count of DPAMT page pairs for splitting S-EPT

From: Yan Zhao

Date: Thu Oct 15 2026 - 00:48:39 EST


On Thu, Oct 15, 2026 at 02:34:21AM +0800, Edgecombe, Rick P wrote:
> On Wed, 2026-10-14 at 13:36 +0800, Yan Zhao wrote:
> > > The idea is to tell external infra what the fault handler might do. It might
> > > add
> > > a root, it might add a private leaf and it may need extra spts beyond the
> > > root.
> > > These are all concepts known to mirror EPT and also has all the info needed
> > > for
> > > the calculation on the TDX side, and also doesn't assume anything about TDX
> > > implementation from the mirror side. There is extra info passed, that is not
> > > needed. But the gain is that the code on both sides and calculation are self
> > > documenting.
> > It seems strange to me to have nr_extra_spts if root_spt is false, in which
> > case
> > nr_extra_spts are all the spts the caller wants to topup for, so why call them
> > extra?
>
> Can you suggest a better name for "extra"?
I think non-root_spts is clearer.

> > Also, is there a case where "private_page" is false? I can't find one...
> > Specifically for the "split" case (patch 6,
> > https://lore.kernel.org/all/20260928091005.15567-1-yan.y.zhao@xxxxxxxxx/)
> > where
> > .topup_external_cache() is invoked in tdp_mmu_alloc_sp_for_split(), how does
> > the
> > caller (tdp_mmu_alloc_sp_for_split()) know whether private_page should be true
> > or false without TDX's specific knowledge?
>
> The point of spelling it all out was to make the contact clear and the
> implementation doesn't have to assume anything about the callers.
Hmm, but it's hard for the caller to know if private_page is true.
We should avoid leaking TDX specific knowledge to KVM MMU, right?