From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrFpy-00080f-Cs for qemu-devel@nongnu.org; Wed, 19 Nov 2014 19:43:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrFpu-00013b-4r for qemu-devel@nongnu.org; Wed, 19 Nov 2014 19:43:06 -0500 Received: from ozlabs.org ([103.22.144.67]:56966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrFpt-00013P-Pn for qemu-devel@nongnu.org; Wed, 19 Nov 2014 19:43:02 -0500 Date: Thu, 20 Nov 2014 08:48:37 +1100 From: David Gibson Message-ID: <20141119214837.GL2867@voom.redhat.com> References: <1412358473-31398-1-git-send-email-dgilbert@redhat.com> <1412358473-31398-36-git-send-email-dgilbert@redhat.com> <20141110061924.GC31324@voom.redhat.com> <20141119200130.GU2355@work-vm> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2OzUYMsT4j3Kc+NU" Content-Disposition: inline In-Reply-To: <20141119200130.GU2355@work-vm> Subject: Re: [Qemu-devel] [PATCH v4 35/47] Page request: Add MIG_RPCOMM_REQPAGES reverse command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, cristian.klein@cs.umu.se, qemu-devel@nongnu.org, amit.shah@redhat.com, yanghy@cn.fujitsu.com --2OzUYMsT4j3Kc+NU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 19, 2014 at 08:01:31PM +0000, Dr. David Alan Gilbert wrote: > * David Gibson (david@gibson.dropbear.id.au) wrote: > > On Fri, Oct 03, 2014 at 06:47:41PM +0100, Dr. David Alan Gilbert (git) = wrote: > > > From: "Dr. David Alan Gilbert" > > >=20 > > > Add MIG_RPCOMM_REQPAGES command on Return path for the postcopy > > > destination to request a page from the source. >=20 > > > + buf64[0] =3D (uint64_t)start; > > > + buf64[0] =3D cpu_to_be64(buf64[0]); > >=20 > > I think this would be clearer as well as less verbose, as just: > > buf64[0] =3D cpu_to_be64(start); >=20 > I've gone with the halfway mark of: >=20 > buf64[0] =3D cpu_to_be64((uint64_t)start); >=20 > it jsut doesn't feel right passing something into a byteswap > unless you know the size. I've always thought of (this group of) byteswap functions as specifying the output size. It's a value parameter so integer promotion to the required type is pretty safe. > > > + buf64[1] =3D (uint64_t)len; > > > + buf64[1] =3D cpu_to_be64(buf64[1]); > > > + migrate_send_rp_message(mis, MIG_RPCOMM_REQPAGES, msglen, bufc); > > > +} > > > + > > > void qemu_start_incoming_migration(const char *uri, Error **errp) > > > { > > > const char *p; > > > @@ -784,6 +816,17 @@ static void source_return_path_bad(MigrationStat= e *s) > > > } > > > =20 > > > /* > > > + * Process a request for pages received on the return path, > > > + * We're allowed to send more than requested (e.g. to round to our p= age size) > > > + * and we don't need to send pages that have already been sent. > > > + */ > > > +static void migrate_handle_rp_reqpages(MigrationState *ms, const cha= r* rbname, > > > + ram_addr_t start, ram_addr_t = len) > > > +{ > > > + DPRINTF("migrate_handle_rp_reqpages: at %zx for len %zx", start,= len); > > > +} > > > + > > > +/* > > > * Handles messages sent on the return path towards the source VM > > > * > > > */ > > > @@ -795,6 +838,8 @@ static void *source_return_path_thread(void *opaq= ue) > > > const int max_len =3D 512; > > > uint8_t buf[max_len]; > > > uint32_t tmp32; > > > + uint64_t tmp64a, tmp64b; > >=20 > > Hrm.. calling everything "tmp*" doesn't help readability. >=20 > True; most of the rest of those tmps are used by multiple commands and > just read off the wire and immediately used. > They're now start/len for tmp64a/b. Ok, great. I find it's usually best to declare appropriate variables for each case (or even use local blocks), rather than share. The compiler's smart enough to coalesce them, so there's no real cost. --=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 --2OzUYMsT4j3Kc+NU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUbRA0AAoJEGw4ysog2bOS25cP/iiuuSRAKCVUjHIt/xD6mGrA DIfaB2ykD6Z5z4wQIgWZPJ7IPZyZnLKz80iO/8c69gxJEQDvSuLCI8JG0RZvs7KJ fBmpy8RJg6d1v4NBHsMkDDPYFLWjit9GHeuE6ezieepVYLueLuS2kFih1YomYEUi CZVvd/lgvzE3S/Pxp5dCtaSq1CVzMocc1+TdFLYhMiGz0Odp2kaYsGheH6ZeBi/9 ZCXz5qX7N2WI7PElYJsahnSye8w3F2pfRbG3Jn4m3JkOE0frQYaMItZmzszkGvjs HnW3WI5eUigwDt3k21vm7Ski5INrey+/fmOr1zj/FpVqBf0ekzhyB95RHaYd43V5 sNO1j1HzOj5w/oZUJEGhMz+wLFT+bG8ypcsS9GEdpOL7BPJ51uUCP0uk9VWmhVZK aTca13VOgNnJgn4BbnPXqx/Xlpq11fy6heXLpBiBM/HlVkbhg53Rosxuf3tbLTcD 6O29DZlrZ8ybt8qxhah2BmyYAl3WeEKKCJ6TXmZX3+UICU0uw4tvYhQhMnngNQmY 6X1YFVnrJNfNk1uGDp9EFBxJwM7DjrRmyq4EB/2Klf0v1bmWJAdOJT/6m0XPCVP+ oXVaJnddUkTh6wBPviulVsH9tJAQZyM3+SL/JZsvEOsAP1oIAHebAyUP6f7G5lcR 83TJQJrNmQ5/fd9Ki7E0 =2nL1 -----END PGP SIGNATURE----- --2OzUYMsT4j3Kc+NU--