spapr/ppc: fix backward migration to QEMU 2.9
PATCH 1/1 spapr/ppc: fix backward migration to QEMU 2.9
Commit c783b0012708 ("ppc: Rework CPU compatibility testing across migration") added a subsection to the vmstate description of CPUs. This subsection is sent when the CPU compat_pvr field is non-zero, which is likely to happen after CAS negociation (since QEMU 2.9) or even before CAS negociation if the user explicitely asked for compat mode.
This breaks backward migration of existing pseries-2.9 machine types since they don't know about this "compat" subsection:
qemu-system-ppc64: error while loading state for instance 0x0 of
device 'cpu'
This patch reverts to the behavior of simply ignoring the PVR when migrating older machines (ie, let the migration succeed if the user is sure that the CPU on the destination is close enough to work).
--- hw/ppc/spapr.c | 7 ++++++- target/ppc/cpu.h | 1 + target/ppc/machine.c | 2 +- target/ppc/translate_init.c | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +6 -1
@@ -3474,7 +3474,12 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", true);* pseries-2.9 */ #define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 + HW_COMPAT_2_9 \ + { \ + .driver = TYPE_POWERPC_CPU, \ + .property = "pre-2.10-migration", \ + .value = "on", \ + }, \static void spapr_machine_2_9_instance_options (MachineState *machine) {
target/ppc/cpu.h +1 -0
@@ -1211,6 +1211,7 @@ struct PowerPCCPU {uint64_t mig_insns_flags;uint64_t mig_insns_flags2;uint32_t mig_nb_BATs; +bool pre_2_10_migration; };static inline PowerPCCPU *ppc_env_get_cpu (CPUPPCState *env)
target/ppc/machine.c +1 -1
@@ -608,7 +608,7 @@ static bool compat_needed(void *opaque)PowerPCCPU *cpu = opaque;assert (!(cpu->compat_pvr && !cpu->vhyp)); -return (cpu->compat_pvr !=0 ); +return !cpu->pre_2_10_migration && cpu->compat_pvr !=0 ; }static const VMStateDescription vmstate_compat = {
target/ppc/translate_init.c +2 -0
@@ -10610,6 +10610,8 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)static Property ppc_cpu_properties[] = {DEFINE_PROP_BOOL ("pre-2.8-migration" , PowerPCCPU, pre_2_8_migration, false), +DEFINE_PROP_BOOL ("pre-2.10-migration" , PowerPCCPU, pre_2_10_migration, + false),DEFINE_PROP_END_OF_LIST (), };
Quoted 10 lines · Greg Kurz
Commit
c783b0012708("ppc: Rework CPU compatibility testing across migration") added a subsection to the vmstate description of CPUs. This subsection is sent when the CPUcompat_pvrfield is non-zero, which is likely to happen after CAS negociation (since QEMU 2.9) or even before CAS negociation if the user explicitely asked for compat mode.This breaks backward migration of existing pseries-2.9 machine types since they don't know about this "compat" subsection:
Quoted 8 lines
qemu-system-ppc64: error while loading state for instance
0x0of
device 'cpu'This patch reverts to the behavior of simply ignoring the PVR when migrating older machines (ie, let the migration succeed if the user is sure that the CPU on the destination is close enough to work).
Signed-off-by Greg Kurz <[email protected]>
but I think it should be merged with patch ("ppc: Rework CPU compatibility testing across migration") that is not merged and in the maintainer tree.
thanks,
Laurent
Quoted 65 lines
--- hw/ppc/spapr.c | 7 ++++++- target/ppc/cpu.h | 1 + target/ppc/machine.c | 2 +- target/ppc/translate_init.c | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-)hw/ppc/spapr.c +6
-1@@ -3474,7 +3474,12 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", true);* pseries-2.9 */ #define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 + HW_COMPAT_2_9 \ + { \ + .driver = TYPE_POWERPC_CPU, \ + .property = "pre-2.10-migration", \ + .value = "on", \ + }, \static void spapr_machine_2_9_instance_options (MachineState *machine) {target/ppc/cpu.h +1
-0@@ -1211,6 +1211,7 @@ struct PowerPCCPU {uint64_t mig_insns_flags;uint64_t mig_insns_flags2;uint32_t mig_nb_BATs; +bool pre_2_10_migration; };static inline PowerPCCPU *ppc_env_get_cpu (CPUPPCState *env)target/ppc/machine.c +1
-1@@ -608,7 +608,7 @@ static bool compat_needed(void *opaque)PowerPCCPU *cpu = opaque;assert (!(cpu->compat_pvr && !cpu->vhyp)); -return (cpu->compat_pvr !=0 ); +return !cpu->pre_2_10_migration && cpu->compat_pvr !=0 ; }static const VMStateDescription vmstate_compat = {target/ppc/translate_init.c +2
-0@@ -10610,6 +10610,8 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)static Property ppc_cpu_properties[] = {DEFINE_PROP_BOOL ("pre-2.8-migration" , PowerPCCPU, pre_2_8_migration, false), +DEFINE_PROP_BOOL ("pre-2.10-migration" , PowerPCCPU, pre_2_10_migration, + false),DEFINE_PROP_END_OF_LIST (), };
Quoted 18 lines · On Tue, 20 Jun 2017 15:08:47 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 17 lines · Greg Kurz
Commit
c783b0012708("ppc: Rework CPU compatibility testing across migration") added a subsection to the vmstate description of CPUs. This subsection is sent when the CPUcompat_pvrfield is non-zero, which is likely to happen after CAS negociation (since QEMU 2.9) or even before CAS negociation if the user explicitely asked for compat mode.This breaks backward migration of existing pseries-2.9 machine types since they don't know about this "compat" subsection:
qemu-system-ppc64: error while loading state for instance
0x0of
device 'cpu'This patch reverts to the behavior of simply ignoring the PVR when migrating older machines (ie, let the migration succeed if the user is sure that the CPU on the destination is close enough to work).
Quoted 8 lines
Quoted 1 line
Signed-off-by Greg Kurz <[email protected]>Reviewed-by Laurent Vivier <[email protected]>but I think it should be merged with patch ("ppc: Rework CPU compatibility testing across migration") that is not merged and in the maintainer tree.
I agree this would be better for bisect.
Cheers,
--
Greg
Quoted 69 lines
thanks,
LaurentQuoted 65 lines
--- hw/ppc/spapr.c | 7 ++++++- target/ppc/cpu.h | 1 + target/ppc/machine.c | 2 +- target/ppc/translate_init.c | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-)hw/ppc/spapr.c +6
-1@@ -3474,7 +3474,12 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", true);* pseries-2.9 */ #define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 + HW_COMPAT_2_9 \ + { \ + .driver = TYPE_POWERPC_CPU, \ + .property = "pre-2.10-migration", \ + .value = "on", \ + }, \static void spapr_machine_2_9_instance_options (MachineState *machine) {target/ppc/cpu.h +1
-0@@ -1211,6 +1211,7 @@ struct PowerPCCPU {uint64_t mig_insns_flags;uint64_t mig_insns_flags2;uint32_t mig_nb_BATs; +bool pre_2_10_migration; };static inline PowerPCCPU *ppc_env_get_cpu (CPUPPCState *env)target/ppc/machine.c +1
-1@@ -608,7 +608,7 @@ static bool compat_needed(void *opaque)PowerPCCPU *cpu = opaque;assert (!(cpu->compat_pvr && !cpu->vhyp)); -return (cpu->compat_pvr !=0 ); +return !cpu->pre_2_10_migration && cpu->compat_pvr !=0 ; }static const VMStateDescription vmstate_compat = {target/ppc/translate_init.c +2
-0@@ -10610,6 +10610,8 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)static Property ppc_cpu_properties[] = {DEFINE_PROP_BOOL ("pre-2.8-migration" , PowerPCCPU, pre_2_8_migration, false), +DEFINE_PROP_BOOL ("pre-2.10-migration" , PowerPCCPU, pre_2_10_migration, + false),DEFINE_PROP_END_OF_LIST (), };
Quoted 23 lines · Greg Kurz
Quoted 20 lines · On Tue, 20 Jun 2017 15:08:47 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 18 lines · Greg Kurz
Commit
c783b0012708("ppc: Rework CPU compatibility testing across migration") added a subsection to the vmstate description of CPUs. This subsection is sent when the CPUcompat_pvrfield is non-zero, which is likely to happen after CAS negociation (since QEMU 2.9) or even before CAS negociation if the user explicitely asked for compat mode.This breaks backward migration of existing pseries-2.9 machine types since they don't know about this "compat" subsection:
qemu-system-ppc64: error while loading state for instance
0x0of
device 'cpu'This patch reverts to the behavior of simply ignoring the PVR when migrating older machines (ie, let the migration succeed if the user is sure that the CPU on the destination is close enough to work).
Signed-off-by Greg Kurz <[email protected]>
Quoted 8 lines
Quoted 6 lines
Reviewed-by Laurent Vivier <[email protected]>but I think it should be merged with patch ("ppc: Rework CPU compatibility testing across migration") that is not merged and in the maintainer tree.
I agree this would be better for bisect.
As suggested, folded into the existing patch.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson