From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVAT8-00026C-Vq for qemu-devel@nongnu.org; Mon, 09 Mar 2015 23:04:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVAT4-0003oa-Ng for qemu-devel@nongnu.org; Mon, 09 Mar 2015 23:04:30 -0400 Received: from ozlabs.org ([103.22.144.67]:35521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVAT4-0003oN-Bo for qemu-devel@nongnu.org; Mon, 09 Mar 2015 23:04:26 -0400 Date: Tue, 10 Mar 2015 13:49:52 +1100 From: David Gibson Message-ID: <20150310024952.GH30335@voom.fritz.box> References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> <1424883128-9841-8-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J/zg8ciPNcraoWb6" Content-Disposition: inline In-Reply-To: <1424883128-9841-8-git-send-email-dgilbert@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 07/45] Return path: Open a return path on QEMUFile for sockets 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, quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com, pbonzini@redhat.com, yanghy@cn.fujitsu.com --J/zg8ciPNcraoWb6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 25, 2015 at 04:51:30PM +0000, Dr. David Alan Gilbert (git) wrot= e: > From: "Dr. David Alan Gilbert" >=20 > Postcopy needs a method to send messages from the destination back to > the source, this is the 'return path'. >=20 > Wire it up for 'socket' QEMUFile's using a dup'd fd. >=20 > Signed-off-by: Dr. David Alan Gilbert > --- > include/migration/qemu-file.h | 7 +++++ > migration/qemu-file-internal.h | 2 ++ > migration/qemu-file-unix.c | 58 +++++++++++++++++++++++++++++++++++-= ------ > migration/qemu-file.c | 12 +++++++++ > 4 files changed, 70 insertions(+), 9 deletions(-) >=20 > diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h > index 6ae0b03..3c38963 100644 > --- a/include/migration/qemu-file.h > +++ b/include/migration/qemu-file.h > @@ -85,6 +85,11 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, void *op= aque, > int *bytes_sent); > =20 > /* > + * Return a QEMUFile for comms in the opposite direction > + */ > +typedef QEMUFile *(QEMURetPathFunc)(void *opaque); > + > +/* > * Stop any read or write (depending on flags) on the underlying > * transport on the QEMUFile. > * Existing blocking reads/writes must be woken > @@ -102,6 +107,7 @@ typedef struct QEMUFileOps { > QEMURamHookFunc *after_ram_iterate; > QEMURamHookFunc *hook_ram_load; > QEMURamSaveFunc *save_page; > + QEMURetPathFunc *get_return_path; > QEMUFileShutdownFunc *shut_down; > } QEMUFileOps; > =20 > @@ -188,6 +194,7 @@ int64_t qemu_file_get_rate_limit(QEMUFile *f); > int qemu_file_get_error(QEMUFile *f); > void qemu_file_set_error(QEMUFile *f, int ret); > int qemu_file_shutdown(QEMUFile *f); > +QEMUFile *qemu_file_get_return_path(QEMUFile *f); > void qemu_fflush(QEMUFile *f); > =20 > static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) > diff --git a/migration/qemu-file-internal.h b/migration/qemu-file-interna= l.h > index d95e853..a39b8e3 100644 > --- a/migration/qemu-file-internal.h > +++ b/migration/qemu-file-internal.h > @@ -48,6 +48,8 @@ struct QEMUFile { > unsigned int iovcnt; > =20 > int last_error; > + > + struct QEMUFile *return_path; AFAICT, the only thing this field is used for is an assert, which seems a bit pointless. I'd suggest either getting rid of it, or make qemu_file_get_return_path() safely idempotent by having it only call the FileOps pointer if QEMUFile::return_path is non-NULL, otherwise just return the existing return_path. Setting the field probably belongs better in the wrapper than in the socket specific callback, too, since there's nothing inherently related to the socket implementation about it. --=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 --J/zg8ciPNcraoWb6 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU/lvQAAoJEGw4ysog2bOSv1IQANDQOztRWsMnh2qckJjQ7grY 1PPuMLr8jxSSeZdYDMeHR+Bc4ahOxnVCbDXzmC6uRVj5RSYcoOJI/H5nVtEElV+g fhgzVGRyhDwCO8HrDpqYkSV15IK5i9D1ANMU0bkI89hyZ4LcV8SYKUc27CwHiR1I hh4xkn3kuv5r/5R+EGg8s0OfdQEwYgKQ5VTEvfnx+MyZhWowmAk5lHDlqz2rLqVA ggPu80RRzs0i76ymwMBqSAxEZn11LINVLnNfCBwseMBnBK5F2+p8ElNnBDAiUnOq mnLCSGXk/x+WG5l9JlhccampkyW++5qFJbnzfx1w9DaWdNj+rbN7h/nw8+sJjIh5 Acbr/fO0BZj7q5TwNUdRoJ5vGmqCSWnlTiVW7aBbZOWfpJOhKGp5R44MGRRj86VB Rz8yunNS+V8NHdkDwrFVNemEjVYQ6atalrz2EiSxprLl4mgMqoG0solB/4k3C9x9 KngjGJrV9w9UwfUQdbcnYHttDh7G3j+k1lRb88U/e9st0KAJo77cjRdGcT42DUDg A4V/boazqXlem7pxNvNaJrd9W/iWXhIZq5MDO3JjF8fjo5BFwKuvI1nmFqN6vXGx AJYUtjw7XSbxJbp26oXQf59/4mSA3iS4+MAPWxW0YbXQ4HdmpDGUe1C+jVF4cKdU mkgS3dtq2kuvNAZzUj70 =XKaG -----END PGP SIGNATURE----- --J/zg8ciPNcraoWb6--