From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZ8Ot-0007Ol-Dh for qemu-devel@nongnu.org; Fri, 09 Dec 2011 16:54:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZ8Or-0003ph-J9 for qemu-devel@nongnu.org; Fri, 09 Dec 2011 16:54:39 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:12024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZ8Or-0003pZ-AO for qemu-devel@nongnu.org; Fri, 09 Dec 2011 16:54:37 -0500 From: Anthony PERARD Date: Fri, 9 Dec 2011 21:54:04 +0000 Message-ID: <1323467645-24271-5-git-send-email-anthony.perard@citrix.com> In-Reply-To: <1323467645-24271-1-git-send-email-anthony.perard@citrix.com> References: <1323467645-24271-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH V2 4/5] xen: Change memory access behavior during migration. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU-devel Cc: Anthony PERARD , Xen Devel , Stefano Stabellini Do not allocate RAM during pre-migration runstate. Do not actually "do" set_memory during migration. Signed-off-by: Anthony PERARD --- xen-all.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/xen-all.c b/xen-all.c index b2e9853..c1fed87 100644 --- a/xen-all.c +++ b/xen-all.c @@ -189,6 +189,11 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size) trace_xen_ram_alloc(ram_addr, size); + if (runstate_check(RUN_STATE_PREMIGRATE)) { + /* RAM already populated in Xen */ + return; + } + nr_pfn = size >> TARGET_PAGE_BITS; pfn_list = g_malloc(sizeof (*pfn_list) * nr_pfn); @@ -269,6 +274,13 @@ go_physmap: DPRINTF("mapping vram to %llx - %llx, from %llx\n", start_addr, start_addr + size, phys_offset); + if (runstate_check(RUN_STATE_INMIGRATE)) { + /* The mapping should already be done and can not be done a second + * time. So we just add to the physmap list instead. + */ + goto done; + } + pfn = phys_offset >> TARGET_PAGE_BITS; start_gpfn = start_addr >> TARGET_PAGE_BITS; for (i = 0; i < size >> TARGET_PAGE_BITS; i++) { @@ -283,6 +295,7 @@ go_physmap: } } +done: physmap = g_malloc(sizeof (XenPhysmap)); physmap->start_addr = start_addr; -- Anthony PERARD