All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl/PCI: defer backend wait upon attaching to PV guest
@ 2021-12-14  7:49 Jan Beulich
  2021-12-14 13:34 ` Jason Andryuk
  2022-01-04  7:53 ` Ping: " Jan Beulich
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Beulich @ 2021-12-14  7:49 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org
  Cc: Wei Liu, Anthony Perard, Juergen Gross, Paul Durrant,
	Stefano Stabellini

Attempting to wait when the backend hasn't been created yet can't work:
the function will complain "Backend ... does not exist". Move the
waiting past the creation of the backend (and that of other related
nodes), hoping that there are no other dependencies that would now be
broken.

Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are reflected in the config")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Just to make it explicit: I have no idea why the waiting is needed in
the first place. It's been there from the very introduction of PCI
passthrough support (commit b0a1af61678b). I therefore can't exclude
that an even better fix would be to simply omit the 2nd hunk here.

--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,11 +157,6 @@ static int libxl__device_pci_add_xenstor
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
-    }
-
     back = flexarray_make(gc, 16, 1);
 
     LOGD(DEBUG, domid, "Adding new pci device to xenstore");
@@ -213,6 +208,9 @@ static int libxl__device_pci_add_xenstor
         if (rc < 0) goto out;
     }
 
+    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV)
+        rc = libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected));
+
 out:
     libxl__xs_transaction_abort(gc, &t);
     if (lock) libxl__unlock_file(lock);



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

end of thread, other threads:[~2022-01-10  8:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-14  7:49 [PATCH] libxl/PCI: defer backend wait upon attaching to PV guest Jan Beulich
2021-12-14 13:34 ` Jason Andryuk
2021-12-14 13:52   ` Jan Beulich
2022-01-07 15:20     ` Anthony PERARD
2022-01-10  8:28       ` Jan Beulich
2022-01-04  7:53 ` Ping: " Jan Beulich
2022-01-04  8:18   ` Durrant, Paul

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.