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

Re: [Xen-devel] [Xen-users] substantial shutdown delay for PV guests with PCI -passthrough



Atom2 writes ("Re: [Xen-users] substantial shutdown delay for PV guests with 
PCI -passthrough"):
> nope, I am using xl; there is no xend or xm installed on the machine or 
> involved anyhow (I assumed with xend you referred back to xm instead of xl).

Can you try this patch ?

Thanks,
Ian.

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 30b0b06..1583498 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2728,7 +2728,7 @@ static void local_device_attach_cb(libxl__egc *egc, 
libxl__ao_device *aodev)
     if (rc < 0)
         goto out;
     be_path = libxl__device_backend_path(gc, &device);
-    rc = libxl__wait_for_backend(gc, be_path, "4");
+    rc = libxl__wait_for_backend_deprecated(gc, be_path, "4", (char*)0);
     if (rc < 0)
         goto out;
 
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index fa99f77..11a9885 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1208,12 +1208,14 @@ int libxl__wait_for_device_model_deprecated(libxl__gc 
*gc,
                                      check_callback, check_callback_userdata);
 }
 
-int libxl__wait_for_backend(libxl__gc *gc, const char *be_path,
-                            const char *state)
+int libxl__wait_for_backend_deprecated(libxl__gc *gc, const char *be_path,
+                                       ...)
 {
     int watchdog = 100;
     const char *p, *path = GCSPRINTF("%s/state", be_path);
+    const char *want;
     int rc;
+    va_list al;
 
     while (watchdog-- > 0) {
         rc = libxl__xs_read_checked(gc, XBT_NULL, path, &p);
@@ -1224,8 +1226,14 @@ int libxl__wait_for_backend(libxl__gc *gc, const char 
*be_path,
             return ERROR_FAIL;
         }
 
-        if (!strcmp(p, state))
-            return 0;
+        va_start(al,be_path);
+        while ((want = va_arg(al, char*))) {
+            if (!strcmp(p, want)) {
+                va_end(al);
+                return 0;
+            }
+        }
+        va_end(al);
 
         usleep(100000);
     }
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index b3a200d..bdcce35 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1025,8 +1025,8 @@ _hidden char *libxl__device_frontend_path(libxl__gc *gc, 
libxl__device *device);
 _hidden int libxl__parse_backend_path(libxl__gc *gc, const char *path,
                                       libxl__device *dev);
 _hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
-_hidden int libxl__wait_for_backend(libxl__gc *gc, const char *be_path,
-                                    const char *state);
+_hidden int libxl__wait_for_backend_deprecated(libxl__gc *gc,
+                   const char *be_path, ...) __attribute__((sentinel));
 _hidden int libxl__nic_type(libxl__gc *gc, libxl__device *dev,
                             libxl_nic_type *nictype);
 
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 44d0453..43ffd57 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -126,7 +126,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, 
uint32_t domid, libxl_d
         return ERROR_FAIL;
 
     if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, "4") < 0)
+        if (libxl__wait_for_backend_deprecated(gc, be_path, "4", (char*)0) < 0)
             return ERROR_FAIL;
     }
 
@@ -169,7 +169,8 @@ static int libxl__device_pci_remove_xenstore(libxl__gc *gc, 
uint32_t domid, libx
         return ERROR_FAIL;
 
     if (domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, "4") < 0) {
+        if (libxl__wait_for_backend_deprecated(gc, be_path, "4", "6", (char*)0)
+            < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not 
ready", be_path);
             return ERROR_FAIL;
         }
@@ -198,7 +199,8 @@ retry_transaction:
             goto retry_transaction;
 
     if (domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, "4") < 0) {
+        if (libxl__wait_for_backend_deprecated(gc, be_path, "4", "6", (char*)0)
+            < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not 
ready", be_path);
             return ERROR_FAIL;
         }

_______________________________________________
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®.