From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTc47-000617-Nv for qemu-devel@nongnu.org; Wed, 10 Feb 2016 16:12:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTc45-0003Cz-Gk for qemu-devel@nongnu.org; Wed, 10 Feb 2016 16:12:47 -0500 Received: from e18.ny.us.ibm.com ([129.33.205.208]:51952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTc45-0003Ci-C2 for qemu-devel@nongnu.org; Wed, 10 Feb 2016 16:12:45 -0500 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Feb 2016 16:12:43 -0500 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1455128440-11783-1-git-send-email-duanj@linux.vnet.ibm.com> References: <1455128440-11783-1-git-send-email-duanj@linux.vnet.ibm.com> Message-ID: <20160210211232.23476.936@loki> Date: Wed, 10 Feb 2016 15:12:32 -0600 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 , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Quoting Jianjun Duan (2016-02-10 12:20:40) > 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. > = > Signed-off-by: Jianjun Duan Reviewed-by: Michael Roth > --- > hw/ppc/spapr.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > = > 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); > = > - 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); > } > = > -- = > 1.9.1 >=20