From patchwork Wed Jan 7 19:48:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 426392 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 67D6914007F for ; Thu, 8 Jan 2015 06:49:43 +1100 (AEDT) Received: from localhost ([::1]:42545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8wbt-0005ti-Km for incoming@patchwork.ozlabs.org; Wed, 07 Jan 2015 14:49:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8wbF-0004b7-0f for qemu-devel@nongnu.org; Wed, 07 Jan 2015 14:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y8wbD-0008NM-VR for qemu-devel@nongnu.org; Wed, 07 Jan 2015 14:49:00 -0500 Received: from mail.kernel.org ([198.145.29.136]:52632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8wbD-0008N9-Qg for qemu-devel@nongnu.org; Wed, 07 Jan 2015 14:48:59 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A107220375; Wed, 7 Jan 2015 19:48:58 +0000 (UTC) Received: from redhat.com (bzq-79-182-177-46.red.bezeqint.net [79.182.177.46]) (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6903B20374; Wed, 7 Jan 2015 19:48:56 +0000 (UTC) Date: Wed, 7 Jan 2015 21:48:53 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1420660083-9961-3-git-send-email-mst@redhat.com> References: <1420660083-9961-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1420660083-9961-1-git-send-email-mst@redhat.com> X-Mailer: git-send-email 2.0.0.545.gd9cabeb X-Mutt-Fcc: =sent X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 198.145.29.136 Cc: Amit Shah , pbonzini@redhat.com, imammedo@redhat.com, dgilbert@redhat.com, Juan Quintela Subject: [Qemu-devel] [PATCH v3 2/8] exec: cpu_physical_memory_set/clear_dirty_range X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make cpu_physical_memory_set/clear_dirty_range behave symmetrically. To clear range for a given client type only, add cpu_physical_memory_clear_dirty_range_type. Signed-off-by: Michael S. Tsirkin --- include/exec/ram_addr.h | 15 ++++++++++++--- exec.c | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 8fc75cd..254931c 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -172,9 +172,9 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap, } #endif /* not _WIN32 */ -static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, - ram_addr_t length, - unsigned client) +static inline void cpu_physical_memory_clear_dirty_range_type(ram_addr_t start, + ram_addr_t length, + unsigned client) { unsigned long end, page; @@ -184,6 +184,15 @@ static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, bitmap_clear(ram_list.dirty_memory[client], page, end - page); } +static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, + ram_addr_t length) +{ + cpu_physical_memory_clear_dirty_range_type(start, length, DIRTY_MEMORY_MIGRATION); + cpu_physical_memory_clear_dirty_range_type(start, length, DIRTY_MEMORY_VGA); + cpu_physical_memory_clear_dirty_range_type(start, length, DIRTY_MEMORY_CODE); +} + + void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t length, unsigned client); diff --git a/exec.c b/exec.c index 963481a..a89aa6c 100644 --- a/exec.c +++ b/exec.c @@ -850,7 +850,7 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t length, { if (length == 0) return; - cpu_physical_memory_clear_dirty_range(start, length, client); + cpu_physical_memory_clear_dirty_range_type(start, length, client); if (tcg_enabled()) { tlb_reset_dirty_range_all(start, length);