From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD2MH-0006G9-R1 for qemu-devel@nongnu.org; Wed, 08 Jul 2015 23:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZD2MC-0007fV-VY for qemu-devel@nongnu.org; Wed, 08 Jul 2015 23:18:45 -0400 Received: from [119.145.14.66] (port=48948 helo=szxga03-in.huawei.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD2MC-0007eq-D7 for qemu-devel@nongnu.org; Wed, 08 Jul 2015 23:18:40 -0400 From: zhanghailiang Date: Thu, 9 Jul 2015 11:16:21 +0800 Message-ID: <1436411802-181876-14-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1436411802-181876-1-git-send-email-zhang.zhanghailiang@huawei.com> References: <1436411802-181876-1-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH COLO-Frame v7 13/34] arch_init: Start to trace dirty pages of SVM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: lizhijian@cn.fujitsu.com, quintela@redhat.com, yunhong.jiang@intel.com, eddie.dong@intel.com, peter.huangpeng@huawei.com, dgilbert@redhat.com, arei.gonglei@huawei.com, amit.shah@redhat.com, zhanghailiang we will use this dirty bitmap together with VM's cache RAM dirty bitmap to decide which page in cache should be flushed into VM's RAM. Signed-off-by: zhanghailiang --- migration/ram.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index deb1100..7a1a1b6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1663,6 +1663,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) int create_and_init_ram_cache(void) { RAMBlock *block; + int64_t ram_cache_pages = last_ram_offset() >> TARGET_PAGE_BITS; rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { @@ -1674,6 +1675,15 @@ int create_and_init_ram_cache(void) } rcu_read_unlock(); ram_cache_enable = true; + /* + * Start dirty log for Secondary VM, we use this dirty bitmap together with + * VM's cache RAM dirty bitmap to decide which page in cache should be + * flushed into VM's RAM. + */ + migration_bitmap = bitmap_new(ram_cache_pages); + migration_dirty_pages = 0; + memory_global_dirty_log_start(); + return 0; out_locked: @@ -1694,6 +1704,12 @@ void release_ram_cache(void) ram_cache_enable = false; + if (migration_bitmap) { + memory_global_dirty_log_stop(); + g_free(migration_bitmap); + migration_bitmap = NULL; + } + rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { if (block->host_cache) { -- 1.7.12.4