[PATCH] qemu: fix concurrency crash bug in force snapshot revert
by Nikolay Shirokovskiy
This patch is just revert of [1]. Actually we should NOT pass
QEMU_ASYNC_JOB_NONE as that patch suggests while we are in async job in order
to acquire nested jobs correctly. The patch tries to fix issues introduced by
another patch [2] where jobs are mistakenly cleared out in qemuProcessStop.
Later patch [3] fixed the issue introduced by patch [2]. Now we need to revert
[1] as well as we now still have same concurrency crash issues as [3] described
but for the force revert.
[1] 0c4408c83: qemu: Don't use asyncJob after stop during snapshot revert
[2] 888aa4b6b: qemuDomainObjPrivateDataClear: Don't leak @migParams
[3] d75f865fb: qemu: fix concurrency crash bug in snapshot revert
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_snapshot.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 1e8ea80..5f49fd1 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1719,7 +1719,6 @@ qemuSnapshotRevert(virDomainObjPtr vm,
qemuDomainSaveCookiePtr cookie;
virCPUDefPtr origCPU = NULL;
unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
- qemuDomainAsyncJob jobType = QEMU_ASYNC_JOB_START;
bool defined = false;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
@@ -1899,9 +1898,6 @@ qemuSnapshotRevert(virDomainObjPtr vm,
VIR_DOMAIN_EVENT_STOPPED,
detail);
virObjectEventStateQueue(driver->domainEventState, event);
- /* Start after stop won't be an async start job, so
- * reset to none */
- jobType = QEMU_ASYNC_JOB_NONE;
goto load;
}
}
@@ -1968,7 +1964,7 @@ qemuSnapshotRevert(virDomainObjPtr vm,
rc = qemuProcessStart(snapshot->domain->conn, driver, vm,
cookie ? cookie->cpu : NULL,
- jobType, NULL, -1, NULL, snap,
+ QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
start_flags);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
@@ -2003,7 +1999,7 @@ qemuSnapshotRevert(virDomainObjPtr vm,
}
rc = qemuProcessStartCPUs(driver, vm,
VIR_DOMAIN_RUNNING_FROM_SNAPSHOT,
- jobType);
+ QEMU_ASYNC_JOB_START);
if (rc < 0)
goto endjob;
virObjectUnref(event);
--
1.8.3.1
4 years, 3 months
[PATCH V2] Modify virCPUarmCompare to perform compare actions
by Zhenyu Zheng
Modify virCPUarmCompare in cpu_arm.c to perform compare action.
This patch only adds host to host CPU compare, the rest cases
remains the same. This is useful for source and destination host
compare during migrations to avoid migration between different
CPU models that have different CPU freatures.
Signed-off-by: Zhenyu Zheng <zheng.zhenyu(a)outlook.com>
---
src/cpu/cpu_arm.c | 51 +++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 939a3b8390..e8581ec31f 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -463,11 +463,54 @@ virCPUarmBaseline(virCPUDefPtr *cpus,
}
static virCPUCompareResult
-virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED,
- virCPUDefPtr cpu G_GNUC_UNUSED,
- bool failMessages G_GNUC_UNUSED)
+virCPUarmCompare(virCPUDefPtr host,
+ virCPUDefPtr cpu,
+ bool failIncompatible
+)
{
- return VIR_CPU_COMPARE_IDENTICAL;
+ g_autofree char *message = NULL;
+ virCPUCompareResult ret = VIR_CPU_COMPARE_IDENTICAL;
+
+ /* Only support host to host CPU compare for ARM*/
+ if (cpu->type != VIR_CPU_TYPE_HOST)
+ return ret;
+
+ if (!host || !host->model) {
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
+ _("unknown host CPU"));
+ ret = VIR_CPU_COMPARE_ERROR;
+ } else {
+ VIR_WARN("unknown host CPU");
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+ return ret;
+ }
+
+ /* Compare vendor and model to check if CPUs are identical */
+ if (STRNEQ(host->vendor, cpu->vendor) ||
+ STRNEQ(host->model, cpu->model)) {
+ VIR_DEBUG("host CPU model does not match required CPU model %s",
+ cpu->model);
+ if (message) {
+ message = g_strdup_printf(_("host CPU model does not match required "
+ "CPU model %s"),
+ cpu->model);
+ }
+
+ ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+
+ if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
+ ret = VIR_CPU_COMPARE_ERROR;
+ if (message) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
+ } else {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
+ }
+ }
+
+ return ret;
}
static int
--
2.20.1
4 years, 3 months
[PATCH] Add unit tests for timer validation
by Sebastian Mitterle
Add minimal coverage for non-x86_64 timer validation
from commit 2f5d8ffebe5d3d00e16a051ed62ce8a703f18e7c
Signed-off-by: Sebastian Mitterle <smitterl(a)redhat.com>
---
tests/meson.build | 1 +
tests/qemuvalidatetest.c | 107 +++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+)
create mode 100644 tests/qemuvalidatetest.c
diff --git a/tests/meson.build b/tests/meson.build
index 0a204c46e4..dfdc1e8b93 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -460,6 +460,7 @@ if conf.has('WITH_QEMU')
{ 'name': 'qemumigparamstest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
{ 'name': 'qemumonitorjsontest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib ] },
{ 'name': 'qemusecuritytest', 'sources': [ 'qemusecuritytest.c', 'qemusecuritymock.c' ], 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib ] },
+ { 'name': 'qemuvalidatetest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_file_wrapper_lib ] },
{ 'name': 'qemuvhostusertest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_file_wrapper_lib ] },
{ 'name': 'qemuxml2argvtest', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_monitor_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
{ 'name': 'qemuxml2xmltest', 'link_with': [ test_qemu_driver_lib ], 'link_whole': [ test_utils_qemu_lib, test_file_wrapper_lib ] },
diff --git a/tests/qemuvalidatetest.c b/tests/qemuvalidatetest.c
new file mode 100644
index 0000000000..617669dae0
--- /dev/null
+++ b/tests/qemuvalidatetest.c
@@ -0,0 +1,107 @@
+/*
+ * qemuvalidatetest.c: Test the qemu domain validation
+ *
+ * Copyright (C) 2010-2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "qemu/qemu_validate.c"
+#include "testutils.h"
+#include "internal.h"
+#include "src/conf/virconftypes.h"
+#include "src/conf/domain_conf.h"
+#include "src/qemu/qemu_capabilities.h"
+#include "src/util/virarch.h"
+
+static virDomainDefPtr
+getDefWithUnsupportedTimerPresent(void)
+{
+ virDomainTimerDefPtr timer;
+ virDomainDefPtr def;
+
+ if (VIR_ALLOC(timer) < 0)
+ return NULL;
+
+ timer->present = 1;
+ timer->name = VIR_DOMAIN_TIMER_NAME_TSC;
+
+ def = virDomainDefNew();
+ def->virtType = VIR_DOMAIN_VIRT_QEMU;
+ def->os = (virDomainOSDef) {
+ .arch = VIR_ARCH_S390X,
+ .machine = (char *)"m"
+ };
+ def->emulator = (char *)"e";
+ def->clock = (virDomainClockDef) {
+ .ntimers = 1,
+ };
+ if (VIR_ALLOC_N(def->clock.timers, 1) < 0)
+ return NULL;
+ def->clock.timers[0] = timer;
+
+ return def;
+}
+
+static int
+errorTimersNotOnX86(const void *unused G_GNUC_UNUSED)
+{
+ int ret = 0;
+ char *log;
+ char expectedError[75] = "'tsc' timer is not supported for virtType=qemu arch=s390x machine=m guests";
+ virDomainDefPtr def = getDefWithUnsupportedTimerPresent();
+ if (qemuValidateDomainDefClockTimers(def, NULL) != -1) {
+ ret = -1;
+ }
+ log = virTestLogContentAndReset();
+ if (!strstr(log, expectedError)) {
+ printf("expected : %s", expectedError);
+ printf("but got : %s", virTestLogContentAndReset());
+ ret = -1;
+ }
+ return ret;
+}
+
+static int
+onlyErrorTimersNotOnX86IfPresent(const void *unused G_GNUC_UNUSED)
+{
+ int ret = 0;
+ virDomainDefPtr def = getDefWithUnsupportedTimerPresent();
+ def->clock.timers[0]->present = 0;
+ if (qemuValidateDomainDefClockTimers(def, NULL) == -1) {
+ ret = -1;
+ }
+ return ret;
+}
+
+static int
+testsuite(void)
+{
+ int ret = 0;
+
+#define DO_TEST(NAME) \
+ if (virTestRun("Command Exec " #NAME " test", \
+ NAME, NULL) < 0) \
+ ret = -1
+
+ DO_TEST(errorTimersNotOnX86);
+ DO_TEST(onlyErrorTimersNotOnX86IfPresent);
+
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+VIR_TEST_MAIN(testsuite);
--
2.26.2
4 years, 3 months
[PATCH 0/2] qemu: Properly configure readonly iSCSI hostdevs
by Peter Krempa
See patch 2/2.
Peter Krempa (2):
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Add <readonly/> to one of
the iSCSI hostdevs
qemuBuildHostdevSCSIAttachPrepare: Propagate 'readonly' flag also for
iSCSI
src/qemu/qemu_command.c | 2 +-
.../qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args | 2 +-
.../qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 2 +-
.../hostdev-scsi-virtio-scsi.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml | 1 +
tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml | 1 +
6 files changed, 6 insertions(+), 4 deletions(-)
--
2.26.2
4 years, 3 months
[PATCH] docs/system: clarify deprecation scheduled
by Stefan Hajnoczi
The sentence explaining the deprecation schedule is ambiguous. Make it
clear that a feature deprecated in the Nth release is guaranteed to
remain available in the N+1th release. Removal can occur in the N+2nd
release or later.
As an example of this in action, see commit
25956af3fe5dd0385ad8017bc768a6afe41e2a74 ("block: Finish deprecation of
'qemu-img convert -n -o'"). The feature was deprecated in QEMU 4.2.0. It
was present in the 5.0.0 release and removed in the 5.1.0 release.
Signed-off-by: Stefan Hajnoczi <stefanha(a)redhat.com>
---
docs/system/deprecated.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 851dbdeb8a..fecfb2f1c1 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -4,9 +4,9 @@ Deprecated features
In general features are intended to be supported indefinitely once
introduced into QEMU. In the event that a feature needs to be removed,
it will be listed in this section. The feature will remain functional
-for 2 releases prior to actual removal. Deprecated features may also
-generate warnings on the console when QEMU starts up, or if activated
-via a monitor command, however, this is not a mandatory requirement.
+for 1 more release after deprecation. Deprecated features may also generate
+warnings on the console when QEMU starts up, or if activated via a monitor
+command, however, this is not a mandatory requirement.
Prior to the 2.10.0 release there was no official policy on how
long features would be deprecated prior to their removal, nor
--
2.26.2
4 years, 3 months
[PATCH 0/3] qemu: backup: Properly write TLS cert and secret object alias into status XML
by Peter Krempa
Please see 3/3 for explanation.
Peter Krempa (3):
qemustatusxml2xml: backup-pull: Test private data formatting/parsing
qemu: backup: Remove note that TLS should be implemented
qemu: backup: Write TLS cert and secret object aliases into status XML
src/qemu/qemu_backup.c | 7 +++----
tests/qemustatusxml2xmldata/backup-pull-in.xml | 8 +++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
--
2.26.2
4 years, 3 months
[PATCH REBASE 0/7] qemu: Use memory-backend-* for regular guest memory
by Michal Privoznik
This is a rebased version of patches posted in May:
https://www.redhat.com/archives/libvir-list/2020-May/msg01114.html
Fortunately, the QEMU part is now merged (v5.1.0-3-gc556600598) and
thus these can get proper review.
Michal Prívozník (7):
qemuBuildMemoryBackendProps: Move @prealloc setting to backend
agnostic part
qemuBuildMemoryBackendProps: Respect
//memoryBacking/allocation/@mode=immediate
qemuBuildMemoryBackendProps: Prealloc mem for memfd backend
qemuBuildMemoryBackendProps: Fix const correctness
qemu: Introduce QEMU_CAPS_MACHINE_MEMORY_BACKEND
qemu: Track default-ram-id machine attribute
qemu: Use memory-backend-* for regular guest memory
src/qemu/qemu_capabilities.c | 42 +++-
src/qemu/qemu_capabilities.h | 6 +
src/qemu/qemu_capspriv.h | 3 +-
src/qemu/qemu_command.c | 98 +++++++--
src/qemu/qemu_command.h | 4 +-
src/qemu/qemu_monitor.c | 1 +
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 11 +
.../caps_5.2.0.x86_64.xml | 197 +++++++++---------
.../blkdeviotune-group-num.x86_64-latest.args | 3 +-
...blkdeviotune-max-length.x86_64-latest.args | 3 +-
.../blkdeviotune-max.x86_64-latest.args | 3 +-
.../channel-unix-guestfwd.x86_64-latest.args | 3 +-
.../console-virtio-unix.x86_64-latest.args | 3 +-
.../controller-virtio-scsi.x86_64-latest.args | 3 +-
...-Icelake-Server-pconfig.x86_64-latest.args | 3 +-
.../cpu-translation.x86_64-latest.args | 3 +-
.../cputune-cpuset-big-id.x86_64-latest.args | 3 +-
.../disk-aio-io_uring.x86_64-latest.args | 3 +-
.../disk-aio.x86_64-latest.args | 3 +-
...-backing-chains-noindex.x86_64-latest.args | 3 +-
.../disk-cache.x86_64-latest.args | 4 +-
.../disk-cdrom-bus-other.x86_64-latest.args | 3 +-
...m-empty-network-invalid.x86_64-latest.args | 3 +-
.../disk-cdrom-network.x86_64-latest.args | 3 +-
.../disk-cdrom-tray.x86_64-latest.args | 3 +-
.../disk-cdrom.x86_64-latest.args | 3 +-
.../disk-copy_on_read.x86_64-latest.args | 3 +-
.../disk-detect-zeroes.x86_64-latest.args | 3 +-
.../disk-discard.x86_64-latest.args | 3 +-
.../disk-error-policy.x86_64-latest.args | 3 +-
.../disk-floppy-q35-2_11.x86_64-latest.args | 4 +-
.../disk-floppy-q35-2_9.x86_64-latest.args | 4 +-
.../disk-floppy.x86_64-latest.args | 3 +-
.../disk-network-gluster.x86_64-latest.args | 3 +-
.../disk-network-http.x86_64-latest.args | 3 +-
.../disk-network-iscsi.x86_64-latest.args | 3 +-
.../disk-network-nbd.x86_64-latest.args | 3 +-
.../disk-network-rbd.x86_64-latest.args | 3 +-
.../disk-network-sheepdog.x86_64-latest.args | 3 +-
...isk-network-source-auth.x86_64-latest.args | 3 +-
...isk-network-tlsx509-nbd.x86_64-latest.args | 3 +-
.../disk-nvme.x86_64-latest.args | 3 +-
.../disk-readonly-disk.x86_64-latest.args | 3 +-
.../disk-scsi-device-auto.x86_64-latest.args | 3 +-
.../disk-scsi.x86_64-latest.args | 3 +-
.../disk-shared.x86_64-latest.args | 3 +-
.../disk-slices.x86_64-latest.args | 3 +-
...irtio-scsi-reservations.x86_64-latest.args | 3 +-
.../eoi-disabled.x86_64-latest.args | 3 +-
.../eoi-enabled.x86_64-latest.args | 3 +-
.../floppy-drive-fat.x86_64-latest.args | 3 +-
.../qemuxml2argvdata/fs9p.x86_64-latest.args | 3 +-
.../genid-auto.x86_64-latest.args | 3 +-
.../qemuxml2argvdata/genid.x86_64-latest.args | 3 +-
...egl-headless-rendernode.x86_64-latest.args | 3 +-
.../graphics-egl-headless.x86_64-latest.args | 3 +-
...pice-gl-auto-rendernode.x86_64-latest.args | 3 +-
...graphics-vnc-tls-secret.x86_64-latest.args | 3 +-
.../graphics-vnc-tls.x86_64-latest.args | 3 +-
...tdev-mdev-display-ramfb.x86_64-latest.args | 3 +-
...play-spice-egl-headless.x86_64-latest.args | 3 +-
...ev-display-spice-opengl.x86_64-latest.args | 3 +-
...isplay-vnc-egl-headless.x86_64-latest.args | 3 +-
...ostdev-mdev-display-vnc.x86_64-latest.args | 3 +-
.../hostdev-scsi-lsi.x86_64-latest.args | 3 +-
...ostdev-scsi-virtio-scsi.x86_64-latest.args | 3 +-
.../qemuxml2argvdata/hugepages-memaccess.args | 30 +--
.../hugepages-memaccess2.args | 12 +-
.../hugepages-numa-nodeset-part.args | 5 +-
.../hugepages-numa-nodeset.args | 20 +-
.../hugepages-nvdimm.x86_64-latest.args | 15 +-
tests/qemuxml2argvdata/hugepages-shared.args | 24 +--
.../hyperv-off.x86_64-latest.args | 3 +-
.../hyperv-panic.x86_64-latest.args | 3 +-
.../hyperv-stimer-direct.x86_64-latest.args | 3 +-
.../hyperv.x86_64-latest.args | 3 +-
.../intel-iommu-aw-bits.x86_64-latest.args | 4 +-
...ntel-iommu-caching-mode.x86_64-latest.args | 4 +-
...ntel-iommu-device-iotlb.x86_64-latest.args | 4 +-
.../intel-iommu-eim.x86_64-latest.args | 4 +-
.../intel-iommu.x86_64-latest.args | 3 +-
...threads-virtio-scsi-pci.x86_64-latest.args | 3 +-
.../kvmclock+eoi-disabled.x86_64-latest.args | 3 +-
...luks-disks-source-qcow2.x86_64-latest.args | 4 +-
...memory-default-hugepage.x86_64-latest.args | 8 +-
.../memfd-memory-numa.x86_64-latest.args | 8 +-
.../memory-hotplug-dimm-addr.args | 6 +-
.../qemuxml2argvdata/memory-hotplug-dimm.args | 6 +-
...y-hotplug-nvdimm-access.x86_64-latest.args | 8 +-
...ry-hotplug-nvdimm-align.x86_64-latest.args | 8 +-
...ry-hotplug-nvdimm-label.x86_64-latest.args | 8 +-
...ory-hotplug-nvdimm-pmem.x86_64-latest.args | 8 +-
...ory-hotplug-nvdimm-ppc64.ppc64-latest.args | 2 +-
...hotplug-nvdimm-readonly.x86_64-latest.args | 8 +-
.../memory-hotplug-nvdimm.x86_64-latest.args | 6 +-
.../mlock-off.x86_64-latest.args | 3 +-
.../mlock-on.x86_64-latest.args | 3 +-
.../net-vhostuser.x86_64-latest.args | 3 +-
.../numatune-hmat.x86_64-latest.args | 4 +-
.../os-firmware-bios.x86_64-latest.args | 4 +-
...os-firmware-efi-secboot.x86_64-latest.args | 4 +-
.../os-firmware-efi.x86_64-latest.args | 4 +-
.../qemuxml2argvdata/pages-dimm-discard.args | 4 +-
.../parallel-unix-chardev.x86_64-latest.args | 3 +-
...cie-root-port-nohotplug.x86_64-latest.args | 3 +-
.../pv-spinlock-disabled.x86_64-latest.args | 3 +-
.../pv-spinlock-enabled.x86_64-latest.args | 3 +-
.../qemu-ns.x86_64-latest.args | 3 +-
.../serial-unix-chardev.x86_64-latest.args | 3 +-
...rtcard-passthrough-unix.x86_64-latest.args | 3 +-
.../tpm-emulator-tpm2-enc.x86_64-latest.args | 4 +-
.../tpm-emulator-tpm2.x86_64-latest.args | 4 +-
.../tpm-emulator.x86_64-latest.args | 4 +-
.../tpm-passthrough-crb.x86_64-latest.args | 4 +-
.../tpm-passthrough.x86_64-latest.args | 4 +-
.../tseg-explicit-size.x86_64-latest.args | 4 +-
.../usb-redir-unix.x86_64-latest.args | 3 +-
tests/qemuxml2argvdata/user-aliases.args | 16 +-
...vhost-user-fs-fd-memory.x86_64-latest.args | 4 +-
...vhost-user-fs-hugepages.x86_64-latest.args | 10 +-
...host-user-gpu-secondary.x86_64-latest.args | 3 +-
.../vhost-user-vga.x86_64-latest.args | 3 +-
.../vhost-vsock-auto.x86_64-latest.args | 4 +-
.../vhost-vsock.x86_64-latest.args | 3 +-
...eo-bochs-display-device.x86_64-latest.args | 3 +-
...video-qxl-device-vram64.x86_64-latest.args | 3 +-
...o-qxl-sec-device-vram64.x86_64-latest.args | 3 +-
...eo-ramfb-display-device.x86_64-latest.args | 3 +-
.../virtio-9p-multidevs.x86_64-latest.args | 3 +-
...virtio-non-transitional.x86_64-latest.args | 3 +-
...-options-controller-ats.x86_64-latest.args | 3 +-
...ptions-controller-iommu.x86_64-latest.args | 3 +-
...tions-controller-packed.x86_64-latest.args | 3 +-
...virtio-options-disk-ats.x86_64-latest.args | 3 +-
...rtio-options-disk-iommu.x86_64-latest.args | 3 +-
...tio-options-disk-packed.x86_64-latest.args | 3 +-
.../virtio-options-fs-ats.x86_64-latest.args | 3 +-
...virtio-options-fs-iommu.x86_64-latest.args | 3 +-
...irtio-options-fs-packed.x86_64-latest.args | 3 +-
...irtio-options-input-ats.x86_64-latest.args | 3 +-
...tio-options-input-iommu.x86_64-latest.args | 3 +-
...io-options-input-packed.x86_64-latest.args | 3 +-
...-options-memballoon-ats.x86_64-latest.args | 3 +-
...ptions-memballoon-iommu.x86_64-latest.args | 3 +-
...tions-memballoon-packed.x86_64-latest.args | 3 +-
.../virtio-options-net-ats.x86_64-latest.args | 3 +-
...irtio-options-net-iommu.x86_64-latest.args | 3 +-
...rtio-options-net-packed.x86_64-latest.args | 3 +-
.../virtio-options-rng-ats.x86_64-latest.args | 3 +-
...irtio-options-rng-iommu.x86_64-latest.args | 3 +-
...rtio-options-rng-packed.x86_64-latest.args | 3 +-
...irtio-options-video-ats.x86_64-latest.args | 3 +-
...tio-options-video-iommu.x86_64-latest.args | 3 +-
...io-options-video-packed.x86_64-latest.args | 3 +-
.../virtio-options.x86_64-latest.args | 3 +-
.../virtio-rng-builtin.x86_64-latest.args | 3 +-
.../virtio-rng-egd-unix.x86_64-latest.args | 3 +-
.../virtio-transitional.x86_64-latest.args | 3 +-
...-default-cpu-kvm-pc-4.2.x86_64-latest.args | 4 +-
...default-cpu-kvm-q35-4.2.x86_64-latest.args | 4 +-
...-default-cpu-tcg-pc-4.2.x86_64-latest.args | 4 +-
...default-cpu-tcg-q35-4.2.x86_64-latest.args | 4 +-
.../x86_64-pc-graphics.x86_64-latest.args | 3 +-
.../x86_64-pc-headless.x86_64-latest.args | 3 +-
.../x86_64-q35-graphics.x86_64-latest.args | 3 +-
.../x86_64-q35-headless.x86_64-latest.args | 3 +-
tests/testutilsqemu.c | 15 +-
168 files changed, 671 insertions(+), 357 deletions(-)
--
2.26.2
4 years, 3 months
[PATCH v3] cphp: remove deprecated cpu-add command(s)
by Igor Mammedov
These were deprecated since 4.0, remove both HMP and QMP variants.
Users should use device_add command instead. To get list of
possible CPUs and options, use 'info hotpluggable-cpus' HMP
or query-hotpluggable-cpus QMP command.
Signed-off-by: Igor Mammedov <imammedo(a)redhat.com>
Reviewed-by: Thomas Huth <thuth(a)redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert(a)redhat.com>
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Acked-by: Cornelia Huck <cohuck(a)redhat.com>
---
v2,3: fix typos in commit message
include/hw/boards.h | 1 -
include/hw/i386/pc.h | 1 -
include/monitor/hmp.h | 1 -
docs/system/deprecated.rst | 25 +++++----
hmp-commands.hx | 15 ------
hw/core/machine-hmp-cmds.c | 12 -----
hw/core/machine-qmp-cmds.c | 12 -----
hw/i386/pc.c | 27 ----------
hw/i386/pc_piix.c | 1 -
hw/s390x/s390-virtio-ccw.c | 12 -----
qapi/machine.json | 24 ---------
tests/qtest/cpu-plug-test.c | 100 ++++--------------------------------
tests/qtest/test-hmp.c | 1 -
13 files changed, 21 insertions(+), 211 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 795910d01b..7abd5d889c 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -169,7 +169,6 @@ struct MachineClass {
void (*init)(MachineState *state);
void (*reset)(MachineState *state);
void (*wakeup)(MachineState *state);
- void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp);
int (*kvm_type)(MachineState *machine, const char *arg);
void (*smp_parse)(MachineState *ms, QemuOpts *opts);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 421a77acc2..79b7ab17bc 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -135,7 +135,6 @@ extern int fd_bootchk;
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
-void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
void pc_smp_parse(MachineState *ms, QemuOpts *opts);
void pc_guest_info_init(PCMachineState *pcms);
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index c986cfd28b..642e9e91f9 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -89,7 +89,6 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict);
void hmp_chardev_change(Monitor *mon, const QDict *qdict);
void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
void hmp_chardev_send_break(Monitor *mon, const QDict *qdict);
-void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index a158e765c3..c43c53f432 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -284,13 +284,6 @@ The ``query-cpus`` command is replaced by the ``query-cpus-fast`` command.
The ``arch`` output member of the ``query-cpus-fast`` command is
replaced by the ``target`` output member.
-``cpu-add`` (since 4.0)
-'''''''''''''''''''''''
-
-Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See
-documentation of ``query-hotpluggable-cpus`` for additional
-details.
-
``query-events`` (since 4.0)
''''''''''''''''''''''''''''
@@ -306,12 +299,6 @@ the 'wait' field, which is only applicable to sockets in server mode
Human Monitor Protocol (HMP) commands
-------------------------------------
-``cpu-add`` (since 4.0)
-'''''''''''''''''''''''
-
-Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See
-documentation of ``query-hotpluggable-cpus`` for additional details.
-
``acl_show``, ``acl_reset``, ``acl_policy``, ``acl_add``, ``acl_remove`` (since 4.0.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -521,6 +508,12 @@ QEMU Machine Protocol (QMP) commands
The "autoload" parameter has been ignored since 2.12.0. All bitmaps
are automatically loaded from qcow2 images.
+``cpu-add`` (removed in 5.2)
+''''''''''''''''''''''''''''
+
+Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See
+documentation of ``query-hotpluggable-cpus`` for additional details.
+
Human Monitor Protocol (HMP) commands
-------------------------------------
@@ -530,6 +523,12 @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
+``cpu-add`` (removed in 5.2)
+''''''''''''''''''''''''''''
+
+Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See
+documentation of ``query-hotpluggable-cpus`` for additional details.
+
Guest Emulator ISAs
-------------------
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 60f395c276..d1e3e0e1c6 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1761,21 +1761,6 @@ SRST
Executes a qemu-io command on the given block device.
ERST
- {
- .name = "cpu-add",
- .args_type = "id:i",
- .params = "id",
- .help = "add cpu (deprecated, use device_add instead)",
- .cmd = hmp_cpu_add,
- },
-
-SRST
-``cpu-add`` *id*
- Add CPU with id *id*. This command is deprecated, please
- +use ``device_add`` instead. For details, refer to
- 'docs/cpu-hotplug.rst'.
-ERST
-
{
.name = "qom-list",
.args_type = "path:s?",
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
index 39999c47c5..f4092b98cc 100644
--- a/hw/core/machine-hmp-cmds.c
+++ b/hw/core/machine-hmp-cmds.c
@@ -46,18 +46,6 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
qapi_free_CpuInfoFastList(cpu_list);
}
-void hmp_cpu_add(Monitor *mon, const QDict *qdict)
-{
- int cpuid;
- Error *err = NULL;
-
- error_report("cpu_add is deprecated, please use device_add instead");
-
- cpuid = qdict_get_int(qdict, "id");
- qmp_cpu_add(cpuid, &err);
- hmp_handle_error(mon, err);
-}
-
void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 21551221ad..5362c80a18 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -284,18 +284,6 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
return machine_query_hotpluggable_cpus(ms);
}
-void qmp_cpu_add(int64_t id, Error **errp)
-{
- MachineClass *mc;
-
- mc = MACHINE_GET_CLASS(current_machine);
- if (mc->hot_add_cpu) {
- mc->hot_add_cpu(current_machine, id, errp);
- } else {
- error_setg(errp, "Not supported");
- }
-}
-
void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
{
if (!runstate_check(RUN_STATE_PRECONFIG)) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index d11daacc23..d071da787b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -777,32 +777,6 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
}
}
-void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp)
-{
- X86MachineState *x86ms = X86_MACHINE(ms);
- int64_t apic_id = x86_cpu_apic_id_from_index(x86ms, id);
- Error *local_err = NULL;
-
- if (id < 0) {
- error_setg(errp, "Invalid CPU id: %" PRIi64, id);
- return;
- }
-
- if (apic_id >= ACPI_CPU_HOTPLUG_ID_LIMIT) {
- error_setg(errp, "Unable to add CPU: %" PRIi64
- ", resulting APIC ID (%" PRIi64 ") is too large",
- id, apic_id);
- return;
- }
-
-
- x86_cpu_new(X86_MACHINE(ms), apic_id, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
-}
-
static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
{
if (cpus_count > 0xff) {
@@ -1966,7 +1940,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
mc->auto_enable_numa_with_memdev = true;
mc->has_hotpluggable_cpus = true;
mc->default_boot_order = "cad";
- mc->hot_add_cpu = pc_hot_add_cpu;
mc->smp_parse = pc_smp_parse;
mc->block_default_type = IF_IDE;
mc->max_cpus = 255;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 33fa035fb7..8ce7dda464 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -752,7 +752,6 @@ static void pc_i440fx_1_4_machine_options(MachineClass *m)
{
pc_i440fx_1_5_machine_options(m);
m->hw_version = "1.4.0";
- m->hot_add_cpu = NULL;
compat_props_add(m->compat_props, pc_compat_1_4, pc_compat_1_4_len);
}
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 3106bbea33..28266a3a35 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -553,17 +553,6 @@ static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
return NULL;
}
-static void s390_hot_add_cpu(MachineState *machine,
- const int64_t id, Error **errp)
-{
- ObjectClass *oc;
-
- g_assert(machine->possible_cpus->cpus[0].cpu);
- oc = OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu));
-
- s390x_new_cpu(object_class_get_name(oc), id, errp);
-}
-
static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
{
CPUState *cs = qemu_get_cpu(cpu_index);
@@ -604,7 +593,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
s390mc->hpage_1m_allowed = true;
mc->init = ccw_init;
mc->reset = s390_machine_reset;
- mc->hot_add_cpu = s390_hot_add_cpu;
mc->block_default_type = IF_VIRTIO;
mc->no_cdrom = 1;
mc->no_floppy = 1;
diff --git a/qapi/machine.json b/qapi/machine.json
index 0ac1880e4a..d8ed096e9a 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -307,30 +307,6 @@
##
{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
-##
-# @cpu-add:
-#
-# Adds CPU with specified ID.
-#
-# @id: ID of CPU to be created, valid values [0..max_cpus)
-#
-# Features:
-# @deprecated: This command is deprecated. Use `device_add` instead.
-# See the `query-hotpluggable-cpus` command for details.
-#
-# Returns: Nothing on success
-#
-# Since: 1.5
-#
-# Example:
-#
-# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'cpu-add', 'data': {'id': 'int'},
- 'features': [ 'deprecated' ] }
-
##
# @MachineInfo:
#
diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c
index e8ffbbce4b..a1c689414b 100644
--- a/tests/qtest/cpu-plug-test.c
+++ b/tests/qtest/cpu-plug-test.c
@@ -25,54 +25,6 @@ struct PlugTestData {
};
typedef struct PlugTestData PlugTestData;
-static void test_plug_with_cpu_add(gconstpointer data)
-{
- const PlugTestData *s = data;
- char *args;
- QDict *response;
- unsigned int i;
-
- args = g_strdup_printf("-machine %s -cpu %s "
- "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u",
- s->machine, s->cpu_model,
- s->sockets, s->cores, s->threads, s->maxcpus);
- qtest_start(args);
-
- for (i = 1; i < s->maxcpus; i++) {
- response = qmp("{ 'execute': 'cpu-add',"
- " 'arguments': { 'id': %d } }", i);
- g_assert(response);
- g_assert(!qdict_haskey(response, "error"));
- qobject_unref(response);
- }
-
- qtest_end();
- g_free(args);
-}
-
-static void test_plug_without_cpu_add(gconstpointer data)
-{
- const PlugTestData *s = data;
- char *args;
- QDict *response;
-
- args = g_strdup_printf("-machine %s -cpu %s "
- "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u",
- s->machine, s->cpu_model,
- s->sockets, s->cores, s->threads, s->maxcpus);
- qtest_start(args);
-
- response = qmp("{ 'execute': 'cpu-add',"
- " 'arguments': { 'id': %d } }",
- s->sockets * s->cores * s->threads);
- g_assert(response);
- g_assert(qdict_haskey(response, "error"));
- qobject_unref(response);
-
- qtest_end();
- g_free(args);
-}
-
static void test_plug_with_device_add(gconstpointer data)
{
const PlugTestData *td = data;
@@ -144,36 +96,13 @@ static void add_pc_test_case(const char *mname)
data->cores = 3;
data->threads = 2;
data->maxcpus = data->sockets * data->cores * data->threads;
- if (g_str_has_suffix(mname, "-1.4") ||
- (strcmp(mname, "pc-1.3") == 0) ||
- (strcmp(mname, "pc-1.2") == 0) ||
- (strcmp(mname, "pc-1.1") == 0) ||
- (strcmp(mname, "pc-1.0") == 0)) {
- path = g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=%u",
- mname, data->sockets, data->cores,
- data->threads, data->maxcpus);
- qtest_add_data_func_full(path, data, test_plug_without_cpu_add,
- test_data_free);
- g_free(path);
- } else {
- PlugTestData *data2 = g_memdup(data, sizeof(PlugTestData));
-
- data2->machine = g_strdup(data->machine);
- data2->device_model = g_strdup(data->device_model);
- path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u",
- mname, data->sockets, data->cores,
- data->threads, data->maxcpus);
- qtest_add_data_func_full(path, data, test_plug_with_cpu_add,
- test_data_free);
- g_free(path);
- path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
- mname, data2->sockets, data2->cores,
- data2->threads, data2->maxcpus);
- qtest_add_data_func_full(path, data2, test_plug_with_device_add,
- test_data_free);
- g_free(path);
- }
+ path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
+ mname, data->sockets, data->cores,
+ data->threads, data->maxcpus);
+ qtest_add_data_func_full(path, data, test_plug_with_device_add,
+ test_data_free);
+ g_free(path);
}
static void add_pseries_test_case(const char *mname)
@@ -205,7 +134,7 @@ static void add_pseries_test_case(const char *mname)
static void add_s390x_test_case(const char *mname)
{
char *path;
- PlugTestData *data, *data2;
+ PlugTestData *data;
if (!g_str_has_prefix(mname, "s390-ccw-virtio-")) {
return;
@@ -220,21 +149,10 @@ static void add_s390x_test_case(const char *mname)
data->threads = 1;
data->maxcpus = data->sockets * data->cores * data->threads;
- data2 = g_memdup(data, sizeof(PlugTestData));
- data2->machine = g_strdup(data->machine);
- data2->device_model = g_strdup(data->device_model);
-
- path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u",
+ path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
mname, data->sockets, data->cores,
data->threads, data->maxcpus);
- qtest_add_data_func_full(path, data, test_plug_with_cpu_add,
- test_data_free);
- g_free(path);
-
- path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
- mname, data2->sockets, data2->cores,
- data2->threads, data2->maxcpus);
- qtest_add_data_func_full(path, data2, test_plug_with_device_add,
+ qtest_add_data_func_full(path, data, test_plug_with_device_add,
test_data_free);
g_free(path);
}
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index aea1384bac..94a8023173 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -27,7 +27,6 @@ static const char *hmp_cmds[] = {
"chardev-change testchardev1 ringbuf",
"chardev-remove testchardev1",
"commit all",
- "cpu-add 1",
"cpu 0",
"device_add ?",
"device_add usb-mouse,id=mouse1",
--
2.27.0
4 years, 3 months
[PATCH v2 0/5] Support CSS and DASD devices in node_device driver
by Boris Fiuczynski
This series enables support for channel subsystem (CSS) devices,
Direct Access Storage Devices (DASDs) in the node_device driver and
adds support to create vfio-ccw mdev devices in the node_device driver.
Changed in V2:
* now filtering only supported drivers in udevProcessCSS
* renamed udevProcessDasd into udevProcessDASD
* addend explaining comment in udevKludgeStorageType
* generalized error message in nodeDeviceGetMdevctlStartCommand
Boris Fiuczynski (5):
node_device: refactor udevProcessCCW
node_device: detect CSS devices
virsh: nodedev: ability to filter CSS capabilities
node_device: detect DASD devices
node_device: mdev vfio-ccw support
docs/formatnode.html.in | 12 +++
docs/manpages/virsh.rst | 2 +-
docs/schemas/nodedev.rng | 16 ++++
include/libvirt/libvirt-nodedev.h | 1 +
src/conf/domain_addr.c | 2 +-
src/conf/domain_addr.h | 3 +
src/conf/node_device_conf.c | 5 ++
src/conf/node_device_conf.h | 4 +-
src/conf/virnodedeviceobj.c | 4 +-
src/libvirt-nodedev.c | 1 +
src/libvirt_private.syms | 1 +
src/node_device/node_device_driver.c | 26 ++++--
src/node_device/node_device_udev.c | 80 ++++++++++++++++---
.../ccw_0_0_10000-invalid.xml | 4 +-
tests/nodedevschemadata/ccw_0_0_ffff.xml | 4 +-
tests/nodedevschemadata/css_0_0_ffff.xml | 10 +++
tests/nodedevxml2xmltest.c | 1 +
tools/virsh-nodedev.c | 3 +
18 files changed, 153 insertions(+), 26 deletions(-)
create mode 100644 tests/nodedevschemadata/css_0_0_ffff.xml
--
2.25.1
4 years, 3 months
device compatibility interface for live migration with assigned devices
by Yan Zhao
hi folks,
we are defining a device migration compatibility interface that helps upper
layer stack like openstack/ovirt/libvirt to check if two devices are
live migration compatible.
The "devices" here could be MDEVs, physical devices, or hybrid of the two.
e.g. we could use it to check whether
- a src MDEV can migrate to a target MDEV,
- a src VF in SRIOV can migrate to a target VF in SRIOV,
- a src MDEV can migration to a target VF in SRIOV.
(e.g. SIOV/SRIOV backward compatibility case)
The upper layer stack could use this interface as the last step to check
if one device is able to migrate to another device before triggering a real
live migration procedure.
we are not sure if this interface is of value or help to you. please don't
hesitate to drop your valuable comments.
(1) interface definition
The interface is defined in below way:
__ userspace
/\ \
/ \write
/ read \
________/__________ ___\|/_____________
| migration_version | | migration_version |-->check migration
--------------------- --------------------- compatibility
device A device B
a device attribute named migration_version is defined under each device's
sysfs node. e.g. (/sys/bus/pci/devices/0000\:00\:02.0/$mdev_UUID/migration_version).
userspace tools read the migration_version as a string from the source device,
and write it to the migration_version sysfs attribute in the target device.
The userspace should treat ANY of below conditions as two devices not compatible:
- any one of the two devices does not have a migration_version attribute
- error when reading from migration_version attribute of one device
- error when writing migration_version string of one device to
migration_version attribute of the other device
The string read from migration_version attribute is defined by device vendor
driver and is completely opaque to the userspace.
for a Intel vGPU, string format can be defined like
"parent device PCI ID" + "version of gvt driver" + "mdev type" + "aggregator count".
for an NVMe VF connecting to a remote storage. it could be
"PCI ID" + "driver version" + "configured remote storage URL"
for a QAT VF, it may be
"PCI ID" + "driver version" + "supported encryption set".
(to avoid namespace confliction from each vendor, we may prefix a driver name to
each migration_version string. e.g. i915-v1-8086-591d-i915-GVTg_V5_8-1)
(2) backgrounds
The reason we hope the migration_version string is opaque to the userspace
is that it is hard to generalize standard comparing fields and comparing
methods for different devices from different vendors.
Though userspace now could still do a simple string compare to check if
two devices are compatible, and result should also be right, it's still
too limited as it excludes the possible candidate whose migration_version
string fails to be equal.
e.g. an MDEV with mdev_type_1, aggregator count 3 is probably compatible
with another MDEV with mdev_type_3, aggregator count 1, even their
migration_version strings are not equal.
(assumed mdev_type_3 is of 3 times equal resources of mdev_type_1).
besides that, driver version + configured resources are all elements demanding
to take into account.
So, we hope leaving the freedom to vendor driver and let it make the final decision
in a simple reading from source side and writing for test in the target side way.
we then think the device compatibility issues for live migration with assigned
devices can be divided into two steps:
a. management tools filter out possible migration target devices.
Tags could be created according to info from product specification.
we think openstack/ovirt may have vendor proprietary components to create
those customized tags for each product from each vendor.
e.g.
for Intel vGPU, with a vGPU(a MDEV device) in source side, the tags to
search target vGPU are like:
a tag for compatible parent PCI IDs,
a tag for a range of gvt driver versions,
a tag for a range of mdev type + aggregator count
for NVMe VF, the tags to search target VF may be like:
a tag for compatible PCI IDs,
a tag for a range of driver versions,
a tag for URL of configured remote storage.
b. with the output from step a, openstack/ovirt/libvirt could use our proposed
device migration compatibility interface to make sure the two devices are
indeed live migration compatible before launching the real live migration
process to start stream copying, src device stopping and target device
resuming.
It is supposed that this step would not bring any performance penalty as
-in kernel it's just a simple string decoding and comparing
-in openstack/ovirt, it could be done by extending current function
check_can_live_migrate_destination, along side claiming target resources.[1]
[1] https://specs.openstack.org/openstack/nova-specs/specs/stein/approved/lib...
Thanks
Yan
4 years, 3 months