Skip to contentSkip to conversation

Misc cleanups for libxl

PATCH Superseded Yang Hongyang 2 participants 23 messages May 20, 2015 – Jun 3, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Misc cleanups for libxl

This patchset mainly focus on libxl save, most of the patches are simply move codes out of libxl_dom.c, no functional changes, may conflict with Andrew Cooper's libxl work for migration v2, so CCed Andrew for comments.

For convenience, my previous sent patch
[PATCH v1] libxl/save: Refactor libxl__domain_suspend_state
is included in this series because all the other patches in this series are based on that.

Please see individual patch for detail.

Can get the whole patchset from:
https://github.com/macrosheep/xen/tree/misc-libxl-v1

Yang Hongyang (5):
libxl/save: Refactor libxl__domain_suspend_state tools/libxl: move domain suspend codes into a separate file tools/libxl: move remus codes into libxl_remus.c tools/libxl: move toolstack code into libxl_toolstack.c tools/libxl: move domain save codes into libxl_dom_save.c

 tools/libxl/Makefile             |    5 +-
 tools/libxl/libxl.c              |   67 +--
 tools/libxl/libxl_dom.c          | 1202 --------------------------------------
 tools/libxl/libxl_dom_save.c     |  493 ++++++++++++++++
 tools/libxl/libxl_dom_suspend.c  |  400 +++++++++++++
 tools/libxl/libxl_internal.h     |   62 +-
 tools/libxl/libxl_netbuffer.c    |    2 +-
 tools/libxl/libxl_remus.c        |  306 ++++++++++
 tools/libxl/libxl_save_callout.c |    2 +-
 tools/libxl/libxl_toolstack.c    |  196 +++++++
 10 files changed, 1452 insertions(+), 1283 deletions(-)
 create mode 100644 tools/libxl/libxl_dom_save.c
 create mode 100644 tools/libxl/libxl_dom_suspend.c
 create mode 100644 tools/libxl/libxl_remus.c
 create mode 100644 tools/libxl/libxl_toolstack.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 libxl/save: Refactor libxl__domain_suspend_state

Currently struct libxl__domain_suspend_state contains 2 type of states, one is save state, another is suspend state. This patch separate it out. Also rename libxl__domain_suspend() to libxl__domain_save() since it actually do the save domain work.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Andrew Cooper <[email protected]>
---
 tools/libxl/libxl.c              |  18 +++---
 tools/libxl/libxl_dom.c          | 126 +++++++++++++++++++++------------------
 tools/libxl/libxl_internal.h     |  45 ++++++++------
 tools/libxl/libxl_netbuffer.c    |   2 +-
 tools/libxl/libxl_save_callout.c |   2 +-
 5 files changed, 108 insertions(+), 85 deletions(-)
tools/libxl/libxl.c +9 -9
index a6eb2df..7259061 100644
@@ -830,7 +830,7 @@ static void libxl__remus_setup_done(libxl__egc *egc,
 static void libxl__remus_setup_failed(libxl__egc *egc,
                                       libxl__remus_devices_state *rds, int rc);
 static void remus_failover_cb(libxl__egc *egc,
-                              libxl__domain_suspend_state *dss, int rc);
+                              libxl__domain_save_state *dss, int rc);
 
 /* TODO: Explicit Checkpoint acknowledgements via recv_fd. */
 int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,
@@ -838,7 +838,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,
                              const libxl_asyncop_how *ao_how)
 {
     AO_CREATE(ctx, domid, ao_how);
-    libxl__domain_suspend_state *dss;
+    libxl__domain_save_state *dss;
     int rc;
 
     libxl_domain_type type = libxl__domain_type(gc, domid);
@@ -907,11 +907,11 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,
 static void libxl__remus_setup_done(libxl__egc *egc,
                                     libxl__remus_devices_state *rds, int rc)
 {
-    libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds);
+    libxl__domain_save_state *dss = CONTAINER_OF(rds, *dss, rds);
     STATE_AO_GC(dss->ao);
 
     if (!rc) {
-        libxl__domain_suspend(egc, dss);
+        libxl__domain_save(egc, dss);
         return;
     }
 
@@ -924,7 +924,7 @@ static void libxl__remus_setup_done(libxl__egc *egc,
 static void libxl__remus_setup_failed(libxl__egc *egc,
                                       libxl__remus_devices_state *rds, int rc)
 {
-    libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds);
+    libxl__domain_save_state *dss = CONTAINER_OF(rds, *dss, rds);
     STATE_AO_GC(dss->ao);
 
     if (rc)
@@ -935,7 +935,7 @@ static void libxl__remus_setup_failed(libxl__egc *egc,
 }
 
 static void remus_failover_cb(libxl__egc *egc,
-                              libxl__domain_suspend_state *dss, int rc)
+                              libxl__domain_save_state *dss, int rc)
 {
     STATE_AO_GC(dss->ao);
     /*
@@ -947,7 +947,7 @@ static void remus_failover_cb(libxl__egc *egc,
 }
 
 static void domain_suspend_cb(libxl__egc *egc,
-                              libxl__domain_suspend_state *dss, int rc)
+                              libxl__domain_save_state *dss, int rc)
 {
     STATE_AO_GC(dss->ao);
     libxl__ao_complete(egc,ao,rc);
@@ -966,7 +966,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags,
         goto out_err;
     }
 
-    libxl__domain_suspend_state *dss;
+    libxl__domain_save_state *dss;
     GCNEW(dss);
 
     dss->ao = ao;
@@ -978,7 +978,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags,
     dss->live = flags & LIBXL_SUSPEND_LIVE;
     dss->debug = flags & LIBXL_SUSPEND_DEBUG;
 
-    libxl__domain_suspend(egc, dss);
+    libxl__domain_save(egc, dss);
     return AO_INPROGRESS;
 
  out_err:
tools/libxl/libxl_dom.c +69 -57

375 lines not on this page · raw message

tools/libxl/libxl_internal.h +28 -17

89 lines not on this page · raw message

tools/libxl/libxl_netbuffer.c +1 -1
index edc6843..71c6531 100644
@@ -41,7 +41,7 @@ int libxl__netbuffer_enabled(libxl__gc *gc)
 int init_subkind_nic(libxl__remus_devices_state *rds)
 {
     int rc, ret;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(rds, *dss, rds);
+    libxl__domain_save_state *dss = CONTAINER_OF(rds, *dss, rds);
 
     STATE_AO_GC(rds->ao);
 
tools/libxl/libxl_save_callout.c +1 -1
index 40b25e4..cd342b9 100644
@@ -74,7 +74,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs,
                argnums, ARRAY_SIZE(argnums));
 }
 
-void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss)
+void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_save_state *dss)
 {
     STATE_AO_GC(dss->ao);
     int r, rc, toolstack_data_fd = -1;
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1766

Quoted 7 lines · Yang Hongyang
tools/libxl/libxl_dom.c +2 -1
@@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
 {
     libxl__save_helper_state *shs = data;
     libxl__egc *egc = shs->egc;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_suspend_state *dss2 = &dss->dss;

With dss now being ambiguously save vs suspend I don't think adding a 2 suffix to one of the usages is the right answer.

I think in contexts where you are dealing with both that *save_state and *suspend_state are the way to go for the local variables. I'm afraid this will make the change noisier, sorry.

I'm afraid I think that the dss member of struct libxl__domain_save_state will therefore also need to be called suspend_state too.

I think we can tolerate using dss in contexts where there is only one of the two structs in active use, just to avoid even more noise.

Alternatively if there is another name for either "save" or "suspend" which doesn't start with an s (or conflict with some other type) perhaps we could go with that. I can't think of one off hand.

Another name might also help because the semantic difference between suspend and save is something I have to think about every time. Is there a split along live/dead lines which we could use here perhaps?

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1775

Quoted 5 lines
tools/libxl/libxl_dom.c +1 -1
 static void domain_suspend_callback_common_done(libxl__egc *egc,
                                 libxl__domain_suspend_state *dss, int ok)
 {
-    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
+    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);

I suppose dsvs is a bit better then dss2. Maybe that's the answer, if used consistently.

Ian.

#3 lore raw

Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state

Quoted 32 lines · Ian Campbell

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1766

Quoted 7 lines · Yang Hongyang
tools/libxl/libxl_dom.c +2 -1
@@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
  {
      libxl__save_helper_state *shs = data;
      libxl__egc *egc = shs->egc;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_suspend_state *dss2 = &dss->dss;

With dss now being ambiguously save vs suspend I don't think adding a 2 suffix to one of the usages is the right answer.

I think in contexts where you are dealing with both that *save_state and *suspend_state are the way to go for the local variables. I'm afraid this will make the change noisier, sorry.

I'm afraid I think that the dss member of struct libxl__domain_save_state will therefore also need to be called suspend_state too.

I think we can tolerate using dss in contexts where there is only one of the two structs in active use, just to avoid even more noise.

Alternatively if there is another name for either "save" or "suspend" which doesn't start with an s (or conflict with some other type) perhaps we could go with that. I can't think of one off hand.

Another name might also help because the semantic difference between suspend and save is something I have to think about every time. Is there a split along live/dead lines which we could use here perhaps?

Quoted 8 lines

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1775

Quoted 5 lines
tools/libxl/libxl_dom.c +1 -1
  static void domain_suspend_callback_common_done(libxl__egc *egc,
                                  libxl__domain_suspend_state *dss, int ok)
  {
-    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
+    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);

I suppose dsvs is a bit better then dss2. Maybe that's the answer, if used consistently.

If use dsvs to represent save_state consistently, the modification of the code will be too much. I'm thinking of using "dsps" stands for domain_suspend_state, is it ok?

Quoted 5 lines

Ian.

.

Signature · 2 lines
Thanks,
Yang.
#4 lore raw

Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state

Quoted 39 lines · Yang Hongyang
Quoted 38 lines · Ian Campbell

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1766

Quoted 7 lines · Yang Hongyang
tools/libxl/libxl_dom.c +2 -1
@@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
  {
      libxl__save_helper_state *shs = data;
      libxl__egc *egc = shs->egc;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_suspend_state *dss2 = &dss->dss;

With dss now being ambiguously save vs suspend I don't think adding a 2 suffix to one of the usages is the right answer.

I think in contexts where you are dealing with both that *save_state and *suspend_state are the way to go for the local variables. I'm afraid this will make the change noisier, sorry.

I'm afraid I think that the dss member of struct libxl__domain_save_state will therefore also need to be called suspend_state too.

I think we can tolerate using dss in contexts where there is only one of the two structs in active use, just to avoid even more noise.

Alternatively if there is another name for either "save" or "suspend" which doesn't start with an s (or conflict with some other type) perhaps we could go with that. I can't think of one off hand.

Another name might also help because the semantic difference between suspend and save is something I have to think about every time. Is there a split along live/dead lines which we could use here perhaps?

Quoted 5 lines
tools/libxl/libxl_dom.c +1 -1
  static void domain_suspend_callback_common_done(libxl__egc *egc,
                                  libxl__domain_suspend_state *dss, int ok)
  {
-    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
+    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);
Quoted 6 lines
Quoted 2 lines

I suppose dsvs is a bit better then dss2. Maybe that's the answer, if used consistently.

If use dsvs to represent save_state consistently, the modification of the code will be too much. I'm thinking of using "dsps" stands for domain_suspend_state, is it ok?

So in some contexts you would have "dss" (existing save state) and "dsps" (new suspend state), which is potentially confusing so I think it would be worth renaming dss to dsvs in at least those places, it's mechanical so although noisy it's not too bad.

Ian (J) is the main author if this code (and therefore chose the existing names), it might be worth giving him a chance to object or suggest an alternative.

Ian.

#5 lore raw

Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state

Quoted 47 lines · Ian Campbell
Quoted 39 lines · Yang Hongyang
Quoted 38 lines · Ian Campbell

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1766

Quoted 7 lines · Yang Hongyang
tools/libxl/libxl_dom.c +2 -1
@@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
   {
       libxl__save_helper_state *shs = data;
       libxl__egc *egc = shs->egc;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_suspend_state *dss2 = &dss->dss;

With dss now being ambiguously save vs suspend I don't think adding a 2 suffix to one of the usages is the right answer.

I think in contexts where you are dealing with both that *save_state and *suspend_state are the way to go for the local variables. I'm afraid this will make the change noisier, sorry.

I'm afraid I think that the dss member of struct libxl__domain_save_state will therefore also need to be called suspend_state too.

I think we can tolerate using dss in contexts where there is only one of the two structs in active use, just to avoid even more noise.

Alternatively if there is another name for either "save" or "suspend" which doesn't start with an s (or conflict with some other type) perhaps we could go with that. I can't think of one off hand.

Another name might also help because the semantic difference between suspend and save is something I have to think about every time. Is there a split along live/dead lines which we could use here perhaps?

Quoted 5 lines
tools/libxl/libxl_dom.c +1 -1
   static void domain_suspend_callback_common_done(libxl__egc *egc,
                                   libxl__domain_suspend_state *dss, int ok)
   {
-    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
+    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);
Quoted 6 lines
Quoted 2 lines

I suppose dsvs is a bit better then dss2. Maybe that's the answer, if used consistently.

If use dsvs to represent save_state consistently, the modification of the code will be too much. I'm thinking of using "dsps" stands for domain_suspend_state, is it ok?

Quoted 8 lines

So in some contexts you would have "dss" (existing save state) and "dsps" (new suspend state), which is potentially confusing so I think it would be worth renaming dss to dsvs in at least those places, it's mechanical so although noisy it's not too bad.

Ian (J) is the main author if this code (and therefore chose the existing names), it might be worth giving him a chance to object or suggest an alternative.

OK, thanks

Quoted 5 lines

Ian.

.

Signature · 2 lines
Thanks,
Yang.
#6 lore raw

Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state

In reply to Ian Campbell
Quoted 43 lines · Ian Campbell
Quoted 42 lines · Yang Hongyang
Quoted 40 lines · Ian Campbell

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1766

Quoted 7 lines · Yang Hongyang
tools/libxl/libxl_dom.c +2 -1
@@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
   {
       libxl__save_helper_state *shs = data;
       libxl__egc *egc = shs->egc;
-    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
+    libxl__domain_suspend_state *dss2 = &dss->dss;

With dss now being ambiguously save vs suspend I don't think adding a 2 suffix to one of the usages is the right answer.

I think in contexts where you are dealing with both that *save_state and *suspend_state are the way to go for the local variables. I'm afraid this will make the change noisier, sorry.

I'm afraid I think that the dss member of struct libxl__domain_save_state will therefore also need to be called suspend_state too.

I think we can tolerate using dss in contexts where there is only one of the two structs in active use, just to avoid even more noise.

Alternatively if there is another name for either "save" or "suspend" which doesn't start with an s (or conflict with some other type) perhaps we could go with that. I can't think of one off hand.

Another name might also help because the semantic difference between suspend and save is something I have to think about every time. Is there a split along live/dead lines which we could use here perhaps?

tools/libxl/libxl_dom.c static void libxl__domain_suspend_callback(void *data) · line 1775

Quoted 5 lines
tools/libxl/libxl_dom.c +1 -1
   static void domain_suspend_callback_common_done(libxl__egc *egc,
                                   libxl__domain_suspend_state *dss, int ok)
   {
-    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
+    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);

I suppose dsvs is a bit better then dss2. Maybe that's the answer, if used consistently.

Quoted 8 lines
Quoted 3 lines

If use dsvs to represent save_state consistently, the modification of the code will be too much. I'm thinking of using "dsps" stands for domain_suspend_state, is it ok?

So in some contexts you would have "dss" (existing save state) and "dsps" (new suspend state), which is potentially confusing so I think it would be worth renaming dss to dsvs in at least those places, it's mechanical so although noisy it's not too bad.

Ah, my thought was use "dsps" consistently, that is all placees that using libxl__domain_suspend_state will be renamed to dsps.(after moving the suspend code into libxl_dom_suspend.c, dsps mostly appears there).It did confuse one if he is familiar with the old code. But I think it will make the code clearer for new readers. Anyway, let's wait for Ian (J)'s comment.

Quoted 9 lines

Ian (J) is the main author if this code (and therefore chose the existing names), it might be worth giving him a chance to object or suggest an alternative.

Ian.

.

Signature · 2 lines
Thanks,
Yang.
#7 lore raw

PATCH 2/5 tools/libxl: move domain suspend codes into a separate file

In reply to Yang Hongyang

move domain suspend codes into a separate file libxl_dom_suspend.c

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Andrew Cooper <[email protected]>
---
 tools/libxl/Makefile            |   3 +-
 tools/libxl/libxl_dom.c         | 376 +------------------------------------
 tools/libxl/libxl_dom_suspend.c | 400 ++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_internal.h    |   6 +
 4 files changed, 412 insertions(+), 373 deletions(-)
 create mode 100644 tools/libxl/libxl_dom_suspend.c
tools/libxl/Makefile +2 -1
index 1b16598..21558b0 100644
@@ -95,7 +95,8 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o \
 			libxl_json.o libxl_aoutils.o libxl_numa.o libxl_vnuma.o \
 			libxl_save_callout.o _libxl_save_msgs_callout.o \
-			libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o libxl_fork.o libxl_dom_suspend.o \
+			$(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
tools/libxl/libxl_dom.c +4 -372

406 lines not on this page · raw message

tools/libxl/libxl_dom_suspend.c new file +400 -0

400 lines not on this page · raw message

tools/libxl/libxl_internal.h +6 -0
index f86fc89..b2eeb89 100644
@@ -3191,6 +3191,12 @@ _hidden void libxl__domain_save_device_model(libxl__egc *egc,
 
 _hidden const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid);
 
+void libxl__domain_suspend_callback(void *data);
+
+/* calls dss->callback_common_done when done */
+void libxl__domain_suspend(libxl__egc *egc,
+                           libxl__domain_suspend_state *dss);
+
 
 /*
  * Convenience macros.
Signature · 1 line
1.9.1
#9 lore raw

Re: [PATCH v1 2/5] tools/libxl: move domain suspend codes into a separate file

In reply to Yang Hongyang
Quoted 6 lines · Yang Hongyang
tools/libxl/libxl_internal.h +0 -0
index f86fc89..b2eeb89 100644

tools/libxl/libxl_internal.h _hidden void · line 3200

Quoted 10 lines
tools/libxl/libxl_internal.h +5 -0
@@ -3191,6 +3191,12 @@ _hidden void
 libxl__domain_save_device_model(libxl__egc *egc,
 
 _hidden const char *libxl__device_model_savefile(libxl__gc *gc,
 uint32_t domid);
 
+void libxl__domain_suspend_callback(void *data);
+
+/* calls dss->callback_common_done when done */
+void libxl__domain_suspend(libxl__egc *egc,
+                           libxl__domain_suspend_state *dss);

Please mark these internal functions _hidden like the other examples in this file.

With that the ack I just sent before I notice this stands.

Ian.

#10 lore raw

Re: [PATCH v1 2/5] tools/libxl: move domain suspend codes into a separate file

Quoted 12 lines · Ian Campbell
Quoted 11 lines · Yang Hongyang
tools/libxl/libxl_internal.h +0 -0
index f86fc89..b2eeb89 100644
@@ -3191,6 +3191,12 @@ _hidden void
 libxl__domain_save_device_model(libxl__egc *egc,
 
  _hidden const char *libxl__device_model_savefile(libxl__gc *gc,
 uint32_t domid);
 
Quoted 8 lines

tools/libxl/libxl_internal.h _hidden void libxl__domain_save_device_model(libxl__egc *egc, · line 3198

Quoted 5 lines
tools/libxl/libxl_internal.h +5 -0
+void libxl__domain_suspend_callback(void *data);
+
+/* calls dss->callback_common_done when done */
+void libxl__domain_suspend(libxl__egc *egc,
+                           libxl__domain_suspend_state *dss);

Please mark these internal functions _hidden like the other examples in this file.

ok.

Quoted 8 lines

With that the ack I just sent before I notice this stands.

Ian.

.

Signature · 2 lines
Thanks,
Yang.
#11 lore raw

PATCH 3/5 tools/libxl: move remus codes into libxl_remus.c

In reply to Yang Hongyang

move remus codes into libxl_remus.c

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Andrew Cooper <[email protected]>
---
 tools/libxl/Makefile         |   2 +-
 tools/libxl/libxl.c          |  55 +-------
 tools/libxl/libxl_dom.c      | 223 ++-----------------------------
 tools/libxl/libxl_internal.h |  11 ++
 tools/libxl/libxl_remus.c    | 306 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 327 insertions(+), 270 deletions(-)
 create mode 100644 tools/libxl/libxl_remus.c
tools/libxl/Makefile +1 -1
index 21558b0..a9abdbc 100644
@@ -56,7 +56,7 @@ else
 LIBXL_OBJS-y += libxl_nonetbuffer.o
 endif
 
-LIBXL_OBJS-y += libxl_remus_device.o libxl_remus_disk_drbd.o
+LIBXL_OBJS-y += libxl_remus.o libxl_remus_device.o libxl_remus_disk_drbd.o
 
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o
 LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o
tools/libxl/libxl.c +1 -54

74 lines not on this page · raw message

tools/libxl/libxl_dom.c +8 -215

244 lines not on this page · raw message

tools/libxl/libxl_internal.h +11 -0
index b2eeb89..c3d70eb 100644
@@ -2815,6 +2815,7 @@ _hidden void libxl__remus_devices_commit(libxl__egc *egc,
                                          libxl__remus_devices_state *rds);
 _hidden int libxl__netbuffer_enabled(libxl__gc *gc);
 
+
 /*----- Domain suspend (save) state structure -----*/
 
 typedef struct libxl__domain_suspend_state libxl__domain_suspend_state;
@@ -3197,6 +3198,16 @@ void libxl__domain_suspend_callback(void *data);
 void libxl__domain_suspend(libxl__egc *egc,
                            libxl__domain_suspend_state *dss);
 
+/* Remus callbacks for save */
+void libxl__remus_domain_suspend_callback(void *data);
+void libxl__remus_domain_resume_callback(void *data);
+void libxl__remus_domain_checkpoint_callback(void *data);
+/* Remus setup and teardown*/
+void libxl__remus_setup(libxl__egc *egc, libxl__domain_save_state *dss);
+void libxl__remus_teardown(libxl__egc *egc,
+                           libxl__domain_save_state *dss,
+                           int rc);
+
 
 /*
  * Convenience macros.
tools/libxl/libxl_remus.c new file +306 -0

306 lines not on this page · raw message

Signature · 1 line
1.9.1
#12 lore raw

Re: [PATCH v1 3/5] tools/libxl: move remus codes into libxl_remus.c

Quoted 1 line · Yang Hongyang

move remus codes into libxl_remus.c

"code"

Apart from dropping some "static" and adding some prototypes to the header this is purely motion, correct? (I assume this about the last one too).

tools/libxl/libxl_internal.h _hidden void libxl__remus_devices_commit(libxl__egc *egc, · line 2818

Quoted 9 lines
tools/libxl/libxl_internal.h +1 -0
index b2eeb89..c3d70eb 100644
@@ -2815,6 +2815,7 @@ _hidden void libxl__remus_devices_commit(libxl__egc *egc,
                                          libxl__remus_devices_state *rds);
 _hidden int libxl__netbuffer_enabled(libxl__gc *gc);
 
+

Please avoid spurious whitespace changes.

Quoted 6 lines
tools/libxl/libxl_internal.h +0 -0
 /*----- Domain suspend (save) state structure -----*/
 
 typedef struct libxl__domain_suspend_state libxl__domain_suspend_state;
@@ -3197,6 +3198,16 @@ void libxl__domain_suspend_callback(void *data);
 void libxl__domain_suspend(libxl__egc *egc,
                            libxl__domain_suspend_state *dss);

tools/libxl/libxl_internal.h void libxl__domain_suspend_callback(void *data); · line 3209

Quoted 10 lines
tools/libxl/libxl_internal.h +9 -0
 
+/* Remus callbacks for save */
+void libxl__remus_domain_suspend_callback(void *data);
+void libxl__remus_domain_resume_callback(void *data);
+void libxl__remus_domain_checkpoint_callback(void *data);
+/* Remus setup and teardown*/
+void libxl__remus_setup(libxl__egc *egc, libxl__domain_save_state *dss);
+void libxl__remus_teardown(libxl__egc *egc,
+                           libxl__domain_save_state *dss,
+                           int rc);

Please mark these all _hidden.

#13 lore raw

Re: [PATCH v1 3/5] tools/libxl: move remus codes into libxl_remus.c

Quoted 8 lines · Ian Campbell
Quoted 1 line · Yang Hongyang

move remus codes into libxl_remus.c

"code"

Apart from dropping some "static" and adding some prototypes to the header this is purely motion, correct? (I assume this about the last one too).

and add remus setup and teardown func. that's all.

Quoted 11 lines

tools/libxl/libxl_internal.h _hidden void libxl__remus_devices_commit(libxl__egc *egc, · line 2818

Quoted 9 lines
tools/libxl/libxl_internal.h +1 -0
index b2eeb89..c3d70eb 100644
@@ -2815,6 +2815,7 @@ _hidden void libxl__remus_devices_commit(libxl__egc *egc,
                                           libxl__remus_devices_state *rds);
  _hidden int libxl__netbuffer_enabled(libxl__gc *gc);
 
+

Please avoid spurious whitespace changes.

fixed.

Quoted 8 lines
Quoted 8 lines
tools/libxl/libxl_internal.h +0 -0
  /*----- Domain suspend (save) state structure -----*/
 
  typedef struct libxl__domain_suspend_state libxl__domain_suspend_state;
@@ -3197,6 +3198,16 @@ void libxl__domain_suspend_callback(void *data);
  void libxl__domain_suspend(libxl__egc *egc,
                             libxl__domain_suspend_state *dss);
 
Quoted 11 lines

tools/libxl/libxl_internal.h void libxl__domain_suspend_callback(void *data); · line 3209

Quoted 9 lines
tools/libxl/libxl_internal.h +9 -0
+/* Remus callbacks for save */
+void libxl__remus_domain_suspend_callback(void *data);
+void libxl__remus_domain_resume_callback(void *data);
+void libxl__remus_domain_checkpoint_callback(void *data);
+/* Remus setup and teardown*/
+void libxl__remus_setup(libxl__egc *egc, libxl__domain_save_state *dss);
+void libxl__remus_teardown(libxl__egc *egc,
+                           libxl__domain_save_state *dss,
+                           int rc);

Please mark these all _hidden.

ok.

Quoted 4 lines

.

Signature · 2 lines
Thanks,
Yang.
#14 lore raw

PATCH 4/5 tools/libxl: move toolstack code into libxl_toolstack.c

In reply to Yang Hongyang

move toolstack code into libxl_toolstack.c

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Andrew Cooper <[email protected]>
---
 tools/libxl/Makefile          |   2 +-
 tools/libxl/libxl_dom.c       | 171 ------------------------------------
 tools/libxl/libxl_toolstack.c | 196 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 197 insertions(+), 172 deletions(-)
 create mode 100644 tools/libxl/libxl_toolstack.c
tools/libxl/Makefile +1 -1
index a9abdbc..48f2cbb 100644
@@ -96,7 +96,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_json.o libxl_aoutils.o libxl_numa.o libxl_vnuma.o \
 			libxl_save_callout.o _libxl_save_msgs_callout.o \
 			libxl_qmp.o libxl_event.o libxl_fork.o libxl_dom_suspend.o \
-			$(LIBXL_OBJS-y)
+			libxl_toolstack.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
tools/libxl/libxl_dom.c +0 -171

183 lines not on this page · raw message

tools/libxl/libxl_toolstack.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
1.9.1
#15 lore raw

Re: [PATCH v1 4/5] tools/libxl: move toolstack code into libxl_toolstack.c

Quoted 1 line · Yang Hongyang

move toolstack code into libxl_toolstack.c

It's not clear to me what "toolstack code" is here, the whole of libxl and xl is "toolstack code".

Is the code being moved stuff to do with adding toolstack state to the save stream? Perhaps libxl_{suspend,save}_toolstack.c? Or could this not go in the libxl_dom_suspend.c you just created?

#16 lore raw

Re: [PATCH v1 4/5] tools/libxl: move toolstack code into libxl_toolstack.c

Quoted 9 lines · Ian Campbell
Quoted 1 line · Yang Hongyang

move toolstack code into libxl_toolstack.c

It's not clear to me what "toolstack code" is here, the whole of libxl and xl is "toolstack code".

Is the code being moved stuff to do with adding toolstack state to the save stream? Perhaps libxl_{suspend,save}_toolstack.c? Or could this not go in the libxl_dom_suspend.c you just created?

My thought was libxl_dom_suspend.c only contains code that do vm suspend stuff(not save). So compare to move it to dom_suspend.c, I prefer not move it or use libxl_{suspend,save}_toolstack.c. Maybe leave the code not moved?

Quoted 4 lines

.

Signature · 2 lines
Thanks,
Yang.
#17 lore raw

Re: [PATCH v1 4/5] tools/libxl: move toolstack code into libxl_toolstack.c

Quoted 9 lines · Yang Hongyang
Quoted 6 lines · Ian Campbell
Quoted 1 line · Yang Hongyang

move toolstack code into libxl_toolstack.c

It's not clear to me what "toolstack code" is here, the whole of libxl and xl is "toolstack code".

Quoted 8 lines
Quoted 3 lines

Is the code being moved stuff to do with adding toolstack state to the save stream? Perhaps libxl_{suspend,save}_toolstack.c? Or could this not go in the libxl_dom_suspend.c you just created?

My thought was libxl_dom_suspend.c only contains code that do vm suspend stuff(not save). So compare to move it to dom_suspend.c, I prefer not move it or use libxl_{suspend,save}_toolstack.c. Maybe leave the code not moved?

I think I'm going to move this code into libxl_dom_save.c, by merge this patch with the next patch.

Quoted 6 lines
Quoted 5 lines

.

Signature · 2 lines
Thanks,
Yang.
#18 lore raw

Re: [PATCH v1 4/5] tools/libxl: move toolstack code into libxl_toolstack.c

Quoted 15 lines · Yang Hongyang
Quoted 13 lines · Yang Hongyang
Quoted 9 lines · Ian Campbell
Quoted 1 line · Yang Hongyang

move toolstack code into libxl_toolstack.c

It's not clear to me what "toolstack code" is here, the whole of libxl and xl is "toolstack code".

Is the code being moved stuff to do with adding toolstack state to the save stream? Perhaps libxl_{suspend,save}_toolstack.c? Or could this not go in the libxl_dom_suspend.c you just created?

Quoted 7 lines
Quoted 4 lines

My thought was libxl_dom_suspend.c only contains code that do vm suspend stuff(not save). So compare to move it to dom_suspend.c, I prefer not move it or use libxl_{suspend,save}_toolstack.c. Maybe leave the code not moved?

I think I'm going to move this code into libxl_dom_save.c, by merge this patch with the next patch.

OK.

#19 lore raw

PATCH 5/5 tools/libxl: move domain save codes into libxl_dom_save.c

In reply to Yang Hongyang

move domain save codes into libxl_dom_save.c

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Andrew Cooper <[email protected]>
---
 tools/libxl/Makefile         |   2 +-
 tools/libxl/libxl_dom.c      | 468 ----------------------------------------
 tools/libxl/libxl_dom_save.c | 493 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 494 insertions(+), 469 deletions(-)
 create mode 100644 tools/libxl/libxl_dom_save.c
tools/libxl/Makefile +1 -1
index 48f2cbb..105a989 100644
@@ -96,7 +96,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_json.o libxl_aoutils.o libxl_numa.o libxl_vnuma.o \
 			libxl_save_callout.o _libxl_save_msgs_callout.o \
 			libxl_qmp.o libxl_event.o libxl_fork.o libxl_dom_suspend.o \
-			libxl_toolstack.o $(LIBXL_OBJS-y)
+			libxl_toolstack.o libxl_dom_save.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
tools/libxl/libxl_dom.c +0 -468

474 lines not on this page · raw message

tools/libxl/libxl_dom_save.c new file +493 -0

493 lines not on this page · raw message

Signature · 1 line
1.9.1
#20 lore raw
In reply to Yang Hongyang

ping...

Quoted 38 lines · Yang Hongyang

This patchset mainly focus on libxl save, most of the patches are simply move codes out of libxl_dom.c, no functional changes, may conflict with Andrew Cooper's libxl work for migration v2, so CCed Andrew for comments.

For convenience, my previous sent patch
[PATCH v1] libxl/save: Refactor libxl__domain_suspend_state
is included in this series because all the other patches in this series are based on that.

Please see individual patch for detail.

Can get the whole patchset from:
https://github.com/macrosheep/xen/tree/misc-libxl-v1

Yang Hongyang (5):
libxl/save: Refactor libxl__domain_suspend_state tools/libxl: move domain suspend codes into a separate file tools/libxl: move remus codes into libxl_remus.c tools/libxl: move toolstack code into libxl_toolstack.c tools/libxl: move domain save codes into libxl_dom_save.c

  tools/libxl/Makefile             |    5 +-
  tools/libxl/libxl.c              |   67 +--
  tools/libxl/libxl_dom.c          | 1202 --------------------------------------
  tools/libxl/libxl_dom_save.c     |  493 ++++++++++++++++
  tools/libxl/libxl_dom_suspend.c  |  400 +++++++++++++
  tools/libxl/libxl_internal.h     |   62 +-
  tools/libxl/libxl_netbuffer.c    |    2 +-
  tools/libxl/libxl_remus.c        |  306 ++++++++++
  tools/libxl/libxl_save_callout.c |    2 +-
  tools/libxl/libxl_toolstack.c    |  196 +++++++
  10 files changed, 1452 insertions(+), 1283 deletions(-)

create mode 100644 tools/libxl/libxl_dom_save.c create mode 100644 tools/libxl/libxl_dom_suspend.c create mode 100644 tools/libxl/libxl_remus.c create mode 100644 tools/libxl/libxl_toolstack.c

Signature · 2 lines
Thanks,
Yang.
#21 lore raw
In reply to Yang Hongyang

On Wed, 2015-05-20 at 18:01 +0800, Yang Hongyang wrote:

I've just been through this, sorry for the delay.

I also have written on my TODO list "Remus on Migration-v2 (v7)", but I have no such patches in my folders and I think I already applied everything to do with that, so I think that's just a stale entry. If there's something remus related I've dropped please point me at it.

"[PATCH v1 COLO Pre 00/12]" from earlier is on my TODO list separately already.

Quoted 38 lines

This patchset mainly focus on libxl save, most of the patches are simply move codes out of libxl_dom.c, no functional changes, may conflict with Andrew Cooper's libxl work for migration v2, so CCed Andrew for comments.

For convenience, my previous sent patch
[PATCH v1] libxl/save: Refactor libxl__domain_suspend_state
is included in this series because all the other patches in this series are based on that.

Please see individual patch for detail.

Can get the whole patchset from:
https://github.com/macrosheep/xen/tree/misc-libxl-v1

Yang Hongyang (5):
libxl/save: Refactor libxl__domain_suspend_state tools/libxl: move domain suspend codes into a separate file tools/libxl: move remus codes into libxl_remus.c tools/libxl: move toolstack code into libxl_toolstack.c tools/libxl: move domain save codes into libxl_dom_save.c

 tools/libxl/Makefile             |    5 +-
 tools/libxl/libxl.c              |   67 +--
 tools/libxl/libxl_dom.c          | 1202 --------------------------------------
 tools/libxl/libxl_dom_save.c     |  493 ++++++++++++++++
 tools/libxl/libxl_dom_suspend.c  |  400 +++++++++++++
 tools/libxl/libxl_internal.h     |   62 +-
 tools/libxl/libxl_netbuffer.c    |    2 +-
 tools/libxl/libxl_remus.c        |  306 ++++++++++
 tools/libxl/libxl_save_callout.c |    2 +-
 tools/libxl/libxl_toolstack.c    |  196 +++++++
 10 files changed, 1452 insertions(+), 1283 deletions(-)
 create mode 100644 tools/libxl/libxl_dom_save.c
 create mode 100644 tools/libxl/libxl_dom_suspend.c
 create mode 100644 tools/libxl/libxl_remus.c
 create mode 100644 tools/libxl/libxl_toolstack.c
#22 lore raw

Hi Ian,

Thank you very much for taking time to review this!

Quoted 8 lines · Ian Campbell

On Wed, 2015-05-20 at 18:01 +0800, Yang Hongyang wrote:

I've just been through this, sorry for the delay.

I also have written on my TODO list "Remus on Migration-v2 (v7)", but I have no such patches in my folders and I think I already applied everything to do with that, so I think that's just a stale entry. If there's something remus related I've dropped please point me at it.

Yeah, you have already applied all Remus on Migration-v2 stuff. Thanks again..

Quoted 3 lines

"[PATCH v1 COLO Pre 00/12]" from earlier is on my TODO list separately already.

Thank you!

Quoted 43 lines
Quoted 34 lines

This patchset mainly focus on libxl save, most of the patches are simply move codes out of libxl_dom.c, no functional changes, may conflict with Andrew Cooper's libxl work for migration v2, so CCed Andrew for comments.

For convenience, my previous sent patch
[PATCH v1] libxl/save: Refactor libxl__domain_suspend_state
is included in this series because all the other patches in this series are based on that.

Please see individual patch for detail.

Can get the whole patchset from:
https://github.com/macrosheep/xen/tree/misc-libxl-v1

Yang Hongyang (5):
libxl/save: Refactor libxl__domain_suspend_state tools/libxl: move domain suspend codes into a separate file tools/libxl: move remus codes into libxl_remus.c tools/libxl: move toolstack code into libxl_toolstack.c tools/libxl: move domain save codes into libxl_dom_save.c

  tools/libxl/Makefile             |    5 +-
  tools/libxl/libxl.c              |   67 +--
  tools/libxl/libxl_dom.c          | 1202 --------------------------------------
  tools/libxl/libxl_dom_save.c     |  493 ++++++++++++++++
  tools/libxl/libxl_dom_suspend.c  |  400 +++++++++++++
  tools/libxl/libxl_internal.h     |   62 +-
  tools/libxl/libxl_netbuffer.c    |    2 +-
  tools/libxl/libxl_remus.c        |  306 ++++++++++
  tools/libxl/libxl_save_callout.c |    2 +-
  tools/libxl/libxl_toolstack.c    |  196 +++++++
  10 files changed, 1452 insertions(+), 1283 deletions(-)
Quoted 5 lines

create mode 100644 tools/libxl/libxl_dom_save.c create mode 100644 tools/libxl/libxl_dom_suspend.c create mode 100644 tools/libxl/libxl_remus.c create mode 100644 tools/libxl/libxl_toolstack.c

.

Signature · 2 lines
Thanks,
Yang.