Received: from eggs.gnu.org ([2001:4830:134:3::10]:45946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTfrb-0007hj-NX for qemu-devel@nongnu.org; Wed, 10 Feb 2016 20:16:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTfrX-0003lV-OW for qemu-devel@nongnu.org; Wed, 10 Feb 2016 20:16:07 -0500 Date: Thu, 11 Feb 2016 10:43:50 +1000 From: David Gibson Message-ID: <20160211004350.GI29288@voom.bne.redhat.com> References: <1455128440-11783-1-git-send-email-duanj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U3s59FfKcByyGl+j" Content-Disposition: inline In-Reply-To: <1455128440-11783-1-git-send-email-duanj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH] migration: ensure htab_save_first completes after timeout List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jianjun Duan Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com --U3s59FfKcByyGl+j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 10, 2016 at 10:20:40AM -0800, Jianjun Duan wrote: > htab_save_first_pass could return without finishing its work due to > timeout. The patch checks if another invocation of it is necessary and > will call it in htab_save_complete if necessary. >=20 > Signed-off-by: Jianjun Duan Looks good, applied to ppc-for-2.6 (with a small fix to remove the overly long line). > --- > hw/ppc/spapr.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 6bfb908..f6b6749 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1317,6 +1317,7 @@ static int htab_save_setup(QEMUFile *f, void *opaqu= e) > static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, > int64_t max_ns) > { > + bool has_timeout =3D max_ns !=3D -1; > int htabslots =3D HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; > int index =3D spapr->htab_save_index; > int64_t starttime =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); > @@ -1350,7 +1351,7 @@ static void htab_save_first_pass(QEMUFile *f, sPAPR= MachineState *spapr, > qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), > HASH_PTE_SIZE_64 * n_valid); > =20 > - if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > m= ax_ns) { > + if (has_timeout && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) -= starttime) > max_ns) { > break; > } > } > @@ -1503,6 +1504,9 @@ static int htab_save_complete(QEMUFile *f, void *op= aque) > close(spapr->htab_fd); > spapr->htab_fd =3D -1; > } else { > + if (spapr->htab_first_pass) { > + htab_save_first_pass(f, spapr, -1); > + } > htab_save_later_pass(f, spapr, -1); > } > =20 --=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 --U3s59FfKcByyGl+j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWu9lGAAoJEGw4ysog2bOSWHQQAJThUt2vCIyyV4291oL5jYNG y4A0/zMtbIW47/gwzpWc4EmwrclAhdCIKxndQ3AFFYL/qF+VcwrDmgAn8XT16lzH TXAIAcrEk23b7DVEM+jBGwO1MirNxaCBRv4kZUEBQbmC+O1x4klDQAn1pwTtu6QP j5TO1ouM5GCQItXzrTuyxvYGcy07Iaa2CFWu/bvvgapLtghfS/GMTJjFZFSFfqRm 0WVz5sRhiMnfzgA3EBWbpXf/aFLrDQmTmCujFcsd6YK4ipXpJEvUjS3MDf29bYR0 EBfOVOb7+YgU7FBiFbjcH8cu3M8qFIxQfoiaFGQqFPdF+2gb3U6HQHaHxqH5egjQ 7Gc+YHKoThxhv/L656jsllMehkjzQGpjMokQ6B7x9dfbcT4n4SUc393h9N+gAAS4 K4q6TCk9/F8nPeinOQO0wBGGN1IWXy/rqalUz5Gto/vF9OQnpD2ex+AdoCVexdX3 l6l5K7D+EBcDs5HqVfuAdboslNsuJqcf2hidsuUkfCl/l8kuov28t2FaYLatl4o/ acwTLhGyWMBdJHLuAigxw2yVpq8DWGYUxFjgqeLC3srYtvKq/eKL3Y+bp6oWCc57 aehvh73pl6eIwGbzwkd2gqlX35IFgdpXxm7+k/6r6U6IZqQJ2Y+jX9lmVlsVbZNw ZCtXOW9YDtyzcMYr2e6n =7TrZ -----END PGP SIGNATURE----- --U3s59FfKcByyGl+j--