From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn7mj-00048Q-LA for qemu-devel@nongnu.org; Thu, 22 Sep 2016 13:27:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn7mf-0008P7-Ey for qemu-devel@nongnu.org; Thu, 22 Sep 2016 13:27:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn7mf-0008O5-6B for qemu-devel@nongnu.org; Thu, 22 Sep 2016 13:27:41 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8MHCuMW003601 for ; Thu, 22 Sep 2016 13:27:40 -0400 Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) by mx0a-001b2d01.pphosted.com with ESMTP id 25ktabhceu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Sep 2016 13:27:39 -0400 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Sep 2016 03:27:37 +1000 From: Nikunj A Dadhania In-Reply-To: <20160922160717.GA24720@work-vm> References: <20160922052105.GD7915@in.ibm.com> <1474524441.2857.159.camel@kernel.crashing.org> <20160922061514.GF7915@in.ibm.com> <1474534046.2857.166.camel@kernel.crashing.org> <87d1jw5mr0.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <1474538671.2857.169.camel@kernel.crashing.org> <8737ks5h1c.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <20160922160717.GA24720@work-vm> Date: Thu, 22 Sep 2016 22:57:29 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: <87zimzonem.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> Subject: Re: [Qemu-devel] pseries-2.6 migration from QEMU-2.6 to QEMU-2.7 broken List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: Benjamin Herrenschmidt , bharata@linux.vnet.ibm.com, aik@ozlabs.ru, clg@kaod.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au "Dr. David Alan Gilbert" writes: > * Nikunj A Dadhania (nikunj@linux.vnet.ibm.com) wrote: >> Benjamin Herrenschmidt writes: >>=20 >> > On Thu, 2016-09-22 at 14:34 +0530, Nikunj A Dadhania wrote: >> >> Something like this works for KVM: >> >>=20 >> >> 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 =3D { >> >> =C2=A0 >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Sanity checking */ >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UINTTL_EQUAL= (env.msr_mask, PowerPCCPU), >> >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UINT64_EQUAL(env.= insns_flags, PowerPCCPU), >> >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UINT64_EQUAL(env.= insns_flags2, PowerPCCPU), >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UNUSED(sizeof(tar= get_ulong)), /* was _EQUAL(env.insns_flags) */ >> >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UNUSED(sizeof(tar= get_ulong)), /* was _EQUAL(env.insns_flags2) */ >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_UINT32_EQUAL= (env.nb_BATs, PowerPCCPU), >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VMSTATE_END_OF_LIST() >> >> =C2=A0=C2=A0=C2=A0=C2=A0 }, >> >>=20 >> >> TCG migration still remains broken with this. >> > >> > Can we have conditionally present flags and a post-load that does some >> > matching ? >>=20 >> I think its possible like this: >>=20 >> diff --git a/target-ppc/machine.c b/target-ppc/machine.c >> index 4820f22..dc4704e 100644 >> --- a/target-ppc/machine.c >> +++ b/target-ppc/machine.c >> @@ -528,6 +528,42 @@ static const VMStateDescription vmstate_tlbmas =3D { >> } >> }; >>=20=20 >> +static bool ppc_kvm_enabled(void *opaque, int version_id) >> +{ >> + printf("%s: is kvm enabled %d\n", __func__, kvm_enabled()); >> + return !kvm_enabled(); >> +} >> + >> +static int get_insns_equal(QEMUFile *f, void *pv, size_t size) >> +{ >> + uint64_t *v =3D pv; >> + uint64_t v2; >> + qemu_get_be64s(f, &v2); >> + >> + printf("%s: \n", __func__); >> + >> + if (*v =3D=3D v2) { >> + return 0; >> + } >> + printf("Did not match, ignore %" PRIu64 " !=3D %" PRIu64 "\n", *v, = v2); >> + return 0; >> +} >> + >> +static void put_insns(QEMUFile *f, void *pv, size_t size) >> +{ >> + uint64_t *v =3D pv; >> + qemu_put_be64s(f, v); >> +} >> + >> +const VMStateInfo vmstate_info_insns_equal =3D { >> + .name =3D "insns equal", >> + .get =3D get_insns_equal, >> + .put =3D put_insns, >> +}; >> + > > I'd prefer it if you can avoid adding qemu_get/put's unless > really desperate; I'm trying to squash all the read/writing back into > standard macros; but I understand it can be tricky. Right, the above code is just experimental :-) > > I'd agree that a post_load is the nicest way; it can return > an error value. > (Oh and ideally use error_report) Sure Regards Nikunj