Skip to contentSkip to conversation

fix HVM log dirty issue

PATCH New Zhai, Edwin 1 participant 1 message Sep 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix HVM log dirty issue

These patches fix some issues for HVM log dirty in qemu:
* Add necessary logging dirty in qemu to avoid guest error with intensive disk access when live migration
* Take place of shared memory between qemu and migration tools by new added hypercall, which is clean and simple

tools/ioemu-remote/cpu-all.h +4 -0
Index: hv/tools/ioemu-remote/cpu-all.h
===================================================================
@@ -972,10 +972,14 @@ static inline int cpu_physical_memory_ge
     return phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
 }
 
+#ifdef CONFIG_DM
+void cpu_physical_memory_set_dirty(ram_addr_t addr);
+#else
 static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
 {
     phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
 }
+#endif
 
 void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
                                      int dirty_flags);
tools/ioemu-remote/i386-dm/exec-dm.c +21 -22

73 lines not on this page · raw message

tools/ioemu-remote/xen-config-host.h +1 -2
Index: hv/tools/ioemu-remote/xen-config-host.h
===================================================================
@@ -39,8 +39,7 @@ struct CharDriverState;
 void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
 				     const char *devname);
 
-extern unsigned long *logdirty_bitmap;
-extern unsigned long logdirty_bitmap_size;
+extern unsigned int xen_logdirty_enable;
 
 #ifdef CONFIG_STUBDOM
 #undef HAVE_IOVEC
tools/ioemu-remote/xenstore.c +28 -102

160 lines not on this page · raw message

tools/libxc/ia64/xc_ia64_linux_save.c +6 -32
Index: hv/tools/libxc/ia64/xc_ia64_linux_save.c
===================================================================
@@ -382,8 +382,7 @@ out:
 int
 xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
                uint32_t max_factor, uint32_t flags, int (*suspend)(void),
-               int hvm, void *(*init_qemu_maps)(int, unsigned),
-               void (*qemu_flip_buffer)(int, int))
+               int hvm, void (*switch_qemu_logdirty)(int, unsigned))
 {
     DECLARE_DOMCTL;
     xc_dominfo_t info;
@@ -424,11 +423,6 @@ xc_domain_save(int xc_handle, int io_fd,
 
     char *mem;
 
-    /* HVM: shared-memory bitmaps for getting log-dirty bits from qemu-dm */
-    unsigned long *qemu_bitmaps[2];
-    int qemu_active = 0;
-    int qemu_non_active = 1;
-
     /* for foreign p2m exposure */
     unsigned long memmap_info_num_pages;
     /* Unsigned int was used before. To keep file format compatibility. */
@@ -545,14 +539,9 @@ xc_domain_save(int xc_handle, int io_fd,
             goto out;
         }
 
-        if (hvm) {
-            /* Get qemu-dm logging dirty pages too */
-            void *seg = init_qemu_maps(dom, bitmap_size);
-            qemu_bitmaps[0] = seg;
-            qemu_bitmaps[1] = seg + bitmap_size;
-            qemu_active = 0;
-            qemu_non_active = 1;
-        }
+        /* Enable qemu-dm logging dirty pages to xen */
+        if (hvm)
+            switch_qemu_logdirty(dom, 1);
     } else {
 
         /* This is a non-live suspend. Issue the call back to get the
@@ -703,23 +692,6 @@ xc_domain_save(int xc_handle, int io_fd,
                 goto out;
             }
 
-            if (hvm) {
-                unsigned int j;
-                /* Pull in the dirty bits from qemu-dm too */
-                if (!last_iter) {
-                    qemu_active = qemu_non_active;
-                    qemu_non_active = qemu_active ? 0 : 1;
-                    qemu_flip_buffer(dom, qemu_active);
-                    for (j = 0; j < bitmap_size / sizeof(unsigned long); j++) {
-                        to_send[j] |= qemu_bitmaps[qemu_non_active][j];
-                        qemu_bitmaps[qemu_non_active][j] = 0;
-                    }
-                } else {
-                    for (j = 0; j < bitmap_size / sizeof(unsigned long); j++)
-                        to_send[j] |= qemu_bitmaps[qemu_active][j];
-                }
-            }
-
             sent_last_iter = sent_this_iter;
 
             //print_stats(xc_handle, dom, sent_this_iter, &stats, 1);
@@ -762,6 +734,8 @@ xc_domain_save(int xc_handle, int io_fd,
                               NULL, 0, NULL, 0, NULL ) < 0) {
             DPRINTF("Warning - couldn't disable shadow mode");
         }
+        if ( hvm )
+            switch_qemu_logdirty(dom, 0);
     }
 
     unlock_pages(to_send, bitmap_size);
tools/libxc/xc_domain_save.c +5 -36

72 lines not on this page · raw message

tools/libxc/xenguest.h +1 -2
Index: hv/tools/libxc/xenguest.h
===================================================================
@@ -26,8 +26,7 @@
 int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
                    uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
                    int (*suspend)(void), int hvm,
-                   void *(*init_qemu_maps)(int, unsigned),  /* HVM only */
-                   void (*qemu_flip_buffer)(int, int));     /* HVM only */
+                   void (*switch_qemu_logdirty)(int, unsigned)); /* HVM only */
 
 
 /**
tools/xcutils/xc_save.c +37 -88

159 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel