xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back
@ 2016-04-04 16:58 Ian.Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian.Jackson @ 2016-04-04 16:58 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Lars Kurth, Li Zhijian, Changlong Xie, Wei Liu, Ian Campbell,
	Wen Congyang, Andrew Cooper, Jiang Yunhong, Dong Eddie,
	xen devel, Anthony Perard, Jim Fehlig, Gui Jianfeng,
	Shriram Rajagopalan, Yang Hongyang

Olaf Hering writes ("Re: [Xen-devel] [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back"):
> On Mon, Apr 04, Wei Liu wrote:
> > The fix is to patch libvirt. Looking at libvirt code I think I need to
> > patch Makefile.in to pass in an explicit LIBXL_API_VERSION number.
> 
> That might be true.
> 
> But shouldnt at the same time libxl.h get a change to recognize
> 0x040700? Perhaps this will be part of the release management.

It is on the release checklist.  But perhaps we should do it now.
Patch welcome :-).

Thanks,
Ian.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back
  2016-04-04 13:02     ` Wei Liu
@ 2016-04-04 15:29       ` Olaf Hering
  0 siblings, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2016-04-04 15:29 UTC (permalink / raw)
  To: Wei Liu
  Cc: Lars Kurth, Li Zhijian, Changlong Xie, Ian Campbell,
	Wen Congyang, Andrew Cooper, Jiang Yunhong, Ian Jackson,
	xen devel, Anthony Perard, Jim Fehlig, Dong Eddie, Gui Jianfeng,
	Shriram Rajagopalan, Yang Hongyang

On Mon, Apr 04, Wei Liu wrote:

> The fix is to patch libvirt. Looking at libvirt code I think I need to
> patch Makefile.in to pass in an explicit LIBXL_API_VERSION number.

That might be true.

But shouldnt at the same time libxl.h get a change to recognize
0x040700? Perhaps this will be part of the release management.

For the time being this change fixes it for me:

+++ libvirt.spec        (working copy)
@@ -1163,6 +1163,7 @@

 autoreconf -f -i
 export CFLAGS="$RPM_OPT_FLAGS"
+export CFLAGS="$CFLAGS -DLIBXL_API_VERSION=0x040500"
 %configure --disable-static --with-pic \
            %{?_without_xen} \
            %{?_without_qemu} \

Olaf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back
  2016-04-04 12:07   ` Olaf Hering
@ 2016-04-04 13:02     ` Wei Liu
  2016-04-04 15:29       ` Olaf Hering
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2016-04-04 13:02 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Lars Kurth, Li Zhijian, Changlong Xie, Wei Liu, Ian Campbell,
	Wen Congyang, Andrew Cooper, Jiang Yunhong, Ian Jackson,
	xen devel, Shriram Rajagopalan, Jim Fehlig, Dong Eddie,
	Gui Jianfeng, Anthony Perard, Yang Hongyang

CC Jim

On Mon, Apr 04, 2016 at 02:07:28PM +0200, Olaf Hering wrote:
> On Fri, Mar 25, Changlong Xie wrote:
> 
> > +#elif defined(LIBXL_API_VERSION) && LIBXL_API_VERSION >= 0x040400 \
> > +                                 && LIBXL_API_VERSION < 0x040700
> 
> Is this supposed to work? libvirt.git fails to build now:
> 
> libxl/libxl_domain.c: In function 'libxlDomainStart':
> libxl/libxl_domain.c:1077: warning: passing argument 5 of 'libxl_domain_create_restore' makes integer from pointer without a cast
> libxl/libxl_domain.c:1077: warning: passing argument 7 of 'libxl_domain_create_restore' from incompatible pointer type
> libxl/libxl_domain.c:1077: error: too few arguments to function 'libxl_domain_create_restore'
> make[3]: *** [libxl/libvirt_driver_libxl_impl_la-libxl_domain.lo] Error 1
> 

From the look of it that's because libvirt doesn't have
LIBXL_API_VERSION defined before including libxl.h, so it always gets
the latest API.

The fix is to patch libvirt. Looking at libvirt code I think I need to
patch Makefile.in to pass in an explicit LIBXL_API_VERSION number.

Jim, does that sound right?

Wei.

> Olaf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back
  2016-03-25  6:44 ` [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back Changlong Xie
@ 2016-04-04 12:07   ` Olaf Hering
  2016-04-04 13:02     ` Wei Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2016-04-04 12:07 UTC (permalink / raw)
  To: Changlong Xie
  Cc: Lars Kurth, Li Zhijian, Wei Liu, Ian Campbell, Wen Congyang,
	Andrew Cooper, Jiang Yunhong, Ian Jackson, xen devel,
	Shriram Rajagopalan, Dong Eddie, Gui Jianfeng, Anthony Perard,
	Yang Hongyang

On Fri, Mar 25, Changlong Xie wrote:

> +#elif defined(LIBXL_API_VERSION) && LIBXL_API_VERSION >= 0x040400 \
> +                                 && LIBXL_API_VERSION < 0x040700

Is this supposed to work? libvirt.git fails to build now:

libxl/libxl_domain.c: In function 'libxlDomainStart':
libxl/libxl_domain.c:1077: warning: passing argument 5 of 'libxl_domain_create_restore' makes integer from pointer without a cast
libxl/libxl_domain.c:1077: warning: passing argument 7 of 'libxl_domain_create_restore' from incompatible pointer type
libxl/libxl_domain.c:1077: error: too few arguments to function 'libxl_domain_create_restore'
make[3]: *** [libxl/libvirt_driver_libxl_impl_la-libxl_domain.lo] Error 1

Olaf

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back
  2016-03-25  6:44 [PATCH v13 00/26] COarse-grain LOck-stepping Virtual Machines for Non-stop Service Changlong Xie
@ 2016-03-25  6:44 ` Changlong Xie
  2016-04-04 12:07   ` Olaf Hering
  0 siblings, 1 reply; 5+ messages in thread
From: Changlong Xie @ 2016-03-25  6:44 UTC (permalink / raw)
  To: xen devel, Konrad Rzeszutek Wilk, Andrew Cooper, Ian Campbell,
	Ian Jackson, Wei Liu
  Cc: Lars Kurth, Changlong Xie, Wen Congyang, Li Zhijian,
	Gui Jianfeng, Jiang Yunhong, Dong Eddie, Anthony Perard,
	Shriram Rajagopalan, Yang Hongyang

From: Wen Congyang <wency@cn.fujitsu.com>

In COLO mode, secondary needs to send the following data to primary:
1. In libxl
   Secondary sends the following CHECKPOINT_CONTEXT to primary:
   CHECKPOINT_SVM_SUSPENDED, CHECKPOINT_SVM_READY and CHECKPOINT_SVM_RESUMED
2. In libxc
   Secondary sends the dirty pfn list to primary

But the io_fd only can be written in primary, and only can be read in
secondary. Save recv_fd in domain_suspend_state, and send_fd in
domain_create_state. Extend libxl_domain_create_restore API, add a
send_fd param to it. Add LIBXL_HAVE_CREATE_RESTORE_SEND_FD to indicate
the API change.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yang Hongyang <hongyang.yang@easystack.cn>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl.c                  |  3 +--
 tools/libxl/libxl.h                  | 29 ++++++++++++++++++++++++++++-
 tools/libxl/libxl_create.c           | 11 +++++++----
 tools/libxl/libxl_internal.h         |  2 ++
 tools/libxl/xl_cmdimpl.c             |  8 +++++++-
 tools/ocaml/libs/xl/xenlight_stubs.c |  2 +-
 6 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 3471c4c..6bc46cb 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -834,7 +834,6 @@ out:
 static void remus_failover_cb(libxl__egc *egc,
                               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,
                              uint32_t domid, int send_fd, int recv_fd,
                              const libxl_asyncop_how *ao_how)
@@ -871,7 +870,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,
     dss->callback = remus_failover_cb;
     dss->domid = domid;
     dss->fd = send_fd;
-    /* TODO do something with recv_fd */
+    dss->recv_fd = recv_fd;
     dss->type = type;
     dss->live = 1;
     dss->debug = 0;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index f61bc4b..a569286 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -651,6 +651,15 @@ typedef struct libxl__ctx libxl_ctx;
 #define LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
 
 /*
+ * LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD 1
+ *
+ * If this is defined, libxl_domain_create_restore()'s API includes the
+ * send_back_fd param. This is used only with COLO, for the libxl migration
+ * back channel; other callers should pass -1.
+ */
+#define LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD 1
+
+/*
  * LIBXL_HAVE_CREATEINFO_PVH
  * If this is defined, then libxl supports creation of a PVH guest.
  */
@@ -1177,6 +1186,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
                             LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
                                 uint32_t *domid, int restore_fd,
+                                int send_back_fd,
                                 const libxl_domain_restore_params *params,
                                 const libxl_asyncop_how *ao_how,
                                 const libxl_asyncprogress_how *aop_console_how)
@@ -1197,7 +1207,7 @@ int static inline libxl_domain_create_restore_0x040200(
     libxl_domain_restore_params_init(&params);
 
     ret = libxl_domain_create_restore(
-        ctx, d_config, domid, restore_fd, &params, ao_how, aop_console_how);
+        ctx, d_config, domid, restore_fd, -1, &params, ao_how, aop_console_how);
 
     libxl_domain_restore_params_dispose(&params);
     return ret;
@@ -1205,6 +1215,23 @@ int static inline libxl_domain_create_restore_0x040200(
 
 #define libxl_domain_create_restore libxl_domain_create_restore_0x040200
 
+#elif defined(LIBXL_API_VERSION) && LIBXL_API_VERSION >= 0x040400 \
+                                 && LIBXL_API_VERSION < 0x040700
+
+int static inline libxl_domain_create_restore_0x040400(
+    libxl_ctx *ctx, libxl_domain_config *d_config,
+    uint32_t *domid, int restore_fd,
+    const libxl_domain_restore_params *params,
+    const libxl_asyncop_how *ao_how,
+    const libxl_asyncprogress_how *aop_console_how)
+    LIBXL_EXTERNAL_CALLERS_ONLY
+{
+    return libxl_domain_create_restore(ctx, d_config, domid, restore_fd,
+                                       -1, params, ao_how, aop_console_how);
+}
+
+#define libxl_domain_create_restore libxl_domain_create_restore_0x040400
+
 #endif
 
 int libxl_domain_soft_reset(libxl_ctx *ctx,
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 61b5c01..09f2f13 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1639,7 +1639,7 @@ static void domain_create_cb(libxl__egc *egc,
                              int rc, uint32_t domid);
 
 static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
-                            uint32_t *domid, int restore_fd,
+                            uint32_t *domid, int restore_fd, int send_back_fd,
                             const libxl_domain_restore_params *params,
                             const libxl_asyncop_how *ao_how,
                             const libxl_asyncprogress_how *aop_console_how)
@@ -1654,6 +1654,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
     libxl_domain_config_init(&cdcs->dcs.guest_config_saved);
     libxl_domain_config_copy(ctx, &cdcs->dcs.guest_config_saved, d_config);
     cdcs->dcs.restore_fd = cdcs->dcs.libxc_fd = restore_fd;
+    cdcs->dcs.send_back_fd = send_back_fd;
     if (restore_fd > -1) {
         cdcs->dcs.restore_params = *params;
         rc = libxl__fd_flags_modify_save(gc, cdcs->dcs.restore_fd,
@@ -1832,18 +1833,20 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
                             const libxl_asyncop_how *ao_how,
                             const libxl_asyncprogress_how *aop_console_how)
 {
-    return do_domain_create(ctx, d_config, domid, -1, NULL,
+    return do_domain_create(ctx, d_config, domid, -1, -1, NULL,
                             ao_how, aop_console_how);
 }
 
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config,
                                 uint32_t *domid, int restore_fd,
+                                int send_back_fd,
                                 const libxl_domain_restore_params *params,
                                 const libxl_asyncop_how *ao_how,
                                 const libxl_asyncprogress_how *aop_console_how)
 {
-    return do_domain_create(ctx, d_config, domid, restore_fd, params,
-                            ao_how, aop_console_how);
+    assert(send_back_fd == -1);
+    return do_domain_create(ctx, d_config, domid, restore_fd, send_back_fd,
+                            params, ao_how, aop_console_how);
 }
 
 int libxl_domain_soft_reset(libxl_ctx *ctx,
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index de65d85..42d8bbd 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3150,6 +3150,7 @@ struct libxl__domain_save_state {
     uint32_t domid;
     int fd;
     int fdfl; /* original flags on fd */
+    int recv_fd;
     libxl_domain_type type;
     int live;
     int debug;
@@ -3491,6 +3492,7 @@ struct libxl__domain_create_state {
     libxl_domain_config guest_config_saved; /* vanilla config */
     int restore_fd, libxc_fd;
     int restore_fdfl; /* original flags of restore_fd */
+    int send_back_fd;
     libxl_domain_restore_params restore_params;
     uint32_t domid_soft_reset;
     libxl__domain_create_cb *callback;
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index a3610fc..2e64f44 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -159,6 +159,7 @@ struct domain_create {
     char *extra_config; /* extra config string */
     const char *restore_file;
     int migrate_fd; /* -1 means none */
+    int send_back_fd; /* -1 means none */
     char **migration_domname_r; /* from malloc */
 };
 
@@ -2796,6 +2797,7 @@ static uint32_t create_domain(struct domain_create *dom_info)
     int config_len = 0;
     int restore_fd = -1;
     int restore_fd_to_close = -1;
+    int send_back_fd = -1;
     const libxl_asyncprogress_how *autoconnect_console_how;
     struct save_file_header hdr;
     uint32_t domid_soft_reset = INVALID_DOMID;
@@ -2813,6 +2815,7 @@ static uint32_t create_domain(struct domain_create *dom_info)
         if (migrate_fd >= 0) {
             restore_source = "<incoming migration stream>";
             restore_fd = migrate_fd;
+            send_back_fd = dom_info->send_back_fd;
         } else {
             restore_source = restore_file;
             restore_fd = open(restore_file, O_RDONLY);
@@ -3001,7 +3004,7 @@ start:
 
         ret = libxl_domain_create_restore(ctx, &d_config,
                                           &domid, restore_fd,
-                                          &params,
+                                          send_back_fd, &params,
                                           0, autoconnect_console_how);
 
         libxl_domain_restore_params_dispose(&params);
@@ -4754,6 +4757,7 @@ static void migrate_receive(int debug, int daemonize, int monitor,
     dom_info.monitor = monitor;
     dom_info.paused = 1;
     dom_info.migrate_fd = recv_fd;
+    dom_info.send_back_fd = -1;
     dom_info.migration_domname_r = &migration_domname;
     dom_info.checkpointed_stream = checkpointed;
 
@@ -4927,6 +4931,7 @@ int main_restore(int argc, char **argv)
     dom_info.config_file = config_file;
     dom_info.restore_file = checkpoint_file;
     dom_info.migrate_fd = -1;
+    dom_info.send_back_fd = -1;
     dom_info.vnc = vnc;
     dom_info.vncautopass = vncautopass;
     dom_info.console_autoconnect = console_autoconnect;
@@ -5394,6 +5399,7 @@ int main_create(int argc, char **argv)
     dom_info.quiet = quiet;
     dom_info.config_file = filename;
     dom_info.migrate_fd = -1;
+    dom_info.send_back_fd = -1;
     dom_info.vnc = vnc;
     dom_info.vncautopass = vncautopass;
     dom_info.console_autoconnect = console_autoconnect;
diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c
index 4133527..98b52b9 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -538,7 +538,7 @@ value stub_libxl_domain_create_restore(value ctx, value domain_config, value par
 
 	caml_enter_blocking_section();
 	ret = libxl_domain_create_restore(CTX, &c_dconfig, &c_domid, restore_fd,
-		&c_params, ao_how, NULL);
+		-1, &c_params, ao_how, NULL);
 	caml_leave_blocking_section();
 
 	free(ao_how);
-- 
1.9.3




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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-04 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 16:58 [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back Ian.Jackson
  -- strict thread matches above, loose matches on Subject: below --
2016-03-25  6:44 [PATCH v13 00/26] COarse-grain LOck-stepping Virtual Machines for Non-stop Service Changlong Xie
2016-03-25  6:44 ` [PATCH v13 03/26] tools/libxl: Add back channel to allow migration target send data back Changlong Xie
2016-04-04 12:07   ` Olaf Hering
2016-04-04 13:02     ` Wei Liu
2016-04-04 15:29       ` Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).