mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
KVM: SEV: Drop page refcount early in VMSA reload
When reloading the guest VMSA for an SEV-SNP vCPU, KVM retrieves the PFN from guest_memfd. Drop the page reference immediately after retrieving the PFN instead of holding it across MMU lock acquisition in preparation for a follow-up patch to stop returning page pointers from guest_memfd PFN lookups. This is safe because the page's validity and presence are governed by KVM's MMU invalidation protocol rather than the page reference. No functional change intended. Reviewed-by: Michael Roth <michael.roth@amd.com> Signed-off-by: Ackerley Tng <ackerleytng@google.com> Link: https://patch.msgid.link/20260826-gmem-no-return-page-v4-4-3bb9c1ddb4e3@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
acafcf32c8
commit
3c427e5c03
|
|
@ -4078,6 +4078,7 @@ static void __sev_snp_reload_vmsa(struct kvm_vcpu *vcpu, gpa_t gpa)
|
|||
*/
|
||||
if (kvm_gmem_get_pfn(vcpu->kvm, slot, gfn, &pfn, &page, NULL))
|
||||
return;
|
||||
kvm_release_page_clean(page);
|
||||
|
||||
read_lock(&kvm->mmu_lock);
|
||||
/*
|
||||
|
|
@ -4092,8 +4093,6 @@ static void __sev_snp_reload_vmsa(struct kvm_vcpu *vcpu, gpa_t gpa)
|
|||
else
|
||||
svm->vmcb->control.vmsa_pa = pfn_to_hpa(pfn);
|
||||
read_unlock(&kvm->mmu_lock);
|
||||
|
||||
kvm_release_page_clean(page);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user