Skip to contentSkip to conversation

kvm: Mark full address range dirty on live migration start

PATCH In review Jan Kiszka 3 participants 4 messages May 22, 2009 – May 24, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm: Mark full address range dirty on live migration start

As Avi correctly noted, last_ram_offset does not mark the last physical RAM address the guest may see (due to non-continuous memory regions). Ensure that we catch them all by marking the full possible address range dirty.

---

 targphys.h |    2 ++
 vl.c       |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
targphys.h +2 -0
index 81a9c37..99ab23c 100644
@@ -12,9 +12,11 @@
 
 #if TARGET_PHYS_ADDR_BITS == 32
 typedef uint32_t target_phys_addr_t;
+#define TARGET_PHYS_ADDR_MAX UINT32_MAX
 #define TARGET_FMT_plx "%08x"
 #elif TARGET_PHYS_ADDR_BITS == 64
 typedef uint64_t target_phys_addr_t;
+#define TARGET_PHYS_ADDR_MAX UINT64_MAX
 #define TARGET_FMT_plx "%016" PRIx64
 #endif
 #endif
vl.c +1 -1
index 2c1f0e0..090c83d 100644
@@ -3232,7 +3232,7 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
 
-    if (cpu_physical_sync_dirty_bitmap(0, last_ram_offset) != 0) {
+    if (cpu_physical_sync_dirty_bitmap(0, TARGET_PHYS_ADDR_MAX) != 0) {
         qemu_file_set_error(f);
         return 0;
     }
#1 lore raw
Quoted 6 lines · Jan Kiszka

As Avi correctly noted, last_ram_offset does not mark the last physical RAM address the guest may see (due to non-continuous memory regions). Ensure that we catch them all by marking the full possible address range dirty.

Indeed, we already do something in that lines in qemu-kvm tree, in a place that does not apply for It makes a lot of sense. Just maybe you could just -1UL instead of defining a new constant, but I don't really care.

As soon as this is applied to master, I'll pick it for stable too.

Thanks

author
#2 lore raw
Quoted 11 lines · Glauber Costa
Quoted 6 lines · Jan Kiszka

As Avi correctly noted, last_ram_offset does not mark the last physical RAM address the guest may see (due to non-continuous memory regions). Ensure that we catch them all by marking the full possible address range dirty.

Indeed, we already do something in that lines in qemu-kvm tree, in a place that does not apply for It makes a lot of sense. Just maybe you could just -1UL instead of defining a new constant, but I don't really care.

I intentionally made this verbose.

Quoted 2 lines

As soon as this is applied to master, I'll pick it for stable too.

Migration for KVM would be a new feature for stable. It requires a new CPU save/restore format (V9). Do think that qualifies it for stable.

Jan

#3 lore raw
In reply to Glauber Costa
Quoted 6 lines · Glauber Costa
Quoted 5 lines · Jan Kiszka

As Avi correctly noted, last_ram_offset does not mark the last physical RAM address the guest may see (due to non-continuous memory regions). Ensure that we catch them all by marking the full possible address range dirty.

Quoted 6 lines
Quoted 1 line

Indeed, we already do something in that lines in qemu-kvm tree, in a place that does not apply for It makes a lot of sense. Just maybe you could just -1UL instead of defining a new constant, but I don't really care.

-1ul is wrong. -1 is correct.

Paul