Re: [PATCH v3 04/12] KVM: Rename .gmem_invalidate() to .gmem_reclaim_memory()
From: Ackerley Tng
Date: Wed Jul 08 2026 - 18:41:00 EST
Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> Rename .gmem_invalidate() to .gmem_reclaim_memory() as the hook is called
> when a folio is freed, which is far too late and lacks sufficient
> information for KVM to actually invalidate its usage of the memory.
>
> Keep guest_memfd's trampoline, even though it would be trivial to wire up
> .free_folio() directly to an arch callback, to avoid bleeding guest_memfd
> internals into arch code (specifically, avoid referencing folios in arch
> code).
>
> Opportunistically guard kvm_x86_ops.gmem_reclaim_memory() with an ifdef to
> ensure the callback will actually be called, e.g. so that non-SEV code
> doesn't try to wire up a callback without enabling
> CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE.
Shall we also rename this CONFIG to CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM_MEMORY?
>
> [...snip...]
>