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

Re: [Xen-devel] [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao



Roger Pau Monne escribió:
Add a dummy ao parameter to both functions, since they may become slow in the
future.

Signed-off-by: Roger Pau Monne<roger.pau@xxxxxxxxxx>

This is completely wrong, please don't even review it.

---

Requires Ian Jackson's "libxl: Allow AO_GC and EGC_GC even if not used"

  tools/libxl/libxl.c        |   20 ++++++++++++--------
  tools/libxl/libxl.h        |    6 ++++--
  tools/libxl/libxl_create.c |    6 +++---
  tools/libxl/libxl_dm.c     |    4 ++--
  4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 44a54cb..3fd8d5b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2208,9 +2208,10 @@ static int libxl__device_from_vkb(libxl__gc *gc, 
uint32_t domid,
      return 0;
  }

-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how)
  {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
      flexarray_t *front;
      flexarray_t *back;
      libxl__device device;
@@ -2255,8 +2256,9 @@ out_free:
      flexarray_free(back);
      flexarray_free(front);
  out:
-    GC_FREE;
-    return rc;
+    /* Dummy ao */
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
  }

  int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
@@ -2339,9 +2341,10 @@ static int libxl__device_from_vfb(libxl__gc *gc, 
uint32_t domid,
      return 0;
  }

-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how)
  {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
      flexarray_t *front;
      flexarray_t *back;
      libxl__device device;
@@ -2399,8 +2402,9 @@ out_free:
      flexarray_free(front);
      flexarray_free(back);
  out:
-    GC_FREE;
-    return rc;
+    /* Dummy ao */
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
  }

  int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 6da6107..ce89b31 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -563,14 +563,16 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t 
domid,
                                libxl_device_nic *nic, libxl_nicinfo *nicinfo);

  /* Keyboard */
-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how);
  int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
                              libxl_device_vkb *vkb,
                              const libxl_asyncop_how *ao_how);
  int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);

  /* Framebuffer */
-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb);
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how);
  int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
                              libxl_device_vfb *vfb,
                              const libxl_asyncop_how *ao_how);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index a1f5731..39e9257 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -628,7 +628,7 @@ static int do_domain_create(libxl__gc *gc, 
libxl_domain_config *d_config,
          libxl__device_console_dispose(&console);

          libxl_device_vkb_init(&vkb);
-        libxl_device_vkb_add(ctx, domid,&vkb);
+        libxl_device_vkb_add(ctx, domid,&vkb, 0);
          libxl_device_vkb_dispose(&vkb);

          ret = libxl__create_device_model(gc, domid, d_config,
@@ -646,8 +646,8 @@ static int do_domain_create(libxl__gc *gc, 
libxl_domain_config *d_config,
          libxl__device_console console;

          for (i = 0; i<  d_config->num_vfbs; i++) {
-            libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i]);
-            libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i]);
+            libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i], 0);
+            libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i], 0);
          }

          ret = init_console_info(&console, 0);
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8dc588d..4a2b5c1 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -804,10 +804,10 @@ retry_transaction:
          if (ret)
              goto out_free;
      }
-    ret = libxl_device_vfb_add(ctx, dm_domid,&dm_config.vfbs[0]);
+    ret = libxl_device_vfb_add(ctx, dm_domid,&dm_config.vfbs[0], 0);
      if (ret)
          goto out_free;
-    ret = libxl_device_vkb_add(ctx, dm_domid,&dm_config.vkbs[0]);
+    ret = libxl_device_vkb_add(ctx, dm_domid,&dm_config.vkbs[0], 0);
      if (ret)
          goto out_free;



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


 


Rackspace

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