From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTgO-0003fv-2V for qemu-devel@nongnu.org; Mon, 03 Nov 2014 21:17:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlTgM-0008Aq-QZ for qemu-devel@nongnu.org; Mon, 03 Nov 2014 21:17:20 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:43649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTgL-0008AS-Vw for qemu-devel@nongnu.org; Mon, 03 Nov 2014 21:17:18 -0500 Date: Tue, 4 Nov 2014 13:18:24 +1100 From: David Gibson Message-ID: <20141104021824.GI27321@voom.fritz.box> References: <1412358473-31398-1-git-send-email-dgilbert@redhat.com> <1412358473-31398-29-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4LwthZj+AV2mq5CX" Content-Disposition: inline In-Reply-To: <1412358473-31398-29-git-send-email-dgilbert@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 28/47] qemu_savevm_state_complete: Postcopy changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, lilei@linux.vnet.ibm.com, quintela@redhat.com, cristian.klein@cs.umu.se, qemu-devel@nongnu.org, amit.shah@redhat.com, yanghy@cn.fujitsu.com --4LwthZj+AV2mq5CX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 03, 2014 at 06:47:34PM +0100, Dr. David Alan Gilbert (git) wrot= e: > From: "Dr. David Alan Gilbert" >=20 > When postcopy calls qemu_savevm_state_complete it's not really > the end of migration, so skip: > a) Finishing postcopiable iterative devices - they'll carry on > b) The termination byte on the end of the stream. >=20 > We then also add: > qemu_savevm_state_postcopy_complete > which is called at the end of a postcopy migration to call the > complete methods on devices skipped in the _complete call. So, we should probably rename qemu_savevm_state_complete() to reflect the fact that it's no longer actually a completion, but just the transition from pre-copy to post-copy phases. A good, brief name doesn't immediately occur to me, unfortunately. > Signed-off-by: Dr. David Alan Gilbert > --- > include/sysemu/sysemu.h | 1 + > savevm.c | 52 +++++++++++++++++++++++++++++++++++++++++++= +++++- > 2 files changed, 52 insertions(+), 1 deletion(-) >=20 > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index e7ff3d0..46665ce 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -113,6 +113,7 @@ void qemu_savevm_state_cancel(void); > void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size, > uint64_t *res_non_postcopiable, > uint64_t *res_postcopiable); > +void qemu_savevm_state_postcopy_complete(QEMUFile *f); > void qemu_savevm_command_send(QEMUFile *f, enum qemu_vm_cmd command, > uint16_t len, uint8_t *data); > void qemu_savevm_send_reqack(QEMUFile *f, uint32_t value); > diff --git a/savevm.c b/savevm.c > index a0cb88b..7c4541d 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -854,10 +854,51 @@ int qemu_savevm_state_iterate(QEMUFile *f) > return ret; > } > =20 > +/* > + * Calls the complete routines just for those devices that are postcopia= ble; > + * causing the last few pages to be sent immediately and doing any assoc= iated > + * cleanup. > + * Note postcopy also calls the plain qemu_savevm_state_complete to comp= lete > + * all the other devices, but that happens at the point we switch to pos= tcopy. > + */ > +void qemu_savevm_state_postcopy_complete(QEMUFile *f) > +{ > + SaveStateEntry *se; > + int ret; > + > + QTAILQ_FOREACH(se, &savevm_handlers, entry) { > + if (!se->ops || !se->ops->save_live_complete || > + !se->ops->can_postcopy) { So, you check for the presence of a can_postcopy callback, but you don't ever actually invoke it. > + continue; > + } > + if (se->ops && se->ops->is_active) { > + if (!se->ops->is_active(se->opaque)) { > + continue; > + } > + } > + trace_savevm_section_start(se->idstr, se->section_id); > + /* Section type */ > + qemu_put_byte(f, QEMU_VM_SECTION_END); > + qemu_put_be32(f, se->section_id); > + > + ret =3D se->ops->save_live_complete(f, se->opaque); I'm wondering if it might be clearer not to overload the save_live_complete hook, but instead allow both "execution transition" (old complete) and "final complete" (postcopy complete) hooks (expecting only one to be non-NULL in most cases). --=20 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 --4LwthZj+AV2mq5CX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUWDdwAAoJEGw4ysog2bOSjY0QALwSHSOG8WgCJesAZGnA5EgC MfPFynRLbP7PKLTzH3OWTK8MyVRnePR7qamvHGEhtGbK4kDslMgX45pdrtwMOJur Dt1aoFrA+eYkBSx5pyxrSpLmfy2Cy4PKNeBAGBTybk0o2fugoDfJdrjIEKVcqmqf RJ5e2QA7x7c0s3vWLFqiJHcECqMvZK2t8EhDV04K38Ft1bGrhq/eaQpyvUBnIilQ VMd5DklCE6i3fZwME2dA4xDvfawKJVhSFEonkXAbD0u0KCv2uOyaSStGjmlSB0xS 5X+1IJfr9rExWEXM5Q/dOk3HbNhqEkI0S7Y9eJBdNW9eOXNTh2uLUq0hEAyNi3ZE Yuj9iorKknK23vQsGgvWl3tZpHJhrKHLVv3dm1i3UGf1sf5If69WgM1s692nEYO2 KoHjy++fYoVx3F3sp+GaZrt8Fly1vFSWfB/gpygd6+BsxD8ItTVijh9zR9TB8lvh Ka5IOeeQhgvz7lbymVhINcCQiPP/QdY9dqV95nzRuqyAhWIEvSdWWotglEtg7Zqc 62ZNXh1gj+VeUxk0Y8p14YkQju3EOeZs+27+WiIg0exTW6lP5riQ6dgjWsXu6hdH qD2eMxpOimMK5znlb1j5b2UEK8oz0+gVjrSvtUI9NsuIg9MmXdDb5JuxFGbrj7om z4FeSsq0m2HgRy7LRVzi =BtFG -----END PGP SIGNATURE----- --4LwthZj+AV2mq5CX--