Re: [RFC PATCH v5 20/45] KVM: x86/mmu: Allocate/free S-EPT pages using tdx_{alloc,free}_control_page()
From: Huang, Kai
Date: Tue Feb 10 2026 - 05:58:35 EST
>
> Doesn't work, because sp->external_spt will be non-NULL when KVM is freeing
> unused pages in tdp_mmu_split_huge_pages_root() and kvm_tdp_mmu_map(). That's
> solvable, but it's part of the asymmetry I don't love. AFAICT, unless we do
> something truly awful, there's no way to avoid having common KVM free unused
> S-EPT pages.
>
> That said, while I don't love the asymmetry, it's not a deal breaker, especially
> if we make the asymmetry super obvious and cleanly delineated. Specifically, if
> we differentiate between freeing unused page tables and freeing used (linked at
> any point) page tables.
>
> This would also allow us to address the naming than Yan doesn't like around
> reclaim_external_sp(), because we could have both free_external_sp() and
> free_unused_external_spt(), where the lack of "unused" gives the reader a hint
> that there's interesting work to be done for in-use external page tables.
>
> This won't apply cleanly due to other fixups. It's also at:
That's a bit unfortunate.
I hate to say, but should we just use option 1? :-)
As Dave mentioned, we can always improve the locking when there's real
performance issue.