xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] COLO: only build on Linux
@ 2016-04-05 20:05 Wei Liu
  2016-04-05 20:06 ` [PATCH 1/3] libxl: colo: rearrange things in header files Wei Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Wei Liu @ 2016-04-05 20:05 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Changlong Xie, Ian Jackson, Wen Congyang, Roger Pau Monné

COLO depends on netlink which is only available on Linux. This series cleans up
COLO code and make it only build on Linux. This should fix FreeBSD build.

Congyang and Changlong, please review this series as soon as possible. I also
have a question why COLO doesn't use libnl? It is using Linux header directly.

Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.

Wei.

Wei Liu (3):
  libxl: colo: rearrange things in header files
  libxl: colo: move netlink related stuff to libxl_colo_proxy.c
  libxl: colo: only build COLO on Linux

 tools/libxl/Makefile           |  5 ++++
 tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
 tools/libxl/libxl_colo_proxy.c | 13 +++++++++
 tools/libxl/libxl_internal.h   | 36 ++++++++----------------
 tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 117 insertions(+), 51 deletions(-)
 create mode 100644 tools/libxl/libxl_no_colo.c

-- 
2.1.4


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

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

* [PATCH 1/3] libxl: colo: rearrange things in header files
  2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
@ 2016-04-05 20:06 ` Wei Liu
  2016-04-06 13:41   ` Ian Jackson
  2016-04-05 20:06 ` [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c Wei Liu
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Wei Liu @ 2016-04-05 20:06 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Changlong Xie, Ian Jackson, Wen Congyang, Roger Pau Monné

We need to separate COLO code from common code as clean as possible.
With this patch, all COLO structures are now in libxl_colo.h.

It does the following:
1. Move two typedefs for libxl__domain_create_state{,cb} back to
   libxl_internal.h.
2. Move libxl__colo_save_state to libxl_colo.h.
3. Include libxl_internal.h in libxl_colo.h.
4. Move a bunch of colo typedefs to the top of libxl_internal.h.
5. Move the inclusion of libxl_colo.h to the right place in
   libxl_internal.h.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_colo.h     | 40 +++++++++++++++++++++++++---------------
 tools/libxl/libxl_internal.h | 36 ++++++++++++------------------------
 2 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h
index 30fd1dc..4f6a612 100644
--- a/tools/libxl/libxl_colo.h
+++ b/tools/libxl/libxl_colo.h
@@ -16,13 +16,9 @@
 #ifndef LIBXL_COLO_H
 #define LIBXL_COLO_H
 
+#include "libxl_internal.h"
 #include <linux/netlink.h>
 
-struct libxl__ao;
-struct libxl__egc;
-struct libxl__colo_save_state;
-struct libxl__checkpoint_devices_state;
-
 /* Consistent with the new COLO netlink channel in kernel side */
 #define NETLINK_COLO 28
 
@@ -65,16 +61,15 @@ enum colo_netlink_op {
     COLO_PROXY_RESET, /* UNUSED, will be used for continuous FT */
 };
 
-typedef struct libxl__colo_device_nic {
+struct libxl__colo_device_nic {
     int devid;
     const char *vif;
-} libxl__colo_device_nic;
+};
 
-typedef struct libxl__colo_qdisk {
+struct libxl__colo_qdisk {
     bool setuped;
-} libxl__colo_qdisk;
+};
 
-typedef struct libxl__colo_proxy_state libxl__colo_proxy_state;
 struct libxl__colo_proxy_state {
     /* set by caller of colo_proxy_setup */
     struct libxl__ao *ao;
@@ -83,12 +78,27 @@ struct libxl__colo_proxy_state {
     int index;
 };
 
-typedef struct libxl__domain_create_state libxl__domain_create_state;
-typedef void libxl__domain_create_cb(struct libxl__egc *egc,
-                                     libxl__domain_create_state *dcs,
-                                     int rc, uint32_t domid);
+struct libxl__colo_save_state {
+    int send_fd;
+    int recv_fd;
+    char *colo_proxy_script;
+
+    /* private */
+    libxl__stream_read_state srs;
+    void (*callback)(libxl__egc *, libxl__colo_save_state *, int);
+    bool svm_running;
+    bool paused;
+
+    /* private, used by qdisk block replication */
+    bool qdisk_used;
+    bool qdisk_setuped;
+
+    /* private, used by colo-proxy */
+    libxl__colo_proxy_state cps;
+    libxl__ev_child child;
+};
+
 
-typedef struct libxl__colo_restore_state libxl__colo_restore_state;
 typedef void libxl__colo_callback(struct libxl__egc *egc,
                                   libxl__colo_restore_state *crs, int rc);
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7df2711..0107298 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -87,8 +87,6 @@
 #include "_libxl_types_internal.h"
 #include "_libxl_types_internal_json.h"
 
-#include "libxl_colo.h"
-
 #define LIBXL_INIT_TIMEOUT 10
 #define LIBXL_DESTROY_TIMEOUT 10
 #define LIBXL_HOTPLUG_TIMEOUT 40
@@ -184,6 +182,17 @@ typedef struct libxl__aop_occurred libxl__aop_occurred;
 typedef struct libxl__osevent_hook_nexus libxl__osevent_hook_nexus;
 typedef struct libxl__osevent_hook_nexi libxl__osevent_hook_nexi;
 
+typedef struct libxl__domain_create_state libxl__domain_create_state;
+typedef void libxl__domain_create_cb(struct libxl__egc *egc,
+                                     libxl__domain_create_state *dcs,
+                                     int rc, uint32_t domid);
+
+typedef struct libxl__colo_device_nic libxl__colo_device_nic;
+typedef struct libxl__colo_qdisk libxl__colo_qdisk;
+typedef struct libxl__colo_proxy_state libxl__colo_proxy_state;
+typedef struct libxl__colo_save_state libxl__colo_save_state;
+typedef struct libxl__colo_restore_state libxl__colo_restore_state;
+
 _hidden void libxl__alloc_failed(libxl_ctx *, const char *func,
                          size_t nmemb, size_t size) __attribute__((noreturn));
   /* func, size and nmemb are used only in the log message.
@@ -3134,6 +3143,7 @@ libxl__stream_read_inuse(const libxl__stream_read_state *stream)
     return stream->running;
 }
 
+#include "libxl_colo.h"
 
 /*----- Domain suspend (save) state structure -----*/
 /*
@@ -3210,28 +3220,6 @@ libxl__stream_write_inuse(const libxl__stream_write_state *stream)
     return stream->running;
 }
 
-/*----- colo related state structure -----*/
-typedef struct libxl__colo_save_state libxl__colo_save_state;
-struct libxl__colo_save_state {
-    int send_fd;
-    int recv_fd;
-    char *colo_proxy_script;
-
-    /* private */
-    libxl__stream_read_state srs;
-    void (*callback)(libxl__egc *, libxl__colo_save_state *, int);
-    bool svm_running;
-    bool paused;
-
-    /* private, used by qdisk block replication */
-    bool qdisk_used;
-    bool qdisk_setuped;
-
-    /* private, used by colo-proxy */
-    libxl__colo_proxy_state cps;
-    libxl__ev_child child;
-};
-
 typedef struct libxl__logdirty_switch {
     /* Set by caller of libxl__domain_common_switch_qemu_logdirty */
     libxl__ao *ao;
-- 
2.1.4


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

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

* [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c
  2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
  2016-04-05 20:06 ` [PATCH 1/3] libxl: colo: rearrange things in header files Wei Liu
@ 2016-04-05 20:06 ` Wei Liu
  2016-04-06 13:41   ` Ian Jackson
  2016-04-05 20:06 ` [PATCH 3/3] libxl: colo: only build COLO on Linux Wei Liu
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Wei Liu @ 2016-04-05 20:06 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Changlong Xie, Ian Jackson, Wen Congyang, Roger Pau Monné

They are only used there, no need to expose them to other parts of
libxl.

This is necessary to make libxl build on FreeBSD again because FreeBSD
doesn't have netlink.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_colo.h       | 12 ------------
 tools/libxl/libxl_colo_proxy.c | 13 +++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h
index 4f6a612..f0e438e 100644
--- a/tools/libxl/libxl_colo.h
+++ b/tools/libxl/libxl_colo.h
@@ -17,10 +17,6 @@
 #define LIBXL_COLO_H
 
 #include "libxl_internal.h"
-#include <linux/netlink.h>
-
-/* Consistent with the new COLO netlink channel in kernel side */
-#define NETLINK_COLO 28
 
 /* Maximum time(5s) to wait for colo proxy checkpoit */
 #define COLO_PROXY_CHECKPOINT_TIMEOUT 5000000
@@ -53,14 +49,6 @@ enum {
     LIBXL_COLO_RESUMED,
 };
 
-enum colo_netlink_op {
-    COLO_QUERY_CHECKPOINT = (NLMSG_MIN_TYPE + 1),
-    COLO_CHECKPOINT,
-    COLO_FAILOVER,
-    COLO_PROXY_INIT,
-    COLO_PROXY_RESET, /* UNUSED, will be used for continuous FT */
-};
-
 struct libxl__colo_device_nic {
     int devid;
     const char *vif;
diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index 991bd0d..034e76c 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -17,6 +17,19 @@
 
 #include "libxl_internal.h"
 
+#include <linux/netlink.h>
+
+/* Consistent with the new COLO netlink channel in kernel side */
+#define NETLINK_COLO 28
+
+enum colo_netlink_op {
+    COLO_QUERY_CHECKPOINT = (NLMSG_MIN_TYPE + 1),
+    COLO_CHECKPOINT,
+    COLO_FAILOVER,
+    COLO_PROXY_INIT,
+    COLO_PROXY_RESET, /* UNUSED, will be used for continuous FT */
+};
+
 /* ========= colo-proxy: helper functions ========== */
 
 static int colo_proxy_send(libxl__colo_proxy_state *cps, uint8_t *buff,
-- 
2.1.4


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

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

* [PATCH 3/3] libxl: colo: only build COLO on Linux
  2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
  2016-04-05 20:06 ` [PATCH 1/3] libxl: colo: rearrange things in header files Wei Liu
  2016-04-05 20:06 ` [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c Wei Liu
@ 2016-04-05 20:06 ` Wei Liu
  2016-04-06 10:24   ` Wei Liu
  2016-04-06  1:24 ` [PATCH 0/3] COLO: only build " Wen Congyang
  2016-04-06  6:19 ` Changlong Xie
  4 siblings, 1 reply; 12+ messages in thread
From: Wei Liu @ 2016-04-05 20:06 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Changlong Xie, Ian Jackson, Wen Congyang, Roger Pau Monné

Linux's netlink is required when initialising COLO, so make sure only to
compile COLO on Linux.

Provide necessary stub functions in case COLO is disabled. This should
fix libxl build on FreeBSD.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/Makefile        |  5 ++++
 tools/libxl/libxl_no_colo.c | 62 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 tools/libxl/libxl_no_colo.c

diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index a433aaa..47564b3 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -65,10 +65,15 @@ LIBXL_OBJS-y += libxl_no_convert_callout.o
 endif
 
 LIBXL_OBJS-y += libxl_remus.o libxl_checkpoint_device.o libxl_remus_disk_drbd.o
+
+ifeq ($(CONFIG_Linux),y)
 LIBXL_OBJS-y += libxl_colo_restore.o libxl_colo_save.o
 LIBXL_OBJS-y += libxl_colo_qdisk.o
 LIBXL_OBJS-y += libxl_colo_proxy.o
 LIBXL_OBJS-y += libxl_colo_nic.o
+else
+LIBXL_OBJS-y += libxl_no_colo.o
+endif
 
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o
 LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
diff --git a/tools/libxl/libxl_no_colo.c b/tools/libxl/libxl_no_colo.c
new file mode 100644
index 0000000..152f198
--- /dev/null
+++ b/tools/libxl/libxl_no_colo.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016
+ * Author Wei Liu <wei.liu2@citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_osdeps.h" /* must come before any other headers */
+
+#include "libxl_internal.h"
+
+void libxl__colo_restore_setup(libxl__egc *egc,
+                               libxl__colo_restore_state *crs)
+{
+    STATE_AO_GC(crs->ao);
+
+    LOG(ERROR, "COLO is not supported");
+
+    crs->callback(egc, crs, ERROR_FAIL);
+}
+
+void libxl__colo_restore_teardown(libxl__egc *egc, void *dcs_void,
+                                  int ret, int retval, int errnoval)
+{
+    /* Shouldn't be here because setup already failed */
+    abort();
+}
+
+void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css)
+{
+    libxl__domain_save_state *dss = CONTAINER_OF(css, *dss, css);
+    STATE_AO_GC(dss->ao);
+
+    LOG(ERROR, "COLO is not supported");
+
+    dss->callback(egc, dss, ERROR_FAIL);
+}
+
+void libxl__colo_save_teardown(libxl__egc *egc,
+                               libxl__colo_save_state *css,
+                               int rc)
+{
+    /* Shouldn't be here because setup already failed */
+    abort();
+}
+
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
2.1.4


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

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

* Re: [PATCH 0/3] COLO: only build on Linux
  2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
                   ` (2 preceding siblings ...)
  2016-04-05 20:06 ` [PATCH 3/3] libxl: colo: only build COLO on Linux Wei Liu
@ 2016-04-06  1:24 ` Wen Congyang
  2016-04-06 10:17   ` Wei Liu
  2016-04-06  6:19 ` Changlong Xie
  4 siblings, 1 reply; 12+ messages in thread
From: Wen Congyang @ 2016-04-06  1:24 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Changlong Xie, Ian Jackson, Roger Pau Monné

On 04/06/2016 04:05 AM, Wei Liu wrote:
> COLO depends on netlink which is only available on Linux. This series cleans up
> COLO code and make it only build on Linux. This should fix FreeBSD build.
> 
> Congyang and Changlong, please review this series as soon as possible. I also
> have a question why COLO doesn't use libnl? It is using Linux header directly.

It is implemented by Yang one year ago. I don't know the reason. We will investigate
how to use libnl.

Thanks
Wen Congyang

> 
> Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
> 
> Wei.
> 
> Wei Liu (3):
>   libxl: colo: rearrange things in header files
>   libxl: colo: move netlink related stuff to libxl_colo_proxy.c
>   libxl: colo: only build COLO on Linux
> 
>  tools/libxl/Makefile           |  5 ++++
>  tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
>  tools/libxl/libxl_colo_proxy.c | 13 +++++++++
>  tools/libxl/libxl_internal.h   | 36 ++++++++----------------
>  tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 117 insertions(+), 51 deletions(-)
>  create mode 100644 tools/libxl/libxl_no_colo.c
> 




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

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

* Re: [PATCH 0/3] COLO: only build on Linux
  2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
                   ` (3 preceding siblings ...)
  2016-04-06  1:24 ` [PATCH 0/3] COLO: only build " Wen Congyang
@ 2016-04-06  6:19 ` Changlong Xie
  4 siblings, 0 replies; 12+ messages in thread
From: Changlong Xie @ 2016-04-06  6:19 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Ian Jackson, Wen Congyang, Roger Pau Monné

I've test on my side, and works ok for me.

Thanks
	-Xie

On 04/06/2016 04:05 AM, Wei Liu wrote:
> COLO depends on netlink which is only available on Linux. This series cleans up
> COLO code and make it only build on Linux. This should fix FreeBSD build.
>
> Congyang and Changlong, please review this series as soon as possible. I also
> have a question why COLO doesn't use libnl? It is using Linux header directly.
>
> Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
>
> Wei.
>
> Wei Liu (3):
>    libxl: colo: rearrange things in header files
>    libxl: colo: move netlink related stuff to libxl_colo_proxy.c
>    libxl: colo: only build COLO on Linux
>
>   tools/libxl/Makefile           |  5 ++++
>   tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
>   tools/libxl/libxl_colo_proxy.c | 13 +++++++++
>   tools/libxl/libxl_internal.h   | 36 ++++++++----------------
>   tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
>   5 files changed, 117 insertions(+), 51 deletions(-)
>   create mode 100644 tools/libxl/libxl_no_colo.c
>



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

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

* Re: [PATCH 0/3] COLO: only build on Linux
  2016-04-06  1:24 ` [PATCH 0/3] COLO: only build " Wen Congyang
@ 2016-04-06 10:17   ` Wei Liu
  2016-04-06 10:20     ` Wen Congyang
  0 siblings, 1 reply; 12+ messages in thread
From: Wei Liu @ 2016-04-06 10:17 UTC (permalink / raw)
  To: Wen Congyang
  Cc: Xen-devel, Changlong Xie, Wei Liu, Ian Jackson, Roger Pau Monné

On Wed, Apr 06, 2016 at 09:24:26AM +0800, Wen Congyang wrote:
> On 04/06/2016 04:05 AM, Wei Liu wrote:
> > COLO depends on netlink which is only available on Linux. This series cleans up
> > COLO code and make it only build on Linux. This should fix FreeBSD build.
> > 
> > Congyang and Changlong, please review this series as soon as possible. I also
> > have a question why COLO doesn't use libnl? It is using Linux header directly.
> 
> It is implemented by Yang one year ago. I don't know the reason. We will investigate
> how to use libnl.
> 

It's easy -- change inclusion of linux/netlink.h to netlink/netlink.h. I
already have a series to do that -- this series is actually my second
attempt to fix COLO.

If you can confirm COLO should depend on libnl, I will post my patches.

Wei.

> Thanks
> Wen Congyang
> 
> > 
> > Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
> > 
> > Wei.
> > 
> > Wei Liu (3):
> >   libxl: colo: rearrange things in header files
> >   libxl: colo: move netlink related stuff to libxl_colo_proxy.c
> >   libxl: colo: only build COLO on Linux
> > 
> >  tools/libxl/Makefile           |  5 ++++
> >  tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
> >  tools/libxl/libxl_colo_proxy.c | 13 +++++++++
> >  tools/libxl/libxl_internal.h   | 36 ++++++++----------------
> >  tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 117 insertions(+), 51 deletions(-)
> >  create mode 100644 tools/libxl/libxl_no_colo.c
> > 
> 
> 
> 

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

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

* Re: [PATCH 0/3] COLO: only build on Linux
  2016-04-06 10:17   ` Wei Liu
@ 2016-04-06 10:20     ` Wen Congyang
  2016-04-06 10:22       ` Wei Liu
  0 siblings, 1 reply; 12+ messages in thread
From: Wen Congyang @ 2016-04-06 10:20 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Changlong Xie, Ian Jackson, Roger Pau Monné

On 04/06/2016 06:17 PM, Wei Liu wrote:
> On Wed, Apr 06, 2016 at 09:24:26AM +0800, Wen Congyang wrote:
>> On 04/06/2016 04:05 AM, Wei Liu wrote:
>>> COLO depends on netlink which is only available on Linux. This series cleans up
>>> COLO code and make it only build on Linux. This should fix FreeBSD build.
>>>
>>> Congyang and Changlong, please review this series as soon as possible. I also
>>> have a question why COLO doesn't use libnl? It is using Linux header directly.
>>
>> It is implemented by Yang one year ago. I don't know the reason. We will investigate
>> how to use libnl.
>>
> 
> It's easy -- change inclusion of linux/netlink.h to netlink/netlink.h. I
> already have a series to do that -- this series is actually my second
> attempt to fix COLO.
> 
> If you can confirm COLO should depend on libnl, I will post my patches.

I think COLO should depend on libnl.

Thanks
Wen Congyang

> 
> Wei.
> 
>> Thanks
>> Wen Congyang
>>
>>>
>>> Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
>>>
>>> Wei.
>>>
>>> Wei Liu (3):
>>>   libxl: colo: rearrange things in header files
>>>   libxl: colo: move netlink related stuff to libxl_colo_proxy.c
>>>   libxl: colo: only build COLO on Linux
>>>
>>>  tools/libxl/Makefile           |  5 ++++
>>>  tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
>>>  tools/libxl/libxl_colo_proxy.c | 13 +++++++++
>>>  tools/libxl/libxl_internal.h   | 36 ++++++++----------------
>>>  tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
>>>  5 files changed, 117 insertions(+), 51 deletions(-)
>>>  create mode 100644 tools/libxl/libxl_no_colo.c
>>>
>>
>>
>>
> 
> 
> .
> 




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

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

* Re: [PATCH 0/3] COLO: only build on Linux
  2016-04-06 10:20     ` Wen Congyang
@ 2016-04-06 10:22       ` Wei Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Wei Liu @ 2016-04-06 10:22 UTC (permalink / raw)
  To: Wen Congyang
  Cc: Xen-devel, Changlong Xie, Wei Liu, Ian Jackson, Roger Pau Monn??

On Wed, Apr 06, 2016 at 06:20:52PM +0800, Wen Congyang wrote:
> On 04/06/2016 06:17 PM, Wei Liu wrote:
> > On Wed, Apr 06, 2016 at 09:24:26AM +0800, Wen Congyang wrote:
> >> On 04/06/2016 04:05 AM, Wei Liu wrote:
> >>> COLO depends on netlink which is only available on Linux. This series cleans up
> >>> COLO code and make it only build on Linux. This should fix FreeBSD build.
> >>>
> >>> Congyang and Changlong, please review this series as soon as possible. I also
> >>> have a question why COLO doesn't use libnl? It is using Linux header directly.
> >>
> >> It is implemented by Yang one year ago. I don't know the reason. We will investigate
> >> how to use libnl.
> >>
> > 
> > It's easy -- change inclusion of linux/netlink.h to netlink/netlink.h. I
> > already have a series to do that -- this series is actually my second
> > attempt to fix COLO.
> > 
> > If you can confirm COLO should depend on libnl, I will post my patches.
> 
> I think COLO should depend on libnl.
> 

NP, patch series incoming.

Wei.

> Thanks
> Wen Congyang
> 
> > 
> > Wei.
> > 
> >> Thanks
> >> Wen Congyang
> >>
> >>>
> >>> Roger, can you run functional tests on FreeBSD? I don't have FreeBSD Dom0.
> >>>
> >>> Wei.
> >>>
> >>> Wei Liu (3):
> >>>   libxl: colo: rearrange things in header files
> >>>   libxl: colo: move netlink related stuff to libxl_colo_proxy.c
> >>>   libxl: colo: only build COLO on Linux
> >>>
> >>>  tools/libxl/Makefile           |  5 ++++
> >>>  tools/libxl/libxl_colo.h       | 52 +++++++++++++++++------------------
> >>>  tools/libxl/libxl_colo_proxy.c | 13 +++++++++
> >>>  tools/libxl/libxl_internal.h   | 36 ++++++++----------------
> >>>  tools/libxl/libxl_no_colo.c    | 62 ++++++++++++++++++++++++++++++++++++++++++
> >>>  5 files changed, 117 insertions(+), 51 deletions(-)
> >>>  create mode 100644 tools/libxl/libxl_no_colo.c
> >>>
> >>
> >>
> >>
> > 
> > 
> > .
> > 
> 
> 
> 

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

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

* Re: [PATCH 3/3] libxl: colo: only build COLO on Linux
  2016-04-05 20:06 ` [PATCH 3/3] libxl: colo: only build COLO on Linux Wei Liu
@ 2016-04-06 10:24   ` Wei Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Wei Liu @ 2016-04-06 10:24 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Changlong Xie, Ian Jackson, Wen Congyang, Roger Pau Monné

On Tue, Apr 05, 2016 at 09:06:02PM +0100, Wei Liu wrote:
> Linux's netlink is required when initialising COLO, so make sure only to
> compile COLO on Linux.
> 
> Provide necessary stub functions in case COLO is disabled. This should
> fix libxl build on FreeBSD.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxl/Makefile        |  5 ++++
>  tools/libxl/libxl_no_colo.c | 62 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 tools/libxl/libxl_no_colo.c
> 
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index a433aaa..47564b3 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -65,10 +65,15 @@ LIBXL_OBJS-y += libxl_no_convert_callout.o
>  endif
>  
>  LIBXL_OBJS-y += libxl_remus.o libxl_checkpoint_device.o libxl_remus_disk_drbd.o
> +
> +ifeq ($(CONFIG_Linux),y)

I think about this a bit more, this is not necessary right.

The header file (linux/netlink.h) may be in a dedicated package. On
Debian it is in linux-libc-dev. I should explicitly check the
availability of that header file instead.

...

Just after I finished the above paragraph, Congyang confirmed that COLO
should depend on libnl, so whatever I wrote above is moot. I post it for
the public record anyway.

Wei.

>  LIBXL_OBJS-y += libxl_colo_restore.o libxl_colo_save.o
>  LIBXL_OBJS-y += libxl_colo_qdisk.o
>  LIBXL_OBJS-y += libxl_colo_proxy.o
>  LIBXL_OBJS-y += libxl_colo_nic.o
> +else
> +LIBXL_OBJS-y += libxl_no_colo.o
> +endif
>  
>  LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o
>  LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
> diff --git a/tools/libxl/libxl_no_colo.c b/tools/libxl/libxl_no_colo.c
> new file mode 100644
> index 0000000..152f198
> --- /dev/null
> +++ b/tools/libxl/libxl_no_colo.c
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright (C) 2016
> + * Author Wei Liu <wei.liu2@citrix.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_osdeps.h" /* must come before any other headers */
> +
> +#include "libxl_internal.h"
> +
> +void libxl__colo_restore_setup(libxl__egc *egc,
> +                               libxl__colo_restore_state *crs)
> +{
> +    STATE_AO_GC(crs->ao);
> +
> +    LOG(ERROR, "COLO is not supported");
> +
> +    crs->callback(egc, crs, ERROR_FAIL);
> +}
> +
> +void libxl__colo_restore_teardown(libxl__egc *egc, void *dcs_void,
> +                                  int ret, int retval, int errnoval)
> +{
> +    /* Shouldn't be here because setup already failed */
> +    abort();
> +}
> +
> +void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css)
> +{
> +    libxl__domain_save_state *dss = CONTAINER_OF(css, *dss, css);
> +    STATE_AO_GC(dss->ao);
> +
> +    LOG(ERROR, "COLO is not supported");
> +
> +    dss->callback(egc, dss, ERROR_FAIL);
> +}
> +
> +void libxl__colo_save_teardown(libxl__egc *egc,
> +                               libxl__colo_save_state *css,
> +                               int rc)
> +{
> +    /* Shouldn't be here because setup already failed */
> +    abort();
> +}
> +
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> -- 
> 2.1.4
> 

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

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

* Re: [PATCH 1/3] libxl: colo: rearrange things in header files
  2016-04-05 20:06 ` [PATCH 1/3] libxl: colo: rearrange things in header files Wei Liu
@ 2016-04-06 13:41   ` Ian Jackson
  0 siblings, 0 replies; 12+ messages in thread
From: Ian Jackson @ 2016-04-06 13:41 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Changlong Xie, Wen Congyang, Roger Pau Monné

Wei Liu writes ("[PATCH 1/3] libxl: colo: rearrange things in header files"):
> We need to separate COLO code from common code as clean as possible.
> With this patch, all COLO structures are now in libxl_colo.h.
> 
> It does the following:
> 1. Move two typedefs for libxl__domain_create_state{,cb} back to
>    libxl_internal.h.
> 2. Move libxl__colo_save_state to libxl_colo.h.
> 3. Include libxl_internal.h in libxl_colo.h.
> 4. Move a bunch of colo typedefs to the top of libxl_internal.h.
> 5. Move the inclusion of libxl_colo.h to the right place in
>    libxl_internal.h.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

On the basis that I believe you that this is just code motion.

Ian.

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

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

* Re: [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c
  2016-04-05 20:06 ` [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c Wei Liu
@ 2016-04-06 13:41   ` Ian Jackson
  0 siblings, 0 replies; 12+ messages in thread
From: Ian Jackson @ 2016-04-06 13:41 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Changlong Xie, Wen Congyang, Roger Pau Monné

Wei Liu writes ("[PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c"):
> They are only used there, no need to expose them to other parts of
> libxl.
> 
> This is necessary to make libxl build on FreeBSD again because FreeBSD
> doesn't have netlink.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

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

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

end of thread, other threads:[~2016-04-06 13:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 20:05 [PATCH 0/3] COLO: only build on Linux Wei Liu
2016-04-05 20:06 ` [PATCH 1/3] libxl: colo: rearrange things in header files Wei Liu
2016-04-06 13:41   ` Ian Jackson
2016-04-05 20:06 ` [PATCH 2/3] libxl: colo: move netlink related stuff to libxl_colo_proxy.c Wei Liu
2016-04-06 13:41   ` Ian Jackson
2016-04-05 20:06 ` [PATCH 3/3] libxl: colo: only build COLO on Linux Wei Liu
2016-04-06 10:24   ` Wei Liu
2016-04-06  1:24 ` [PATCH 0/3] COLO: only build " Wen Congyang
2016-04-06 10:17   ` Wei Liu
2016-04-06 10:20     ` Wen Congyang
2016-04-06 10:22       ` Wei Liu
2016-04-06  6:19 ` Changlong Xie

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).