Skip to content

Commit 2119884

Browse files
Sean Christophersonbonzini
authored andcommitted
KVM: x86: Free arrays for old memslot when moving memslot's base gfn
Explicitly free the metadata arrays (stored in slot->arch) in the old memslot structure when moving the memslot's base gfn is committed. This eliminates x86's dependency on kvm_free_memslot() being called when a memslot move is committed, and paves the way for removing the funky code in kvm_free_memslot() that conditionally frees structures based on its @dont param. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 9d4c197 commit 2119884

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kvm/x86.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10066,6 +10066,10 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
1006610066
*/
1006710067
if (change != KVM_MR_DELETE)
1006810068
kvm_mmu_slot_apply_flags(kvm, (struct kvm_memory_slot *) new);
10069+
10070+
/* Free the arrays associated with the old memslot. */
10071+
if (change == KVM_MR_MOVE)
10072+
kvm_arch_free_memslot(kvm, old, NULL);
1006910073
}
1007010074

1007110075
void kvm_arch_flush_shadow_all(struct kvm *kvm)

0 commit comments

Comments
 (0)