0a122b
From bde7a88eaae5b1f1d2dd83a4d4fd232991d2397d Mon Sep 17 00:00:00 2001
0a122b
From: Juan Quintela <quintela@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 15:07:45 +0100
0a122b
Subject: [PATCH 34/40] memory: unfold memory_region_test_and_clear()
0a122b
0a122b
RH-Author: Juan Quintela <quintela@redhat.com>
0a122b
Message-id: <1389712071-23303-35-git-send-email-quintela@redhat.com>
0a122b
Patchwork-id: 56689
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 34/40] memory: unfold memory_region_test_and_clear()
0a122b
Bugzilla: 997559
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
0a122b
0a122b
We are going to update the bitmap directly
0a122b
0a122b
Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
0a122b
(cherry picked from commit 12291ec18fdce3c1973c172f5a942a1bd26b9a5f)
0a122b
Signed-off-by: Juan Quintela <quintela@trasno.org>
0a122b
---
0a122b
 arch_init.c | 10 +++++++---
0a122b
 1 file changed, 7 insertions(+), 3 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 arch_init.c |   10 +++++++---
0a122b
 1 files changed, 7 insertions(+), 3 deletions(-)
0a122b
0a122b
diff --git a/arch_init.c b/arch_init.c
0a122b
index d71fb33..41da357 100644
0a122b
--- a/arch_init.c
0a122b
+++ b/arch_init.c
0a122b
@@ -48,6 +48,7 @@
0a122b
 #include "qmp-commands.h"
0a122b
 #include "trace.h"
0a122b
 #include "exec/cpu-all.h"
0a122b
+#include "exec/ram_addr.h"
0a122b
 #include "hw/acpi/acpi.h"
0a122b
 
0a122b
 #ifdef DEBUG_ARCH_INIT
0a122b
@@ -400,9 +401,12 @@ static void migration_bitmap_sync(void)
0a122b
 
0a122b
     QTAILQ_FOREACH(block, &ram_list.blocks, next) {
0a122b
         for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
0a122b
-            if (memory_region_test_and_clear_dirty(block->mr,
0a122b
-                                                   addr, TARGET_PAGE_SIZE,
0a122b
-                                                   DIRTY_MEMORY_MIGRATION)) {
0a122b
+            if (cpu_physical_memory_get_dirty(block->mr->ram_addr + addr,
0a122b
+                                              TARGET_PAGE_SIZE,
0a122b
+                                              DIRTY_MEMORY_MIGRATION)) {
0a122b
+                cpu_physical_memory_reset_dirty(block->mr->ram_addr + addr,
0a122b
+                                                TARGET_PAGE_SIZE,
0a122b
+                                                DIRTY_MEMORY_MIGRATION);
0a122b
                 migration_bitmap_set_dirty(block->mr, addr);
0a122b
             }
0a122b
         }
0a122b
-- 
0a122b
1.7.1
0a122b