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 22 2026 - 22:16:36 EST


On Fri, Oct 23, 2026 at 10:06:01AM +0800, Edgecombe, Rick P wrote:
> On Fri, 2026-10-23 at 10:03 +0800, Yan Zhao wrote:
> > > Can we mention why we only need one for 512 pages, what about?
> >
> > But "2MB guest page" should already imply that the physical range is 2MB
> > aligned. Instead of expanding the details in the comment, would it be better
> > to put the explanation in the patch changelog?
>
> I think the detail that is missing is that DPAMT only needs one page pair per
> 2MB aligned region. That info is encapsulated in arch/x86 side. So I think this
> code needs a comment to cover that part.
Makes sense.

> That the 2MB page is 2MB aligned is not necessary. Can you propose something
> else?
What about

/*
* Only one DPAMT page pair is needed per 2MB aligned region.
* +1 pair to account for mapping a new 4KB guest page or splitting a
* 2MB guest page into 512 4KB pages.
*/

?

> >
> > > /*
> > >   * +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.
> > >   */
>
>