Re: [PATCH v3 11/24] KVM: x86/mmu: Introduce kvm_split_cross_boundary_leafs()
From: Sean Christopherson
Date: Thu Jan 29 2026 - 09:55:09 EST
On Thu, Jan 22, 2026, Yan Zhao wrote:
> On Tue, Jan 20, 2026 at 10:02:41AM -0800, Sean Christopherson wrote:
> > On Tue, Jan 20, 2026, Vishal Annapurve wrote:
> > > On Fri, Jan 16, 2026 at 3:39 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > > > And then for the PUNCH_HOLE case, do the math to determine which, if any, head
> > > > and tail pages need to be split, and use the existing APIs to make that happen.
> > >
> > > Just a note: Through guest_memfd upstream syncs, we agreed that
> > > guest_memfd will only allow the punch_hole operation for huge page
> > > size-aligned ranges for hugetlb and thp backing. i.e. the PUNCH_HOLE
> > > operation doesn't need to split any EPT mappings for foreseeable
> > > future.
> >
> > Oh! Right, forgot about that. It's the conversion path that we need to sort out,
> > not PUNCH_HOLE. Thanks for the reminder!
> Hmm, I see.
> However, do you think it's better to leave the splitting logic in PUNCH_HOLE as
> well? e.g., guest_memfd may want to map several folios in a mapping in the
> future, i.e., after *max_order > folio_order(folio);
No, not at this time. That is a _very_ big "if". Coordinating and tracking
contiguous chunks of memory at a larger granularity than the underlying HugeTLB
page size would require significant complexity, I don't see us ever doing that.