mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
KVM: Put the extra pfn reference when reusing a pfn in the gpc cache
commit3dddf65b4f
upstream. Put the struct page reference to pfn acquired by hva_to_pfn() when the old and new pfns for a gfn=>pfn cache match. The cache already has a reference via the old/current pfn, and will only put one reference when the cache is done with the pfn. Fixes:982ed0de47
("KVM: Reinstate gfn_to_pfn_cache with invalidation support") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20220429210025.3293691-5-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
81b640cc9b
commit
391931dafc
1 changed files with 8 additions and 0 deletions
|
@ -206,6 +206,14 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache *gpc,
|
||||||
|
|
||||||
if (gpc->usage & KVM_HOST_USES_PFN) {
|
if (gpc->usage & KVM_HOST_USES_PFN) {
|
||||||
if (new_pfn == old_pfn) {
|
if (new_pfn == old_pfn) {
|
||||||
|
/*
|
||||||
|
* Reuse the existing pfn and khva, but put the
|
||||||
|
* reference acquired hva_to_pfn_retry(); the
|
||||||
|
* cache still holds a reference to the pfn
|
||||||
|
* from the previous refresh.
|
||||||
|
*/
|
||||||
|
gpc_release_pfn_and_khva(kvm, new_pfn, NULL);
|
||||||
|
|
||||||
new_khva = old_khva;
|
new_khva = old_khva;
|
||||||
old_pfn = KVM_PFN_ERR_FAULT;
|
old_pfn = KVM_PFN_ERR_FAULT;
|
||||||
old_khva = NULL;
|
old_khva = NULL;
|
||||||
|
|
Loading…
Reference in a new issue