From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC5ys-00070T-5A for qemu-devel@nongnu.org; Wed, 21 Aug 2013 06:49:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VC5ym-00071r-4y for qemu-devel@nongnu.org; Wed, 21 Aug 2013 06:49:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC5yl-00071m-SI for qemu-devel@nongnu.org; Wed, 21 Aug 2013 06:49:32 -0400 Message-ID: <52149B09.705@redhat.com> Date: Wed, 21 Aug 2013 12:48:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1377069536-12658-1-git-send-email-lilei@linux.vnet.ibm.com> <1377069536-12658-14-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1377069536-12658-14-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 13/18] arch_init: adjust ram_save_setup() for migrate_is_localhost List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aarcange@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com Il 21/08/2013 09:18, Lei Li ha scritto: > Send all the ram blocks hooked by save_page, which will copy > ram page and MADV_DONTNEED the page just copied. You should implement this entirely in the hook. It will be a little less efficient because of the dirty bitmap overhead, but you should aim at having *zero* changes in arch_init.c and migration.c. Paolo > > Signed-off-by: Lei Li > --- > arch_init.c | 19 +++++++++++++------ > 1 files changed, 13 insertions(+), 6 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index 434a4ca..cbbb4db 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -474,7 +474,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage) > /* In doubt sent page as normal */ > bytes_sent = -1; > ret = ram_control_save_page(f, block->offset, > - offset, TARGET_PAGE_SIZE, &bytes_sent); > + offset, TARGET_PAGE_SIZE, &bytes_sent); > > if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { > if (ret != RAM_SAVE_CONTROL_DELAYED) { > @@ -613,11 +613,13 @@ static int ram_save_setup(QEMUFile *f, void *opaque) > RAMBlock *block; > int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS; > > - migration_bitmap = bitmap_new(ram_pages); > - bitmap_set(migration_bitmap, 0, ram_pages); > - migration_dirty_pages = ram_pages; > - mig_throttle_on = false; > - dirty_rate_high_cnt = 0; > + if (!migrate_is_localhost()) { > + migration_bitmap = bitmap_new(ram_pages); > + bitmap_set(migration_bitmap, 0, ram_pages); > + migration_dirty_pages = ram_pages; > + mig_throttle_on = false; > + dirty_rate_high_cnt = 0; > + } > > if (migrate_use_xbzrle()) { > XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() / > @@ -641,6 +643,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque) > migration_bitmap_sync(); > qemu_mutex_unlock_iothread(); > > + if (migrate_is_localhost()) { > + ram_save_blocks(f); > + return 0; > + } > + > qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE); > > QTAILQ_FOREACH(block, &ram_list.blocks, next) { >