qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 4/4] memory: unify loops to sync dirty log bitmap
Date: Fri,  9 Feb 2018 11:45:46 +0100	[thread overview]
Message-ID: <20180209104546.29401-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20180209104546.29401-1-pbonzini@redhat.com>

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 <pbonzini@redhat.com>
---
 memory.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/memory.c b/memory.c
index 74917a19eb..586de4556d 100644
--- a/memory.c
+++ b/memory.c
@@ -1990,7 +1990,7 @@ static void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
         as = listener->address_space;
         view = address_space_get_flatview(as);
         FOR_EACH_FLAT_RANGE(fr, view) {
-            if (fr->mr == mr) {
+            if (fr->dirty_log_mask && (!mr || fr->mr == mr)) {
                 MemoryRegionSection mrs = section_from_flat_range(fr, view);
                 listener->log_sync(listener, &mrs);
             }
@@ -2509,26 +2509,7 @@ bool memory_region_present(MemoryRegion *container, hwaddr addr)
 
 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 = listener->address_space;
-        view = address_space_get_flatview(as);
-        FOR_EACH_FLAT_RANGE(fr, view) {
-            if (fr->dirty_log_mask) {
-                MemoryRegionSection mrs = section_from_flat_range(fr, view);
-
-                listener->log_sync(listener, &mrs);
-            }
-        }
-        flatview_unref(view);
-    }
+    memory_region_sync_dirty_bitmap(NULL);
 }
 
 void memory_global_after_dirty_log_sync(void)
-- 
2.14.3

  parent reply	other threads:[~2018-02-09 10:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 10:45 [Qemu-devel] [PATCH 0/4] tcg: fix dirty bitmap race with MTTCG Paolo Bonzini
2018-02-09 10:45 ` [Qemu-devel] [PATCH 1/4] memory: remove memory_region_test_and_clear_dirty Paolo Bonzini
2018-02-09 20:13   ` Richard Henderson
2018-02-09 10:45 ` [Qemu-devel] [PATCH 2/4] memory: hide memory_region_sync_dirty_bitmap behind DirtyBitmapSnapshot Paolo Bonzini
2018-02-09 20:16   ` Richard Henderson
2018-02-09 10:45 ` [Qemu-devel] [PATCH 3/4] memory: introduce memory_global_after_dirty_log_sync Paolo Bonzini
2018-02-09 20:20   ` Richard Henderson
2018-02-09 10:45 ` Paolo Bonzini [this message]
2018-02-09 20:23   ` [Qemu-devel] [PATCH 4/4] memory: unify loops to sync dirty log bitmap Richard Henderson
2018-02-09 11:02 ` [Qemu-devel] [PATCH 0/4] tcg: fix dirty bitmap race with MTTCG no-reply
2018-02-09 11:33 ` no-reply
2018-02-09 11:33 ` no-reply
2018-02-09 20:27 ` Dr. David Alan Gilbert
2018-02-13 11:10 ` Dr. David Alan Gilbert
2018-10-30 12:21 ` Alex Bennée
2018-10-30 13:48   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180209104546.29401-5-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).