From nobody Mon Feb 9 17:24:29 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15185256252603.9565689337226786; Tue, 13 Feb 2018 04:40:25 -0800 (PST) Received: from localhost ([::1]:51231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elZsm-0002Fh-BF for importer@patchew.org; Tue, 13 Feb 2018 07:40:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elZI3-0004hC-St for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elZI1-0007uA-M1 for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:27 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:55801) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elZI1-0007tw-Ff for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:25 -0500 Received: by mail-wm0-x242.google.com with SMTP id a84so4246836wmi.5 for ; Tue, 13 Feb 2018 04:02:25 -0800 (PST) Received: from 640k.lan ([82.84.102.245]) by smtp.gmail.com with ESMTPSA id f9sm6870298wmf.12.2018.02.13.04.02.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 04:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=HPwjrzEdIDVgSNVVM5g3LpEue5PEeNZeEvgYUNERs9w=; b=NhJLUB/RG16LHHpCC5PjEjuNSqBflJyWCOTZZMUwuAtDpQvaeO8norSRIQ2KIPYGcF UO/JnHAO3EmtJMCXkTipNI41phe155WfSZsMmHu/L3ZiMhzlgG5jTtOe1e9qNlpaFaMk ExfpZaAHx05G8zLjGF3hyBOb66eYDypp9+qOxDon60ihHvmccTcAjhJ+ZTV5Ps7fmkLc IwK1g9I0aqLfvO2AruGNMBwmac9Vg9IQYQFObYkyd8QIiVeY2JXcvfSdj3a1jIaTpjWb Tir9xs8b6m/sN2jAo6+WytcU8hpMBxIdpdZ5OaxkBk/g8s1BXgA/CpekDNF51mSUyTWh sADQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=HPwjrzEdIDVgSNVVM5g3LpEue5PEeNZeEvgYUNERs9w=; b=UVEVWQ8nJsAdJBYzROJwsJyG3oSWq53ZO0DRvPJcTiD7KKkGZvMEVSh3U6iSwg5W11 BKAWKw161SjWRxrDYMZNii+z647cS8BV5xrVmDSM4VIPifZMjvTYhrkR2p0xUYL15pA+ hpT7QtCGrgW03eiKlVSjAKUSBaOdQ4JOHCLO/Yx0IRd16qkpc7vNqKxgbnpwjUDO98OP 4PaqoGcpveWR68n5LTSjYD1pN3iJnTa/yB3mDv1Ig8eBX4Ehh+iebfXt9EtmPzTcXbMc y2Sw1gJ/4tISxzS4hNIb2Ya2MZza+WGqVyjd1l64oJuGwAFMz9Xyuo+KB19K6EfBz6Xi qylw== X-Gm-Message-State: APf1xPANSBU7M9PqAlV2aoWfZd0bN9nYWmBQjFse/C2GJdmZ1DGCw9Mc 3JokmidZe97uhVJXbREK4I0v8F2j X-Google-Smtp-Source: AH8x225NI7U1uYViNep7uCGZgHGdZmUY6Vn/2KrwCFIN1MiveGQ+wJRO+GZODTWslRAYcQ0SzNkBNQ== X-Received: by 10.28.127.73 with SMTP id a70mr1012604wmd.43.1518523344098; Tue, 13 Feb 2018 04:02:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Feb 2018 13:00:51 +0100 Message-Id: <1518523252-49106-48-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518523252-49106-1-git-send-email-pbonzini@redhat.com> References: <1518523252-49106-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 47/48] memory: unify loops to sync dirty log bitmap 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that memory_region_sync_dirty_bitmap is NULL, we can unify its loop with memory_global_dirty_log_sync's. The only difference is that memory_region_sync_dirty_bitmap will no longer call log_sync on FlatRanges that do have a zero dirty_log_mask, but this is okay because video memory is always registered with the dirty page logging mechanism. Signed-off-by: Paolo Bonzini --- memory.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/memory.c b/memory.c index 8ed809c..c7f6588 100644 --- a/memory.c +++ b/memory.c @@ -1990,7 +1990,7 @@ static void memory_region_sync_dirty_bitmap(MemoryReg= ion *mr) as =3D listener->address_space; view =3D address_space_get_flatview(as); FOR_EACH_FLAT_RANGE(fr, view) { - if (fr->mr =3D=3D mr) { + if (fr->dirty_log_mask && (!mr || fr->mr =3D=3D mr)) { MemoryRegionSection mrs =3D section_from_flat_range(fr, vi= ew); listener->log_sync(listener, &mrs); } @@ -2506,26 +2506,7 @@ bool memory_region_present(MemoryRegion *container, = hwaddr addr) =20 void memory_global_dirty_log_sync(void) { - MemoryListener *listener; - AddressSpace *as; - FlatView *view; - FlatRange *fr; - - QTAILQ_FOREACH(listener, &memory_listeners, link) { - if (!listener->log_sync) { - continue; - } - as =3D listener->address_space; - view =3D address_space_get_flatview(as); - FOR_EACH_FLAT_RANGE(fr, view) { - if (fr->dirty_log_mask) { - MemoryRegionSection mrs =3D section_from_flat_range(fr, vi= ew); - - listener->log_sync(listener, &mrs); - } - } - flatview_unref(view); - } + memory_region_sync_dirty_bitmap(NULL); } =20 static VMChangeStateEntry *vmstate_change; --=20 1.8.3.1