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 - 22:06:23 EST


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.

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

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