From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGQfF-000393-Vz for qemu-devel@nongnu.org; Tue, 25 Sep 2012 04:38:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGQfA-0005nn-05 for qemu-devel@nongnu.org; Tue, 25 Sep 2012 04:38:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGQf9-0005nj-N5 for qemu-devel@nongnu.org; Tue, 25 Sep 2012 04:38:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8P8cdEt013851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Sep 2012 04:38:39 -0400 Message-ID: <50616D8B.6090303@redhat.com> Date: Tue, 25 Sep 2012 10:38:35 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1348217255-22441-1-git-send-email-quintela@redhat.com> <1348217255-22441-10-git-send-email-quintela@redhat.com> In-Reply-To: <1348217255-22441-10-git-send-email-quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/41] ram: introduce migration_bitmap_set_dirty() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On 09/21/2012 11:47 AM, Juan Quintela wrote: > 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(); > Reviewed-by: Orit Wasserman