aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-02-06 17:55:27 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-13 16:15:09 +0100
commit3ebb1817b387804bd5e21f49ca538db74b09a2b0 (patch)
treef0b2ddf2ec12d4dafca45a119b9d2d79ac864a63 /memory.c
parent0fe1eca7dcef4b0432c858d0eea32a84f014ddc5 (diff)
downloadqemu-3ebb1817b387804bd5e21f49ca538db74b09a2b0.zip
qemu-3ebb1817b387804bd5e21f49ca538db74b09a2b0.tar.gz
qemu-3ebb1817b387804bd5e21f49ca538db74b09a2b0.tar.bz2
memory: unify loops to sync dirty log bitmap
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>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c23
1 files 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(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);
}
@@ -2506,26 +2506,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);
}
static VMChangeStateEntry *vmstate_change;