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

From: Edgecombe, Rick P

Date: Wed Oct 14 2026 - 14:35:08 EST


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"?

>
> 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.