All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xl/libxl: add pvcalls support
@ 2018-02-27 21:28 Stefano Stabellini
  2018-03-05 22:00 ` Stefano Stabellini
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Stefano Stabellini @ 2018-02-27 21:28 UTC (permalink / raw)
  To: wei.liu2, ian.jackson; +Cc: xen-devel, sstabellini

Add pvcalls support to libxl and xl. Create the appropriate pvcalls
entries in xenstore.

Signed-off-by: Stefano Stabellini <stefano@aporeto.com>

diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
index 7be2592..77d1a36 100644
--- a/docs/misc/xenstore-paths.markdown
+++ b/docs/misc/xenstore-paths.markdown
@@ -299,6 +299,11 @@ A virtual scsi device frontend. Described by
 A virtual usb device frontend. Described by
 [xen/include/public/io/usbif.h][USBIF]
 
+#### ~/device/pvcalls/$DEVID/* []
+
+Paravirtualized POSIX function calls frontend. Described by
+[docs/misc/pvcalls.markdown][PVCALLS]
+
 #### ~/console/* []
 
 The primary PV console device. Described in [console.txt](console.txt)
@@ -377,6 +382,10 @@ A PV SCSI backend.
 
 A PV USB backend. Described by
 [xen/include/public/io/usbif.h][USBIF]
+ 
+#### ~/backend/pvcalls/$DOMID/$DEVID/* []
+
+A PVCalls backend. Described in [docs/misc/pvcalls.markdown][PVCALLS].
 
 #### ~/backend/console/$DOMID/$DEVID/* []
 
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 917ceb0..035e66e 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
 			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
 			libxl_9pfs.o libxl_domain.o libxl_vdispl.o \
-                        $(LIBXL_OBJS-y)
+                        libxl_pvcalls.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index eca0ea2..76574d2 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -2006,6 +2006,16 @@ int libxl_device_p9_destroy(libxl_ctx *ctx, uint32_t domid,
                             const libxl_asyncop_how *ao_how)
                             LIBXL_EXTERNAL_CALLERS_ONLY;
 
+/* pvcalls */
+int libxl_device_pvcalls_remove(libxl_ctx *ctx, uint32_t domid,
+                                libxl_device_pvcalls *pvcalls,
+                                const libxl_asyncop_how *ao_how)
+                                LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_pvcalls_destroy(libxl_ctx *ctx, uint32_t domid,
+                                 libxl_device_pvcalls *pvcalls,
+                                 const libxl_asyncop_how *ao_how)
+                                 LIBXL_EXTERNAL_CALLERS_ONLY;
+
 /* PCI Passthrough */
 int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid,
                          libxl_device_pci *pcidev,
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index c498135..bbdeee5 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1374,6 +1374,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
     for (i = 0; i < d_config->num_p9s; i++)
         libxl__device_add(gc, domid, &libxl__p9_devtype, &d_config->p9s[i]);
 
+    for (i = 0; i < d_config->num_pvcallss; i++)
+        libxl__device_add(gc, domid, &libxl__pvcalls_devtype, &d_config->pvcallss[i]);
+
     switch (d_config->c_info.type) {
     case LIBXL_DOMAIN_TYPE_HVM:
     {
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 506687f..e9edfac 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3648,6 +3648,7 @@ extern const struct libxl_device_type libxl__usbdev_devtype;
 extern const struct libxl_device_type libxl__pcidev_devtype;
 extern const struct libxl_device_type libxl__vdispl_devtype;
 extern const struct libxl_device_type libxl__p9_devtype;
+extern const struct libxl_device_type libxl__pvcalls_devtype;
 
 extern const struct libxl_device_type *device_type_tbl[];
 
diff --git a/tools/libxl/libxl_pvcalls.c b/tools/libxl/libxl_pvcalls.c
new file mode 100644
index 0000000..a285343
--- /dev/null
+++ b/tools/libxl/libxl_pvcalls.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018      Aporeto
+ * Author Stefano Stabellini <stefano@aporeto.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"
+
+#include "libxl_internal.h"
+
+static int libxl__device_pvcalls_setdefault(libxl__gc *gc, uint32_t domid,
+                                            libxl_device_pvcalls *pvcalls,
+                                            bool hotplug)
+{
+    return libxl__resolve_domid(gc, pvcalls->backend_domname,
+                                &pvcalls->backend_domid);
+}
+
+static LIBXL_DEFINE_UPDATE_DEVID(pvcalls)
+static LIBXL_DEFINE_DEVICE_FROM_TYPE(pvcalls)
+
+#define libxl__add_pvcallss NULL
+#define libxl_device_pvcalls_list NULL
+#define libxl_device_pvcalls_compare NULL
+
+LIBXL_DEFINE_DEVICE_REMOVE(pvcalls)
+
+DEFINE_DEVICE_TYPE_STRUCT(pvcalls, PVCALLS);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 3503812..89c6ef6 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -790,6 +790,12 @@ libxl_device_p9 = Struct("device_p9", [
     ("devid",            libxl_devid),
 ])
 
+libxl_device_pvcalls = Struct("device_pvcalls", [
+    ("backend_domid",    libxl_domid),
+    ("backend_domname",  string),
+    ("devid",            libxl_devid),
+])
+
 libxl_device_channel = Struct("device_channel", [
     ("backend_domid", libxl_domid),
     ("backend_domname", string),
@@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
     ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
     ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
     ("p9s", Array(libxl_device_p9, "num_p9s")),
+    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
     ("vdispls", Array(libxl_device_vdispl, "num_vdispls")),
     # a channel manifests as a console with a name,
     # see docs/misc/channels.txt
diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl
index d144dd6..f2ff017 100644
--- a/tools/libxl/libxl_types_internal.idl
+++ b/tools/libxl/libxl_types_internal.idl
@@ -28,6 +28,7 @@ libxl__device_kind = Enumeration("device_kind", [
     (11, "9PFS"),
     (12, "VDISPL"),
     (13, "VUART"),
+    (14, "PVCALLS"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index f684254..da051ed 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -860,7 +860,7 @@ void parse_config_data(const char *config_source,
     long l, vcpus = 0;
     XLU_Config *config;
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
-                   *usbctrls, *usbdevs, *p9devs, *vdispls;
+                   *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcalls_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
                    *mca_caps;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
@@ -1691,6 +1691,41 @@ void parse_config_data(const char *config_source,
         }
     }
 
+    if (!xlu_cfg_get_list(config, "pvcalls", &pvcalls_devs, 0, 0)) {
+        d_config->num_pvcallss = 0;
+        d_config->pvcallss = NULL;
+        while ((buf = xlu_cfg_get_listitem (pvcalls_devs, d_config->num_pvcallss)) != NULL) {
+            libxl_device_pvcalls *pvcalls;
+            char *backend = NULL;
+            char *p, *p2, *buf2;
+            pvcalls = ARRAY_EXTEND_INIT(d_config->pvcallss,
+                                   d_config->num_pvcallss,
+                                   libxl_device_pvcalls_init);
+
+            buf2 = strdup(buf);
+            p = strtok(buf2, ",");
+            if (p) {
+               do {
+                  while (*p == ' ')
+                     ++p;
+                  if ((p2 = strchr(p, '=')) == NULL)
+                     break;
+                  *p2 = '\0';
+                  if(!strcmp(p, "backend")) {
+                     backend = strdup(p2 + 1);
+                  } else {
+                     fprintf(stderr, "Unknown string `%s' in pvcalls spec\n", p);
+                     exit(1);
+                  }
+               } while ((p = strtok(NULL, ",")) != NULL);
+            }
+            free(buf2);
+
+            if (backend)
+                    replace_string(&pvcalls->backend_domname, backend);
+        }
+    }
+
     if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) {
         d_config->num_channels = 0;
         d_config->channels = NULL;

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-02-27 21:28 [PATCH] xl/libxl: add pvcalls support Stefano Stabellini
@ 2018-03-05 22:00 ` Stefano Stabellini
  2018-03-11 20:49   ` Stefano Stabellini
  2018-03-13 14:13 ` Wei Liu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2018-03-05 22:00 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: ian.jackson, wei.liu2, xen-devel

ping?

On Tue, 27 Feb 2018, Stefano Stabellini wrote:
> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> entries in xenstore.
> 
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> 
> diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
> index 7be2592..77d1a36 100644
> --- a/docs/misc/xenstore-paths.markdown
> +++ b/docs/misc/xenstore-paths.markdown
> @@ -299,6 +299,11 @@ A virtual scsi device frontend. Described by
>  A virtual usb device frontend. Described by
>  [xen/include/public/io/usbif.h][USBIF]
>  
> +#### ~/device/pvcalls/$DEVID/* []
> +
> +Paravirtualized POSIX function calls frontend. Described by
> +[docs/misc/pvcalls.markdown][PVCALLS]
> +
>  #### ~/console/* []
>  
>  The primary PV console device. Described in [console.txt](console.txt)
> @@ -377,6 +382,10 @@ A PV SCSI backend.
>  
>  A PV USB backend. Described by
>  [xen/include/public/io/usbif.h][USBIF]
> + 
> +#### ~/backend/pvcalls/$DOMID/$DEVID/* []
> +
> +A PVCalls backend. Described in [docs/misc/pvcalls.markdown][PVCALLS].
>  
>  #### ~/backend/console/$DOMID/$DEVID/* []
>  
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index 917ceb0..035e66e 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
>  			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
>  			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
>  			libxl_9pfs.o libxl_domain.o libxl_vdispl.o \
> -                        $(LIBXL_OBJS-y)
> +                        libxl_pvcalls.o $(LIBXL_OBJS-y)
>  LIBXL_OBJS += libxl_genid.o
>  LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
>  
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index eca0ea2..76574d2 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -2006,6 +2006,16 @@ int libxl_device_p9_destroy(libxl_ctx *ctx, uint32_t domid,
>                              const libxl_asyncop_how *ao_how)
>                              LIBXL_EXTERNAL_CALLERS_ONLY;
>  
> +/* pvcalls */
> +int libxl_device_pvcalls_remove(libxl_ctx *ctx, uint32_t domid,
> +                                libxl_device_pvcalls *pvcalls,
> +                                const libxl_asyncop_how *ao_how)
> +                                LIBXL_EXTERNAL_CALLERS_ONLY;
> +int libxl_device_pvcalls_destroy(libxl_ctx *ctx, uint32_t domid,
> +                                 libxl_device_pvcalls *pvcalls,
> +                                 const libxl_asyncop_how *ao_how)
> +                                 LIBXL_EXTERNAL_CALLERS_ONLY;
> +
>  /* PCI Passthrough */
>  int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid,
>                           libxl_device_pci *pcidev,
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index c498135..bbdeee5 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -1374,6 +1374,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
>      for (i = 0; i < d_config->num_p9s; i++)
>          libxl__device_add(gc, domid, &libxl__p9_devtype, &d_config->p9s[i]);
>  
> +    for (i = 0; i < d_config->num_pvcallss; i++)
> +        libxl__device_add(gc, domid, &libxl__pvcalls_devtype, &d_config->pvcallss[i]);
> +
>      switch (d_config->c_info.type) {
>      case LIBXL_DOMAIN_TYPE_HVM:
>      {
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 506687f..e9edfac 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -3648,6 +3648,7 @@ extern const struct libxl_device_type libxl__usbdev_devtype;
>  extern const struct libxl_device_type libxl__pcidev_devtype;
>  extern const struct libxl_device_type libxl__vdispl_devtype;
>  extern const struct libxl_device_type libxl__p9_devtype;
> +extern const struct libxl_device_type libxl__pvcalls_devtype;
>  
>  extern const struct libxl_device_type *device_type_tbl[];
>  
> diff --git a/tools/libxl/libxl_pvcalls.c b/tools/libxl/libxl_pvcalls.c
> new file mode 100644
> index 0000000..a285343
> --- /dev/null
> +++ b/tools/libxl/libxl_pvcalls.c
> @@ -0,0 +1,37 @@
> +/*
> + * Copyright (C) 2018      Aporeto
> + * Author Stefano Stabellini <stefano@aporeto.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"
> +
> +#include "libxl_internal.h"
> +
> +static int libxl__device_pvcalls_setdefault(libxl__gc *gc, uint32_t domid,
> +                                            libxl_device_pvcalls *pvcalls,
> +                                            bool hotplug)
> +{
> +    return libxl__resolve_domid(gc, pvcalls->backend_domname,
> +                                &pvcalls->backend_domid);
> +}
> +
> +static LIBXL_DEFINE_UPDATE_DEVID(pvcalls)
> +static LIBXL_DEFINE_DEVICE_FROM_TYPE(pvcalls)
> +
> +#define libxl__add_pvcallss NULL
> +#define libxl_device_pvcalls_list NULL
> +#define libxl_device_pvcalls_compare NULL
> +
> +LIBXL_DEFINE_DEVICE_REMOVE(pvcalls)
> +
> +DEFINE_DEVICE_TYPE_STRUCT(pvcalls, PVCALLS);
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 3503812..89c6ef6 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -790,6 +790,12 @@ libxl_device_p9 = Struct("device_p9", [
>      ("devid",            libxl_devid),
>  ])
>  
> +libxl_device_pvcalls = Struct("device_pvcalls", [
> +    ("backend_domid",    libxl_domid),
> +    ("backend_domname",  string),
> +    ("devid",            libxl_devid),
> +])
> +
>  libxl_device_channel = Struct("device_channel", [
>      ("backend_domid", libxl_domid),
>      ("backend_domname", string),
> @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
>      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
>      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
>      ("p9s", Array(libxl_device_p9, "num_p9s")),
> +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
>      ("vdispls", Array(libxl_device_vdispl, "num_vdispls")),
>      # a channel manifests as a console with a name,
>      # see docs/misc/channels.txt
> diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl
> index d144dd6..f2ff017 100644
> --- a/tools/libxl/libxl_types_internal.idl
> +++ b/tools/libxl/libxl_types_internal.idl
> @@ -28,6 +28,7 @@ libxl__device_kind = Enumeration("device_kind", [
>      (11, "9PFS"),
>      (12, "VDISPL"),
>      (13, "VUART"),
> +    (14, "PVCALLS"),
>      ])
>  
>  libxl__console_backend = Enumeration("console_backend", [
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index f684254..da051ed 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -860,7 +860,7 @@ void parse_config_data(const char *config_source,
>      long l, vcpus = 0;
>      XLU_Config *config;
>      XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
> -                   *usbctrls, *usbdevs, *p9devs, *vdispls;
> +                   *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcalls_devs;
>      XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
>                     *mca_caps;
>      int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
> @@ -1691,6 +1691,41 @@ void parse_config_data(const char *config_source,
>          }
>      }
>  
> +    if (!xlu_cfg_get_list(config, "pvcalls", &pvcalls_devs, 0, 0)) {
> +        d_config->num_pvcallss = 0;
> +        d_config->pvcallss = NULL;
> +        while ((buf = xlu_cfg_get_listitem (pvcalls_devs, d_config->num_pvcallss)) != NULL) {
> +            libxl_device_pvcalls *pvcalls;
> +            char *backend = NULL;
> +            char *p, *p2, *buf2;
> +            pvcalls = ARRAY_EXTEND_INIT(d_config->pvcallss,
> +                                   d_config->num_pvcallss,
> +                                   libxl_device_pvcalls_init);
> +
> +            buf2 = strdup(buf);
> +            p = strtok(buf2, ",");
> +            if (p) {
> +               do {
> +                  while (*p == ' ')
> +                     ++p;
> +                  if ((p2 = strchr(p, '=')) == NULL)
> +                     break;
> +                  *p2 = '\0';
> +                  if(!strcmp(p, "backend")) {
> +                     backend = strdup(p2 + 1);
> +                  } else {
> +                     fprintf(stderr, "Unknown string `%s' in pvcalls spec\n", p);
> +                     exit(1);
> +                  }
> +               } while ((p = strtok(NULL, ",")) != NULL);
> +            }
> +            free(buf2);
> +
> +            if (backend)
> +                    replace_string(&pvcalls->backend_domname, backend);
> +        }
> +    }
> +
>      if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) {
>          d_config->num_channels = 0;
>          d_config->channels = NULL;
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-03-05 22:00 ` Stefano Stabellini
@ 2018-03-11 20:49   ` Stefano Stabellini
  0 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2018-03-11 20:49 UTC (permalink / raw)
  To: wei.liu2; +Cc: xen-devel, sstabellini, ian.jackson

reping

On Mon, 5 Mar 2018, Stefano Stabellini wrote:
> ping?
> 
> On Tue, 27 Feb 2018, Stefano Stabellini wrote:
> > Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> > entries in xenstore.
> > 
> > Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> > 
> > diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
> > index 7be2592..77d1a36 100644
> > --- a/docs/misc/xenstore-paths.markdown
> > +++ b/docs/misc/xenstore-paths.markdown
> > @@ -299,6 +299,11 @@ A virtual scsi device frontend. Described by
> >  A virtual usb device frontend. Described by
> >  [xen/include/public/io/usbif.h][USBIF]
> >  
> > +#### ~/device/pvcalls/$DEVID/* []
> > +
> > +Paravirtualized POSIX function calls frontend. Described by
> > +[docs/misc/pvcalls.markdown][PVCALLS]
> > +
> >  #### ~/console/* []
> >  
> >  The primary PV console device. Described in [console.txt](console.txt)
> > @@ -377,6 +382,10 @@ A PV SCSI backend.
> >  
> >  A PV USB backend. Described by
> >  [xen/include/public/io/usbif.h][USBIF]
> > + 
> > +#### ~/backend/pvcalls/$DOMID/$DEVID/* []
> > +
> > +A PVCalls backend. Described in [docs/misc/pvcalls.markdown][PVCALLS].
> >  
> >  #### ~/backend/console/$DOMID/$DEVID/* []
> >  
> > diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> > index 917ceb0..035e66e 100644
> > --- a/tools/libxl/Makefile
> > +++ b/tools/libxl/Makefile
> > @@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
> >  			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
> >  			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
> >  			libxl_9pfs.o libxl_domain.o libxl_vdispl.o \
> > -                        $(LIBXL_OBJS-y)
> > +                        libxl_pvcalls.o $(LIBXL_OBJS-y)
> >  LIBXL_OBJS += libxl_genid.o
> >  LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
> >  
> > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> > index eca0ea2..76574d2 100644
> > --- a/tools/libxl/libxl.h
> > +++ b/tools/libxl/libxl.h
> > @@ -2006,6 +2006,16 @@ int libxl_device_p9_destroy(libxl_ctx *ctx, uint32_t domid,
> >                              const libxl_asyncop_how *ao_how)
> >                              LIBXL_EXTERNAL_CALLERS_ONLY;
> >  
> > +/* pvcalls */
> > +int libxl_device_pvcalls_remove(libxl_ctx *ctx, uint32_t domid,
> > +                                libxl_device_pvcalls *pvcalls,
> > +                                const libxl_asyncop_how *ao_how)
> > +                                LIBXL_EXTERNAL_CALLERS_ONLY;
> > +int libxl_device_pvcalls_destroy(libxl_ctx *ctx, uint32_t domid,
> > +                                 libxl_device_pvcalls *pvcalls,
> > +                                 const libxl_asyncop_how *ao_how)
> > +                                 LIBXL_EXTERNAL_CALLERS_ONLY;
> > +
> >  /* PCI Passthrough */
> >  int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid,
> >                           libxl_device_pci *pcidev,
> > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> > index c498135..bbdeee5 100644
> > --- a/tools/libxl/libxl_create.c
> > +++ b/tools/libxl/libxl_create.c
> > @@ -1374,6 +1374,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
> >      for (i = 0; i < d_config->num_p9s; i++)
> >          libxl__device_add(gc, domid, &libxl__p9_devtype, &d_config->p9s[i]);
> >  
> > +    for (i = 0; i < d_config->num_pvcallss; i++)
> > +        libxl__device_add(gc, domid, &libxl__pvcalls_devtype, &d_config->pvcallss[i]);
> > +
> >      switch (d_config->c_info.type) {
> >      case LIBXL_DOMAIN_TYPE_HVM:
> >      {
> > diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> > index 506687f..e9edfac 100644
> > --- a/tools/libxl/libxl_internal.h
> > +++ b/tools/libxl/libxl_internal.h
> > @@ -3648,6 +3648,7 @@ extern const struct libxl_device_type libxl__usbdev_devtype;
> >  extern const struct libxl_device_type libxl__pcidev_devtype;
> >  extern const struct libxl_device_type libxl__vdispl_devtype;
> >  extern const struct libxl_device_type libxl__p9_devtype;
> > +extern const struct libxl_device_type libxl__pvcalls_devtype;
> >  
> >  extern const struct libxl_device_type *device_type_tbl[];
> >  
> > diff --git a/tools/libxl/libxl_pvcalls.c b/tools/libxl/libxl_pvcalls.c
> > new file mode 100644
> > index 0000000..a285343
> > --- /dev/null
> > +++ b/tools/libxl/libxl_pvcalls.c
> > @@ -0,0 +1,37 @@
> > +/*
> > + * Copyright (C) 2018      Aporeto
> > + * Author Stefano Stabellini <stefano@aporeto.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"
> > +
> > +#include "libxl_internal.h"
> > +
> > +static int libxl__device_pvcalls_setdefault(libxl__gc *gc, uint32_t domid,
> > +                                            libxl_device_pvcalls *pvcalls,
> > +                                            bool hotplug)
> > +{
> > +    return libxl__resolve_domid(gc, pvcalls->backend_domname,
> > +                                &pvcalls->backend_domid);
> > +}
> > +
> > +static LIBXL_DEFINE_UPDATE_DEVID(pvcalls)
> > +static LIBXL_DEFINE_DEVICE_FROM_TYPE(pvcalls)
> > +
> > +#define libxl__add_pvcallss NULL
> > +#define libxl_device_pvcalls_list NULL
> > +#define libxl_device_pvcalls_compare NULL
> > +
> > +LIBXL_DEFINE_DEVICE_REMOVE(pvcalls)
> > +
> > +DEFINE_DEVICE_TYPE_STRUCT(pvcalls, PVCALLS);
> > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> > index 3503812..89c6ef6 100644
> > --- a/tools/libxl/libxl_types.idl
> > +++ b/tools/libxl/libxl_types.idl
> > @@ -790,6 +790,12 @@ libxl_device_p9 = Struct("device_p9", [
> >      ("devid",            libxl_devid),
> >  ])
> >  
> > +libxl_device_pvcalls = Struct("device_pvcalls", [
> > +    ("backend_domid",    libxl_domid),
> > +    ("backend_domname",  string),
> > +    ("devid",            libxl_devid),
> > +])
> > +
> >  libxl_device_channel = Struct("device_channel", [
> >      ("backend_domid", libxl_domid),
> >      ("backend_domname", string),
> > @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
> >      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
> >      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
> >      ("p9s", Array(libxl_device_p9, "num_p9s")),
> > +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
> >      ("vdispls", Array(libxl_device_vdispl, "num_vdispls")),
> >      # a channel manifests as a console with a name,
> >      # see docs/misc/channels.txt
> > diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl
> > index d144dd6..f2ff017 100644
> > --- a/tools/libxl/libxl_types_internal.idl
> > +++ b/tools/libxl/libxl_types_internal.idl
> > @@ -28,6 +28,7 @@ libxl__device_kind = Enumeration("device_kind", [
> >      (11, "9PFS"),
> >      (12, "VDISPL"),
> >      (13, "VUART"),
> > +    (14, "PVCALLS"),
> >      ])
> >  
> >  libxl__console_backend = Enumeration("console_backend", [
> > diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> > index f684254..da051ed 100644
> > --- a/tools/xl/xl_parse.c
> > +++ b/tools/xl/xl_parse.c
> > @@ -860,7 +860,7 @@ void parse_config_data(const char *config_source,
> >      long l, vcpus = 0;
> >      XLU_Config *config;
> >      XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
> > -                   *usbctrls, *usbdevs, *p9devs, *vdispls;
> > +                   *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcalls_devs;
> >      XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
> >                     *mca_caps;
> >      int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
> > @@ -1691,6 +1691,41 @@ void parse_config_data(const char *config_source,
> >          }
> >      }
> >  
> > +    if (!xlu_cfg_get_list(config, "pvcalls", &pvcalls_devs, 0, 0)) {
> > +        d_config->num_pvcallss = 0;
> > +        d_config->pvcallss = NULL;
> > +        while ((buf = xlu_cfg_get_listitem (pvcalls_devs, d_config->num_pvcallss)) != NULL) {
> > +            libxl_device_pvcalls *pvcalls;
> > +            char *backend = NULL;
> > +            char *p, *p2, *buf2;
> > +            pvcalls = ARRAY_EXTEND_INIT(d_config->pvcallss,
> > +                                   d_config->num_pvcallss,
> > +                                   libxl_device_pvcalls_init);
> > +
> > +            buf2 = strdup(buf);
> > +            p = strtok(buf2, ",");
> > +            if (p) {
> > +               do {
> > +                  while (*p == ' ')
> > +                     ++p;
> > +                  if ((p2 = strchr(p, '=')) == NULL)
> > +                     break;
> > +                  *p2 = '\0';
> > +                  if(!strcmp(p, "backend")) {
> > +                     backend = strdup(p2 + 1);
> > +                  } else {
> > +                     fprintf(stderr, "Unknown string `%s' in pvcalls spec\n", p);
> > +                     exit(1);
> > +                  }
> > +               } while ((p = strtok(NULL, ",")) != NULL);
> > +            }
> > +            free(buf2);
> > +
> > +            if (backend)
> > +                    replace_string(&pvcalls->backend_domname, backend);
> > +        }
> > +    }
> > +
> >      if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) {
> >          d_config->num_channels = 0;
> >          d_config->channels = NULL;
> > 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-02-27 21:28 [PATCH] xl/libxl: add pvcalls support Stefano Stabellini
  2018-03-05 22:00 ` Stefano Stabellini
@ 2018-03-13 14:13 ` Wei Liu
  2018-03-13 14:33   ` George Dunlap
  2018-03-28 20:40 ` Stefano Stabellini
  2018-03-29 16:52 ` Ian Jackson
  3 siblings, 1 reply; 9+ messages in thread
From: Wei Liu @ 2018-03-13 14:13 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: ian.jackson, wei.liu2, xen-devel

On Tue, Feb 27, 2018 at 01:28:08PM -0800, Stefano Stabellini wrote:
> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> entries in xenstore.
> 
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>

The code looks fine.

I only want to have a second opinion on

> @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
>      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
>      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
>      ("p9s", Array(libxl_device_p9, "num_p9s")),
> +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),

this...

I think the two s'es look a bit strange. But I don't have a better idea.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-03-13 14:13 ` Wei Liu
@ 2018-03-13 14:33   ` George Dunlap
  2018-03-13 17:29     ` Stefano Stabellini
  0 siblings, 1 reply; 9+ messages in thread
From: George Dunlap @ 2018-03-13 14:33 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Stefano Stabellini, Ian Jackson

On Tue, Mar 13, 2018 at 2:13 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> On Tue, Feb 27, 2018 at 01:28:08PM -0800, Stefano Stabellini wrote:
>> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
>> entries in xenstore.
>>
>> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
>
> The code looks fine.
>
> I only want to have a second opinion on
>
>> @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
>>      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
>>      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
>>      ("p9s", Array(libxl_device_p9, "num_p9s")),
>> +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
>
> this...
>
> I think the two s'es look a bit strange. But I don't have a better idea.

That does look a bit Gollum-like, my precioussss.  Call individual
connections a "pvcalldev", and then have it "pvcalldevs" and
"num_pvcalldevs"?

Alternately, only allow a single pvcall connection?

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-03-13 14:33   ` George Dunlap
@ 2018-03-13 17:29     ` Stefano Stabellini
  0 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2018-03-13 17:29 UTC (permalink / raw)
  To: George Dunlap; +Cc: Ian Jackson, Stefano Stabellini, Wei Liu, xen-devel

On Tue, 13 Mar 2018, George Dunlap wrote:
> On Tue, Mar 13, 2018 at 2:13 PM, Wei Liu <wei.liu2@citrix.com> wrote:
> > On Tue, Feb 27, 2018 at 01:28:08PM -0800, Stefano Stabellini wrote:
> >> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> >> entries in xenstore.
> >>
> >> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> >
> > The code looks fine.
> >
> > I only want to have a second opinion on
> >
> >> @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
> >>      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
> >>      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
> >>      ("p9s", Array(libxl_device_p9, "num_p9s")),
> >> +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
> >
> > this...
> >
> > I think the two s'es look a bit strange. But I don't have a better idea.
> 
> That does look a bit Gollum-like, my precioussss.  Call individual
> connections a "pvcalldev", and then have it "pvcalldevs" and
> "num_pvcalldevs"?
> 
> Alternately, only allow a single pvcall connection?

Unfortunately neither can be done without rearchitecting/changing the
idl and libxl (I tried). Given that pvcallss remains only "internal", I
opted for the easy route.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-02-27 21:28 [PATCH] xl/libxl: add pvcalls support Stefano Stabellini
  2018-03-05 22:00 ` Stefano Stabellini
  2018-03-13 14:13 ` Wei Liu
@ 2018-03-28 20:40 ` Stefano Stabellini
  2018-03-29 16:52 ` Ian Jackson
  3 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2018-03-28 20:40 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: ian.jackson, wei.liu2, xen-devel

It would be nice to get it in before the code freeze

On Tue, 27 Feb 2018, Stefano Stabellini wrote:
> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> entries in xenstore.
> 
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> 
> diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
> index 7be2592..77d1a36 100644
> --- a/docs/misc/xenstore-paths.markdown
> +++ b/docs/misc/xenstore-paths.markdown
> @@ -299,6 +299,11 @@ A virtual scsi device frontend. Described by
>  A virtual usb device frontend. Described by
>  [xen/include/public/io/usbif.h][USBIF]
>  
> +#### ~/device/pvcalls/$DEVID/* []
> +
> +Paravirtualized POSIX function calls frontend. Described by
> +[docs/misc/pvcalls.markdown][PVCALLS]
> +
>  #### ~/console/* []
>  
>  The primary PV console device. Described in [console.txt](console.txt)
> @@ -377,6 +382,10 @@ A PV SCSI backend.
>  
>  A PV USB backend. Described by
>  [xen/include/public/io/usbif.h][USBIF]
> + 
> +#### ~/backend/pvcalls/$DOMID/$DEVID/* []
> +
> +A PVCalls backend. Described in [docs/misc/pvcalls.markdown][PVCALLS].
>  
>  #### ~/backend/console/$DOMID/$DEVID/* []
>  
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index 917ceb0..035e66e 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
>  			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
>  			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
>  			libxl_9pfs.o libxl_domain.o libxl_vdispl.o \
> -                        $(LIBXL_OBJS-y)
> +                        libxl_pvcalls.o $(LIBXL_OBJS-y)
>  LIBXL_OBJS += libxl_genid.o
>  LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
>  
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index eca0ea2..76574d2 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -2006,6 +2006,16 @@ int libxl_device_p9_destroy(libxl_ctx *ctx, uint32_t domid,
>                              const libxl_asyncop_how *ao_how)
>                              LIBXL_EXTERNAL_CALLERS_ONLY;
>  
> +/* pvcalls */
> +int libxl_device_pvcalls_remove(libxl_ctx *ctx, uint32_t domid,
> +                                libxl_device_pvcalls *pvcalls,
> +                                const libxl_asyncop_how *ao_how)
> +                                LIBXL_EXTERNAL_CALLERS_ONLY;
> +int libxl_device_pvcalls_destroy(libxl_ctx *ctx, uint32_t domid,
> +                                 libxl_device_pvcalls *pvcalls,
> +                                 const libxl_asyncop_how *ao_how)
> +                                 LIBXL_EXTERNAL_CALLERS_ONLY;
> +
>  /* PCI Passthrough */
>  int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid,
>                           libxl_device_pci *pcidev,
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index c498135..bbdeee5 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -1374,6 +1374,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
>      for (i = 0; i < d_config->num_p9s; i++)
>          libxl__device_add(gc, domid, &libxl__p9_devtype, &d_config->p9s[i]);
>  
> +    for (i = 0; i < d_config->num_pvcallss; i++)
> +        libxl__device_add(gc, domid, &libxl__pvcalls_devtype, &d_config->pvcallss[i]);
> +
>      switch (d_config->c_info.type) {
>      case LIBXL_DOMAIN_TYPE_HVM:
>      {
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 506687f..e9edfac 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -3648,6 +3648,7 @@ extern const struct libxl_device_type libxl__usbdev_devtype;
>  extern const struct libxl_device_type libxl__pcidev_devtype;
>  extern const struct libxl_device_type libxl__vdispl_devtype;
>  extern const struct libxl_device_type libxl__p9_devtype;
> +extern const struct libxl_device_type libxl__pvcalls_devtype;
>  
>  extern const struct libxl_device_type *device_type_tbl[];
>  
> diff --git a/tools/libxl/libxl_pvcalls.c b/tools/libxl/libxl_pvcalls.c
> new file mode 100644
> index 0000000..a285343
> --- /dev/null
> +++ b/tools/libxl/libxl_pvcalls.c
> @@ -0,0 +1,37 @@
> +/*
> + * Copyright (C) 2018      Aporeto
> + * Author Stefano Stabellini <stefano@aporeto.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"
> +
> +#include "libxl_internal.h"
> +
> +static int libxl__device_pvcalls_setdefault(libxl__gc *gc, uint32_t domid,
> +                                            libxl_device_pvcalls *pvcalls,
> +                                            bool hotplug)
> +{
> +    return libxl__resolve_domid(gc, pvcalls->backend_domname,
> +                                &pvcalls->backend_domid);
> +}
> +
> +static LIBXL_DEFINE_UPDATE_DEVID(pvcalls)
> +static LIBXL_DEFINE_DEVICE_FROM_TYPE(pvcalls)
> +
> +#define libxl__add_pvcallss NULL
> +#define libxl_device_pvcalls_list NULL
> +#define libxl_device_pvcalls_compare NULL
> +
> +LIBXL_DEFINE_DEVICE_REMOVE(pvcalls)
> +
> +DEFINE_DEVICE_TYPE_STRUCT(pvcalls, PVCALLS);
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 3503812..89c6ef6 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -790,6 +790,12 @@ libxl_device_p9 = Struct("device_p9", [
>      ("devid",            libxl_devid),
>  ])
>  
> +libxl_device_pvcalls = Struct("device_pvcalls", [
> +    ("backend_domid",    libxl_domid),
> +    ("backend_domname",  string),
> +    ("devid",            libxl_devid),
> +])
> +
>  libxl_device_channel = Struct("device_channel", [
>      ("backend_domid", libxl_domid),
>      ("backend_domname", string),
> @@ -829,6 +835,7 @@ libxl_domain_config = Struct("domain_config", [
>      ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
>      ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
>      ("p9s", Array(libxl_device_p9, "num_p9s")),
> +    ("pvcallss", Array(libxl_device_pvcalls, "num_pvcallss")),
>      ("vdispls", Array(libxl_device_vdispl, "num_vdispls")),
>      # a channel manifests as a console with a name,
>      # see docs/misc/channels.txt
> diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl
> index d144dd6..f2ff017 100644
> --- a/tools/libxl/libxl_types_internal.idl
> +++ b/tools/libxl/libxl_types_internal.idl
> @@ -28,6 +28,7 @@ libxl__device_kind = Enumeration("device_kind", [
>      (11, "9PFS"),
>      (12, "VDISPL"),
>      (13, "VUART"),
> +    (14, "PVCALLS"),
>      ])
>  
>  libxl__console_backend = Enumeration("console_backend", [
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index f684254..da051ed 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -860,7 +860,7 @@ void parse_config_data(const char *config_source,
>      long l, vcpus = 0;
>      XLU_Config *config;
>      XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
> -                   *usbctrls, *usbdevs, *p9devs, *vdispls;
> +                   *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcalls_devs;
>      XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
>                     *mca_caps;
>      int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
> @@ -1691,6 +1691,41 @@ void parse_config_data(const char *config_source,
>          }
>      }
>  
> +    if (!xlu_cfg_get_list(config, "pvcalls", &pvcalls_devs, 0, 0)) {
> +        d_config->num_pvcallss = 0;
> +        d_config->pvcallss = NULL;
> +        while ((buf = xlu_cfg_get_listitem (pvcalls_devs, d_config->num_pvcallss)) != NULL) {
> +            libxl_device_pvcalls *pvcalls;
> +            char *backend = NULL;
> +            char *p, *p2, *buf2;
> +            pvcalls = ARRAY_EXTEND_INIT(d_config->pvcallss,
> +                                   d_config->num_pvcallss,
> +                                   libxl_device_pvcalls_init);
> +
> +            buf2 = strdup(buf);
> +            p = strtok(buf2, ",");
> +            if (p) {
> +               do {
> +                  while (*p == ' ')
> +                     ++p;
> +                  if ((p2 = strchr(p, '=')) == NULL)
> +                     break;
> +                  *p2 = '\0';
> +                  if(!strcmp(p, "backend")) {
> +                     backend = strdup(p2 + 1);
> +                  } else {
> +                     fprintf(stderr, "Unknown string `%s' in pvcalls spec\n", p);
> +                     exit(1);
> +                  }
> +               } while ((p = strtok(NULL, ",")) != NULL);
> +            }
> +            free(buf2);
> +
> +            if (backend)
> +                    replace_string(&pvcalls->backend_domname, backend);
> +        }
> +    }
> +
>      if (!xlu_cfg_get_list (config, "channel", &channels, 0, 0)) {
>          d_config->num_channels = 0;
>          d_config->channels = NULL;
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-02-27 21:28 [PATCH] xl/libxl: add pvcalls support Stefano Stabellini
                   ` (2 preceding siblings ...)
  2018-03-28 20:40 ` Stefano Stabellini
@ 2018-03-29 16:52 ` Ian Jackson
  2018-03-29 22:05   ` Stefano Stabellini
  3 siblings, 1 reply; 9+ messages in thread
From: Ian Jackson @ 2018-03-29 16:52 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: xen-devel, wei.liu2

Stefano Stabellini writes ("[PATCH] xl/libxl: add pvcalls support"):
> Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> entries in xenstore.
...
> +#### ~/device/pvcalls/$DEVID/* []
> +
> +Paravirtualized POSIX function calls frontend. Described by
> +[docs/misc/pvcalls.markdown][PVCALLS]

It's not entirely clear what the semantics are if multiple pvcalls
devices are provided.  Which is the guest expected to use ?

Perhaps the doc should state some convention, if there is one.  I hope
there is such a convention ($DEVID usually 0 maybe?)

> +    for (i = 0; i < d_config->num_pvcallss; i++)

The name `pvcallss' is clumsy.  But I'm not sure I have a much better
suggestion.

One idea might be to rename your whole thing `pvrpc' since it's a
general RPC scheme, more or less.  Except that I don't want to come in
now and say you should rename it.  And also most rpc systems have an
idl language and you have ad hoc binary structs.

Have you considered calling this `pvcallsifs' ?  Where `if' is
`intrerface' ?  Or something ?

Anyway, I would like you to think about this and answer my questions
but I don't think it's a blocker. 

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xl/libxl: add pvcalls support
  2018-03-29 16:52 ` Ian Jackson
@ 2018-03-29 22:05   ` Stefano Stabellini
  0 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2018-03-29 22:05 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Stefano Stabellini, wei.liu2

On Thu, 29 Mar 2018, Ian Jackson wrote:
> Stefano Stabellini writes ("[PATCH] xl/libxl: add pvcalls support"):
> > Add pvcalls support to libxl and xl. Create the appropriate pvcalls
> > entries in xenstore.
> ...
> > +#### ~/device/pvcalls/$DEVID/* []
> > +
> > +Paravirtualized POSIX function calls frontend. Described by
> > +[docs/misc/pvcalls.markdown][PVCALLS]
> 
> It's not entirely clear what the semantics are if multiple pvcalls
> devices are provided.  Which is the guest expected to use ?
> 
> Perhaps the doc should state some convention, if there is one.  I hope
> there is such a convention ($DEVID usually 0 maybe?)

It would be similar to providing two network cards to the guest. Either
one can be used. But there is no way to provide meta-information on
which one should be used for what at the moment. As you point out, and
as per other PV protocols, the first one uses DEVID 0.


> > +    for (i = 0; i < d_config->num_pvcallss; i++)
> 
> The name `pvcallss' is clumsy.  But I'm not sure I have a much better
> suggestion.
> 
> One idea might be to rename your whole thing `pvrpc' since it's a
> general RPC scheme, more or less.  Except that I don't want to come in
> now and say you should rename it.  And also most rpc systems have an
> idl language and you have ad hoc binary structs.

I don't think it is a good idea at this stage. All the documents and
presentations refer to it as "pvcalls" including
docs/misc/pvcalls.markdown.


> Have you considered calling this `pvcallsifs' ?  Where `if' is
> `intrerface' ?  Or something ?

This is a good suggestion, thank you. I'll send a v2 of the patch.


> Anyway, I would like you to think about this and answer my questions
> but I don't think it's a blocker. 

Thank you for the good feedback.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-03-29 22:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 21:28 [PATCH] xl/libxl: add pvcalls support Stefano Stabellini
2018-03-05 22:00 ` Stefano Stabellini
2018-03-11 20:49   ` Stefano Stabellini
2018-03-13 14:13 ` Wei Liu
2018-03-13 14:33   ` George Dunlap
2018-03-13 17:29     ` Stefano Stabellini
2018-03-28 20:40 ` Stefano Stabellini
2018-03-29 16:52 ` Ian Jackson
2018-03-29 22:05   ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.