[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC Patch v2 24/45] HACK: do checkpoint per 20ms



Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
---
 tools/libxl/libxl_colo_save.c | 19 ++++++++++++++++++-
 tools/libxl/libxl_internal.h  |  3 +++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c
index 6675d3d..75d83c8 100644
--- a/tools/libxl/libxl_colo_save.c
+++ b/tools/libxl/libxl_colo_save.c
@@ -55,6 +55,8 @@ void libxl__colo_save_setup(libxl__egc *egc, 
libxl__colo_save_state *css)
     cds->ao = ao;
     cds->domid = dss->domid;
 
+    libxl__ev_time_init(&css->timeout);
+
     libxl__checkpoint_devices_setup(egc, &css->cds);
 
     return;
@@ -473,6 +475,8 @@ out:
 static void colo_device_commit_cb(libxl__egc *egc,
                                   libxl__checkpoint_devices_state *cds,
                                   int rc);
+static void colo_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev,
+                                  const struct timeval *requested_abs);
 static void colo_start_new_checkpoint(libxl__egc *egc,
                                       libxl__checkpoint_devices_state *cds,
                                       int rc);
@@ -508,13 +512,26 @@ static void colo_device_commit_cb(libxl__egc *egc,
     }
 
     /* TODO: wait a new checkpoint */
-    colo_start_new_checkpoint(egc, cds, 0);
+    rc = libxl__ev_time_register_rel(gc, &css->timeout,
+                                     colo_next_checkpoint,
+                                     20);
+    if (rc)
+        goto out;
+
     return;
 
 out:
     libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, 0);
 }
 
+static void colo_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev,
+                                 const struct timeval *requested_abs)
+{
+    libxl__colo_save_state *css = CONTAINER_OF(ev, *css, timeout);
+
+    colo_start_new_checkpoint(egc, &css->cds, 0);
+}
+
 static void colo_start_new_checkpoint(libxl__egc *egc,
                                       libxl__checkpoint_devices_state *cds,
                                       int rc)
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index aebc972..6fc26c9 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2736,6 +2736,9 @@ struct libxl__colo_save_state {
     uint8_t temp_buff[9];
     void (*callback)(libxl__egc *, libxl__colo_save_state *);
     bool svm_running;
+
+    /* hack */
+    libxl__ev_time timeout;
 };
 
 /*----- Domain suspend (save) state structure -----*/
-- 
1.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.