On Fri, Feb 21, 2020 at 05:42:01PM +0100, David Hildenbrand wrote:
> Resizing while migrating is dangerous and does not work as expected.
> The whole migration code works on the usable_length of ram blocks and does
> not expect this to change at random points in time.
> 
> In the case of postcopy, relying on used_length is racy as soon as the
> guest is running. Also, when used_length changes we might leave the
> uffd handler registered for some memory regions, reject valid pages
> when migrating and fail when sending the recv bitmap to the source.
> 
> Resizing can be trigger *after* (but not during) a reset in
> ACPI code by the guest
> - hw/arm/virt-acpi-build.c:acpi_ram_update()
> - hw/i386/acpi-build.c:acpi_ram_update()
> 
> Let's remember the original used_length in a separate variable and
> use it in relevant postcopy code. Make sure to update it when we resize
> during precopy, when synchronizing the RAM block sizes with the source.
> 
> Cc: "Dr. David Alan Gilbert" <dgilb...@redhat.com>
> Cc: Juan Quintela <quint...@redhat.com>
> Cc: Eduardo Habkost <ehabk...@redhat.com>
> Cc: Paolo Bonzini <pbonz...@redhat.com>
> Cc: Igor Mammedov <imamm...@redhat.com>
> Cc: "Michael S. Tsirkin" <m...@redhat.com>
> Cc: Richard Henderson <richard.hender...@linaro.org>
> Cc: Shannon Zhao <shannon.z...@linaro.org>
> Cc: Alex Bennée <alex.ben...@linaro.org>
> Cc: Peter Xu <pet...@redhat.com>
> Signed-off-by: David Hildenbrand <da...@redhat.com>

Reviewed-by: Peter Xu <pet...@redhat.com>

-- 
Peter Xu


Reply via email to