From patchwork Thu Jan 8 13:14:50 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: 426627 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 4CBF61400DE for ; Fri, 9 Jan 2015 00:15:53 +1100 (AEDT) Received: from localhost ([::1]:45974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9CwJ-0001Ar-DX for incoming@patchwork.ozlabs.org; Thu, 08 Jan 2015 08:15:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9CvX-0008VO-2X for qemu-devel@nongnu.org; Thu, 08 Jan 2015 08:15:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9CvQ-0004HJ-UV for qemu-devel@nongnu.org; Thu, 08 Jan 2015 08:15:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9CvQ-0004HB-MG for qemu-devel@nongnu.org; Thu, 08 Jan 2015 08:14:56 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t08DEs1C029639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Jan 2015 08:14:54 -0500 Received: from redhat.com (ovpn-116-119.ams2.redhat.com [10.36.116.119]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t08DEpq5003598; Thu, 8 Jan 2015 08:14:52 -0500 Date: Thu, 8 Jan 2015 15:14:50 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1420722790-17178-3-git-send-email-mst@redhat.com> References: <1420722790-17178-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1420722790-17178-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Paolo Bonzini , dgilbert@redhat.com, Juan Quintela Subject: [Qemu-devel] [PULL v2 2/7] 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 Reviewed-by: Paolo Bonzini --- 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);