From nobody Mon Feb 9 02:28:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521121290588250.89333326755457; Thu, 15 Mar 2018 06:41:30 -0700 (PDT) Received: from localhost ([::1]:51660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewT8L-0000TW-QO for importer@patchew.org; Thu, 15 Mar 2018 09:41:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewT37-0004Mb-IJ for qemu-devel@nongnu.org; Thu, 15 Mar 2018 09:36:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ewT33-0003VQ-LM for qemu-devel@nongnu.org; Thu, 15 Mar 2018 09:36:05 -0400 Received: from [112.64.68.174] (port=39095 helo=robinhe-hp.sh.intel.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ewT33-0003Qs-3o for qemu-devel@nongnu.org; Thu, 15 Mar 2018 09:36:01 -0400 Received: from robinhe-hp.sh.intel.com (localhost [127.0.0.1]) by robinhe-hp (8.15.2/8.15.2/Debian-3) with ESMTP id w2D8Xwr7018956; Tue, 13 Mar 2018 16:33:58 +0800 Received: (from robinhe@localhost) by robinhe-hp.sh.intel.com (8.15.2/8.15.2/Submit) id w2D8Xwkq018955; Tue, 13 Mar 2018 16:33:58 +0800 From: junyan.he@intel.com To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 16:33:48 +0800 Message-Id: <1520930033-18885-6-git-send-email-junyan.he@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520930033-18885-1-git-send-email-junyan.he@intel.com> References: <1520930033-18885-1-git-send-email-junyan.he@intel.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 112.64.68.174 Subject: [Qemu-devel] [PATCH 05/10] RFC: Add memory region snapshot bitmap get function. 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: kwolf@redhat.com, famz@redhat.com, crosthwaite.peter@gmail.com, quintela@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, Junyan He , pbonzini@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Junyan He We need to get the bitmap content of the snapshot when enable dirty log trace for nvdimm. Signed-off-by: Junyan He --- exec.c | 7 +++++++ include/exec/memory.h | 9 +++++++++ include/exec/ram_addr.h | 2 ++ memory.c | 7 +++++++ 4 files changed, 25 insertions(+) diff --git a/exec.c b/exec.c index a9181e6..3d2bf0d 100644 --- a/exec.c +++ b/exec.c @@ -1235,6 +1235,13 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBit= mapSnapshot *snap, return false; } =20 +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ + assert(snap); + return snap->dirty; +} + /* Called from RCU critical section */ hwaddr memory_region_section_get_iotlb(CPUState *cpu, MemoryRegionSection *section, diff --git a/include/exec/memory.h b/include/exec/memory.h index 31eae0a..f742995 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1179,6 +1179,15 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *= mr, hwaddr addr, hwaddr size); =20 /** + * memory_region_snapshot_get_dirty_bitmap: Get the dirty bitmap data of + * snapshot. + * + * @snap: the dirty bitmap snapshot + */ +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap); + +/** * memory_region_reset_dirty: Mark a range of pages as clean, for a specif= ied * client. * diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index cf2446a..ce366c1 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -371,6 +371,8 @@ DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_c= lear_dirty bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, ram_addr_t start, ram_addr_t length); +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap); =20 static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, ram_addr_t length) diff --git a/memory.c b/memory.c index 4a8a2fe..68f17f0 100644 --- a/memory.c +++ b/memory.c @@ -1991,6 +1991,13 @@ DirtyBitmapSnapshot *memory_region_snapshot_and_clea= r_dirty(MemoryRegion *mr, memory_region_get_ram_addr(mr) + addr, size, client); } =20 +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ + assert(snap); + return cpu_physical_memory_snapshot_get_dirty_bitmap(snap); +} + bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapsho= t *snap, hwaddr addr, hwaddr size) { --=20 2.7.4