From nobody Mon Feb 9 03:48:19 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.zoho.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 1490303519785166.0449862953135; Thu, 23 Mar 2017 14:11:59 -0700 (PDT) Received: from localhost ([::1]:58666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crA1W-0005MB-EP for importer@patchew.org; Thu, 23 Mar 2017 17:11:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cr9dC-0008Nj-QF for qemu-devel@nongnu.org; Thu, 23 Mar 2017 16:46:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cr9dB-0000g7-P4 for qemu-devel@nongnu.org; Thu, 23 Mar 2017 16:46:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39988) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cr9dB-0000fp-J6 for qemu-devel@nongnu.org; Thu, 23 Mar 2017 16:46:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9588883F47 for ; Thu, 23 Mar 2017 20:46:49 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7388753; Thu, 23 Mar 2017 20:46:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9588883F47 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9588883F47 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 23 Mar 2017 21:45:35 +0100 Message-Id: <20170323204544.12015-43-quintela@redhat.com> In-Reply-To: <20170323204544.12015-1-quintela@redhat.com> References: <20170323204544.12015-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 23 Mar 2017 20:46:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 42/51] ram: Pass RAMBlock to bitmap_sync 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: dgilbert@redhat.com 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" We change the meaning of start to be the offset from the beggining of the block. Signed-off-by: Juan Quintela --- include/exec/ram_addr.h | 2 ++ migration/ram.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index b05dc84..d50c970 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -354,11 +354,13 @@ static inline void cpu_physical_memory_clear_dirty_ra= nge(ram_addr_t start, =20 static inline uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, + RAMBlock *rb, ram_addr_t start, ram_addr_t length, int64_t *real_dirty_pages) { ram_addr_t addr; + start =3D rb->offset + start; unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); uint64_t num_dirty =3D 0; =20 diff --git a/migration/ram.c b/migration/ram.c index 064b2c0..9772fd8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -648,13 +648,13 @@ static inline bool migration_bitmap_clear_dirty(RAMSt= ate *rs, ram_addr_t addr) return ret; } =20 -static void migration_bitmap_sync_range(RAMState *rs, ram_addr_t start, - ram_addr_t length) +static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb, + ram_addr_t start, ram_addr_t lengt= h) { unsigned long *bitmap; bitmap =3D atomic_rcu_read(&rs->ram_bitmap)->bmap; rs->migration_dirty_pages +=3D - cpu_physical_memory_sync_dirty_bitmap(bitmap, start, length, + cpu_physical_memory_sync_dirty_bitmap(bitmap, rb, start, length, &rs->num_dirty_pages_period); } =20 @@ -701,7 +701,7 @@ static void migration_bitmap_sync(RAMState *rs) qemu_mutex_lock(&rs->bitmap_mutex); rcu_read_lock(); QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { - migration_bitmap_sync_range(rs, block->offset, block->used_length); + migration_bitmap_sync_range(rs, block, 0, block->used_length); } rcu_read_unlock(); qemu_mutex_unlock(&rs->bitmap_mutex); --=20 2.9.3