Re: [PATCH v3 10/12] KVM: SEV: Forcefully invalidate SNP VMSA if its backing gmem page is zapped
From: Ackerley Tng
Date: Wed Jul 08 2026 - 18:56:17 EST
Sean Christopherson <seanjc@xxxxxxxxxx> writes:
>
> [...snip...]
>
> @@ -1902,6 +1905,7 @@ struct kvm_x86_ops {
> void *(*alloc_apic_backing_page)(struct kvm_vcpu *vcpu);
> int (*gmem_prepare)(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order);
> #ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE
> + void (*gmem_invalidate_range)(struct kvm *kvm, struct kvm_gfn_range *range);
> void (*gmem_reclaim_memory)(kvm_pfn_t start, kvm_pfn_t end);
> #endif
I suggested CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM_MEMORY before looking at
this patch.
Considering this, it seems like gmem_invalidate_range is a true
invalidation request and .gmem_reclaim_memory is too late for
invalidation as you explained in the commit message of the renaming
patch.
Perhaps the new .gmem_invalidate_range should take over
CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE, and .gmem_reclaim_memory should
use a new CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM_MEMORY?
Are they both invalidations in your opinion?
If we're clumping SNP configs together,
CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE is also only enabled by SNP...
>
> [...snip...]
>