Re: [PATCH v7 08/11] KVM: TDX: Get/put PAMT pages when (un)mapping private memory
Sean Christopherson <[email protected]> Wed, 22 Jul 2026 12:41:01 -0700
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jul 17, 2026, Rick Edgecombe wrote: > From: "Kirill A. Shutemov" <[email protected]> > > Add Dynamic PAMT support to KVM's S-EPT MMU by "getting" a PAMT page when > adding guest memory (PAGE.ADD or PAGE.AUG), and "putting" the page when > removing guest memory (PAGE.REMOVE). > > To access the per-vCPU PAMT caches without plumbing @vcpu throughout the > TDP MMU, begrudgingly use kvm_get_running_vcpu() to get the vCPU, and bug > the VM if KVM attempts to set an S-EPT leaf without an active vCPU. KVM > only supports creating _new_ mappings in page (pre)fault paths, all of > which require an active vCPU. > > The PAMT memory holds metadata for TDX protected memory. With Dynamic > PAMT, PAMT_4K is allocated on demand. The kernel supplies the TDX module > with a few pages that cover 2MB of host physical memory. > > Releases are balanced via tdx_pamt_put(): every control-page free goes > through tdx_free_control_page(), and guest data pages are put directly on > the successful tdh_mem_page_remove() path and in the > tdx_mem_page_add/aug() error path. > > Signed-off-by: Kirill A. Shutemov <[email protected]> > Co-developed-by: Sean Christopherson <[email protected]> > Signed-off-by: Sean Christopherson <[email protected]> > [rick: enhance log, reviewing, rebase, with help from AI tooling] > Co-developed-by: Rick Edgecombe <[email protected]> > Signed-off-by: Rick Edgecombe <[email protected]> > Reviewed-by: Binbin Wu <[email protected]> > Reviewed-by: Tony Lindgren <[email protected]> > --- With the nits fixed, Acked-by: Sean Christopherson <[email protected]>