kvm: Reallocate dirty_bmap when we change a slot
commit9b3a31c745b61758aaa5466a3a9fc0526d409188
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 21 Nov 2019 16:56:45 +0000 (21 16:56 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Dec 2019 18:32:23 +0000 (17 19:32 +0100)
treefd1118be353bf282ccb487f332b290dd5638b612
parentaceeaa69d28e6f08a24395d0aa6915b687d0a681
kvm: Reallocate dirty_bmap when we change a slot

kvm_set_phys_mem can be called to reallocate a slot by something the
guest does (e.g. writing to PAM and other chipset registers).
This can happen in the middle of a migration, and if we're unlucky
it can now happen between the split 'sync' and 'clear'; the clear
asserts if there's no bmap to clear.   Recreate the bmap whenever
we change the slot, keeping the clear path happy.

Typically this is triggered by the guest rebooting during a migrate.

Corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=1772774
https://bugzilla.redhat.com/show_bug.cgi?id=1771032

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
accel/kvm/kvm-all.c