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

From: Edgecombe, Rick P

Date: Thu Oct 22 2026 - 21:56:37 EST


On Fri, 2026-10-23 at 07:59 +0800, Yan Zhao wrote:
> > Yes this looks much clearer than even the upstream code. Do you have any
> > better
> > ideas than "4KB guest private page" though? Because in the split case it is
> > actually for 512 guest private pages. We should put an artful comment to
> > explain
> > both cases while not making it look like something that has a better
> > solution.
> > Because I'm thinking there isn't one.
>
> What about a comment like
> /*
>          * +1 pair to account for mapping a new 4KB guest page or splitting a
>          * 2MB guest page into 512 4KB pages.
>          */
> ?

Can we mention why we only need one for 512 pages, what about?

/*
* +1 pair to account for mapping a new 4KB guest page or splitting a
* 2MB guest page. Since the resulting split 2MB page will be 2MB
* aligned it will only end up needing one DPAMT page pair to cover all
* 512 4KB pages.
*/