From: Anthony PERARD Subject: [PATCH 4/5] xen: Change memory access behavior during migration. Date: Thu, 24 Nov 2011 16:08:12 +0000 Message-ID: <1322150893-887-5-git-send-email-anthony.perard@citrix.com> References: <1322150893-887-1-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1322150893-887-1-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: QEMU-devel Cc: Anthony PERARD , Xen Devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org 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 40e8869..279651a 100644 --- a/xen-all.c +++ b/xen-all.c @@ -191,6 +191,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); @@ -271,6 +276,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++) { @@ -285,6 +297,7 @@ go_physmap: } } +done: physmap = g_malloc(sizeof (XenPhysmap)); physmap->start_addr = start_addr; -- Anthony PERARD