From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.81 as permitted sender) client-ip=207.211.31.81;
envelope-from=libvir-list-bounces@redhat.com;
helo=us-smtp-delivery-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296832; cv=none;
d=zohomail.com; s=zohoarc;
b=Rk3gHZtEDAHpAV70mok0Iu4KNeOew6QCYSX/decEQh/RcOxtxylLXaWHbpuKspxtqxnVj/YyTdoeFMNhNm4TFF/PVZ2zpDlxieWvESg1kO/010uLdMsuNazIcwcLph+vsGoRShmWzJDa7jpcK8e/BGRpXWLYxIPVWz75zG6DizY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296832;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=4GBMJcjAoIoCtIjkdsMW49zFc3S6Z+IjcwRKM7AzrZE=;
b=SyDem1Dz/BMzGL/zbxFffbWPv3DNOzkqn/ItR9YZSHnd45Z1LZpig/n4VLs4j7gA9NyFNqQiNAnY/wZaV8ZQlWNHtAhV6u6gLFULWnvWb7tV5ysJkMmQb4+hi0uJZQmbGZcninlTy/rKDNgL4F74RPlu9/Yz5trYH/t8JvN65dk=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
[207.211.31.81]) by mx.zohomail.com
with SMTPS id 1575296832684885.4158437064136;
Mon, 2 Dec 2019 06:27:12 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-403-rteU7GqIOFqkFJseBUeZVg-1; Mon, 02 Dec 2019 09:27:10 -0500
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C82A802CAE;
Mon, 2 Dec 2019 14:27:04 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 89BC35D6BE;
Mon, 2 Dec 2019 14:27:03 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 67B7518089CD;
Mon, 2 Dec 2019 14:27:00 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2EQxdg027245 for ;
Mon, 2 Dec 2019 09:26:59 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 54FBF67662; Mon, 2 Dec 2019 14:26:59 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id D236A6764D
for ; Mon, 2 Dec 2019 14:26:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296831;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=4GBMJcjAoIoCtIjkdsMW49zFc3S6Z+IjcwRKM7AzrZE=;
b=A7YMg13kl9n/j/a5GIlY99Go8c7ve/5sQyfA0U916dvCbMTHXqQLoFwOXxVCJk8idYE1O8
hSR5lGV3VohX04/zJ778KcZorztZh8MuSF9nJRuAxBxgClEtVn7v1E2olOy7miBYXyIG3m
CtczYLcwpJs1VbQaPFq/yA5JtXzJa/k=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:24 +0100
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 01/30] qemu: Explicitly add/remove
/dev/vfio/vfio to/from NS/CGroups
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-MC-Unique: rteU7GqIOFqkFJseBUeZVg-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
In near future, the decision what to do with /dev/vfio/vfio with
respect to domain namespace and CGroup is going to be moved out
of qemuDomainGetHostdevPath() because there will be some other
types of devices than hostdevs that need access to VFIO.
All functions that I'm changing (except qemuSetupHostdevCgroup())
assume that hostdev we are adding/removing to VM is not in the
definition yet (because of how qemuDomainNeedsVFIO() is written).
Fortunately, this assumption is true.
For qemuSetupHostdevCgroup(), the worst thing that may happen is
that we allow /dev/vfio/vfio which was already allowed.
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/qemu/qemu_cgroup.c | 47 +++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_domain.c | 36 ++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 31cf71146b..65b148cd83 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -25,6 +25,7 @@
#include "qemu_domain.h"
#include "qemu_process.h"
#include "qemu_extdevice.h"
+#include "qemu_hostdev.h"
#include "virlog.h"
#include "viralloc.h"
#include "virerror.h"
@@ -359,6 +360,17 @@ qemuTeardownInputCgroup(virDomainObjPtr vm,
}
=20
=20
+/**
+ * qemuSetupHostdevCgroup:
+ * vm: domain object
+ * @dev: device to allow
+ *
+ * For given host device @dev allow access to in Cgroups.
+ * Note, @dev must not be in @vm's definition.
+ *
+ * Returns: 0 on success,
+ * -1 otherwise.
+ */
int
qemuSetupHostdevCgroup(virDomainObjPtr vm,
virDomainHostdevDefPtr dev)
@@ -385,6 +397,16 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
goto cleanup;
}
=20
+ if (qemuHostdevNeedsVFIO(dev)) {
+ VIR_DEBUG("Cgroup allow %s perms=3D%d", QEMU_DEV_VFIO, VIR_CGROUP_=
DEVICE_RW);
+ rv =3D virCgroupAllowDevicePath(priv->cgroup, QEMU_DEV_VFIO,
+ VIR_CGROUP_DEVICE_RW, false);
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
+ QEMU_DEV_VFIO, "rw", rv);
+ if (rv < 0)
+ goto cleanup;
+ }
+
ret =3D 0;
=20
cleanup:
@@ -395,9 +417,21 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
return ret;
}
=20
+
+/**
+ * qemuTeardownHostdevCgroup:
+ * @vm: doamin object
+ * @dev: device to tear down
+ *
+ * For given host device @dev deny access to it in CGroups.
+ * Note, @dev must not be in @vm's definition.
+ *
+ * Returns: 0 on success,
+ * -1 otherwise.
+ */
int
qemuTeardownHostdevCgroup(virDomainObjPtr vm,
- virDomainHostdevDefPtr dev)
+ virDomainHostdevDefPtr dev)
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
char **path =3D NULL;
@@ -421,6 +455,17 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
goto cleanup;
}
=20
+ if (qemuHostdevNeedsVFIO(dev) &&
+ !qemuDomainNeedsVFIO(vm->def)) {
+ VIR_DEBUG("Cgroup deny " QEMU_DEV_VFIO);
+ rv =3D virCgroupDenyDevicePath(priv->cgroup, QEMU_DEV_VFIO,
+ VIR_CGROUP_DEVICE_RWM, false);
+ virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
+ QEMU_DEV_VFIO, "rwm", rv);
+ if (rv < 0)
+ goto cleanup;
+ }
+
ret =3D 0;
cleanup:
for (i =3D 0; i < npaths; i++)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d1596a28ca..550ae848df 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -13542,6 +13542,10 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg =
G_GNUC_UNUSED,
goto cleanup;
}
=20
+ if (qemuHostdevNeedsVFIO(dev) &&
+ qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0)
+ goto cleanup;
+
ret =3D 0;
cleanup:
for (i =3D 0; i < npaths; i++)
@@ -14565,6 +14569,17 @@ qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm=
G_GNUC_UNUSED,
}
=20
=20
+/**
+ * qemuDomainNamespaceSetupHostdev:
+ * @vm: domain object
+ * @hostdev: hostdev to create in @vm's namespace
+ *
+ * For given @hostdev, create its devfs representation (if it has one) in
+ * domain namespace. Note, @hostdev must not be in @vm's definition.
+ *
+ * Returns: 0 on success,
+ * -1 otherwise.
+ */
int
qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -14579,6 +14594,11 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
if (qemuDomainNamespaceMknodPaths(vm, (const char **)paths, npaths) < =
0)
goto cleanup;
=20
+ if (qemuHostdevNeedsVFIO(hostdev) &&
+ !qemuDomainNeedsVFIO(vm->def) &&
+ qemuDomainNamespaceMknodPath(vm, QEMU_DEV_VFIO) < 0)
+ goto cleanup;
+
ret =3D 0;
cleanup:
for (i =3D 0; i < npaths; i++)
@@ -14588,6 +14608,17 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
}
=20
=20
+/**
+ * qemuDomainNamespaceTeardownHostdev:
+ * @vm: domain object
+ * @hostdev: hostdev to remove in @vm's namespace
+ *
+ * For given @hostdev, remove its devfs representation (if it has one) in
+ * domain namespace. Note, @hostdev must not be in @vm's definition.
+ *
+ * Returns: 0 on success,
+ * -1 otherwise.
+ */
int
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -14603,6 +14634,11 @@ qemuDomainNamespaceTeardownHostdev(virDomainObjPtr=
vm,
if (qemuDomainNamespaceUnlinkPaths(vm, (const char **)paths, npaths) <=
0)
goto cleanup;
=20
+ if (qemuHostdevNeedsVFIO(hostdev) &&
+ !qemuDomainNeedsVFIO(vm->def) &&
+ qemuDomainNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0)
+ goto cleanup;
+
ret =3D 0;
cleanup:
for (i =3D 0; i < npaths; i++)
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.120 as permitted sender) client-ip=207.211.31.120;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296849; cv=none;
d=zohomail.com; s=zohoarc;
b=Sdhyl32r0ZDtrJEX0FjR6/W0M6O/ssjB+p2qJFcD3onYV/x1DasEFBYUulDCWJqBhfAbvYIisKCMyqgmlOkvO3FF4RbrQ8cBpCfsTu1GXW2T8ju2okH4PHjXrTajXFxJr/z8+2sp4lEXkyXlsAF1y/AlmHk02i4WKsNdAcnOFYQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296849;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=Y67dFitmR98jNbVr8NYs9/j+PAWdx7Q3mlJtrs5yHOY=;
b=doYw64kstDAXeEAMKkLfsJ3bI0E2UJgpQD05YzgiP31R6ovJ14dlG7dLRjN1hv9MFkaVt6MvQ8HmG2Vr4m9q/Ewpnq6NPPz3bUQW28VwbTwn7e4Z9HmC+deulABm5e/gH/2PR53HJdiYe7fwuWxB6/0TdvAV3xrDjdaZMAXryC8=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[207.211.31.120]) by mx.zohomail.com
with SMTPS id 1575296849687479.19444680819095;
Mon, 2 Dec 2019 06:27:29 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-291-xb470t2HPy2GZAd0jrjS5A-1; Mon, 02 Dec 2019 09:27:27 -0500
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35A9B1014996;
Mon, 2 Dec 2019 14:27:21 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id EFE4E5C578;
Mon, 2 Dec 2019 14:27:20 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8D8A918089D0;
Mon, 2 Dec 2019 14:27:20 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER0hf027255 for ;
Mon, 2 Dec 2019 09:27:00 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 25D8067662; Mon, 2 Dec 2019 14:27:00 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id A2AFD6764D
for ; Mon, 2 Dec 2019 14:26:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296848;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=Y67dFitmR98jNbVr8NYs9/j+PAWdx7Q3mlJtrs5yHOY=;
b=SgXbscjxAUysrmkISe/aAo3qCjLJGgMaoki5izKoc60fpm5BbGdXRgsRO8wC8TSCs5e/sT
d2vdyPJNufC3M+2dGIQ17aek2Xf09HiGBSNG0M8VtXDnhUZ1j3DHVdClzIgnPni7JYZ6DB
lcuazhwnDudmsqrFqyf/82z3k045Z0U=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:25 +0100
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 02/30] qemuDomainGetHostdevPath: Use more
g_autoptr()/g_autofree
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-MC-Unique: xb470t2HPy2GZAd0jrjS5A-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
There are several variables which could be automatically freed
upon return from the function. I'm not changing @tmpPaths (which
is a string list) because it is going to be removed in next
commit.
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/qemu/qemu_domain.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 550ae848df..6daae24c3d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12891,14 +12891,14 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s=
csi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u=
.mdev;
- virPCIDevicePtr pci =3D NULL;
- virUSBDevicePtr usb =3D NULL;
- virSCSIDevicePtr scsi =3D NULL;
- virSCSIVHostDevicePtr host =3D NULL;
- char *tmpPath =3D NULL;
+ g_autoptr(virPCIDevice) pci =3D NULL;
+ g_autoptr(virUSBDevice) usb =3D NULL;
+ g_autoptr(virSCSIDevice) scsi =3D NULL;
+ g_autoptr(virSCSIVHostDevice) host =3D NULL;
+ g_autofree char *tmpPath =3D NULL;
bool includeVFIO =3D false;
char **tmpPaths =3D NULL;
- int *tmpPerms =3D NULL;
+ g_autofree int *tmpPerms =3D NULL;
size_t tmpNpaths =3D 0;
int perm =3D 0;
=20
@@ -13025,12 +13025,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
ret =3D 0;
cleanup:
virStringListFreeCount(tmpPaths, tmpNpaths);
- VIR_FREE(tmpPerms);
- virPCIDeviceFree(pci);
- virUSBDeviceFree(usb);
- virSCSIDeviceFree(scsi);
- virSCSIVHostDeviceFree(host);
- VIR_FREE(tmpPath);
return ret;
}
=20
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
205.139.110.61 as permitted sender) client-ip=205.139.110.61;
envelope-from=libvir-list-bounces@redhat.com;
helo=us-smtp-delivery-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575297005; cv=none;
d=zohomail.com; s=zohoarc;
b=eTYW6XU0nfr+Sic1pl+DJzzJaPrOJGKxkQubgEHtKe5v0M1bT4VR4Ke94GctR0gxXgx+0f+qf/PwLnhQLq9MNyt3IPgGfpEamoUQVkHS6bxIi3Pewg+mCgLScBkmrHZ1APtowlOtLYwgzU5Q89+6EFicjy05aDTDGqLkkN5rFiI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575297005;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=ytAWQ1HJi1+MrZw17vSP6xeUfNdPxJryTWqvubmbnUQ=;
b=Ei4517Xc3nrLUoSZqjV8PNGWaCReNJujYuaGmWFaHdRHrPN5n4i9RkH552S8EmxWObVFzRCdv6EWJ2R4M3b59r34G92dgiKX7KohV+/T7eiJx3/Yzu2cZ7GVJTpJjTYuXgTLKlJbFvWZTG/Hm7vVL+L63bCFvorqurhKvFPCLpM=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
[205.139.110.61]) by mx.zohomail.com
with SMTPS id 1575297005789631.9759972159239;
Mon, 2 Dec 2019 06:30:05 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-409-liMu7AvZM-KI0o_JnKrm6A-1; Mon, 02 Dec 2019 09:27:34 -0500
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A14628BEA4A;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 68C9C5D9E5;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1041018089D7;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER0dq027268 for ;
Mon, 2 Dec 2019 09:27:00 -0500
Received: by smtp.corp.redhat.com (Postfix)
id ECB0667662; Mon, 2 Dec 2019 14:27:00 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 751CD6764D
for ; Mon, 2 Dec 2019 14:27:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575297002;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=ytAWQ1HJi1+MrZw17vSP6xeUfNdPxJryTWqvubmbnUQ=;
b=AluUjDnnuy+Fslg1Mrz1DIaYgr/CfzmxjdVzYt4jwfoaeGsbIegwQDZG0/nCG1IGr0fv2R
KEFXRiGjL3r86BQLoDR3rjw7p1V0x2kcSX1wwIXfKJjpLXODBK54bzCRQri4wbKE8+bGgn
lXfA9vMYpX8+LjbAclMsgbMEulIwnvo=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:26 +0100
Message-Id:
<1eb009bf00167e1fe4aa9967d0fceff35826e626.1575296392.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 03/30] qemuDomainGetHostdevPath: Don't include
/dev/vfio/vfio in returned paths
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-MC-Unique: liMu7AvZM-KI0o_JnKrm6A-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
Now that all callers of qemuDomainGetHostdevPath() handle
/dev/vfio/vfio on their own, we can safely drop handling in this
function. In near future the decision whether domain needs VFIO
file is going to include more device types than just
virDomainHostdev.
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/qemu/qemu_cgroup.c | 52 ++++++++--------------
src/qemu/qemu_domain.c | 98 +++++++++---------------------------------
src/qemu/qemu_domain.h | 9 ++--
3 files changed, 42 insertions(+), 117 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 65b148cd83..d54d01d4c0 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -376,26 +376,23 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
virDomainHostdevDefPtr dev)
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
- char **path =3D NULL;
- int *perms =3D NULL;
- size_t i, npaths =3D 0;
+ g_autofree char *path =3D NULL;
+ int perms;
int rv, ret =3D -1;
=20
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
- if (qemuDomainGetHostdevPath(NULL, dev, false, &npaths, &path, &perms)=
< 0)
+ if (qemuDomainGetHostdevPath(dev, &path, &perms) < 0)
goto cleanup;
=20
- for (i =3D 0; i < npaths; i++) {
- VIR_DEBUG("Cgroup allow %s perms=3D%d", path[i], perms[i]);
- rv =3D virCgroupAllowDevicePath(priv->cgroup, path[i], perms[i], f=
alse);
- virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path[i],
- virCgroupGetDevicePermsString(perms[i]),
- rv);
- if (rv < 0)
- goto cleanup;
- }
+ VIR_DEBUG("Cgroup allow %s perms=3D%d", path, perms);
+ rv =3D virCgroupAllowDevicePath(priv->cgroup, path, perms, false);
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path,
+ virCgroupGetDevicePermsString(perms),
+ rv);
+ if (rv < 0)
+ goto cleanup;
=20
if (qemuHostdevNeedsVFIO(dev)) {
VIR_DEBUG("Cgroup allow %s perms=3D%d", QEMU_DEV_VFIO, VIR_CGROUP_=
DEVICE_RW);
@@ -410,10 +407,6 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
ret =3D 0;
=20
cleanup:
- for (i =3D 0; i < npaths; i++)
- VIR_FREE(path[i]);
- VIR_FREE(path);
- VIR_FREE(perms);
return ret;
}
=20
@@ -434,26 +427,22 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
virDomainHostdevDefPtr dev)
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
- char **path =3D NULL;
- size_t i, npaths =3D 0;
+ g_autofree char *path =3D NULL;
int rv, ret =3D -1;
=20
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
- if (qemuDomainGetHostdevPath(vm->def, dev, true,
- &npaths, &path, NULL) < 0)
+ if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
goto cleanup;
=20
- for (i =3D 0; i < npaths; i++) {
- VIR_DEBUG("Cgroup deny %s", path[i]);
- rv =3D virCgroupDenyDevicePath(priv->cgroup, path[i],
- VIR_CGROUP_DEVICE_RWM, false);
- virDomainAuditCgroupPath(vm, priv->cgroup,
- "deny", path[i], "rwm", rv);
- if (rv < 0)
- goto cleanup;
- }
+ VIR_DEBUG("Cgroup deny %s", path);
+ rv =3D virCgroupDenyDevicePath(priv->cgroup, path,
+ VIR_CGROUP_DEVICE_RWM, false);
+ virDomainAuditCgroupPath(vm, priv->cgroup,
+ "deny", path, "rwm", rv);
+ if (rv < 0)
+ goto cleanup;
=20
if (qemuHostdevNeedsVFIO(dev) &&
!qemuDomainNeedsVFIO(vm->def)) {
@@ -468,9 +457,6 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
=20
ret =3D 0;
cleanup:
- for (i =3D 0; i < npaths; i++)
- VIR_FREE(path[i]);
- VIR_FREE(path);
return ret;
}
=20
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6daae24c3d..be769cb3ff 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12861,29 +12861,23 @@ qemuDomainNeedsVFIO(const virDomainDef *def)
=20
/**
* qemuDomainGetHostdevPath:
- * @def: domain definition
* @dev: host device definition
- * @teardown: true if device will be removed
- * @npaths: number of items in @path and @perms arrays
* @path: resulting path to @dev
* @perms: Optional pointer to VIR_CGROUP_DEVICE_* perms
*
* For given device @dev fetch its host path and store it at
- * @path. If a device requires other paths to be present/allowed
- * they are stored in the @path array after the actual path.
- * Optionally, caller can get @perms on the path (e.g. rw/ro).
+ * @path. Optionally, caller can get @perms on the path (e.g.
+ * rw/ro).
*
- * The caller is responsible for freeing the memory.
+ * The caller is responsible for freeing the @path when no longer
+ * needed.
*
* Returns 0 on success, -1 otherwise.
*/
int
-qemuDomainGetHostdevPath(virDomainDefPtr def,
- virDomainHostdevDefPtr dev,
- bool teardown,
- size_t *npaths,
- char ***path,
- int **perms)
+qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
+ char **path,
+ int *perms)
{
int ret =3D -1;
virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb;
@@ -12896,14 +12890,9 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
g_autoptr(virSCSIDevice) scsi =3D NULL;
g_autoptr(virSCSIVHostDevice) host =3D NULL;
g_autofree char *tmpPath =3D NULL;
- bool includeVFIO =3D false;
- char **tmpPaths =3D NULL;
g_autofree int *tmpPerms =3D NULL;
- size_t tmpNpaths =3D 0;
int perm =3D 0;
=20
- *npaths =3D 0;
-
switch ((virDomainHostdevMode) dev->mode) {
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
@@ -12920,12 +12909,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
goto cleanup;
=20
perm =3D VIR_CGROUP_DEVICE_RW;
- if (teardown) {
- if (!virDomainDefHasVFIOHostdev(def))
- includeVFIO =3D true;
- } else {
- includeVFIO =3D true;
- }
}
break;
=20
@@ -12981,7 +12964,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
if (!(tmpPath =3D virMediatedDeviceGetIOMMUGroupDev(mdevsrc->u=
uidstr)))
goto cleanup;
=20
- includeVFIO =3D true;
perm =3D VIR_CGROUP_DEVICE_RW;
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
@@ -12995,36 +12977,11 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
break;
}
=20
- if (tmpPath) {
- size_t toAlloc =3D 1;
-
- if (includeVFIO)
- toAlloc =3D 2;
-
- if (VIR_ALLOC_N(tmpPaths, toAlloc) < 0 ||
- VIR_ALLOC_N(tmpPerms, toAlloc) < 0)
- goto cleanup;
- tmpPaths[0] =3D g_strdup(tmpPath);
- tmpNpaths =3D toAlloc;
- tmpPerms[0] =3D perm;
-
- if (includeVFIO) {
- tmpPaths[1] =3D g_strdup(QEMU_DEV_VFIO);
- tmpPerms[1] =3D VIR_CGROUP_DEVICE_RW;
- }
- }
-
- *npaths =3D tmpNpaths;
- tmpNpaths =3D 0;
- *path =3D tmpPaths;
- tmpPaths =3D NULL;
- if (perms) {
- *perms =3D tmpPerms;
- tmpPerms =3D NULL;
- }
+ *path =3D g_steal_pointer(&tmpPath);
+ if (perms)
+ *perms =3D perm;
ret =3D 0;
cleanup:
- virStringListFreeCount(tmpPaths, tmpNpaths);
return ret;
}
=20
@@ -13525,16 +13482,13 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg=
G_GNUC_UNUSED,
const struct qemuDomainCreateDeviceData *data)
{
int ret =3D -1;
- char **path =3D NULL;
- size_t i, npaths =3D 0;
+ g_autofree char *path =3D NULL;
=20
- if (qemuDomainGetHostdevPath(NULL, dev, false, &npaths, &path, NULL) <=
0)
+ if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
goto cleanup;
=20
- for (i =3D 0; i < npaths; i++) {
- if (qemuDomainCreateDevice(path[i], data, false) < 0)
- goto cleanup;
- }
+ if (qemuDomainCreateDevice(path, data, false) < 0)
+ goto cleanup;
=20
if (qemuHostdevNeedsVFIO(dev) &&
qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0)
@@ -13542,9 +13496,6 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg G=
_GNUC_UNUSED,
=20
ret =3D 0;
cleanup:
- for (i =3D 0; i < npaths; i++)
- VIR_FREE(path[i]);
- VIR_FREE(path);
return ret;
}
=20
@@ -14579,13 +14530,12 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr v=
m,
virDomainHostdevDefPtr hostdev)
{
int ret =3D -1;
- char **paths =3D NULL;
- size_t i, npaths =3D 0;
+ g_autofree char *path =3D NULL;
=20
- if (qemuDomainGetHostdevPath(NULL, hostdev, false, &npaths, &paths, NU=
LL) < 0)
+ if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
goto cleanup;
=20
- if (qemuDomainNamespaceMknodPaths(vm, (const char **)paths, npaths) < =
0)
+ if (qemuDomainNamespaceMknodPath(vm, path) < 0)
goto cleanup;
=20
if (qemuHostdevNeedsVFIO(hostdev) &&
@@ -14595,9 +14545,6 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
=20
ret =3D 0;
cleanup:
- for (i =3D 0; i < npaths; i++)
- VIR_FREE(paths[i]);
- VIR_FREE(paths);
return ret;
}
=20
@@ -14618,14 +14565,12 @@ qemuDomainNamespaceTeardownHostdev(virDomainObjPt=
r vm,
virDomainHostdevDefPtr hostdev)
{
int ret =3D -1;
- char **paths =3D NULL;
- size_t i, npaths =3D 0;
+ g_autofree char *path =3D NULL;
=20
- if (qemuDomainGetHostdevPath(vm->def, hostdev, true,
- &npaths, &paths, NULL) < 0)
+ if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
goto cleanup;
=20
- if (qemuDomainNamespaceUnlinkPaths(vm, (const char **)paths, npaths) <=
0)
+ if (qemuDomainNamespaceUnlinkPath(vm, path) < 0)
goto cleanup;
=20
if (qemuHostdevNeedsVFIO(hostdev) &&
@@ -14635,9 +14580,6 @@ qemuDomainNamespaceTeardownHostdev(virDomainObjPtr =
vm,
=20
ret =3D 0;
cleanup:
- for (i =3D 0; i < npaths; i++)
- VIR_FREE(paths[i]);
- VIR_FREE(paths);
return ret;
}
=20
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index db45a932dc..65bd83aece 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1079,12 +1079,9 @@ bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr=
video,
=20
bool qemuDomainNeedsVFIO(const virDomainDef *def);
=20
-int qemuDomainGetHostdevPath(virDomainDefPtr def,
- virDomainHostdevDefPtr dev,
- bool teardown,
- size_t *npaths,
- char ***path,
- int **perms);
+int qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
+ char **path,
+ int *perms);
=20
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
virSecurityManagerPtr mgr,
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.120 as permitted sender) client-ip=207.211.31.120;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296834; cv=none;
d=zohomail.com; s=zohoarc;
b=Lp2JfzOJorpTjViawmsrPYzXwNX6vs6wYLIFLOMb0p3VB9JqKZc3lISwv2yU97Dw5mD1cZVoyDKCrnOh3ED/OJ2ef6ew5/ZbO0/tLD1QsWHXJ1+Wprl0XugynZXmMZ0aj4uNxdANCKDAjA1otcMEjpbVG4ZxvOdrTNfOMkLaTGw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296834;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=Uq5BbtFLI/1wgjtjMVO0y8QL+0F+0E6q3786cwkMxEc=;
b=TtC2f29phOG+84rRTkmwcOfwCNtfumQNF4CMmmqzUpPfTQh6+qivQhIEBQwO3BVtlhuGel1mMF1Mx2c+CdY3c32CuVoui6c1L6d22v8o0Ciz6IoDixfnAamBH5QsRGHU8P3igRUXkoX82PUKASz10aETNMn7Anr89Yy+7FPfX3M=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[207.211.31.120]) by mx.zohomail.com
with SMTPS id 1575296834240375.181005028689;
Mon, 2 Dec 2019 06:27:14 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-29-3vGUqxWqOuq5FCGFi9wzEQ-1; Mon, 02 Dec 2019 09:27:11 -0500
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C00F710513CD;
Mon, 2 Dec 2019 14:27:05 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id D480D67662;
Mon, 2 Dec 2019 14:27:03 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 80E3C4EDAF;
Mon, 2 Dec 2019 14:27:03 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER1WM027273 for ;
Mon, 2 Dec 2019 09:27:01 -0500
Received: by smtp.corp.redhat.com (Postfix)
id BD21667E56; Mon, 2 Dec 2019 14:27:01 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 4644C67E52
for ; Mon, 2 Dec 2019 14:27:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296833;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=Uq5BbtFLI/1wgjtjMVO0y8QL+0F+0E6q3786cwkMxEc=;
b=KL9Lu1vWReVf0MtNFI/Ou2YAblULGtrOXvwLuagd1kk8CwG93h44C2Pjf/4rg+MkaAhW0q
f24Xc320WZ0bC8yaRmKcspzAbsTYInKs0LFNEWHHcKH4ZYdCAhzMlUlk0k8b8FxPboclRy
Bq2OYGqc2GMPpn2BuBgKkLIJeh/t55M=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:27 +0100
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 04/30] qemu: Drop some 'cleanup' labels
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-MC-Unique: 3vGUqxWqOuq5FCGFi9wzEQ-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
Previous patches rendered some of 'cleanup' labels needless.
Drop them.
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/qemu/qemu_cgroup.c | 25 +++++++++------------
src/qemu/qemu_domain.c | 50 ++++++++++++++++--------------------------
2 files changed, 29 insertions(+), 46 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index d54d01d4c0..d23318db8c 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -378,13 +378,13 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv =3D vm->privateData;
g_autofree char *path =3D NULL;
int perms;
- int rv, ret =3D -1;
+ int rv;
=20
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
if (qemuDomainGetHostdevPath(dev, &path, &perms) < 0)
- goto cleanup;
+ return -1;
=20
VIR_DEBUG("Cgroup allow %s perms=3D%d", path, perms);
rv =3D virCgroupAllowDevicePath(priv->cgroup, path, perms, false);
@@ -392,7 +392,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
virCgroupGetDevicePermsString(perms),
rv);
if (rv < 0)
- goto cleanup;
+ return -1;
=20
if (qemuHostdevNeedsVFIO(dev)) {
VIR_DEBUG("Cgroup allow %s perms=3D%d", QEMU_DEV_VFIO, VIR_CGROUP_=
DEVICE_RW);
@@ -401,13 +401,10 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
QEMU_DEV_VFIO, "rw", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
}
=20
- ret =3D 0;
-
- cleanup:
- return ret;
+ return 0;
}
=20
=20
@@ -428,13 +425,13 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
{
qemuDomainObjPrivatePtr priv =3D vm->privateData;
g_autofree char *path =3D NULL;
- int rv, ret =3D -1;
+ int rv;
=20
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
return 0;
=20
if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
=20
VIR_DEBUG("Cgroup deny %s", path);
rv =3D virCgroupDenyDevicePath(priv->cgroup, path,
@@ -442,7 +439,7 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup,
"deny", path, "rwm", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
=20
if (qemuHostdevNeedsVFIO(dev) &&
!qemuDomainNeedsVFIO(vm->def)) {
@@ -452,12 +449,10 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
QEMU_DEV_VFIO, "rwm", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
}
=20
- ret =3D 0;
- cleanup:
- return ret;
+ return 0;
}
=20
=20
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index be769cb3ff..21a4dad37d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12879,7 +12879,6 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
char **path,
int *perms)
{
- int ret =3D -1;
virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi;
@@ -12903,10 +12902,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d=
ev,
pcisrc->addr.slot,
pcisrc->addr.function);
if (!pci)
- goto cleanup;
+ return -1;
=20
if (!(tmpPath =3D virPCIDeviceGetIOMMUGroupDev(pci)))
- goto cleanup;
+ return -1;
=20
perm =3D VIR_CGROUP_DEVICE_RW;
}
@@ -12919,7 +12918,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
usbsrc->device,
NULL);
if (!usb)
- goto cleanup;
+ return -1;
=20
tmpPath =3D g_strdup(virUSBDeviceGetPath(usb));
perm =3D VIR_CGROUP_DEVICE_RW;
@@ -12940,7 +12939,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
dev->shareable);
=20
if (!scsi)
- goto cleanup;
+ return -1;
=20
tmpPath =3D g_strdup(virSCSIDeviceGetPath(scsi));
perm =3D virSCSIDeviceGetReadonly(scsi) ?
@@ -12952,7 +12951,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
if (hostsrc->protocol =3D=3D
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) {
if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn)))
- goto cleanup;
+ return -1;
=20
tmpPath =3D g_strdup(virSCSIVHostDeviceGetPath(host));
perm =3D VIR_CGROUP_DEVICE_RW;
@@ -12962,7 +12961,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
=20
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
if (!(tmpPath =3D virMediatedDeviceGetIOMMUGroupDev(mdevsrc->u=
uidstr)))
- goto cleanup;
+ return -1;
=20
perm =3D VIR_CGROUP_DEVICE_RW;
break;
@@ -12980,9 +12979,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
*path =3D g_steal_pointer(&tmpPath);
if (perms)
*perms =3D perm;
- ret =3D 0;
- cleanup:
- return ret;
+ return 0;
}
=20
=20
@@ -13481,22 +13478,19 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg=
G_GNUC_UNUSED,
virDomainHostdevDefPtr dev,
const struct qemuDomainCreateDeviceData *data)
{
- int ret =3D -1;
g_autofree char *path =3D NULL;
=20
if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuDomainCreateDevice(path, data, false) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuHostdevNeedsVFIO(dev) &&
qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0)
- goto cleanup;
+ return -1;
=20
- ret =3D 0;
- cleanup:
- return ret;
+ return 0;
}
=20
=20
@@ -14529,23 +14523,20 @@ int
qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
- int ret =3D -1;
g_autofree char *path =3D NULL;
=20
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuDomainNamespaceMknodPath(vm, path) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuHostdevNeedsVFIO(hostdev) &&
!qemuDomainNeedsVFIO(vm->def) &&
qemuDomainNamespaceMknodPath(vm, QEMU_DEV_VFIO) < 0)
- goto cleanup;
+ return -1;
=20
- ret =3D 0;
- cleanup:
- return ret;
+ return 0;
}
=20
=20
@@ -14564,23 +14555,20 @@ int
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
- int ret =3D -1;
g_autofree char *path =3D NULL;
=20
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuDomainNamespaceUnlinkPath(vm, path) < 0)
- goto cleanup;
+ return -1;
=20
if (qemuHostdevNeedsVFIO(hostdev) &&
!qemuDomainNeedsVFIO(vm->def) &&
qemuDomainNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0)
- goto cleanup;
+ return -1;
=20
- ret =3D 0;
- cleanup:
- return ret;
+ return 0;
}
=20
=20
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.81 as permitted sender) client-ip=207.211.31.81;
envelope-from=libvir-list-bounces@redhat.com;
helo=us-smtp-delivery-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296860; cv=none;
d=zohomail.com; s=zohoarc;
b=QEl5GUehxc3JlOwh601Sj2SkGsfb6tdglc2s6YB27kLoZBzjFqyoOZmo3+y357jHNwnFqzbTC6WM3pCFDuWhZuCW165WpFfCGG7yKKID2Ku9vH9KU348KJF/lSdiGqRef8Tcp+/blGlaviC/2vpAWXrCjdsBjS+t4/wSHDmVqwI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296860;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=Ru1djAH7eKE4GJgIrc8T1LoM5mp2yryMdjxkRt+b4Fk=;
b=HWmekyaSLRZY5WLh2W9itx5PHmkI50t+jeeZiohEUnzHudVwpp/m99szy157tqhwyKjZhR762AFxiRMixHs0v34w1KIq+asS0xlOPIF9DqofVA/OfcbR95ROz1LE5+/Sjc9d8G9uOKiIPTeRPI82lLtIHPaWKi8jxf2Osv0L4kQ=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
[207.211.31.81]) by mx.zohomail.com
with SMTPS id 1575296860356299.67207901013194;
Mon, 2 Dec 2019 06:27:40 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-211-6cS3T1_lPqe0PPI-lDTwAQ-1; Mon, 02 Dec 2019 09:27:37 -0500
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B87E9B8C7;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 524D05D6A7;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 04C4F180880D;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER2ss027288 for ;
Mon, 2 Dec 2019 09:27:02 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 932A667E56; Mon, 2 Dec 2019 14:27:02 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1AF6D67E52
for ; Mon, 2 Dec 2019 14:27:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296859;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=Ru1djAH7eKE4GJgIrc8T1LoM5mp2yryMdjxkRt+b4Fk=;
b=Aar/Vp0DAxk/YDoW/XPZmZ7P17G7vJymhuG/GOjtb5wdEbCeCD374m6mPzeoYzXQGP+/9P
Zi2Sv0fN2CXZ1NOTBI5GlozepBKyEUR9/6LedegTqewer8OH/dPnHz2BAIJVT9OkLbkwf9
gnLylJxsFnAIHSJBkJoNNLhDHUkXwWA=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:28 +0100
Message-Id:
<667ad03b9edd9b986a7939cc316b4ab64615b27b.1575296392.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 05/30] virpci: Introduce and use
virPCIDeviceAddressGetIOMMUGroupDev
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-MC-Unique: 6cS3T1_lPqe0PPI-lDTwAQ-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
Sometimes, we have a PCI address and not fully allocated
virPCIDevice and yet we still want to know its /dev/vfio/N path.
Introduce virPCIDeviceAddressGetIOMMUGroupDev() function exactly
for that.
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 11 +----------
src/util/virpci.c | 15 +++++++++++++++
src/util/virpci.h | 1 +
4 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8fe0bf9365..0988f36c20 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2692,6 +2692,7 @@ virPCIDeviceAddressAsString;
virPCIDeviceAddressEqual;
virPCIDeviceAddressFree;
virPCIDeviceAddressGetIOMMUGroupAddresses;
+virPCIDeviceAddressGetIOMMUGroupDev;
virPCIDeviceAddressGetIOMMUGroupNum;
virPCIDeviceAddressGetSysfsFile;
virPCIDeviceAddressIOMMUGroupIterate;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 21a4dad37d..59e98de2d2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12884,12 +12884,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d=
ev,
virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s=
csi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u=
.mdev;
- g_autoptr(virPCIDevice) pci =3D NULL;
g_autoptr(virUSBDevice) usb =3D NULL;
g_autoptr(virSCSIDevice) scsi =3D NULL;
g_autoptr(virSCSIVHostDevice) host =3D NULL;
g_autofree char *tmpPath =3D NULL;
- g_autofree int *tmpPerms =3D NULL;
int perm =3D 0;
=20
switch ((virDomainHostdevMode) dev->mode) {
@@ -12897,14 +12895,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr de=
v,
switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO=
) {
- pci =3D virPCIDeviceNew(pcisrc->addr.domain,
- pcisrc->addr.bus,
- pcisrc->addr.slot,
- pcisrc->addr.function);
- if (!pci)
- return -1;
-
- if (!(tmpPath =3D virPCIDeviceGetIOMMUGroupDev(pci)))
+ if (!(tmpPath =3D virPCIDeviceAddressGetIOMMUGroupDev(&pci=
src->addr)))
return -1;
=20
perm =3D VIR_CGROUP_DEVICE_RW;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 9bea5a20d0..b0a4107551 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1942,6 +1942,21 @@ virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddr=
essPtr addr)
}
=20
=20
+char *
+virPCIDeviceAddressGetIOMMUGroupDev(const virPCIDeviceAddress *devAddr)
+{
+ g_autoptr(virPCIDevice) pci =3D NULL;
+
+ if (!(pci =3D virPCIDeviceNew(devAddr->domain,
+ devAddr->bus,
+ devAddr->slot,
+ devAddr->function)))
+ return NULL;
+
+ return virPCIDeviceGetIOMMUGroupDev(pci);
+}
+
+
/* virPCIDeviceGetIOMMUGroupDev - return the name of the device used
* to control this PCI device's group (e.g. "/dev/vfio/15")
*/
diff --git a/src/util/virpci.h b/src/util/virpci.h
index cfb4581edf..1c94dc307c 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -195,6 +195,7 @@ int virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDev=
iceAddressPtr devAddr,
virPCIDeviceAddressPtr **iom=
muGroupDevices,
size_t *nIommuGroupDevices);
int virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr);
+char *virPCIDeviceAddressGetIOMMUGroupDev(const virPCIDeviceAddress *devAd=
dr);
char *virPCIDeviceGetIOMMUGroupDev(virPCIDevicePtr dev);
=20
int virPCIDeviceIsAssignable(virPCIDevicePtr dev,
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.81 as permitted sender) client-ip=207.211.31.81;
envelope-from=libvir-list-bounces@redhat.com;
helo=us-smtp-delivery-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296850; cv=none;
d=zohomail.com; s=zohoarc;
b=SPvXWK7iFzpEzvmCwZPeSTRfYOtDJDxdkIIxCKCJDSchfsFbrprVL4L8FbdcathQoxTux+xGPDs/AV5hgssHjBJCJTG2kINHzEk79ud5lAG9Phmm9NCaPd3hJyQi97rGszordmsxbkrKS2oUYg5qAuje9wn7tdbld3iTJLQ0IHQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296850;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=HD69gL4TGE7lsADEV5OJry+rJtcwn4eE/kkdFjdCXoM=;
b=X75PJOFw9P76uBGfRvqqC9t4tjWNIJzzgfioznwmkuzgpkEk5ALVrgr4DxGnYDa5g7aQNDxX1zfx0Q2R8/3H9ozGbdJ85O0Y9/PiPwoO0sBu9ETVqPHf7XTClmYimCNq1yVUkuWq/QVRSsBFVtFSKdME5eTZEKG3EXJA1FLT6iw=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
[207.211.31.81]) by mx.zohomail.com
with SMTPS id 1575296850763741.6160975485046;
Mon, 2 Dec 2019 06:27:30 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-375-b52O5NfON6W5mYotvCdxUg-1; Mon, 02 Dec 2019 09:27:27 -0500
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 416171083EA0;
Mon, 2 Dec 2019 14:27:21 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 06D675C240;
Mon, 2 Dec 2019 14:27:21 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9551F4EDAE;
Mon, 2 Dec 2019 14:27:20 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER3Uh027293 for ;
Mon, 2 Dec 2019 09:27:03 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 633C267E57; Mon, 2 Dec 2019 14:27:03 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id E037067E52
for ; Mon, 2 Dec 2019 14:27:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296849;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=HD69gL4TGE7lsADEV5OJry+rJtcwn4eE/kkdFjdCXoM=;
b=Uu7KCY6JTYXYbr9tgpW52R8LjeiVFKI5zFAX4MQpzMIWVtUzfMAju9ZCor7eIho0Q8XbOC
E5tdyrPZlXO2IcIEyR6LD6Ahf332HTvvx7Vao//qx8VTGoFlszJEUIWtyHiSpHSC+sIpXc
gmd2Iuy1RVtCoMXEfWYQodqxtHiBs38=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:29 +0100
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 06/30] virHostdevPreparePCIDevices: Separate
out function body
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-MC-Unique: b52O5NfON6W5mYotvCdxUg-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
In near future we will have a list of PCI devices we want to
detach (held in virPCIDeviceListPtr) but we don't have
virDomainHostdevDefPtr. That's okay because
virHostdevPreparePCIDevices() works with virPCIDeviceListPtr
mostly anyway. And in very few places where it needs
virDomainHostdevDefPtr are not interesting for our case.
Signed-off-by: Michal Privoznik
ACKed-by: Peter Krempa
Reviewed-by: Cole Robinson
---
src/util/virhostdev.c | 48 +++++++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 39e6b8f49f..b8e6e2bc36 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -714,27 +714,22 @@ virHostdevReattachAllPCIDevices(virHostdevManagerPtr =
mgr,
}
}
=20
-int
-virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
- const char *drv_name,
- const char *dom_name,
- const unsigned char *uuid,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- unsigned int flags)
+
+static int
+virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ const unsigned char *uuid,
+ virPCIDeviceListPtr pcidevs,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
{
- g_autoptr(virPCIDeviceList) pcidevs =3D NULL;
int last_processed_hostdev_vf =3D -1;
size_t i;
int ret =3D -1;
virPCIDeviceAddressPtr devAddr =3D NULL;
=20
- if (!nhostdevs)
- return 0;
-
- if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
- return -1;
-
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
=20
@@ -984,6 +979,29 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
return ret;
}
=20
+
+int
+virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ const unsigned char *uuid,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
+{
+ g_autoptr(virPCIDeviceList) pcidevs =3D NULL;
+
+ if (!nhostdevs)
+ return 0;
+
+ if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
+ return -1;
+
+ return virHostdevPreparePCIDevicesImpl(mgr, drv_name, dom_name, uuid,
+ pcidevs, hostdevs, nhostdevs, f=
lags);
+}
+
+
/* @oldStateDir:
* For upgrade purpose: see virHostdevRestoreNetConfig
*/
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
205.139.110.120 as permitted sender) client-ip=205.139.110.120;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296856; cv=none;
d=zohomail.com; s=zohoarc;
b=f5/Xp+aED2CbYqomH7bGfg/8Mh74Y3bpF8Odo3m33xUpOC9jRzueIyQS8e/2lf8yydAPu9sqVWSi1rLM6VUgYA3aMEFl7Wq8ZtWDf3U/Mm4XhW24VL7gPuLOdeKfewMI8ottiK+GbdsAPbyEQ7gsWih1ub2QF4AsinNwJssGELQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296856;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=IX7qrP/vxbLNH02bT7ksgiYDb6KZ84ywsPamAoz/gvw=;
b=S4Lcs4s9FcYVsG+yLgM46Pq8DdVBS72dypTbizj49jrDPdvKPx6KdBvfrv+iXo+AKXwZHrHxCM6tvh3zQH57uaAnDD/QduKXFUyZsxTryF0cu9s4+evplq9kYGT/hTJHgMp7euuzPQQKbsgY2F0u6YjbrTGlHD0WL5Y5gN7h3ZM=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[205.139.110.120]) by mx.zohomail.com
with SMTPS id 1575296856619741.6420963912824;
Mon, 2 Dec 2019 06:27:36 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-246-p6D8qNDAOwKw0wE6YU9ufQ-1; Mon, 02 Dec 2019 09:27:33 -0500
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A61668048E9;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 737C35D6A7;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1A12A4EDB1;
Mon, 2 Dec 2019 14:27:25 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER6ni027317 for ;
Mon, 2 Dec 2019 09:27:06 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8255B6764D; Mon, 2 Dec 2019 14:27:06 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 0BCE767662
for ; Mon, 2 Dec 2019 14:27:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296855;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=IX7qrP/vxbLNH02bT7ksgiYDb6KZ84ywsPamAoz/gvw=;
b=aTbsiLX/Qhx2NbeI6oarCGsjoQktBXjQpvDzZLt9IJ9YsLGR+uCQBiwmbrmJVSVGIGwzvf
NnGEz1YNC1mkXgdDzOhnEfx8cMY3AsVe3fOuEiOcgUX5O+mKbiRy4qne4ZifrP8MB6DDZC
epQg2FtcZOzUtdEeykkpJyhtDri0Pl8=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:30 +0100
Message-Id:
<3c143522acd9224ce40de2588fb40d6fb23479d1.1575296392.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 07/30] virHostdevReAttachPCIDevices: Separate
out function body
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-MC-Unique: p6D8qNDAOwKw0wE6YU9ufQ-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
In near future we will have a list of PCI devices we want to
re-attach to the host (held in virPCIDeviceListPtr) but we don't
have virDomainHostdevDefPtr. That's okay because
virHostdevReAttachPCIDevices() works with virPCIDeviceListPtr
mostly anyway. And in very few places where it needs
virDomainHostdevDefPtr are not interesting for our case.
Signed-off-by: Michal Privoznik
ACKed-by: Peter Krempa
Reviewed-by: Cole Robinson
---
src/util/virhostdev.c | 58 +++++++++++++++++++++++++++----------------
1 file changed, 37 insertions(+), 21 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index b8e6e2bc36..94a0185597 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1002,30 +1002,17 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mg=
r,
}
=20
=20
-/* @oldStateDir:
- * For upgrade purpose: see virHostdevRestoreNetConfig
- */
-void
-virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
- const char *drv_name,
- const char *dom_name,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- const char *oldStateDir)
+static void
+virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virPCIDeviceListPtr pcidevs,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
{
- g_autoptr(virPCIDeviceList) pcidevs =3D NULL;
size_t i;
=20
- if (!nhostdevs)
- return;
-
- if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))=
) {
- VIR_ERROR(_("Failed to allocate PCI device list: %s"),
- virGetLastErrorMessage());
- virResetLastError();
- return;
- }
-
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
=20
@@ -1121,6 +1108,35 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mg=
r,
virObjectUnlock(mgr->inactivePCIHostdevs);
}
=20
+
+/* @oldStateDir:
+ * For upgrade purpose: see virHostdevRestoreNetConfig
+ */
+void
+virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
+{
+ g_autoptr(virPCIDeviceList) pcidevs =3D NULL;
+
+ if (!nhostdevs)
+ return;
+
+ if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))=
) {
+ VIR_ERROR(_("Failed to allocate PCI device list: %s"),
+ virGetLastErrorMessage());
+ virResetLastError();
+ return;
+ }
+
+ virHostdevReAttachPCIDevicesImpl(mgr, drv_name, dom_name, pcidevs,
+ hostdevs, nhostdevs, oldStateDir);
+}
+
+
int
virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs,
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
205.139.110.61 as permitted sender) client-ip=205.139.110.61;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296853; cv=none;
d=zohomail.com; s=zohoarc;
b=KEikN6t34EHLdxOCP1pMefsmpcBsmiYLB85uqnwXk7xrDrFrDidQ0FaebdDrg1PghAWwchYNHUR2r1enrCrOdn4gseq49OIl8MBApwexaJKGDtsaCPHAqbHC85EoD+e8HCtzjm8CNpmjfkeqrTwDVgG1ivkssoYXXdNHNLz4vRM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296853;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=NMt8v39Vc/6STzLRkqUXHVx4wDUEiiWH6jTpgh4hdNo=;
b=K45XPDjRVYuyQ6aTyAU7+hJXsepFgh3//elDtYHbn52AvFt3/bvKtL40Whw6sNaCcPdC38aYLaemA9Uw1ErJskxVhHFBczZ6AzCW8yGvHs1/87YPaS5139bZ01Mhnu56l3kDnarisJNxYMzF4RCcSqSFIOBHWlnOMsJpMT8ak3w=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com
[205.139.110.61]) by mx.zohomail.com
with SMTPS id 15752968535581016.0458434409496;
Mon, 2 Dec 2019 06:27:33 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-6-fM_ZG7gBPlmT_2g1KKGJDw-1; Mon, 02 Dec 2019 09:27:29 -0500
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B54E9B49B;
Mon, 2 Dec 2019 14:27:23 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id D9F64600CA;
Mon, 2 Dec 2019 14:27:22 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8F61218089D5;
Mon, 2 Dec 2019 14:27:22 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER7ap027322 for ;
Mon, 2 Dec 2019 09:27:07 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 5227967662; Mon, 2 Dec 2019 14:27:07 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id CFC4F6764D
for ; Mon, 2 Dec 2019 14:27:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296852;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=NMt8v39Vc/6STzLRkqUXHVx4wDUEiiWH6jTpgh4hdNo=;
b=ctHjxoKw1P5xaSF7logIA++wPp4PM5YmkDQoK5luyzu5D3oYsvkz0l1G1qjloP+hVY0rzB
kExuO0QUDAB/DKG03wbMFoSAHUBsVtcYF0dxGL8/vgCHYgR4Iq0nvxg0VSmdtE2mQZvmAi
ainUoNyxVLGsGi6+UdPcT1bescjAQYE=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:31 +0100
Message-Id:
<2c14885ad7f394f1be788fb7784a4facf71a61e3.1575296392.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 08/30] virpci: Introduce virPCIDeviceAddressCopy
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-MC-Unique: fM_ZG7gBPlmT_2g1KKGJDw-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
This helper is cleaner than plain memcpy() because one doesn't
have to look into virPCIDeviceAddress struct to see if it
contains any strings / pointers.
Signed-off-by: Michal Privoznik
ACKed-by: Peter Krempa
Reviewed-by: Cole Robinson
---
src/libvirt_private.syms | 1 +
src/util/virpci.c | 14 ++++++++++++++
src/util/virpci.h | 4 ++++
3 files changed, 19 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0988f36c20..6e4ef0413b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2689,6 +2689,7 @@ virObjectUnref;
=20
# util/virpci.h
virPCIDeviceAddressAsString;
+virPCIDeviceAddressCopy;
virPCIDeviceAddressEqual;
virPCIDeviceAddressFree;
virPCIDeviceAddressGetIOMMUGroupAddresses;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index b0a4107551..99a8002743 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1340,6 +1340,20 @@ virPCIDeviceAddressEqual(const virPCIDeviceAddress *=
addr1,
return false;
}
=20
+/**
+ * virPCIDeviceAddressCopy:
+ * @dst: where to store address
+ * @src: source address to copy
+ *
+ * Creates a deep copy of given @src address and stores it into
+ * @dst which has to be pre-allocated by caller.
+ */
+void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
+ const virPCIDeviceAddress *src)
+{
+ memcpy(dst, src, sizeof(*src));
+}
+
char *
virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
{
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 1c94dc307c..f6796fc422 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -44,6 +44,7 @@ typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr;
struct _virZPCIDeviceAddress {
unsigned int uid; /* exempt from syntax-check */
unsigned int fid;
+ /* Don't forget to update virPCIDeviceAddressCopy if needed. */
};
=20
#define VIR_PCI_DEVICE_ADDRESS_FMT "%04x:%02x:%02x.%d"
@@ -56,6 +57,7 @@ struct _virPCIDeviceAddress {
int multi; /* virTristateSwitch */
int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
virZPCIDeviceAddress zpci;
+ /* Don't forget to update virPCIDeviceAddressCopy if needed. */
};
=20
typedef enum {
@@ -236,6 +238,8 @@ bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddre=
ss *addr);
=20
bool virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
const virPCIDeviceAddress *addr2);
+void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
+ const virPCIDeviceAddress *src);
=20
char *virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1);
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
207.211.31.120 as permitted sender) client-ip=207.211.31.120;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575296951; cv=none;
d=zohomail.com; s=zohoarc;
b=Xz+N3/ECnBEsl2+go/KBQAIjfztsvbiMk+pmQhThSL0V4EI6l65V/cjmbSucggiPIScL5epbUIos2epqsQhRu7e4Rojv3q/c6rEAsyR2in2ojehPfKa/KHQE/I0sf7DgxFfrwKKx616m97ah+H4c3sOr8X8hw35887AUOCPm2EQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575296951;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=R069iecDYQIBD9AwHG0q94kz+FGqY/PrQ7Id+q/Vuqw=;
b=bn5QgnrYF+YLg2iO+HajaPMdC7NsSGrJz2fpYd8sfROqfKz73WoJps5dcy1EPI4Uorbz3qSuVf8ufBsTsBL+84+1b9KWuAwKURKrxd6qy0rReMsvVSeC7/P+vm3lrL7mC/ckx1KtfPhTf1edFnM3QJPKFUwNs96JBx2yCQbVPpo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[207.211.31.120]) by mx.zohomail.com
with SMTPS id 15752969515951.040916666630551;
Mon, 2 Dec 2019 06:29:11 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-220-eS0g4Vq2PxKKeoG1ijOZuw-1; Mon, 02 Dec 2019 09:27:42 -0500
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5AD48048F6;
Mon, 2 Dec 2019 14:27:33 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id AABD3100194E;
Mon, 2 Dec 2019 14:27:33 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4A3A6180CB3B;
Mon, 2 Dec 2019 14:27:33 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER84h027328 for ;
Mon, 2 Dec 2019 09:27:08 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 2301967648; Mon, 2 Dec 2019 14:27:08 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id A032D6764D
for ; Mon, 2 Dec 2019 14:27:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575296950;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=R069iecDYQIBD9AwHG0q94kz+FGqY/PrQ7Id+q/Vuqw=;
b=CbkPmV8eGkAWyKbIdLRXPPnWk5Imd6XCNCNs18If9NWL/sQd0Ymcn8391DT4WVFDWHhc0a
XH0SOU8LEEGDslpezz6IsJ0n7MQk8N99cC7xUw+hIDNmBD52pUPxA8FXdXdKci0APf3FE+
gQ4M/BlpzuKvXIe8S+Llay8CdJtEEYo=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:32 +0100
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 09/30] qemuMigrationSrcIsSafe: Rework slightly
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-MC-Unique: eS0g4Vq2PxKKeoG1ijOZuw-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
There are going to be more disk types that are considered unsafe
with respect to migration. Therefore, move the error reporting
call outside of if() body and rework if-else combo to switch().
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
src/qemu/qemu_migration.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c38bf342d7..e4760c6ad3 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1228,6 +1228,8 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def,
for (i =3D 0; i < def->ndisks; i++) {
virDomainDiskDefPtr disk =3D def->disks[i];
const char *src =3D virDomainDiskGetSource(disk);
+ int actualType =3D virStorageSourceGetActualType(disk->src);
+ bool unsafe =3D false;
=20
/* Disks without any source (i.e. floppies and CD-ROMs)
* OR readonly are safe. */
@@ -1241,21 +1243,34 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def,
continue;
=20
/* However, disks on local FS (e.g. ext4) are not safe. */
- if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TY=
PE_FILE) {
+ switch ((virStorageType) actualType) {
+ case VIR_STORAGE_TYPE_FILE:
if ((rc =3D virFileIsSharedFS(src)) < 0) {
return false;
} else if (rc =3D=3D 0) {
- virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
- _("Migration without shared storage is unsa=
fe"));
- return false;
+ unsafe =3D true;
}
if ((rc =3D virStorageFileIsClusterFS(src)) < 0)
return false;
else if (rc =3D=3D 1)
continue;
- } else if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STO=
RAGE_TYPE_NETWORK) {
+ break;
+ case VIR_STORAGE_TYPE_NETWORK:
/* But network disks are safe again. */
continue;
+
+ case VIR_STORAGE_TYPE_NONE:
+ case VIR_STORAGE_TYPE_BLOCK:
+ case VIR_STORAGE_TYPE_DIR:
+ case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_LAST:
+ break;
+ }
+
+ if (unsafe) {
+ virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
+ _("Migration without shared storage is unsafe")=
);
+ return false;
}
=20
/* Our code elsewhere guarantees shared disks are either readonly =
(in
--=20
2.23.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 26 22:05:19 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
205.139.110.120 as permitted sender) client-ip=205.139.110.120;
envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com;
Authentication-Results: mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1575297018; cv=none;
d=zohomail.com; s=zohoarc;
b=QZ9kDHnlzwuIuv/2jXYm4mKWrz1Zc+L2m3BaBY4t8gn29cmgkFqArgreXYbVReFIrWD8bwxnrGo9McoFnTeHktkTuGMdU0Tf0glIc6KQDPzCdO6wuwXjKq8d38DESNbnfVxSx4yZzGX3sWdB3GpcWUEJY6YbghhG5foWrrUgL3A=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1575297018;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
bh=Rn2vA4qtqU+OxxO4WEjpFW2W8ZI83HyUlLrwbRWPNXE=;
b=EFWhpI1nFn6P50dyDayC5Er8XGzEMy5v22hpHZykrlSBZ1abGdJ7AeydD8q0eGnMc0+n7JPrFxpCdRkIvO2CBBqd3R+O45CBgdNXLyB71DSvZj5QnH8PaDzGLJj1eEiAfSIrLEi7uQK76Jgayc5uJttTT9aaPvdO9YddKgOCBvo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
dkim=pass;
spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
[205.139.110.120]) by mx.zohomail.com
with SMTPS id 1575297018740765.6896260022497;
Mon, 2 Dec 2019 06:30:18 -0800 (PST)
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
us-mta-295-2PZejrJ9MK68jQuqkGmlqA-1; Mon, 02 Dec 2019 09:27:42 -0500
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 962578C20F3;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D0DD5D9E5;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 228C44EDB3;
Mon, 2 Dec 2019 14:27:29 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id xB2ER9xx027343 for ;
Mon, 2 Dec 2019 09:27:09 -0500
Received: by smtp.corp.redhat.com (Postfix)
id ED6B867662; Mon, 2 Dec 2019 14:27:08 +0000 (UTC)
Received: from moe.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 733F367648
for ; Mon, 2 Dec 2019 14:27:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1575297017;
h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-unsubscribe:list-subscribe:list-post;
bh=Rn2vA4qtqU+OxxO4WEjpFW2W8ZI83HyUlLrwbRWPNXE=;
b=W2UC78+WE7RYWDuHVGVi73+lYzrdra03v9obrXCBqc/bYUE7V1cDJuDk0GeqEAf7D0ELyc
xa0kBr548f0ZvL+hIUkslR1CaXFcmhlEu+UeSROQvS2g8UwL9jJqTt42J14raPHeI2TA5u
eApDqEzj2YHA9D04P12+cvdiIXSRMmE=
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Mon, 2 Dec 2019 15:26:33 +0100
Message-Id:
<479c0671df3f76fe3353d06c39002c1ec6878ce5.1575296392.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v3 10/30] schemas: Introduce disk type NVMe
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-MC-Unique: 2PZejrJ9MK68jQuqkGmlqA-1
X-Mimecast-Spam-Score: 0
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
Content-Type: text/plain; charset="utf-8"
There is this class of PCI devices that act like disks: NVMe.
Therefore, they are both PCI devices and disks. While we already
have (and can assign a NVMe device to a domain
successfully) we don't have disk representation. There are three
problems with PCI assignment in case of a NVMe device:
1) domains with can't be migrated
2) NVMe device is assigned whole, there's no way to assign only a
namespace
3) Because hypervisors see they don't put block layer
on top of it - users don't get all the fancy features like
snapshots
NVMe namespaces are way of splitting one continuous NVDIMM memory
into smaller ones, effectively creating smaller NVMe-s (which can
then be partitioned, LVMed, etc.)
Because of all of this the following XML was chosen to model a
NVMe device:
Signed-off-by: Michal Privoznik
Reviewed-by: Cole Robinson
---
docs/formatdomain.html.in | 57 +++++++++++++++++++++++--
docs/schemas/domaincommon.rng | 32 ++++++++++++++
tests/qemuxml2argvdata/disk-nvme.xml | 63 ++++++++++++++++++++++++++++
3 files changed, 149 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-nvme.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6df4a8b26e..fe871d933f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2944,6 +2944,13 @@
</backingStore>
<target dev=3D'vdd' bus=3D'virtio'/>
</disk>
+ <disk type=3D'nvme' device=3D'disk'>
+ <driver name=3D'qemu' type=3D'raw'/>
+ <source type=3D'pci' managed=3D'yes' namespace=3D'1'>
+ <address domain=3D'0x0000' bus=3D'0x01' slot=3D'0x00' function=3D=
'0x0'/>
+ </source>
+ <target dev=3D'vde' bus=3D'virtio'/>
+ </disk>
</devices>
...
=20
@@ -2957,7 +2964,8 @@
Valid values are "file", "block",
"dir" (since 0.7.5),
"network" (since 0.8.7), or
- "volume" (since 1.0.5)
+ "volume" (since 1.0.5), or
+ "nvme" (since 5.6.0)
and refer to the underlying source for the disk.
Since 0.0.3
@@ -3140,6 +3148,43 @@
Since 1.0.5
+
nvme
+
+ To specify disk source for NVMe disk the source
+ element has the following attributes:
+
+
type
+
The type of address specified in address
+ sub-element. Currently, only pci value is
+ accepted.
+
+
+
managed
+
This attribute instructs libvirt to detach NVMe
+ controller automatically on domain startup (yes)
+ or expect the controller to be detached by system
+ administrator (no).
+
+
+
namespace
+
The namespace ID which should be assigned to the domai=
n.
+ According to NVMe standard, namespace numbers start from 1,
+ including.
+
+
+
+ The difference between <disk type=3D'nvme'>
+ and <hostdev/> is that the latter is plain
+ host device assignment with all its limitations (e.g. no live
+ migration), while the former makes hypervisor to run the NVMe
+ disk through hypervisor's block layer thus enabling all
+ features provided by the layer (e.g. snapshots, domain
+ migration, etc.). Moreover, since the NVMe disk is unbinded
+ from its PCI driver, the host kernel storage stack is not
+ involved (compared to passing say /dev/nvme0n1 =
via
+ <disk type=3D'block'> and therefore lower
+ latencies can be achieved.
+