From patchwork Thu Mar 3 10:44:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 8491121 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 61FF89F314 for ; Thu, 3 Mar 2016 10:51:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8928F2014A for ; Thu, 3 Mar 2016 10:51:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1F202010B for ; Thu, 3 Mar 2016 10:51:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757434AbcCCKuv (ORCPT ); Thu, 3 Mar 2016 05:50:51 -0500 Received: from mga09.intel.com ([134.134.136.24]:46996 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757425AbcCCKur (ORCPT ); Thu, 3 Mar 2016 05:50:47 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 03 Mar 2016 02:50:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,532,1449561600"; d="scan'208";a="925912453" Received: from ll.sh.intel.com (HELO localhost) ([10.239.13.27]) by orsmga002.jf.intel.com with ESMTP; 03 Mar 2016 02:50:43 -0800 From: Liang Li To: quintela@redhat.com, amit.shah@redhat.com, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Cc: mst@redhat.com, akpm@linux-foundation.org, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, linux-mm@kvack.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, dgilbert@redhat.com, Liang Li Subject: [RFC qemu 3/4] migration: not set migration bitmap in setup stage Date: Thu, 3 Mar 2016 18:44:27 +0800 Message-Id: <1457001868-15949-4-git-send-email-liang.z.li@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> References: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Set ram_list.dirty_memory instead of migration bitmap, the migration bitmap will be update when doing migration_bitmap_sync(). Set migration_dirty_pages to 0 and it will be updated by migration_dirty_pages() too. The following patch is based on this change. Signed-off-by: Liang Li --- migration/ram.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 704f6a9..ee2547d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1931,19 +1931,19 @@ static int ram_save_setup(QEMUFile *f, void *opaque) ram_bitmap_pages = last_ram_offset() >> TARGET_PAGE_BITS; migration_bitmap_rcu = g_new0(struct BitmapRcu, 1); migration_bitmap_rcu->bmap = bitmap_new(ram_bitmap_pages); - bitmap_set(migration_bitmap_rcu->bmap, 0, ram_bitmap_pages); if (migrate_postcopy_ram()) { migration_bitmap_rcu->unsentmap = bitmap_new(ram_bitmap_pages); bitmap_set(migration_bitmap_rcu->unsentmap, 0, ram_bitmap_pages); } - /* - * Count the total number of pages used by ram blocks not including any - * gaps due to alignment or unplugs. - */ - migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS; + migration_dirty_pages = 0; + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { + cpu_physical_memory_set_dirty_range(block->offset, + block->used_length, + DIRTY_MEMORY_MIGRATION); + } memory_global_dirty_log_start(); migration_bitmap_sync(); qemu_mutex_unlock_ramlist();