From patchwork Sat May 4 05:42:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10929541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87F811398 for ; Sat, 4 May 2019 05:44:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7154628753 for ; Sat, 4 May 2019 05:44:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 617842880A; Sat, 4 May 2019 05:44:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F71C28753 for ; Sat, 4 May 2019 05:44:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:51504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnT6-000590-52 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 04 May 2019 01:44:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMnSQ-0004s8-AG for qemu-devel@nongnu.org; Sat, 04 May 2019 01:43:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMnSP-0007u2-BN for qemu-devel@nongnu.org; Sat, 04 May 2019 01:43:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:56092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hMnSP-0007rR-2A for qemu-devel@nongnu.org; Sat, 04 May 2019 01:43:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 22:43:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,428,1549958400"; d="scan'208";a="296895795" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga004.jf.intel.com with ESMTP; 03 May 2019 22:43:24 -0700 From: Wei Yang To: qemu-devel@nongnu.org Date: Sat, 4 May 2019 13:42:55 +0800 Message-Id: <20190504054255.8610-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [PATCH] migration: don't set MIGRATION dirty range for ignored block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quintela@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, Wei Yang , pbonzini@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ignored blocks are not migrated and those ranges are not used. Signed-off-by: Wei Yang --- exec.c | 4 +++- include/exec/ram_addr.h | 2 ++ migration/ram.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 86a38d3b3b..97da155c12 100644 --- a/exec.c +++ b/exec.c @@ -2192,6 +2192,8 @@ static void ram_block_add(RAMBlock *new_block, Error **errp, bool shared) RAMBlock *last_block = NULL; ram_addr_t old_ram_size, new_ram_size; Error *err = NULL; + uint8_t dirty_memory_clients = ramblock_is_ignored(new_block) ? + DIRTY_CLIENTS_NOMIG : DIRTY_CLIENTS_ALL; old_ram_size = last_ram_page(); @@ -2252,7 +2254,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp, bool shared) cpu_physical_memory_set_dirty_range(new_block->offset, new_block->used_length, - DIRTY_CLIENTS_ALL); + dirty_memory_clients); if (new_block->host) { qemu_ram_setup_dump(new_block->host, new_block->max_length); diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index a7c81bdb32..4765435fb8 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -72,6 +72,7 @@ static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, } bool ramblock_is_pmem(RAMBlock *rb); +bool ramblock_is_ignored(RAMBlock *rb); long qemu_getrampagesize(void); @@ -117,6 +118,7 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); #define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) #define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE)) +#define DIRTY_CLIENTS_NOMIG (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_MIGRATION)) void tb_invalidate_phys_range(ram_addr_t start, ram_addr_t end); diff --git a/migration/ram.c b/migration/ram.c index 1def8122e9..44525e3816 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -159,7 +159,7 @@ out: return ret; } -static bool ramblock_is_ignored(RAMBlock *block) +bool ramblock_is_ignored(RAMBlock *block) { return !qemu_ram_is_migratable(block) || (migrate_ignore_shared() && qemu_ram_is_shared(block));