]> xenbits.xensource.com Git - qemu-upstream-4.2-testing.git/commitdiff
exec, memory: Call to xen_modified_memory.
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 21 Feb 2013 12:16:42 +0000 (12:16 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 21 Feb 2013 12:16:42 +0000 (12:16 +0000)
This patch add some calls to xen_modified_memory to notify Xen about dirtybits
during migration.

Backport of e226939de5814527a21396903b08c3d0ed989558

Note a call to xen_modify_memory has been added to qemu_ram_alloc_from_ptr
as the upstream version does:
  cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
and this function does not exist in 4.2.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Alex Bligh <alex@alex.org.uk>
exec.c
memory.c

diff --git a/exec.c b/exec.c
index 07a6f6859ec6f6cca8f013eb8a0fa030492c7ddf..fec1b059891ab0a8b8b91980c0576c876825fec2 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -2988,6 +2988,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name,
     memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),
            0xff, size >> TARGET_PAGE_BITS);
 
+    if (xen_enabled())
+        xen_modified_memory(new_block->offset, size);
+
     if (kvm_enabled())
         kvm_setup_guest_memory(new_block->host, size);
 
@@ -3961,6 +3964,7 @@ static void invalidate_and_set_dirty(target_phys_addr_t addr,
         /* set dirty bit */
         cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG));
     }
+    xen_modified_memory(addr, length);
 }
 
 void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
index 7c20a0703f8d0156708df8107ceaba85673595d5..6e0c5960fef753967f2b7243229fecfc285abeec 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -16,6 +16,7 @@
 #include "ioport.h"
 #include "bitops.h"
 #include "kvm.h"
+#include "hw/xen.h"
 #include <assert.h>
 
 unsigned memory_region_transaction_depth = 0;
@@ -1065,6 +1066,9 @@ bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr,
 void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr)
 {
     assert(mr->terminates);
+    if (xen_enabled())
+        xen_modified_memory((mr->ram_addr + addr) & TARGET_PAGE_MASK,
+                            TARGET_PAGE_SIZE);
     return cpu_physical_memory_set_dirty(mr->ram_addr + addr);
 }