From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJEFb-0008Dd-IT for qemu-devel@nongnu.org; Mon, 18 Aug 2014 00:09:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJEFR-0003Yk-MC for qemu-devel@nongnu.org; Mon, 18 Aug 2014 00:08:55 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:34753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJEFQ-0003YO-NE for qemu-devel@nongnu.org; Mon, 18 Aug 2014 00:08:45 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Aug 2014 14:08:41 +1000 From: Samuel Mendoza-Jonas Date: Mon, 18 Aug 2014 14:08:36 +1000 Message-Id: <1408334916-14292-1-git-send-email-sam.mj@au1.ibm.com> Subject: [Qemu-devel] [PATCH V2] spapr: Fix stale HTAB during live migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: aik@ozlabs.ru, Samuel Mendoza-Jonas If a guest reboots during a running migration, changes to the hash page table are not necessarily updated on the destination. Opening a new file descriptor to the HTAB forces the migration handler to resend the entire table. Signed-off-by: Samuel Mendoza-Jonas --- Changes in v2: Forgot check on kvmppc_get_htab_fd return value hw/ppc/spapr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3a6d26d..94670db 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -997,6 +997,16 @@ static void spapr_reset_htab(sPAPREnvironment *spapr) /* Kernel handles htab, we don't need to allocate one */ spapr->htab_shift = shift; kvmppc_kern_htab = true; + + /* Make sure readers are aware of the reset */ + if (spapr->htab_fd > 0) { + close(spapr->htab_fd); + spapr->htab_fd = kvmppc_get_htab_fd(false); + if (spapr->htab_fd < 0) { + fprintf(stderr, "Unable to open fd for reading hash table from KVM: %s\n", + strerror(errno)); + } + } } else { if (!spapr->htab) { /* Allocate an htab if we don't yet have one */ -- 1.9.3