Re: [PATCH RESEND 15/20] qemu_cgroup.c: skip absent PCI devices in qemuTeardownHostdevCgroup()

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

 



On 1/18/21 2:53 PM, Daniel Henrique Barboza wrote:
There is no need to bother with cgroup tearing down for absent
PCI devices, given that their entries in the sysfs are already
gone.

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
  src/qemu/qemu_cgroup.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index f7146a71c9..050df21d87 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -467,6 +467,16 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
      if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES))
          return 0;
+ /* Skip tearing down Cgroup for hostdevs that represents absent
+     * PCI devices, e.g. SR-IOV virtual functions that were removed from
+     * the host while the domain was still running. */
+    if (virHostdevIsPCIDevice(dev)) {
+        const virDomainHostdevSubsysPCI *pcisrc = &dev->source.subsys.u.pci;
+
+        if (!virPCIDeviceExists(&pcisrc->addr))
+            return 0;

I would have skipped creating the temprorary variable, since it's only used once, but.. eh. Potato, potahtoe.

Reviewed-by: Laine Stump <laine@xxxxxxxxxx>

+    }
+
      if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
          return -1;




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux