device_add/del based CPU hotplug and unplug support is upstream for sPAPR PowerPC and is under development for x86. Both of these will support CPU device removal in random order (and not necessarily in LIFO order). Random order removal will result in holes in cpu_index range which causes migration to fail. This needs fixes in both generic code as well as arch specific code.
- migration_id is newly introduced and used as instance_id when registering CPU devices using vmstate_register. migration_id is set by the target machine code. To support forward migration, as per Igor's suggestion, this needs to be done conditionally based on machine type version. - From pseries-2.7 onwards, we start using migration_id for migration as well as in XICS code. vmstate registration calls are moved to cpu_common_realizefn and newly introduced cpu_common_unrealizefn. This patchset depends on Greg Kurz's patchset where among other things, he is deriving cpu_dt_it (arch_id) based on core-id. (https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg00210.html) Tested changes to XICS code with both kernel_irqchip=on/off. This applies on ppc-for-2.7 branch of David's tree. Changes in v1 ------------- - Introduced CPUState::migration_id to be used with vmstate_register() - migration_id is now set by target machine code via CPUClass::get_migration_id() - Use of migration is controlled by a property CPUState:use_migration_id. - Use of SPAPR_COMPAT_2_6 to set use-migration-id property for all CPUs starting from pseries-2.7 onwards. - Calling vmstate_[un]register() from cpu_common_[un]realizefn calls. v0: http://lists.nongnu.org/archive/html/qemu-ppc/2016-07/msg00090.html Bharata B Rao (5): cpu,target-ppc: Move cpu_vmstate_[un]register calls to cpu_common_[un]realize cpu: Introduce CPUState::migration_id spapr: Implement CPUClass::get_migration_id() for PowerPC CPUs xics: Use migration_id instead of cpu_index in XICS code cpu,spapr: Use migration_id from pseries-2.7 onwards exec.c | 54 ++++++++++++++++++++++++++++----------------- hw/intc/xics.c | 12 ++++++---- hw/intc/xics_kvm.c | 11 +++++---- hw/intc/xics_spapr.c | 28 +++++++++++++++++------ hw/ppc/spapr.c | 5 +++++ include/qom/cpu.h | 8 +++++++ qom/cpu.c | 29 ++++++++++++++++++++++++ target-ppc/cpu-qom.h | 2 ++ target-ppc/translate_init.c | 15 +++++++++++++ 9 files changed, 127 insertions(+), 37 deletions(-) -- 2.7.4