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

[Xen-changelog] [xen staging] libxl: fix cold plugged PCI device with stubdomain



commit 1a734d51902dff44501a7589fdf44d269a55cffd
Author:     Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Sat Sep 28 15:20:34 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri Oct 4 17:04:51 2019 +0100

    libxl: fix cold plugged PCI device with stubdomain
    
    When libxl__device_pci_add() is called, stubdomain is already running,
    even when still constructing the target domain. Previously, do_pci_add()
    was called with 'starting' hardcoded to false, but now do_pci_add() shares
    'starting' flag in pci_add_state for both target domain and stubdomain.
    
    Fix this by resetting (local) 'starting' to false in pci_add_dm_done()
    (previously part of do_pci_add()) when handling stubdomain, regardless
    of pas->starting value.
    
    Fixes: 11db56f9a6 (libxl_pci: Use libxl__ao_device with 
libxl__device_pci_add)
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxl/libxl_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index cb849b2415..eae086e503 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1300,6 +1300,10 @@ static void pci_add_dm_done(libxl__egc *egc,
 
     if (rc) goto out;
 
+    /* stubdomain is always running by now, even at create time */
+    if (isstubdom)
+        starting = false;
+
     sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
                            pcidev->bus, pcidev->dev, pcidev->func);
     f = fopen(sysfs_path, "r");
@@ -1559,7 +1563,6 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t 
domid,
         GCNEW(pcidev_s);
         libxl_device_pci_init(pcidev_s);
         libxl_device_pci_copy(CTX, pcidev_s, pcidev);
-        /* stubdomain is always running by now, even at create time */
         pas->callback = device_pci_add_stubdom_done;
         do_pci_add(egc, stubdomid, pcidev_s, pas); /* must be last */
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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