From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTZO9-0000Kj-5o for qemu-devel@nongnu.org; Wed, 10 Feb 2016 13:21:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTZO4-0008BW-Fe for qemu-devel@nongnu.org; Wed, 10 Feb 2016 13:21:17 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:51430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTZO4-0008BE-7y for qemu-devel@nongnu.org; Wed, 10 Feb 2016 13:21:12 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Feb 2016 11:21:10 -0700 From: Jianjun Duan Date: Wed, 10 Feb 2016 10:20:40 -0800 Message-Id: <1455128440-11783-1-git-send-email-duanj@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] migration: ensure htab_save_first completes after timeout List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jianjun Duan , qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, david@gibson.dropbear.id.au 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 --- 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 *opaque) static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { + bool has_timeout = max_ns != -1; int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); @@ -1350,7 +1351,7 @@ static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); - if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_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 *opaque) close(spapr->htab_fd); spapr->htab_fd = -1; } else { + if (spapr->htab_first_pass) { + htab_save_first_pass(f, spapr, -1); + } htab_save_later_pass(f, spapr, -1); } -- 1.9.1