On 12/06/2017 16:37, David Gibson wrote: > On Thu, Jun 08, 2017 at 07:27:42PM +0200, Laurent Vivier wrote: >> If the OS is not started, QEMU sends an event to the OS >> that is lost and cannot be recovered. An unplug is not >> able to restore QEMU in a coherent state. >> So, while the OS is not started, disable CPU and memory hotplug. >> We guess the OS is started if the CAS has been negotiated. >> >> Signed-off-by: Laurent Vivier <lviv...@redhat.com> > > It seems a pain to introduce a whole new (migrated) variable just to > check this. Could we instead tweak the allocation of spapr->ov5_cas, > so it is NULL until CAS is completed?
I think it's a good idea to use ov5_cas, but we need to modify some functions to manage the NULL pointer (spapr_ovec_test(), spapr_ovec_populate_dt()), and I have some issues to manage the NULL pointer in migration: - with the previous releases, if it is NULL, we don't want to migrate it because previous releases are not able to manage a NULL pointer, so we don't migrate it (spapr_ov5_cas_needed() should be false if ov5_cas is NULL) letting it to its default value (initialized but empty) in this case on the destination, - with the current version, if it is not NULL, we to want migrate it, but the destination guest crashes because the pointer on the destination is NULL and there is no memory the receive the data. I think the problem is we can't migrate ov5_cas if it is not initialized on the destination side[0]. Perhaps I've missed something but it seems a NULL pointer can't be migrated and thus cannot be used as a state marker. Any idea? Thanks, Laurent [0] Perhaps we could use a VMSTATE_XXX() with a VMS_ALLOC flag instead of VMSTATE_STRUCT_POINTER_V() to allocate the memory on the destination?