From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEytw-00070J-5O for qemu-devel@nongnu.org; Fri, 21 Sep 2012 04:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEytq-0004Zc-Cf for qemu-devel@nongnu.org; Fri, 21 Sep 2012 04:47:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEytq-0004ZY-3f for qemu-devel@nongnu.org; Fri, 21 Sep 2012 04:47:50 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8L8lnc2019050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Sep 2012 04:47:49 -0400 From: Juan Quintela Date: Fri, 21 Sep 2012 10:47:03 +0200 Message-Id: <1348217255-22441-10-git-send-email-quintela@redhat.com> In-Reply-To: <1348217255-22441-1-git-send-email-quintela@redhat.com> References: <1348217255-22441-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 09/41] ram: introduce migration_bitmap_set_dirty() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org It just marks a region of memory as dirty. Signed-off-by: Juan Quintela --- arch_init.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arch_init.c b/arch_init.c index 57f7f1a..b2dcc24 100644 --- a/arch_init.c +++ b/arch_init.c @@ -332,6 +332,18 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, static RAMBlock *last_block; static ram_addr_t last_offset; +static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length) +{ + ram_addr_t addr; + + for (addr = 0; addr < length; addr += TARGET_PAGE_SIZE) { + if (!memory_region_get_dirty(mr, addr, TARGET_PAGE_SIZE, + DIRTY_MEMORY_MIGRATION)) { + memory_region_set_dirty(mr, addr, TARGET_PAGE_SIZE); + } + } +} + /* * ram_save_block: Writes a page of memory to the stream f * @@ -494,7 +506,6 @@ static void reset_ram_globals(void) static int ram_save_setup(QEMUFile *f, void *opaque) { - ram_addr_t addr; RAMBlock *block; memory_global_sync_dirty_bitmap(get_system_memory()); @@ -516,12 +527,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) /* Make sure all dirty bits are set */ QLIST_FOREACH(block, &ram_list.blocks, next) { - for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) { - if (!memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE, - DIRTY_MEMORY_MIGRATION)) { - memory_region_set_dirty(block->mr, addr, TARGET_PAGE_SIZE); - } - } + migration_bitmap_set_dirty(block->mr, block->length); } memory_global_dirty_log_start(); -- 1.7.11.4