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

[Xen-changelog] [xen staging] libxl_pci: Don't hold QMP connection while waiting



commit e28eed55a41e4d70c3bd7b0efb1668dd93d8bed6
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Thu Oct 31 12:17:27 2019 +0000
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Mon Nov 18 23:01:10 2019 +0000

    libxl_pci: Don't hold QMP connection while waiting
    
    After sending the 'device_del' command for a PCI passthrough device,
    we wait until QEMU has effectively deleted the device, this involves
    executing more QMP commands. While waiting, libxl hold the connection.
    
    It isn't necessary to hold the connection and it prevents others from
    making progress, so this patch releases the QMP connection.
    
    For background:
        e.g., when a guest is created with several pci passthrough
        attached, on `xl destroy` all the devices needs to be detach, and
        this is usually what happens:
            - 'device_del' called for the 1st pci device
            - 'query-pci' checking if pci still there, it is
            - wait 1s
            - 'query-pci' checking again, and it's gone
            -> now the same can be done for the second pci device, so
            plenty of waiting on others when pci detach can be done in
            parallel.
    
        On shutdown, libxl usually keeps waiting because QEMU never
        releases the device because the guest kernel never responds QEMU's
        unplug queries. So detaching of the 1st device waits until a
        timeout stops it, and since the same timeout is setup at the same
        time for the other devices to detach, the 'device_del' command is
        never sent for those.
    
    Signed-off-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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index a66915542b..664d74c478 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -2084,6 +2084,8 @@ static void pci_remove_qmp_query_cb(libxl__egc *egc,
 
     if (rc) goto out;
 
+    libxl__ev_qmp_dispose(gc, qmp);
+
     asked_id = GCSPRINTF(PCI_PT_QDEV_ID,
                          pcidev->bus, pcidev->dev, pcidev->func);
 
--
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®.