On 22/09/2016 12:04, Benjamin Herrenschmidt wrote: > On Thu, 2016-09-22 at 14:34 +0530, Nikunj A Dadhania wrote: >> Something like this works for KVM: >> >> diff --git a/target-ppc/machine.c b/target-ppc/machine.c >> index 4820f22..1cf3779 100644 >> --- a/target-ppc/machine.c >> +++ b/target-ppc/machine.c >> @@ -563,8 +563,8 @@ const VMStateDescription vmstate_ppc_cpu = { >> >> /* Sanity checking */ >> VMSTATE_UINTTL_EQUAL(env.msr_mask, PowerPCCPU), >> - VMSTATE_UINT64_EQUAL(env.insns_flags, PowerPCCPU), >> - VMSTATE_UINT64_EQUAL(env.insns_flags2, PowerPCCPU), >> + VMSTATE_UNUSED(sizeof(target_ulong)), /* was >> _EQUAL(env.insns_flags) */ >> + VMSTATE_UNUSED(sizeof(target_ulong)), /* was >> _EQUAL(env.insns_flags2) */ >> VMSTATE_UINT32_EQUAL(env.nb_BATs, PowerPCCPU), >> VMSTATE_END_OF_LIST() >> }, >> >> TCG migration still remains broken with this. > > Can we have conditionally present flags and a post-load that does some > matching ?
Yes, you can use something like VMSTATE_UINT64(env.src_insns_flags, PowerPCCPU), VMSTATE_UINT64(env.src_insns_flags2, PowerPCCPU), and a post_load that compares them if kvm_enabled() only. *However* a better fix would be to preserve the old flags for pseries-2.6, and only set the newer flags for pseries-2.7. I'm not saying you have to do this, but if it's not hard (no idea) why not learn how to do it right. The design is not stupid, it's just that compatibility is harder than you think and you are going through the same learning experiences that x86 went though. Paolo