From 073345568dfa4ef83ac8388b7e9c57fe5292c203 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 09:33:33 +0000 Subject: import libvirt-4.5.0-42.module+el8.2.0+6024+15a2423f --- diff --git a/SOURCES/libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch b/SOURCES/libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch new file mode 100644 index 0000000..47ae4bc --- /dev/null +++ b/SOURCES/libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch @@ -0,0 +1,42 @@ +From 825720316c0f63b029673f883c79a45e49e0f8ab Mon Sep 17 00:00:00 2001 +Message-Id: <825720316c0f63b029673f883c79a45e49e0f8ab@dist-git> +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Fri, 6 Mar 2020 15:51:49 +0100 +Subject: [PATCH] RHEL: qemuCheckUnprivSGIO: use @sysfs_path to get unpriv_sgio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Downstream commit 65f4ff0e2c9a968b7ec65c8d751d4055cc212628 + RHEL: qemuSetUnprivSGIO: Actually use calculated + @sysfs_path to set unpriv_sgio +removed the device_path -> sysfs_path conversion from +both virGetDeviceUnprivSGIO and virSetDeviceUnprivSGIO, +but only adjusted one of the callers. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808399 + +Signed-off-by: Ján Tomko +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-7-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/qemu/qemu_conf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c +index 5788354444..a86e340013 100644 +--- a/src/qemu/qemu_conf.c ++++ b/src/qemu/qemu_conf.c +@@ -1255,7 +1255,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices, + goto cleanup; + } + +- if (virGetDeviceUnprivSGIO(device_path, &val) < 0) ++ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0) + goto cleanup; + + /* Error message on failure needs to be handled in caller +-- +2.25.1 + diff --git a/SOURCES/libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch b/SOURCES/libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch new file mode 100644 index 0000000..ee1bd1a --- /dev/null +++ b/SOURCES/libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch @@ -0,0 +1,170 @@ +From 785d2dd780b472bf857dd962d910addd9ff7b07f Mon Sep 17 00:00:00 2001 +Message-Id: <785d2dd780b472bf857dd962d910addd9ff7b07f@dist-git> +From: Michal Privoznik +Date: Fri, 6 Mar 2020 15:51:48 +0100 +Subject: [PATCH] RHEL: qemuSetUnprivSGIO: Actually use calculated @sysfs_path + to set unpriv_sgio + +In previous commits I've attempted to make qemuSetUnprivSGIO() +construct a generic enough path for SCSI devices to set +unpriv_sgio. However, virSetDeviceUnprivSGIO() does not care +about that - it constructs the path on it's own again. This is +suboptimal in either case - we already have the path constructed. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808388 + +Signed-off-by: Michal Privoznik +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-6-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/qemu/qemu_conf.c | 8 +++----- + src/util/virutil.c | 24 ++++++------------------ + src/util/virutil.h | 2 -- + 3 files changed, 9 insertions(+), 25 deletions(-) + +diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c +index 5636277888..5788354444 100644 +--- a/src/qemu/qemu_conf.c ++++ b/src/qemu/qemu_conf.c +@@ -1255,7 +1255,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices, + goto cleanup; + } + +- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0) ++ if (virGetDeviceUnprivSGIO(device_path, &val) < 0) + goto cleanup; + + /* Error message on failure needs to be handled in caller +@@ -1648,7 +1648,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + virDomainDiskDefPtr disk = NULL; + virDomainHostdevDefPtr hostdev = NULL; + char *sysfs_path = NULL; +- const char *path = NULL; + int val = 0; + int ret = -1; + +@@ -1657,13 +1656,12 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + */ + if (dev->type == VIR_DOMAIN_DEVICE_DISK) { + disk = dev->data.disk; ++ const char *path = virDomainDiskGetSource(disk); + + if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN || + !virStorageSourceIsBlockLocal(disk->src)) + return 0; + +- path = virDomainDiskGetSource(disk); +- + if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) + goto cleanup; + +@@ -1703,7 +1701,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio. + */ + if ((virFileExists(sysfs_path) || val == 1) && +- virSetDeviceUnprivSGIO(path, NULL, val) < 0) ++ virSetDeviceUnprivSGIO(sysfs_path, val) < 0) + goto cleanup; + + ret = 0; +diff --git a/src/util/virutil.c b/src/util/virutil.c +index 2448eba073..ad2b8cb3a2 100644 +--- a/src/util/virutil.c ++++ b/src/util/virutil.c +@@ -1736,18 +1736,13 @@ virGetUnprivSGIOSysfsPath(const char *path, + + int + virSetDeviceUnprivSGIO(const char *path, +- const char *sysfs_dir, + int unpriv_sgio) + { +- char *sysfs_path = NULL; + char *val = NULL; + int ret = -1; + int rc; + +- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir))) +- return -1; +- +- if (!virFileExists(sysfs_path)) { ++ if (!virFileExists(path)) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("unpriv_sgio is not supported by this kernel")); + goto cleanup; +@@ -1756,38 +1751,32 @@ virSetDeviceUnprivSGIO(const char *path, + if (virAsprintf(&val, "%d", unpriv_sgio) < 0) + goto cleanup; + +- if ((rc = virFileWriteStr(sysfs_path, val, 0)) < 0) { +- virReportSystemError(-rc, _("failed to set %s"), sysfs_path); ++ if ((rc = virFileWriteStr(path, val, 0)) < 0) { ++ virReportSystemError(-rc, _("failed to set %s"), path); + goto cleanup; + } + + ret = 0; + cleanup: +- VIR_FREE(sysfs_path); + VIR_FREE(val); + return ret; + } + + int + virGetDeviceUnprivSGIO(const char *path, +- const char *sysfs_dir, + int *unpriv_sgio) + { +- char *sysfs_path = NULL; + char *buf = NULL; + char *tmp = NULL; + int ret = -1; + +- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir))) +- return -1; +- +- if (!virFileExists(sysfs_path)) { ++ if (!virFileExists(path)) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("unpriv_sgio is not supported by this kernel")); + goto cleanup; + } + +- if (virFileReadAll(sysfs_path, 1024, &buf) < 0) ++ if (virFileReadAll(path, 1024, &buf) < 0) + goto cleanup; + + if ((tmp = strchr(buf, '\n'))) +@@ -1795,13 +1784,12 @@ virGetDeviceUnprivSGIO(const char *path, + + if (virStrToLong_i(buf, NULL, 10, unpriv_sgio) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, +- _("failed to parse value of %s"), sysfs_path); ++ _("failed to parse value of %s"), path); + goto cleanup; + } + + ret = 0; + cleanup: +- VIR_FREE(sysfs_path); + VIR_FREE(buf); + return ret; + } +diff --git a/src/util/virutil.h b/src/util/virutil.h +index 1ba9635bd9..1a1313cfa3 100644 +--- a/src/util/virutil.h ++++ b/src/util/virutil.h +@@ -160,10 +160,8 @@ int virGetDeviceID(const char *path, + int *maj, + int *min); + int virSetDeviceUnprivSGIO(const char *path, +- const char *sysfs_dir, + int unpriv_sgio); + int virGetDeviceUnprivSGIO(const char *path, +- const char *sysfs_dir, + int *unpriv_sgio); + char *virGetUnprivSGIOSysfsPath(const char *path, + const char *sysfs_dir); +-- +2.25.1 + diff --git a/SOURCES/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch b/SOURCES/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch new file mode 100644 index 0000000..af68a07 --- /dev/null +++ b/SOURCES/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch @@ -0,0 +1,232 @@ +From 521a2285cfee3d2fdd59cb7a3270e9ef91bcc14f Mon Sep 17 00:00:00 2001 +Message-Id: <521a2285cfee3d2fdd59cb7a3270e9ef91bcc14f@dist-git> +From: Michal Privoznik +Date: Fri, 6 Mar 2020 15:51:44 +0100 +Subject: [PATCH] RHEL: virscsi: Check device type before getting it's /dev + node name + +Not all SCSI devices are block devices, therefore +/sys/bus/scsi/devices/X:X:X:X/block/ directory does not always +exist. Check if the SCSI device is a block device beforehand. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808388 + +Signed-off-by: Michal Privoznik +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-2-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/util/virscsi.c | 149 ++++++++++++++++++++++++++++++--- + tests/virscsidata/0-0-0-0/type | 1 + + tests/virscsidata/1-0-0-0/type | 1 + + 3 files changed, 138 insertions(+), 13 deletions(-) + create mode 100644 tests/virscsidata/0-0-0-0/type + create mode 100644 tests/virscsidata/1-0-0-0/type + +diff --git a/src/util/virscsi.c b/src/util/virscsi.c +index b51103a86d..af908107d9 100644 +--- a/src/util/virscsi.c ++++ b/src/util/virscsi.c +@@ -56,6 +56,32 @@ struct _virUsedByInfo { + }; + typedef struct _virUsedByInfo *virUsedByInfoPtr; + ++ ++/* Keep in sync with scsi/scsi_proto.h */ ++typedef enum { ++ VIR_SCSI_DEVICE_TYPE_NONE = -1, ++ VIR_SCSI_DEVICE_TYPE_DISK = 0x00, ++ VIR_SCSI_DEVICE_TYPE_TAPE = 0x01, ++ VIR_SCSI_DEVICE_TYPE_PRINTER = 0x02, ++ VIR_SCSI_DEVICE_TYPE_PROCESSOR = 0x03, ++ VIR_SCSI_DEVICE_TYPE_WORM = 0x04, ++ VIR_SCSI_DEVICE_TYPE_ROM = 0x05, ++ VIR_SCSI_DEVICE_TYPE_SCANNER = 0x06, ++ VIR_SCSI_DEVICE_TYPE_MOD = 0x07, ++ VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER = 0x08, ++ VIR_SCSI_DEVICE_TYPE_COMM = 0x09, ++ VIR_SCSI_DEVICE_TYPE_RAID = 0x0c, ++ VIR_SCSI_DEVICE_TYPE_ENCLOSURE = 0x0d, ++ VIR_SCSI_DEVICE_TYPE_RBC = 0x0e, ++ VIR_SCSI_DEVICE_TYPE_OSD = 0x11, ++ VIR_SCSI_DEVICE_TYPE_ZBC = 0x14, ++ VIR_SCSI_DEVICE_TYPE_WLUN = 0x1e, ++ VIR_SCSI_DEVICE_TYPE_NO_LUN = 0x7f, ++ ++ VIR_SCSI_DEVICE_TYPE_LAST, ++} virSCSIDeviceType; ++ ++ + struct _virSCSIDevice { + unsigned int adapter; + unsigned int bus; +@@ -143,6 +169,86 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix, + return sg; + } + ++ ++static int ++virSCSIDeviceGetType(const char *prefix, ++ unsigned int adapter, ++ unsigned int bus, ++ unsigned int target, ++ unsigned long long unit, ++ virSCSIDeviceType *type) ++{ ++ int intType; ++ ++ if (virFileReadValueInt(&intType, ++ "%s/%d:%u:%u:%llu/type", ++ prefix, adapter, bus, target, unit) < 0) ++ return -1; ++ ++ switch (intType) { ++ case VIR_SCSI_DEVICE_TYPE_DISK: ++ case VIR_SCSI_DEVICE_TYPE_TAPE: ++ case VIR_SCSI_DEVICE_TYPE_PRINTER: ++ case VIR_SCSI_DEVICE_TYPE_PROCESSOR: ++ case VIR_SCSI_DEVICE_TYPE_WORM: ++ case VIR_SCSI_DEVICE_TYPE_ROM: ++ case VIR_SCSI_DEVICE_TYPE_SCANNER: ++ case VIR_SCSI_DEVICE_TYPE_MOD: ++ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER: ++ case VIR_SCSI_DEVICE_TYPE_COMM: ++ case VIR_SCSI_DEVICE_TYPE_RAID: ++ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE: ++ case VIR_SCSI_DEVICE_TYPE_RBC: ++ case VIR_SCSI_DEVICE_TYPE_OSD: ++ case VIR_SCSI_DEVICE_TYPE_ZBC: ++ case VIR_SCSI_DEVICE_TYPE_WLUN: ++ case VIR_SCSI_DEVICE_TYPE_NO_LUN: ++ *type = intType; ++ break; ++ ++ default: ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("unknown SCSI device type: %x"), ++ intType); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ ++static char * ++virSCSIDeviceGetDevNameBlock(const char *prefix, ++ unsigned int adapter, ++ unsigned int bus, ++ unsigned int target, ++ unsigned long long unit) ++{ ++ DIR *dir = NULL; ++ struct dirent *entry; ++ char *path = NULL; ++ char *name = NULL; ++ ++ if (virAsprintf(&path, ++ "%s/%d:%u:%u:%llu/block", ++ prefix, adapter, bus, target, unit) < 0) ++ return NULL; ++ ++ if (virDirOpen(&dir, path) < 0) ++ goto cleanup; ++ ++ while (virDirRead(dir, &entry, path) > 0) { ++ ignore_value(VIR_STRDUP(name, entry->d_name)); ++ break; ++ } ++ ++ cleanup: ++ VIR_DIR_CLOSE(dir); ++ VIR_FREE(path); ++ return name; ++} ++ ++ + /* Returns device name (e.g. "sdc") on success, or NULL + * on failure. + */ +@@ -153,35 +259,52 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, + unsigned int target, + unsigned long long unit) + { +- DIR *dir = NULL; +- struct dirent *entry; +- char *path = NULL; + char *name = NULL; + unsigned int adapter_id; ++ virSCSIDeviceType type; + const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES; + + if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0) + return NULL; + +- if (virAsprintf(&path, +- "%s/%d:%u:%u:%llu/block", +- prefix, adapter_id, bus, target, unit) < 0) ++ if (virSCSIDeviceGetType(prefix, adapter_id, ++ bus, target, unit, &type) < 0) + return NULL; + +- if (virDirOpen(&dir, path) < 0) +- goto cleanup; ++ switch (type) { ++ case VIR_SCSI_DEVICE_TYPE_DISK: ++ name = virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit); ++ break; + +- while (virDirRead(dir, &entry, path) > 0) { +- ignore_value(VIR_STRDUP(name, entry->d_name)); ++ case VIR_SCSI_DEVICE_TYPE_TAPE: ++ case VIR_SCSI_DEVICE_TYPE_PRINTER: ++ case VIR_SCSI_DEVICE_TYPE_PROCESSOR: ++ case VIR_SCSI_DEVICE_TYPE_WORM: ++ case VIR_SCSI_DEVICE_TYPE_ROM: ++ case VIR_SCSI_DEVICE_TYPE_SCANNER: ++ case VIR_SCSI_DEVICE_TYPE_MOD: ++ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER: ++ case VIR_SCSI_DEVICE_TYPE_COMM: ++ case VIR_SCSI_DEVICE_TYPE_RAID: ++ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE: ++ case VIR_SCSI_DEVICE_TYPE_RBC: ++ case VIR_SCSI_DEVICE_TYPE_OSD: ++ case VIR_SCSI_DEVICE_TYPE_ZBC: ++ case VIR_SCSI_DEVICE_TYPE_WLUN: ++ case VIR_SCSI_DEVICE_TYPE_NO_LUN: ++ case VIR_SCSI_DEVICE_TYPE_NONE: ++ case VIR_SCSI_DEVICE_TYPE_LAST: ++ default: ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("unsupported SCSI device type: %x"), ++ type); + break; + } + +- cleanup: +- VIR_DIR_CLOSE(dir); +- VIR_FREE(path); + return name; + } + ++ + virSCSIDevicePtr + virSCSIDeviceNew(const char *sysfs_prefix, + const char *adapter, +diff --git a/tests/virscsidata/0-0-0-0/type b/tests/virscsidata/0-0-0-0/type +new file mode 100644 +index 0000000000..573541ac97 +--- /dev/null ++++ b/tests/virscsidata/0-0-0-0/type +@@ -0,0 +1 @@ ++0 +diff --git a/tests/virscsidata/1-0-0-0/type b/tests/virscsidata/1-0-0-0/type +new file mode 100644 +index 0000000000..573541ac97 +--- /dev/null ++++ b/tests/virscsidata/1-0-0-0/type +@@ -0,0 +1 @@ ++0 +-- +2.25.1 + diff --git a/SOURCES/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch b/SOURCES/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch new file mode 100644 index 0000000..d2d3c65 --- /dev/null +++ b/SOURCES/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch @@ -0,0 +1,148 @@ +From 6dfdc50564c3d2147f36c4cf6c252cad7a0e9381 Mon Sep 17 00:00:00 2001 +Message-Id: <6dfdc50564c3d2147f36c4cf6c252cad7a0e9381@dist-git> +From: Michal Privoznik +Date: Fri, 6 Mar 2020 15:51:46 +0100 +Subject: [PATCH] RHEL: virscsi: Introduce and use + virSCSIDeviceGetUnprivSGIOSysfsPath() + +When constructing a path to the 'unpriv_sgio' file of given SCSI +device we don't need to go through /dev/* and major() + minor() +path. The generated path points to +/sys/dev/block/MAJ:MIN/queue/unpriv_sgio which is wrong if the +SCSI device in question is not a block device. We can generate a +different path: /sys/bus/scsi/devices/X:X:X:X/unpriv_sgio where +the file is directly accessible regardless of the SCSI device +type. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808388 + +Signed-off-by: Michal Privoznik +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-4-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/libvirt_private.syms | 1 + + src/qemu/qemu_conf.c | 19 +++++++++++-------- + src/util/virscsi.c | 21 +++++++++++++++++++++ + src/util/virscsi.h | 5 +++++ + 4 files changed, 38 insertions(+), 8 deletions(-) + +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 2ad21a68bc..5e1d73c148 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -2727,6 +2727,7 @@ virSCSIDeviceGetSgName; + virSCSIDeviceGetShareable; + virSCSIDeviceGetTarget; + virSCSIDeviceGetUnit; ++virSCSIDeviceGetUnprivSGIOSysfsPath; + virSCSIDeviceIsAvailable; + virSCSIDeviceListAdd; + virSCSIDeviceListCount; +diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c +index a81298326f..5636277888 100644 +--- a/src/qemu/qemu_conf.c ++++ b/src/qemu/qemu_conf.c +@@ -1648,7 +1648,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + virDomainDiskDefPtr disk = NULL; + virDomainHostdevDefPtr hostdev = NULL; + char *sysfs_path = NULL; +- char *hostdev_path = NULL; + const char *path = NULL; + int val = 0; + int ret = -1; +@@ -1664,24 +1663,29 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + return 0; + + path = virDomainDiskGetSource(disk); ++ ++ if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) ++ goto cleanup; ++ + } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { + hostdev = dev->data.hostdev; ++ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; ++ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; + + if (hostdev->source.subsys.u.scsi.protocol == + VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) + return 0; + +- if (!(hostdev_path = qemuGetHostdevPath(hostdev))) ++ if (!(sysfs_path = virSCSIDeviceGetUnprivSGIOSysfsPath(NULL, ++ scsihostsrc->adapter, ++ scsihostsrc->bus, ++ scsihostsrc->target, ++ scsihostsrc->unit))) + goto cleanup; +- +- path = hostdev_path; + } else { + return 0; + } + +- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) +- goto cleanup; +- + /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */ + if (dev->type == VIR_DOMAIN_DEVICE_DISK) { + if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) +@@ -1705,7 +1709,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) + ret = 0; + + cleanup: +- VIR_FREE(hostdev_path); + VIR_FREE(sysfs_path); + return ret; + } +diff --git a/src/util/virscsi.c b/src/util/virscsi.c +index 6c3fd8a562..5aab43fc88 100644 +--- a/src/util/virscsi.c ++++ b/src/util/virscsi.c +@@ -342,6 +342,27 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, + } + + ++char * ++virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix, ++ const char *adapter, ++ unsigned int bus, ++ unsigned int target, ++ unsigned long long unit) ++{ ++ char *path = NULL; ++ unsigned int adapter_id; ++ const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES; ++ ++ if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0) ++ return NULL; ++ ++ ignore_value(virAsprintf(&path, ++ "%s/%d:%u:%u:%llu/unpriv_sgio", ++ prefix, adapter_id, bus, target, unit)); ++ return path; ++} ++ ++ + virSCSIDevicePtr + virSCSIDeviceNew(const char *sysfs_prefix, + const char *adapter, +diff --git a/src/util/virscsi.h b/src/util/virscsi.h +index 9f8b3ecf1e..5dea2a9f5d 100644 +--- a/src/util/virscsi.h ++++ b/src/util/virscsi.h +@@ -43,6 +43,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix, + unsigned int bus, + unsigned int target, + unsigned long long unit); ++char *virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix, ++ const char *adapter, ++ unsigned int bus, ++ unsigned int target, ++ unsigned long long unit); + + virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix, + const char *adapter, +-- +2.25.1 + diff --git a/SOURCES/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch b/SOURCES/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch new file mode 100644 index 0000000..f302043 --- /dev/null +++ b/SOURCES/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch @@ -0,0 +1,219 @@ +From 41480c7a787cc776e64d2ab7b737c3e8d6a84bd2 Mon Sep 17 00:00:00 2001 +Message-Id: <41480c7a787cc776e64d2ab7b737c3e8d6a84bd2@dist-git> +From: Michal Privoznik +Date: Fri, 6 Mar 2020 15:51:45 +0100 +Subject: [PATCH] RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName() + +If the SCSI device we want to get /dev node name for is TAPE +device we need to look at 'tape' symlink in the sysfs dir +corresponding to the device. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808388 + +Signed-off-by: Michal Privoznik +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-3-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/util/virscsi.c | 37 ++++++++++++++++++++ + tests/virscsidata/2-0-0-0/model | 1 + + tests/virscsidata/2-0-0-0/scsi_tape/st0/dev | 1 + + tests/virscsidata/2-0-0-0/sg3/dev | 1 + + tests/virscsidata/2-0-0-0/tape | 1 + + tests/virscsidata/2-0-0-0/type | 1 + + tests/virscsidata/2-0-0-0/vendor | 1 + + tests/virscsidata/sg3 | 0 + tests/virscsitest.c | 38 ++++++++++++++++++--- + 9 files changed, 76 insertions(+), 5 deletions(-) + create mode 100644 tests/virscsidata/2-0-0-0/model + create mode 100644 tests/virscsidata/2-0-0-0/scsi_tape/st0/dev + create mode 100644 tests/virscsidata/2-0-0-0/sg3/dev + create mode 120000 tests/virscsidata/2-0-0-0/tape + create mode 100644 tests/virscsidata/2-0-0-0/type + create mode 100644 tests/virscsidata/2-0-0-0/vendor + create mode 100644 tests/virscsidata/sg3 + +diff --git a/src/util/virscsi.c b/src/util/virscsi.c +index af908107d9..6c3fd8a562 100644 +--- a/src/util/virscsi.c ++++ b/src/util/virscsi.c +@@ -42,6 +42,7 @@ + #include "virutil.h" + #include "virstring.h" + #include "virerror.h" ++#include "dirname.h" + + #define SYSFS_SCSI_DEVICES "/sys/bus/scsi/devices" + +@@ -249,6 +250,39 @@ virSCSIDeviceGetDevNameBlock(const char *prefix, + } + + ++static char * ++virSCSIDeviceGetDevNameTape(const char *prefix, ++ unsigned int adapter, ++ unsigned int bus, ++ unsigned int target, ++ unsigned long long unit) ++{ ++ char *path = NULL; ++ char *resolvedPath = NULL; ++ char *name = NULL; ++ ++ if (virAsprintf(&path, ++ "%s/%d:%u:%u:%llu/tape", ++ prefix, adapter, bus, target, unit) < 0) ++ return NULL; ++ ++ if (virFileReadLink(path, &resolvedPath) < 0) { ++ virReportSystemError(errno, ++ _("Unable to read link: %s"), ++ path); ++ goto cleanup; ++ } ++ ++ if (VIR_STRDUP(name, last_component(resolvedPath)) < 0) ++ goto cleanup; ++ ++ cleanup: ++ VIR_FREE(resolvedPath); ++ VIR_FREE(path); ++ return name; ++} ++ ++ + /* Returns device name (e.g. "sdc") on success, or NULL + * on failure. + */ +@@ -277,6 +311,9 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, + break; + + case VIR_SCSI_DEVICE_TYPE_TAPE: ++ name = virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit); ++ break; ++ + case VIR_SCSI_DEVICE_TYPE_PRINTER: + case VIR_SCSI_DEVICE_TYPE_PROCESSOR: + case VIR_SCSI_DEVICE_TYPE_WORM: +diff --git a/tests/virscsidata/2-0-0-0/model b/tests/virscsidata/2-0-0-0/model +new file mode 100644 +index 0000000000..d2ab4715c3 +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/model +@@ -0,0 +1 @@ ++scsi_debug +diff --git a/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev +new file mode 100644 +index 0000000000..3dd777e840 +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev +@@ -0,0 +1 @@ ++9:0 +diff --git a/tests/virscsidata/2-0-0-0/sg3/dev b/tests/virscsidata/2-0-0-0/sg3/dev +new file mode 100644 +index 0000000000..b369a59b3e +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/sg3/dev +@@ -0,0 +1 @@ ++21:3 +diff --git a/tests/virscsidata/2-0-0-0/tape b/tests/virscsidata/2-0-0-0/tape +new file mode 120000 +index 0000000000..6ca7f77539 +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/tape +@@ -0,0 +1 @@ ++scsi_tape/st0 +\ No newline at end of file +diff --git a/tests/virscsidata/2-0-0-0/type b/tests/virscsidata/2-0-0-0/type +new file mode 100644 +index 0000000000..d00491fd7e +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/type +@@ -0,0 +1 @@ ++1 +diff --git a/tests/virscsidata/2-0-0-0/vendor b/tests/virscsidata/2-0-0-0/vendor +new file mode 100644 +index 0000000000..9b075671ea +--- /dev/null ++++ b/tests/virscsidata/2-0-0-0/vendor +@@ -0,0 +1 @@ ++Linux +diff --git a/tests/virscsidata/sg3 b/tests/virscsidata/sg3 +new file mode 100644 +index 0000000000..e69de29bb2 +diff --git a/tests/virscsitest.c b/tests/virscsitest.c +index 1215adbfab..880fa22ca8 100644 +--- a/tests/virscsitest.c ++++ b/tests/virscsitest.c +@@ -36,18 +36,34 @@ VIR_LOG_INIT("tests.scsitest"); + static const char *abs_top_srcdir; + static char *virscsi_prefix; + ++typedef struct { ++ const char *adapter; ++ unsigned int bus; ++ unsigned int target; ++ unsigned int unit; ++ const char *expectedName; ++} testGetDevNameData; ++ + static int +-test1(const void *data ATTRIBUTE_UNUSED) ++testGetDevName(const void *opaque) + { ++ const testGetDevNameData *data = opaque; + char *name = NULL; + int ret = -1; + + if (!(name = virSCSIDeviceGetDevName(virscsi_prefix, +- "scsi_host1", 0, 0, 0))) ++ data->adapter, ++ data->bus, ++ data->target, ++ data->unit))) + return -1; + +- if (STRNEQ(name, "sdh")) ++ if (STRNEQ(name, data->expectedName)) { ++ fprintf(stderr, ++ "SCSI dev name mismatch, expected %s got %s", ++ data->expectedName, name); + goto cleanup; ++ } + + ret = 0; + cleanup: +@@ -225,7 +241,9 @@ mymain(void) + + CREATE_SYMLINK("0-0-0-0", "0:0:0:0"); + CREATE_SYMLINK("1-0-0-0", "1:0:0:0"); ++ CREATE_SYMLINK("2-0-0-0", "2:0:0:0"); + CREATE_SYMLINK("sg0", "sg0"); ++ CREATE_SYMLINK("sg3", "sg3"); + CREATE_SYMLINK("sg8", "sg8"); + + VIR_FREE(virscsi_prefix); +@@ -235,8 +253,18 @@ mymain(void) + goto cleanup; + } + +- if (virTestRun("test1", test1, NULL) < 0) +- ret = -1; ++#define TEST_GET_DEV_NAME(adapter, bus, target, unit, expectedName) \ ++ do { \ ++ testGetDevNameData data = {adapter, bus, target, unit, expectedName}; \ ++ if (virTestRun("test getDevname " expectedName, \ ++ testGetDevName, &data) < 0) \ ++ ret = -1; \ ++ } while (0) ++ ++ TEST_GET_DEV_NAME("scsi_host0", 0, 0, 0, "sda"); ++ TEST_GET_DEV_NAME("scsi_host1", 0, 0, 0, "sdh"); ++ TEST_GET_DEV_NAME("scsi_host2", 0, 0, 0, "st0"); ++ + if (virTestRun("test2", test2, NULL) < 0) + ret = -1; + +-- +2.25.1 + diff --git a/SOURCES/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch b/SOURCES/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch new file mode 100644 index 0000000..6f59819 --- /dev/null +++ b/SOURCES/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch @@ -0,0 +1,37 @@ +From f4d9b6252bd2b2b5a3c70a3869ce49a3a9e1a9cc Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Fri, 6 Mar 2020 15:51:47 +0100 +Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID() + +If a caller wants to learn major or minor number for a device, +let them. There's no need to check if the device is a block +device here. + +https://bugzilla.redhat.com/show_bug.cgi?id=1808388 + +Signed-off-by: Michal Privoznik +Signed-off-by: Andrea Bolognani +Message-Id: <20200306145149.1610286-5-abologna@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/util/virutil.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/util/virutil.c b/src/util/virutil.c +index cd67f54bc2..2448eba073 100644 +--- a/src/util/virutil.c ++++ b/src/util/virutil.c +@@ -1693,9 +1693,6 @@ virGetDeviceID(const char *path, int *maj, int *min) + if (stat(path, &sb) < 0) + return -errno; + +- if (!S_ISBLK(sb.st_mode)) +- return -EINVAL; +- + if (maj) + *maj = major(sb.st_rdev); + if (min) +-- +2.25.1 + diff --git a/SOURCES/libvirt-cpu-Drop-CPUID-definition-for-hv-spinlocks.patch b/SOURCES/libvirt-cpu-Drop-CPUID-definition-for-hv-spinlocks.patch new file mode 100644 index 0000000..e2cf15d --- /dev/null +++ b/SOURCES/libvirt-cpu-Drop-CPUID-definition-for-hv-spinlocks.patch @@ -0,0 +1,82 @@ +From 900c638797181010d2341a8a5496c1335286353e Mon Sep 17 00:00:00 2001 +Message-Id: <900c638797181010d2341a8a5496c1335286353e@dist-git> +From: Jiri Denemark +Date: Fri, 7 Feb 2020 12:01:18 +0100 +Subject: [PATCH] cpu: Drop CPUID definition for hv-spinlocks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +hv-spinlocks is not a CPUID feature and should not be checked as such. +While starting a domain with hv-spinlocks enabled, we would report a +warning about unsupported hyperv spinlocks feature even though it was +set properly. + +Signed-off-by: Jiri Denemark +Reviewed-by: Ján Tomko +(cherry picked from commit ad9d5d3a6a1fc86fca1620278cbd113e08370ba2) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Signed-off-by: Jiri Denemark +Message-Id: +Reviewed-by: Ján Tomko +--- + src/cpu/cpu_x86.c | 3 --- + src/qemu/qemu_process.c | 5 +++-- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c +index 0459a0d1c8..a985913e5e 100644 +--- a/src/cpu/cpu_x86.c ++++ b/src/cpu/cpu_x86.c +@@ -88,8 +88,6 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER, + 0x40000003, 0x00000008); + KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED, + 0x40000003, 0x00000020); +-KVM_FEATURE_DEF(VIR_CPU_x86_HV_SPINLOCKS, +- 0x40000003, 0x00000022); + KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC, + 0x40000003, 0x00000030); + KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX, +@@ -110,7 +108,6 @@ static virCPUx86Feature x86_kvm_features[] = + KVM_FEATURE(VIR_CPU_x86_HV_SYNIC), + KVM_FEATURE(VIR_CPU_x86_HV_STIMER), + KVM_FEATURE(VIR_CPU_x86_HV_RELAXED), +- KVM_FEATURE(VIR_CPU_x86_HV_SPINLOCKS), + KVM_FEATURE(VIR_CPU_x86_HV_VAPIC), + KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX), + KVM_FEATURE(VIR_CPU_x86_HV_RESET), +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 312ce69ba5..17d48357b3 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3917,7 +3917,8 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, + + for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { + /* always supported string property */ +- if (i == VIR_DOMAIN_HYPERV_VENDOR_ID) ++ if (i == VIR_DOMAIN_HYPERV_VENDOR_ID || ++ i == VIR_DOMAIN_HYPERV_SPINLOCKS) + continue; + + if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON) +@@ -3938,7 +3939,6 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, + switch ((virDomainHyperv) i) { + case VIR_DOMAIN_HYPERV_RELAXED: + case VIR_DOMAIN_HYPERV_VAPIC: +- case VIR_DOMAIN_HYPERV_SPINLOCKS: + VIR_WARN("host doesn't support hyperv '%s' feature", + virDomainHypervTypeToString(i)); + break; +@@ -3957,6 +3957,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, + return -1; + + /* coverity[dead_error_begin] */ ++ case VIR_DOMAIN_HYPERV_SPINLOCKS: + case VIR_DOMAIN_HYPERV_VENDOR_ID: + case VIR_DOMAIN_HYPERV_LAST: + break; +-- +2.25.0 + diff --git a/SOURCES/libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch b/SOURCES/libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch new file mode 100644 index 0000000..15d8e68 --- /dev/null +++ b/SOURCES/libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch @@ -0,0 +1,156 @@ +From a7a5fd909ea7a5d7608568e94f9a0f7d4478719b Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Fri, 7 Feb 2020 10:41:43 +0100 +Subject: [PATCH] cpu: Drop KVM_ from hyperv feature macros +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All the features are hyperv features even though they are provided by +KVM with QEMU. The "KVM" part in the macro names does not make a lot of +sense. + +Signed-off-by: Jiri Denemark +Tested-by: Vitaly Kuznetsov +Reviewed-by: Ján Tomko +(cherry picked from commit 1ddf014fef4468a15303029fbc563da0aaaf8ce4) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Conflicts: + src/cpu/cpu_x86.c + src/cpu/cpu_x86_data.h + - a few extra hyperv features upstream + +Signed-off-by: Jiri Denemark +Message-Id: +Reviewed-by: Ján Tomko +--- + src/cpu/cpu_x86.c | 45 +++++++++++++++++++++-------------------- + src/cpu/cpu_x86_data.h | 22 ++++++++++---------- + src/qemu/qemu_command.c | 2 +- + 3 files changed, 35 insertions(+), 34 deletions(-) + +diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c +index cf5ef442e7..ecf11926b4 100644 +--- a/src/cpu/cpu_x86.c ++++ b/src/cpu/cpu_x86.c +@@ -95,27 +95,28 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_UNHALT, + 0x40000001, 0x00000080); + KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT, + 0x40000001, 0x01000000); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RUNTIME, ++ ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_RUNTIME, + 0x40000003, 0x00000001); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_SYNIC, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_SYNIC, + 0x40000003, 0x00000004); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_STIMER, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER, + 0x40000003, 0x00000008); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RELAXED, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED, + 0x40000003, 0x00000020); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_SPINLOCKS, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_SPINLOCKS, + 0x40000003, 0x00000022); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VAPIC, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC, + 0x40000003, 0x00000030); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VPINDEX, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX, + 0x40000003, 0x00000040); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_RESET, + 0x40000003, 0x00000080); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_FREQUENCIES, + 0x40000003, 0x00000800); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT, + 0x40000003, 0x00002000); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH, ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH, + 0x40000004, 0x00000004); + + static virCPUx86Feature x86_kvm_features[] = +@@ -129,17 +130,17 @@ static virCPUx86Feature x86_kvm_features[] = + KVM_FEATURE(VIR_CPU_x86_KVM_PV_EOI), + KVM_FEATURE(VIR_CPU_x86_KVM_PV_UNHALT), + KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RUNTIME), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_SYNIC), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_STIMER), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RELAXED), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_SPINLOCKS), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_VAPIC), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT), +- KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH), ++ KVM_FEATURE(VIR_CPU_x86_HV_RUNTIME), ++ KVM_FEATURE(VIR_CPU_x86_HV_SYNIC), ++ KVM_FEATURE(VIR_CPU_x86_HV_STIMER), ++ KVM_FEATURE(VIR_CPU_x86_HV_RELAXED), ++ KVM_FEATURE(VIR_CPU_x86_HV_SPINLOCKS), ++ KVM_FEATURE(VIR_CPU_x86_HV_VAPIC), ++ KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX), ++ KVM_FEATURE(VIR_CPU_x86_HV_RESET), ++ KVM_FEATURE(VIR_CPU_x86_HV_FREQUENCIES), ++ KVM_FEATURE(VIR_CPU_x86_HV_REENLIGHTENMENT), ++ KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH), + }; + + typedef struct _virCPUx86Model virCPUx86Model; +diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h +index 77797f633c..9668b13eb9 100644 +--- a/src/cpu/cpu_x86_data.h ++++ b/src/cpu/cpu_x86_data.h +@@ -64,17 +64,17 @@ struct _virCPUx86MSR { + * ones defined for virDomainHyperv in domain_conf.c. + * E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc. + */ +-# define VIR_CPU_x86_KVM_HV_RUNTIME "hv-runtime" +-# define VIR_CPU_x86_KVM_HV_SYNIC "hv-synic" +-# define VIR_CPU_x86_KVM_HV_STIMER "hv-stimer" +-# define VIR_CPU_x86_KVM_HV_RELAXED "hv-relaxed" +-# define VIR_CPU_x86_KVM_HV_SPINLOCKS "hv-spinlocks" +-# define VIR_CPU_x86_KVM_HV_VAPIC "hv-vapic" +-# define VIR_CPU_x86_KVM_HV_VPINDEX "hv-vpindex" +-# define VIR_CPU_x86_KVM_HV_RESET "hv-reset" +-# define VIR_CPU_x86_KVM_HV_FREQUENCIES "hv-frequencies" +-# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "hv-reenlightenment" +-# define VIR_CPU_x86_KVM_HV_TLBFLUSH "hv-tlbflush" ++# define VIR_CPU_x86_HV_RUNTIME "hv-runtime" ++# define VIR_CPU_x86_HV_SYNIC "hv-synic" ++# define VIR_CPU_x86_HV_STIMER "hv-stimer" ++# define VIR_CPU_x86_HV_RELAXED "hv-relaxed" ++# define VIR_CPU_x86_HV_SPINLOCKS "hv-spinlocks" ++# define VIR_CPU_x86_HV_VAPIC "hv-vapic" ++# define VIR_CPU_x86_HV_VPINDEX "hv-vpindex" ++# define VIR_CPU_x86_HV_RESET "hv-reset" ++# define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies" ++# define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment" ++# define VIR_CPU_x86_HV_TLBFLUSH "hv-tlbflush" + + + # define VIR_CPU_X86_DATA_INIT { 0 } +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 0289a907a1..71e102747c 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -7039,7 +7039,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + case VIR_DOMAIN_HYPERV_SPINLOCKS: + if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) + virBufferAsprintf(&buf, ",%s=0x%x", +- VIR_CPU_x86_KVM_HV_SPINLOCKS, ++ VIR_CPU_x86_HV_SPINLOCKS, + def->hyperv_spinlocks); + break; + +-- +2.25.0 + diff --git a/SOURCES/libvirt-cpu-Drop-unused-KVM-features.patch b/SOURCES/libvirt-cpu-Drop-unused-KVM-features.patch new file mode 100644 index 0000000..ba0a85f --- /dev/null +++ b/SOURCES/libvirt-cpu-Drop-unused-KVM-features.patch @@ -0,0 +1,102 @@ +From 3ad9cd82d4fe7e87665a0233662712725f5d3d5d Mon Sep 17 00:00:00 2001 +Message-Id: <3ad9cd82d4fe7e87665a0233662712725f5d3d5d@dist-git> +From: Jiri Denemark +Date: Fri, 7 Feb 2020 10:41:44 +0100 +Subject: [PATCH] cpu: Drop unused KVM features +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Most of the internally defined KVM CPUID features are not actually used +by libvirt. The QEMU driver may enable or disable them on the command +line, but we don't check for the associated CPU properties or CPUID +bits. They would be useless with QEMU 4.1 anyway since their names were +only remotely similar to the actual feature names. + +Signed-off-by: Jiri Denemark +Tested-by: Vitaly Kuznetsov +Reviewed-by: Ján Tomko +(cherry picked from commit 9e6172937f8d8f832359dd5eeb4e7c92f9defcbf) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Conflicts: + src/cpu/cpu_x86_data.h + - all defines are indented as downstream lacks #pragma once + +Signed-off-by: Jiri Denemark +Message-Id: <763f5d57b6cb930d9edbfbe8edbb7d5797a48150.1581064395.git.jdenemar@redhat.com> +Reviewed-by: Ján Tomko +--- + src/cpu/cpu_x86.c | 24 ------------------------ + src/cpu/cpu_x86_data.h | 8 -------- + 2 files changed, 32 deletions(-) + +diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c +index ecf11926b4..0459a0d1c8 100644 +--- a/src/cpu/cpu_x86.c ++++ b/src/cpu/cpu_x86.c +@@ -77,24 +77,8 @@ struct _virCPUx86Feature { + } \ + } + +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE, +- 0x40000001, 0x00000001); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_NOP_IO_DELAY, +- 0x40000001, 0x00000002); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_MMU_OP, +- 0x40000001, 0x00000004); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE2, +- 0x40000001, 0x00000008); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_ASYNC_PF, +- 0x40000001, 0x00000010); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_STEAL_TIME, +- 0x40000001, 0x00000020); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_EOI, +- 0x40000001, 0x00000040); + KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_UNHALT, + 0x40000001, 0x00000080); +-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT, +- 0x40000001, 0x01000000); + + KVM_FEATURE_DEF(VIR_CPU_x86_HV_RUNTIME, + 0x40000003, 0x00000001); +@@ -121,15 +105,7 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH, + + static virCPUx86Feature x86_kvm_features[] = + { +- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE), +- KVM_FEATURE(VIR_CPU_x86_KVM_NOP_IO_DELAY), +- KVM_FEATURE(VIR_CPU_x86_KVM_MMU_OP), +- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE2), +- KVM_FEATURE(VIR_CPU_x86_KVM_ASYNC_PF), +- KVM_FEATURE(VIR_CPU_x86_KVM_STEAL_TIME), +- KVM_FEATURE(VIR_CPU_x86_KVM_PV_EOI), + KVM_FEATURE(VIR_CPU_x86_KVM_PV_UNHALT), +- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT), + KVM_FEATURE(VIR_CPU_x86_HV_RUNTIME), + KVM_FEATURE(VIR_CPU_x86_HV_SYNIC), + KVM_FEATURE(VIR_CPU_x86_HV_STIMER), +diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h +index 9668b13eb9..8a189f854e 100644 +--- a/src/cpu/cpu_x86_data.h ++++ b/src/cpu/cpu_x86_data.h +@@ -49,15 +49,7 @@ struct _virCPUx86MSR { + # define CPUX86_KVM 0x40000000 + # define CPUX86_EXTENDED 0x80000000 + +-# define VIR_CPU_x86_KVM_CLOCKSOURCE "__kvm_clocksource" +-# define VIR_CPU_x86_KVM_NOP_IO_DELAY "__kvm_no_io_delay" +-# define VIR_CPU_x86_KVM_MMU_OP "__kvm_mmu_op" +-# define VIR_CPU_x86_KVM_CLOCKSOURCE2 "__kvm_clocksource2" +-# define VIR_CPU_x86_KVM_ASYNC_PF "__kvm_async_pf" +-# define VIR_CPU_x86_KVM_STEAL_TIME "__kvm_steal_time" +-# define VIR_CPU_x86_KVM_PV_EOI "__kvm_pv_eoi" + # define VIR_CPU_x86_KVM_PV_UNHALT "__kvm_pv_unhalt" +-# define VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT "__kvm_clocksource_stable" + + /* + * The following HyperV feature names suffixes must exactly match corresponding +-- +2.25.0 + diff --git a/SOURCES/libvirt-cpu_conf-Pass-policy-to-CPU-feature-filtering-callbacks.patch b/SOURCES/libvirt-cpu_conf-Pass-policy-to-CPU-feature-filtering-callbacks.patch index 50c8e30..b0265c9 100644 --- a/SOURCES/libvirt-cpu_conf-Pass-policy-to-CPU-feature-filtering-callbacks.patch +++ b/SOURCES/libvirt-cpu_conf-Pass-policy-to-CPU-feature-filtering-callbacks.patch @@ -1,7 +1,7 @@ -From 0631e5e7cf7042841d3de563e8c59a74f43b1d68 Mon Sep 17 00:00:00 2001 -Message-Id: <0631e5e7cf7042841d3de563e8c59a74f43b1d68@dist-git> +From acb2d441abd4b584c40748cbaf4f6f7a376753aa Mon Sep 17 00:00:00 2001 +Message-Id: From: Jiri Denemark -Date: Fri, 22 Nov 2019 11:19:20 +0100 +Date: Fri, 15 Nov 2019 17:52:32 +0100 Subject: [PATCH] cpu_conf: Pass policy to CPU feature filtering callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11,9 +11,9 @@ Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé (cherry picked from commit 668797dc5cb474585609559dbe610e09517e23e6) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1749672 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Conflicts: src/cpu/cpu_x86.c @@ -21,7 +21,7 @@ Conflicts: - no glib stuff downstream Signed-off-by: Jiri Denemark -Message-Id: +Message-Id: Reviewed-by: Michal Privoznik --- src/conf/cpu_conf.c | 6 +++--- diff --git a/SOURCES/libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch b/SOURCES/libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch index e86734a..b3c3e7c 100644 --- a/SOURCES/libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch +++ b/SOURCES/libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch @@ -1,5 +1,5 @@ -From b76070b36f9952421488fbf5a15f470c53e1c136 Mon Sep 17 00:00:00 2001 -Message-Id: +From 06a798d6c6283b7041ec8fd631c1289b6fc1b29c Mon Sep 17 00:00:00 2001 +Message-Id: <06a798d6c6283b7041ec8fd631c1289b6fc1b29c@dist-git> From: Jiri Denemark Date: Fri, 13 Dec 2019 14:28:07 +0100 Subject: [PATCH] cpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR @@ -43,5 +43,5 @@ index 7b9f8bb452..c2b3fca47a 100644 -- -2.24.0 +2.24.1 diff --git a/SOURCES/libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch b/SOURCES/libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch index f89c06c..45743c2 100644 --- a/SOURCES/libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch +++ b/SOURCES/libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch @@ -1,5 +1,5 @@ -From 175416715561964226c5c75eaeb7c2fa55395f65 Mon Sep 17 00:00:00 2001 -Message-Id: <175416715561964226c5c75eaeb7c2fa55395f65@dist-git> +From acc51748038a8074fe3a7c769b101455afd64eb7 Mon Sep 17 00:00:00 2001 +Message-Id: From: Jiri Denemark Date: Fri, 13 Dec 2019 14:28:08 +0100 Subject: [PATCH] cpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR @@ -42,5 +42,5 @@ index c2b3fca47a..9609ce71a7 100644 -- -2.24.0 +2.24.1 diff --git a/SOURCES/libvirt-cpu_map-Drop-pconfig-from-Icelake-Server-CPU-model.patch b/SOURCES/libvirt-cpu_map-Drop-pconfig-from-Icelake-Server-CPU-model.patch index ddccae4..26d83d5 100644 --- a/SOURCES/libvirt-cpu_map-Drop-pconfig-from-Icelake-Server-CPU-model.patch +++ b/SOURCES/libvirt-cpu_map-Drop-pconfig-from-Icelake-Server-CPU-model.patch @@ -1,7 +1,7 @@ -From 3b9e2f17d091c57f1fe7cbad18b0985e0644d8c2 Mon Sep 17 00:00:00 2001 -Message-Id: <3b9e2f17d091c57f1fe7cbad18b0985e0644d8c2@dist-git> +From 059091703401ef3029a1ffdbec8de97d5d5a1fd1 Mon Sep 17 00:00:00 2001 +Message-Id: <059091703401ef3029a1ffdbec8de97d5d5a1fd1@dist-git> From: Jiri Denemark -Date: Fri, 22 Nov 2019 11:19:24 +0100 +Date: Fri, 15 Nov 2019 17:52:36 +0100 Subject: [PATCH] cpu_map: Drop pconfig from Icelake-Server CPU model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -27,9 +27,8 @@ Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé (cherry picked from commit 9cd03f7957e114892ae54e7ccb3758b6fb440644) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Conflicts: src/cpu_map/x86_Icelake-Server.xml @@ -39,7 +38,7 @@ Conflicts: - context Signed-off-by: Jiri Denemark -Message-Id: <430d543cce32100e879f1a5ea125abd4428aecf0.1574417839.git.jdenemar@redhat.com> +Message-Id: <6c06dac67da208e6ba8c07798c31405644acfb16.1573836581.git.jdenemar@redhat.com> Reviewed-by: Michal Privoznik --- src/cpu/cpu_map.xml | 1 - diff --git a/SOURCES/libvirt-cpu_map-x86-Add-support-for-BFLOAT16-data-type.patch b/SOURCES/libvirt-cpu_map-x86-Add-support-for-BFLOAT16-data-type.patch new file mode 100644 index 0000000..85e6137 --- /dev/null +++ b/SOURCES/libvirt-cpu_map-x86-Add-support-for-BFLOAT16-data-type.patch @@ -0,0 +1,46 @@ +From a919b41c576e9619b14bcc599a2a0c844943f40b Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Fri, 10 Jan 2020 12:01:47 +0100 +Subject: [PATCH] cpu_map/x86: Add support for BFLOAT16 data type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Introduced in QEMU by commit v4.1.0-266-g80db491da4. + +Signed-off-by: Jiri Denemark +Reviewed-by: Ján Tomko +(cherry picked from commit b570139909fd5d11d82408218a8f1f590a6386b2) + +https://bugzilla.redhat.com/show_bug.cgi?id=1749516 + +Conflicts: + src/cpu_map/x86_features.xml + - features are defined in src/cpu/cpu_map.xml + +Signed-off-by: Jiri Denemark +Message-Id: +Reviewed-by: Pavel Hrdina +--- + src/cpu/cpu_map.xml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml +index 9609ce71a7..c09c80a2e9 100644 +--- a/src/cpu/cpu_map.xml ++++ b/src/cpu/cpu_map.xml +@@ -344,6 +344,10 @@ + + + ++ ++ ++ ++ + + + +-- +2.24.1 + diff --git a/SOURCES/libvirt-cputest-Add-data-for-Ice-Lake-Server-CPU.patch b/SOURCES/libvirt-cputest-Add-data-for-Ice-Lake-Server-CPU.patch index 17c8ee3..355b28c 100644 --- a/SOURCES/libvirt-cputest-Add-data-for-Ice-Lake-Server-CPU.patch +++ b/SOURCES/libvirt-cputest-Add-data-for-Ice-Lake-Server-CPU.patch @@ -1,7 +1,7 @@ -From 3ec400ca1456fcd5ab9dd24763f4635c0c9819f8 Mon Sep 17 00:00:00 2001 -Message-Id: <3ec400ca1456fcd5ab9dd24763f4635c0c9819f8@dist-git> +From 3e331cfb6a38d49feb4a7e2ae93fa5b351f802e9 Mon Sep 17 00:00:00 2001 +Message-Id: <3e331cfb6a38d49feb4a7e2ae93fa5b351f802e9@dist-git> From: Jiri Denemark -Date: Fri, 22 Nov 2019 11:19:23 +0100 +Date: Fri, 15 Nov 2019 17:52:35 +0100 Subject: [PATCH] cputest: Add data for Ice Lake Server CPU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11,12 +11,12 @@ Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé (cherry picked from commit 6b4cc15730e5b2330eaba2b211f16547dccd665c) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1749672 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Signed-off-by: Jiri Denemark -Message-Id: <4ec13db912bfe8c72b5eb850f7f1ccc8180e4a9a.1574417839.git.jdenemar@redhat.com> +Message-Id: <33821ff30d36f29cd88e7e9d6ac08ad98710b8f0.1573836581.git.jdenemar@redhat.com> Reviewed-by: Michal Privoznik --- tests/cputest.c | 1 + diff --git a/SOURCES/libvirt-process-wait-longer-5-30s-on-hard-shutdown.patch b/SOURCES/libvirt-process-wait-longer-5-30s-on-hard-shutdown.patch new file mode 100644 index 0000000..18c41e6 --- /dev/null +++ b/SOURCES/libvirt-process-wait-longer-5-30s-on-hard-shutdown.patch @@ -0,0 +1,56 @@ +From bdf2e9979df2382c6a386f191c74a6055c0228cd Mon Sep 17 00:00:00 2001 +Message-Id: +From: Christian Ehrhardt +Date: Tue, 11 Feb 2020 18:47:10 +0100 +Subject: [PATCH] process: wait longer 5->30s on hard shutdown +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In cases where virProcessKillPainfully already reailizes that +SIGTERM wasn't enough we are partially on a bad path already. +Maybe the system is overloaded or having serious trouble to free and +reap resources in time. + +In those case give the SIGKILL that was sent after 10 seconds some more +time to take effect if force was set (only then we are falling back to +SIGKILL anyway). + +Signed-off-by: Christian Ehrhardt +Reviewed-by: Daniel P. Berrangé +(cherry picked from commit 9a4e4b942df0474503e7524ea427351a46c0eabe) + +https://bugzilla.redhat.com/show_bug.cgi?id=1785338 + +Signed-off-by: Andrea Bolognani +Message-Id: <20200211174710.203500-3-abologna@redhat.com> +Reviewed-by: Ján Tomko +--- + src/util/virprocess.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/util/virprocess.c b/src/util/virprocess.c +index 297c96a8e5..1085e6cd5d 100644 +--- a/src/util/virprocess.c ++++ b/src/util/virprocess.c +@@ -354,7 +354,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay) + size_t i; + int ret = -1; + /* This is in 1/5th seconds since polling is on a 0.2s interval */ +- unsigned int polldelay = 75 + (extradelay*5); ++ unsigned int polldelay = (force ? 200 : 75) + (extradelay*5); + const char *signame = "TERM"; + + VIR_DEBUG("vpid=%lld force=%d extradelay=%u", +@@ -363,7 +363,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay) + /* This loop sends SIGTERM, then waits a few iterations (10 seconds) + * to see if it dies. If the process still hasn't exited, and + * @force is requested, a SIGKILL will be sent, and this will +- * wait up to 5 seconds more for the process to exit before ++ * wait up to 30 seconds more for the process to exit before + * returning. + * + * An extra delay can be passed by the caller for cases that are +-- +2.25.0 + diff --git a/SOURCES/libvirt-process-wait-longer-on-kill-per-assigned-Hostdev.patch b/SOURCES/libvirt-process-wait-longer-on-kill-per-assigned-Hostdev.patch new file mode 100644 index 0000000..54ce621 --- /dev/null +++ b/SOURCES/libvirt-process-wait-longer-on-kill-per-assigned-Hostdev.patch @@ -0,0 +1,138 @@ +From 92027209ce5acc92b43dc15ef582f7c8c8095cf6 Mon Sep 17 00:00:00 2001 +Message-Id: <92027209ce5acc92b43dc15ef582f7c8c8095cf6@dist-git> +From: Christian Ehrhardt +Date: Tue, 11 Feb 2020 18:47:09 +0100 +Subject: [PATCH] process: wait longer on kill per assigned Hostdev +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It was found that in cases with host devices virProcessKillPainfully +might be able to send signal zero to the target PID for quite a while +with the process already being gone from /proc/. + +That is due to cleanup and reset of devices which might include a +secondary bus reset that on top of the actions taken has a 1s delay +to let the bus settle. Due to that guests with plenty of Host devices +could easily exceed the default timeouts. + +To solve that, this adds an extra delay of 2s per hostdev that is associated +to a VM. + +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Christian Ehrhardt +(cherry picked from commit be2ca0444728edd12a000653d3693d68a5c9102f) + +https://bugzilla.redhat.com/show_bug.cgi?id=1785338 + +Signed-off-by: Andrea Bolognani +Message-Id: <20200211174710.203500-2-abologna@redhat.com> +Reviewed-by: Ján Tomko +--- + src/libvirt_private.syms | 1 + + src/qemu/qemu_process.c | 7 +++++-- + src/util/virprocess.c | 20 +++++++++++++++++--- + src/util/virprocess.h | 3 +++ + 4 files changed, 26 insertions(+), 5 deletions(-) + +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index f4b54cee0b..2ad21a68bc 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -2646,6 +2646,7 @@ virProcessGetPids; + virProcessGetStartTime; + virProcessKill; + virProcessKillPainfully; ++virProcessKillPainfullyDelay; + virProcessNamespaceAvailable; + virProcessRunInMountNamespace; + virProcessSchedPolicyTypeFromString; +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 17d48357b3..4d10a38f1d 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -6918,8 +6918,11 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags) + return 0; + } + +- ret = virProcessKillPainfully(vm->pid, +- !!(flags & VIR_QEMU_PROCESS_KILL_FORCE)); ++ /* Request an extra delay of two seconds per current nhostdevs ++ * to be safe against stalls by the kernel freeing up the resources */ ++ ret = virProcessKillPainfullyDelay(vm->pid, ++ !!(flags & VIR_QEMU_PROCESS_KILL_FORCE), ++ vm->def->nhostdevs * 2); + + return ret; + } +diff --git a/src/util/virprocess.c b/src/util/virprocess.c +index f92b0dce37..297c96a8e5 100644 +--- a/src/util/virprocess.c ++++ b/src/util/virprocess.c +@@ -344,15 +344,21 @@ int virProcessKill(pid_t pid, int sig) + * Returns 0 if it was killed gracefully, 1 if it + * was killed forcibly, -1 if it is still alive, + * or another error occurred. ++ * ++ * Callers can proide an extra delay in seconds to ++ * wait longer than the default. + */ + int +-virProcessKillPainfully(pid_t pid, bool force) ++virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay) + { + size_t i; + int ret = -1; ++ /* This is in 1/5th seconds since polling is on a 0.2s interval */ ++ unsigned int polldelay = 75 + (extradelay*5); + const char *signame = "TERM"; + +- VIR_DEBUG("vpid=%lld force=%d", (long long)pid, force); ++ VIR_DEBUG("vpid=%lld force=%d extradelay=%u", ++ (long long)pid, force, extradelay); + + /* This loop sends SIGTERM, then waits a few iterations (10 seconds) + * to see if it dies. If the process still hasn't exited, and +@@ -360,9 +366,12 @@ virProcessKillPainfully(pid_t pid, bool force) + * wait up to 5 seconds more for the process to exit before + * returning. + * ++ * An extra delay can be passed by the caller for cases that are ++ * expected to clean up slower than usual. ++ * + * Note that setting @force could result in dataloss for the process. + */ +- for (i = 0; i < 75; i++) { ++ for (i = 0; i < polldelay; i++) { + int signum; + if (i == 0) { + signum = SIGTERM; /* kindly suggest it should exit */ +@@ -405,6 +414,11 @@ virProcessKillPainfully(pid_t pid, bool force) + } + + ++int virProcessKillPainfully(pid_t pid, bool force) ++{ ++ return virProcessKillPainfullyDelay(pid, force, 0); ++} ++ + #if HAVE_SCHED_GETAFFINITY + + int virProcessSetAffinity(pid_t pid, virBitmapPtr map) +diff --git a/src/util/virprocess.h b/src/util/virprocess.h +index 3c5a882772..5faa0892fe 100644 +--- a/src/util/virprocess.h ++++ b/src/util/virprocess.h +@@ -55,6 +55,9 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw) + int virProcessKill(pid_t pid, int sig); + + int virProcessKillPainfully(pid_t pid, bool force); ++int virProcessKillPainfullyDelay(pid_t pid, ++ bool force, ++ unsigned int extradelay); + + int virProcessSetAffinity(pid_t pid, virBitmapPtr map); + +-- +2.25.0 + diff --git a/SOURCES/libvirt-qemu-Drop-disabled-CPU-features-unknown-to-QEMU.patch b/SOURCES/libvirt-qemu-Drop-disabled-CPU-features-unknown-to-QEMU.patch index 0528871..5429b29 100644 --- a/SOURCES/libvirt-qemu-Drop-disabled-CPU-features-unknown-to-QEMU.patch +++ b/SOURCES/libvirt-qemu-Drop-disabled-CPU-features-unknown-to-QEMU.patch @@ -1,7 +1,7 @@ -From 5e1f4ab125d37efb4c8224184f4cd7dd7a0cfdcd Mon Sep 17 00:00:00 2001 -Message-Id: <5e1f4ab125d37efb4c8224184f4cd7dd7a0cfdcd@dist-git> +From 6227a5d2d70dd396c428af4864ab38b1a32ef0f5 Mon Sep 17 00:00:00 2001 +Message-Id: <6227a5d2d70dd396c428af4864ab38b1a32ef0f5@dist-git> From: Jiri Denemark -Date: Fri, 22 Nov 2019 11:19:22 +0100 +Date: Fri, 15 Nov 2019 17:52:34 +0100 Subject: [PATCH] qemu: Drop disabled CPU features unknown to QEMU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -15,16 +15,16 @@ Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé (cherry picked from commit ac34e141596fab70fbe91a396311f80db6cb57c5) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1749672 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Conflicts: src/qemu/qemu_process.c - downstream still uses cleanup label Signed-off-by: Jiri Denemark -Message-Id: <1c07cf7bb969d38770555e7369d4578ba57bd38c.1574417839.git.jdenemar@redhat.com> +Message-Id: <92f146f8754300266d688dd92dfe95e737dda7da.1573836581.git.jdenemar@redhat.com> Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 32 +++++++++++++++++++ diff --git a/SOURCES/libvirt-qemu-Fix-KVM-features-with-QEMU-4.1.patch b/SOURCES/libvirt-qemu-Fix-KVM-features-with-QEMU-4.1.patch new file mode 100644 index 0000000..d959e62 --- /dev/null +++ b/SOURCES/libvirt-qemu-Fix-KVM-features-with-QEMU-4.1.patch @@ -0,0 +1,67 @@ +From b77f7c1c1424a758295105b92c5f95ff82d54904 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Fri, 7 Feb 2020 10:41:45 +0100 +Subject: [PATCH] qemu: Fix KVM features with QEMU 4.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Originally the names of the KVM CPU features were only used internally +for looking up their CPUID bits. So we used "__kvm_" prefix for them to +make sure the names do not collide with normal CPU features stored in +our CPU map. + +But with QEMU 4.1 we check which features were enabled or disabled by a +freshly started QEMU process using their names rather than their CPUID +bits (mostly because of MSR features). Thus we need to change our made +up internal names into the actual names used by QEMU. + +Signed-off-by: Jiri Denemark +Tested-by: Vitaly Kuznetsov +Reviewed-by: Ján Tomko +(cherry picked from commit 4c62ed606895018aaf9f9f1d2137fcea3918756a) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Conflicts: + src/cpu/cpu_x86_data.h + - all defines are indented as downstream lacks #pragma once + +Signed-off-by: Jiri Denemark +Message-Id: +Reviewed-by: Ján Tomko +--- + src/cpu/cpu_x86_data.h | 2 +- + src/qemu/qemu_command.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h +index 8a189f854e..0087fd2f85 100644 +--- a/src/cpu/cpu_x86_data.h ++++ b/src/cpu/cpu_x86_data.h +@@ -49,7 +49,7 @@ struct _virCPUx86MSR { + # define CPUX86_KVM 0x40000000 + # define CPUX86_EXTENDED 0x80000000 + +-# define VIR_CPU_x86_KVM_PV_UNHALT "__kvm_pv_unhalt" ++# define VIR_CPU_x86_KVM_PV_UNHALT "kvm_pv_unhalt" + + /* + * The following HyperV feature names suffixes must exactly match corresponding +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 71e102747c..a411d214df 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -7008,7 +7008,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + } + + if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK]) { +- qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_unhalt", ++ qemuBuildCpuFeature(qemuCaps, &buf, VIR_CPU_x86_KVM_PV_UNHALT, + def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON); + } + +-- +2.25.0 + diff --git a/SOURCES/libvirt-qemu-Fix-NULL-ptr-dereference-caused-by-qemuDomainDefFormatBufInternal.patch b/SOURCES/libvirt-qemu-Fix-NULL-ptr-dereference-caused-by-qemuDomainDefFormatBufInternal.patch index ba14063..e09e869 100644 --- a/SOURCES/libvirt-qemu-Fix-NULL-ptr-dereference-caused-by-qemuDomainDefFormatBufInternal.patch +++ b/SOURCES/libvirt-qemu-Fix-NULL-ptr-dereference-caused-by-qemuDomainDefFormatBufInternal.patch @@ -1,7 +1,7 @@ -From b21c8cad6d25e328bb93f1ec218546f09c2fbed4 Mon Sep 17 00:00:00 2001 -Message-Id: +From 63d6271b0ed420fe4ef986209ea71fda23e7795a Mon Sep 17 00:00:00 2001 +Message-Id: <63d6271b0ed420fe4ef986209ea71fda23e7795a@dist-git> From: Erik Skultety -Date: Fri, 22 Nov 2019 11:19:25 +0100 +Date: Mon, 18 Nov 2019 15:18:11 +0100 Subject: [PATCH] qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal @@ -22,12 +22,12 @@ Signed-off-by: Erik Skultety Reviewed-by: Daniel Henrique Barboza (cherry picked from commit 2816fe2e846ab3bd2bfbef123c426a17f1e1df98) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1749672 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Signed-off-by: Jiri Denemark -Message-Id: <13caf98777b14c8bc341de37a85c4dc04a50d78e.1574417839.git.jdenemar@redhat.com> +Message-Id: Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 2 +- diff --git a/SOURCES/libvirt-qemu-Fix-hyperv-features-with-QEMU-4.1.patch b/SOURCES/libvirt-qemu-Fix-hyperv-features-with-QEMU-4.1.patch new file mode 100644 index 0000000..2340545 --- /dev/null +++ b/SOURCES/libvirt-qemu-Fix-hyperv-features-with-QEMU-4.1.patch @@ -0,0 +1,100 @@ +From bc74a9da7d6b5c747655468022fdcdd9f9f5f25d Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Fri, 7 Feb 2020 10:41:41 +0100 +Subject: [PATCH] qemu: Fix hyperv features with QEMU 4.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Originally the names of the hyperv CPU features were only used +internally for looking up their CPUID bits. So we used "__kvm_hv_" +prefix for them to make sure the names do not collide with normal CPU +features stored in our CPU map. + +But with QEMU 4.1 we check which features were enabled or disabled by a +freshly started QEMU process using their names rather than their CPUID +bits (mostly because of MSR features). Thus we need to change our made +up internal names into the actual names used by QEMU. Most of the names +are only used with QEMU 4.1 and newer and the reset was introduced with +QEMU recently enough to already support spelling with "-". Thus we don't +need to define them as "hv_*" with a translation to "hv-*" for new QEMU. + +Without this patch libvirt would mistakenly report all hyperv features +as unavailable and refuse to start any domain using them with QEMU 4.1. + +Reported-by: Vitaly Kuznetsov +Signed-off-by: Jiri Denemark +Tested-by: Vitaly Kuznetsov +Reviewed-by: Ján Tomko +(cherry picked from commit 0ccdd476bb329f1486438b896255e5c44a91ff4a) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Conflicts: + src/cpu/cpu_x86_data.h + - a few extra features were added upstream between 4.5.0 and + 5.5.0 + - downstream lacks #pragma once and thus all defines have to + be indented + +Signed-off-by: Jiri Denemark +Message-Id: <8e882b79ff88eccdb68ede1c5afd4550fcd554b6.1581064395.git.jdenemar@redhat.com> +Reviewed-by: Ján Tomko +--- + src/cpu/cpu_x86_data.h | 24 ++++++++++++------------ + src/qemu/qemu_process.c | 2 +- + 2 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h +index 454345b688..77797f633c 100644 +--- a/src/cpu/cpu_x86_data.h ++++ b/src/cpu/cpu_x86_data.h +@@ -62,19 +62,19 @@ struct _virCPUx86MSR { + /* + * The following HyperV feature names suffixes must exactly match corresponding + * ones defined for virDomainHyperv in domain_conf.c. +- * E.g "__kvm_runtime" -> "runtime", "__kvm_hv_spinlocks" -> "spinlocks" etc. ++ * E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc. + */ +-# define VIR_CPU_x86_KVM_HV_RUNTIME "__kvm_hv_runtime" +-# define VIR_CPU_x86_KVM_HV_SYNIC "__kvm_hv_synic" +-# define VIR_CPU_x86_KVM_HV_STIMER "__kvm_hv_stimer" +-# define VIR_CPU_x86_KVM_HV_RELAXED "__kvm_hv_relaxed" +-# define VIR_CPU_x86_KVM_HV_SPINLOCKS "__kvm_hv_spinlocks" +-# define VIR_CPU_x86_KVM_HV_VAPIC "__kvm_hv_vapic" +-# define VIR_CPU_x86_KVM_HV_VPINDEX "__kvm_hv_vpindex" +-# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset" +-# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies" +-# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment" +-# define VIR_CPU_x86_KVM_HV_TLBFLUSH "__kvm_hv_tlbflush" ++# define VIR_CPU_x86_KVM_HV_RUNTIME "hv-runtime" ++# define VIR_CPU_x86_KVM_HV_SYNIC "hv-synic" ++# define VIR_CPU_x86_KVM_HV_STIMER "hv-stimer" ++# define VIR_CPU_x86_KVM_HV_RELAXED "hv-relaxed" ++# define VIR_CPU_x86_KVM_HV_SPINLOCKS "hv-spinlocks" ++# define VIR_CPU_x86_KVM_HV_VAPIC "hv-vapic" ++# define VIR_CPU_x86_KVM_HV_VPINDEX "hv-vpindex" ++# define VIR_CPU_x86_KVM_HV_RESET "hv-reset" ++# define VIR_CPU_x86_KVM_HV_FREQUENCIES "hv-frequencies" ++# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "hv-reenlightenment" ++# define VIR_CPU_x86_KVM_HV_TLBFLUSH "hv-tlbflush" + + + # define VIR_CPU_X86_DATA_INIT { 0 } +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 0700b054f3..312ce69ba5 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3923,7 +3923,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, + if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON) + continue; + +- if (virAsprintf(&cpuFeature, "__kvm_hv_%s", ++ if (virAsprintf(&cpuFeature, "hv-%s", + virDomainHypervTypeToString(i)) < 0) + return -1; + +-- +2.25.0 + diff --git a/SOURCES/libvirt-qemu-Prefer-dashes-for-hyperv-features.patch b/SOURCES/libvirt-qemu-Prefer-dashes-for-hyperv-features.patch new file mode 100644 index 0000000..c85d49e --- /dev/null +++ b/SOURCES/libvirt-qemu-Prefer-dashes-for-hyperv-features.patch @@ -0,0 +1,160 @@ +From 3338d2ca3f36c9f9546cbcd436c344c8a3c97285 Mon Sep 17 00:00:00 2001 +Message-Id: <3338d2ca3f36c9f9546cbcd436c344c8a3c97285@dist-git> +From: Jiri Denemark +Date: Fri, 7 Feb 2020 10:41:42 +0100 +Subject: [PATCH] qemu: Prefer dashes for hyperv features +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Starting with QEMU 4.1, we're using the canonical feature names on the +command line and avoid aliases to prepare for possible deprecation of +all aliases in QEMU. But we do so only for features from our CPU map, +hyperv features defined in the code were unchanged and this patch fixes +it. Some features use "hv-" prefix unconditionally because they were +introduced recently enough to always support spelling with a dash. + +Signed-off-by: Jiri Denemark +Tested-by: Vitaly Kuznetsov +Reviewed-by: Ján Tomko +(cherry picked from commit d99e8f01c7f9b5a0f384ccaac40187091a4e6c6c) + +https://bugzilla.redhat.com/show_bug.cgi?id=1794868 + +Conflicts: + tests/qemuxml2argvdata/hyperv.args + - a few extra hyperv features upstream + +Since "unavailable-features" QOM property was backported to QEMU 2.12, +we would effectively start using "hv-" prefix (instead of "hv_") for all +hyperv features. This is fine because the downstream version of QEMU +with "unavailable-features" backported defines all supported hyperv +features with dashes. + +Signed-off-by: Jiri Denemark +Message-Id: <57ee0267b028177420edeae0edcf479de3f52820.1581064395.git.jdenemar@redhat.com> +Reviewed-by: Ján Tomko +--- + src/qemu/qemu_command.c | 17 ++++++++++++----- + .../clock-timer-hyperv-rtc.args | 2 +- + tests/qemuxml2argvdata/hyperv-panic.args | 2 +- + tests/qemuxml2argvdata/hyperv.args | 4 ++-- + tests/qemuxml2argvdata/panic-double.args | 2 +- + 5 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 2b885e98dd..0289a907a1 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -6995,7 +6995,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + !!timer->present); + } else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK && + timer->present == 1) { +- virBufferAddLit(&buf, ",hv_time"); ++ virBufferAddLit(&buf, ",hv-time"); + } else if (timer->name == VIR_DOMAIN_TIMER_NAME_TSC && + timer->frequency > 0) { + virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency); +@@ -7013,6 +7013,11 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + } + + if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) { ++ const char *hvPrefix = "hv-"; ++ ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES)) ++ hvPrefix = "hv_"; ++ + for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { + switch ((virDomainHyperv) i) { + case VIR_DOMAIN_HYPERV_RELAXED: +@@ -7026,19 +7031,21 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: + case VIR_DOMAIN_HYPERV_TLBFLUSH: + if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) +- virBufferAsprintf(&buf, ",hv_%s", ++ virBufferAsprintf(&buf, ",%s%s", ++ hvPrefix, + virDomainHypervTypeToString(i)); + break; + + case VIR_DOMAIN_HYPERV_SPINLOCKS: + if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) +- virBufferAsprintf(&buf, ",hv_spinlocks=0x%x", ++ virBufferAsprintf(&buf, ",%s=0x%x", ++ VIR_CPU_x86_KVM_HV_SPINLOCKS, + def->hyperv_spinlocks); + break; + + case VIR_DOMAIN_HYPERV_VENDOR_ID: + if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) +- virBufferAsprintf(&buf, ",hv_vendor_id=%s", ++ virBufferAsprintf(&buf, ",hv-vendor-id=%s", + def->hyperv_vendor_id); + break; + +@@ -7051,7 +7058,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, + + for (i = 0; i < def->npanics; i++) { + if (def->panics[i]->model == VIR_DOMAIN_PANIC_MODEL_HYPERV) { +- virBufferAddLit(&buf, ",hv_crash"); ++ virBufferAddLit(&buf, ",hv-crash"); + break; + } + } +diff --git a/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args b/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args +index 6045fbdbf2..1e36d139f9 100644 +--- a/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args ++++ b/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args +@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \ + -name QEMUGuest1 \ + -S \ + -machine pc,accel=kvm,usb=off,dump-guest-core=off \ +--cpu qemu32,hv_time \ ++-cpu qemu32,hv-time \ + -m 214 \ + -smp 6,sockets=6,cores=1,threads=1 \ + -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +diff --git a/tests/qemuxml2argvdata/hyperv-panic.args b/tests/qemuxml2argvdata/hyperv-panic.args +index fca46d7371..627fb09502 100644 +--- a/tests/qemuxml2argvdata/hyperv-panic.args ++++ b/tests/qemuxml2argvdata/hyperv-panic.args +@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \ + -name QEMUGuest1 \ + -S \ + -machine pc,accel=tcg,usb=off,dump-guest-core=off \ +--cpu qemu32,hv_crash \ ++-cpu qemu32,hv-crash \ + -m 214 \ + -smp 6,sockets=6,cores=1,threads=1 \ + -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args +index 6ee6198fb0..a5fc6a1121 100644 +--- a/tests/qemuxml2argvdata/hyperv.args ++++ b/tests/qemuxml2argvdata/hyperv.args +@@ -8,8 +8,8 @@ QEMU_AUDIO_DRV=none \ + -name QEMUGuest1 \ + -S \ + -machine pc,accel=tcg,usb=off,dump-guest-core=off \ +--cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\ +-hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\ ++-cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=0x2fff,hv_vpindex,hv_runtime,\ ++hv_synic,hv_stimer,hv_reset,hv-vendor-id=KVM Hv,hv_frequencies,\ + hv_reenlightenment,hv_tlbflush' \ + -m 214 \ + -smp 6,sockets=6,cores=1,threads=1 \ +diff --git a/tests/qemuxml2argvdata/panic-double.args b/tests/qemuxml2argvdata/panic-double.args +index 7acee1ae29..8a632477b1 100644 +--- a/tests/qemuxml2argvdata/panic-double.args ++++ b/tests/qemuxml2argvdata/panic-double.args +@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \ + -name QEMUGuest1 \ + -S \ + -machine pc,accel=tcg,usb=off,dump-guest-core=off \ +--cpu qemu32,hv_crash \ ++-cpu qemu32,hv-crash \ + -m 214 \ + -smp 6,sockets=6,cores=1,threads=1 \ + -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-- +2.25.0 + diff --git a/SOURCES/libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch b/SOURCES/libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch index 4f939a0..222ba0b 100644 --- a/SOURCES/libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch +++ b/SOURCES/libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch @@ -1,5 +1,5 @@ -From e85f56920d0a22b55ab54b5955ab594568f24a60 Mon Sep 17 00:00:00 2001 -Message-Id: +From f2962c42448d442414246715a30ae74c8dc9fef3 Mon Sep 17 00:00:00 2001 +Message-Id: From: Jiri Denemark Date: Thu, 27 Feb 2020 15:23:04 +0100 Subject: [PATCH] qemu: Translate features in virQEMUCapsGetCPUFeatures diff --git a/SOURCES/libvirt-qemuxml2-test-Add-tests-for-Icelake-Server-pconfig.patch b/SOURCES/libvirt-qemuxml2-test-Add-tests-for-Icelake-Server-pconfig.patch index 3f1cb19..d8cf4ef 100644 --- a/SOURCES/libvirt-qemuxml2-test-Add-tests-for-Icelake-Server-pconfig.patch +++ b/SOURCES/libvirt-qemuxml2-test-Add-tests-for-Icelake-Server-pconfig.patch @@ -1,7 +1,7 @@ -From af4ae65466a629b58cb9493630dc4684c49f3d5e Mon Sep 17 00:00:00 2001 -Message-Id: +From 7e23f06327869c9dad50ae98da10292356eb5f0f Mon Sep 17 00:00:00 2001 +Message-Id: <7e23f06327869c9dad50ae98da10292356eb5f0f@dist-git> From: Jiri Denemark -Date: Fri, 22 Nov 2019 11:19:21 +0100 +Date: Fri, 15 Nov 2019 17:52:33 +0100 Subject: [PATCH] qemuxml2*test: Add tests for Icelake-Server, -pconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11,9 +11,9 @@ Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé (cherry picked from commit ae793ecbcbd17b118ef3a876d247abb49574ab0e) -https://bugzilla.redhat.com/show_bug.cgi?id=1775133 -https://bugzilla.redhat.com/show_bug.cgi?id=1775134 -https://bugzilla.redhat.com/show_bug.cgi?id=1775137 +https://bugzilla.redhat.com/show_bug.cgi?id=1749672 +https://bugzilla.redhat.com/show_bug.cgi?id=1756156 +https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Conflicts: tests/qemuxml2argvtest.c @@ -35,7 +35,7 @@ Conflicts: dropped as it is not as important as the xml2argv test Signed-off-by: Jiri Denemark -Message-Id: <874677b6cbabc2dbf7ff81fc0325de1b99790a45.1574417839.git.jdenemar@redhat.com> +Message-Id: <8cbd8a44446d77a2699ca267b696cfbd05dc8bc3.1573836581.git.jdenemar@redhat.com> Reviewed-by: Michal Privoznik --- ...-Icelake-Server-pconfig.x86_64-latest.args | 31 +++++++++++++++++++ diff --git a/SOURCES/libvirt-selinux-Do-not-report-an-error-when-not-returning-1.patch b/SOURCES/libvirt-selinux-Do-not-report-an-error-when-not-returning-1.patch new file mode 100644 index 0000000..daaa0db --- /dev/null +++ b/SOURCES/libvirt-selinux-Do-not-report-an-error-when-not-returning-1.patch @@ -0,0 +1,55 @@ +From 36d6dd80a2b3840e471add391e8b71556904fa60 Mon Sep 17 00:00:00 2001 +Message-Id: <36d6dd80a2b3840e471add391e8b71556904fa60@dist-git> +From: Martin Kletzander +Date: Mon, 20 Jan 2020 12:55:56 +0100 +Subject: [PATCH] selinux: Do not report an error when not returning -1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +I guess the reason for that was the automatic interpretation/stringification of +setfilecon_errno, but the code was not nice to read and it was a bit confusing. +Also, the logs and error states get cleaner this way. + +Signed-off-by: Martin Kletzander +(cherry picked from commit 86289374ef85f673677881ef863ae6b6ce7e88a2) + +https://bugzilla.redhat.com/show_bug.cgi?id=1788096 + +Signed-off-by: Fabiano Fidêncio +Message-Id: <20200120115556.138061-2-fidencio@redhat.com> +Reviewed-by: Jiri Denemark +--- + src/security/security_selinux.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c +index 96944d0202..0238f31e84 100644 +--- a/src/security/security_selinux.c ++++ b/src/security/security_selinux.c +@@ -1177,14 +1177,18 @@ virSecuritySELinuxSetFileconHelper(const char *path, const char *tcon, + if (setfilecon_errno != EOPNOTSUPP && setfilecon_errno != ENOTSUP && + setfilecon_errno != EROFS) { + VIR_WARNINGS_RESET +- virReportSystemError(setfilecon_errno, +- _("unable to set security context '%s' on '%s'"), +- tcon, path); + /* However, don't claim error if SELinux is in Enforcing mode and + * we are running as unprivileged user and we really did see EPERM. + * Otherwise we want to return error if SELinux is Enforcing. */ +- if (security_getenforce() == 1 && (setfilecon_errno != EPERM || privileged)) ++ if (security_getenforce() == 1 && ++ (setfilecon_errno != EPERM || privileged)) { ++ virReportSystemError(setfilecon_errno, ++ _("unable to set security context '%s' on '%s'"), ++ tcon, path); + return -1; ++ } ++ VIR_WARN("unable to set security context '%s' on '%s' (errno %d)", ++ tcon, path, setfilecon_errno); + } else { + const char *msg; + if (virFileIsSharedFSType(path, VIR_FILE_SHFS_NFS) == 1 && +-- +2.25.0 + diff --git a/SPECS/libvirt.spec b/SPECS/libvirt.spec index d1e4fe5..524f65b 100644 --- a/SPECS/libvirt.spec +++ b/SPECS/libvirt.spec @@ -251,7 +251,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 4.5.0 -Release: 35.3%{?dist}%{?extra_release} +Release: 42%{?dist}%{?extra_release} License: LGPLv2+ URL: https://libvirt.org/ @@ -812,7 +812,23 @@ Patch548: libvirt-cpu_map-Drop-pconfig-from-Icelake-Server-CPU-model.patch Patch549: libvirt-qemu-Fix-NULL-ptr-dereference-caused-by-qemuDomainDefFormatBufInternal.patch Patch550: libvirt-cpu_map-Add-TAA_NO-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch Patch551: libvirt-cpu_map-Add-TSX_CTRL-bit-for-IA32_ARCH_CAPABILITIES-MSR.patch -Patch552: libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch +Patch552: libvirt-cpu_map-x86-Add-support-for-BFLOAT16-data-type.patch +Patch553: libvirt-selinux-Do-not-report-an-error-when-not-returning-1.patch +Patch554: libvirt-qemu-Fix-hyperv-features-with-QEMU-4.1.patch +Patch555: libvirt-qemu-Prefer-dashes-for-hyperv-features.patch +Patch556: libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch +Patch557: libvirt-cpu-Drop-unused-KVM-features.patch +Patch558: libvirt-qemu-Fix-KVM-features-with-QEMU-4.1.patch +Patch559: libvirt-cpu-Drop-CPUID-definition-for-hv-spinlocks.patch +Patch560: libvirt-process-wait-longer-on-kill-per-assigned-Hostdev.patch +Patch561: libvirt-process-wait-longer-5-30s-on-hard-shutdown.patch +Patch562: libvirt-qemu-Translate-features-in-virQEMUCapsGetCPUFeatures.patch +Patch563: libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch +Patch564: libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch +Patch565: libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch +Patch566: libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch +Patch567: libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch +Patch568: libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2724,20 +2740,44 @@ exit 0 %changelog -* Wed Mar 4 2020 Jiri Denemark - 4.5.0-35.3.el8 -- qemu: Translate features in virQEMUCapsGetCPUFeatures (rhbz#1809510) - -* Mon Dec 16 2019 Jiri Denemark - 4.5.0-35.2.el8 +* Mon Mar 16 2020 Jiri Denemark - 4.5.0-42 +- RHEL: virscsi: Check device type before getting it's /dev node name (rhbz#1808388) +- RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName() (rhbz#1808388) +- RHEL: virscsi: Introduce and use virSCSIDeviceGetUnprivSGIOSysfsPath() (rhbz#1808388) +- RHEL: virutil: Accept non-block devices in virGetDeviceID() (rhbz#1808388) +- RHEL: qemuSetUnprivSGIO: Actually use calculated @sysfs_path to set unpriv_sgio (rhbz#1808388) +- RHEL: qemuCheckUnprivSGIO: use @sysfs_path to get unpriv_sgio (rhbz#1808399) + +* Wed Mar 4 2020 Jiri Denemark - 4.5.0-41 +- qemu: Translate features in virQEMUCapsGetCPUFeatures (rhbz#1804224) + +* Mon Feb 17 2020 Jiri Denemark - 4.5.0-40 +- process: wait longer on kill per assigned Hostdev (rhbz#1785338) +- process: wait longer 5->30s on hard shutdown (rhbz#1785338) + +* Mon Feb 10 2020 Jiri Denemark - 4.5.0-39 +- selinux: Do not report an error when not returning -1 (rhbz#1788096) +- qemu: Fix hyperv features with QEMU 4.1 (rhbz#1794868) +- qemu: Prefer dashes for hyperv features (rhbz#1794868) +- cpu: Drop KVM_ from hyperv feature macros (rhbz#1794868) +- cpu: Drop unused KVM features (rhbz#1794868) +- qemu: Fix KVM features with QEMU 4.1 (rhbz#1794868) +- cpu: Drop CPUID definition for hv-spinlocks (rhbz#1794868) + +* Tue Jan 14 2020 Jiri Denemark - 4.5.0-38 +- cpu_map/x86: Add support for BFLOAT16 data type (rhbz#1749516) + +* Fri Dec 13 2019 Jiri Denemark - 4.5.0-37 - cpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR (CVE-2019-11135) - cpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR (CVE-2019-11135) -* Wed Nov 27 2019 Jiri Denemark - 4.5.0-35.1.el8 -- cpu_conf: Pass policy to CPU feature filtering callbacks (rhbz#1775133, rhbz#1775134, rhbz#1775137) -- qemuxml2*test: Add tests for Icelake-Server, -pconfig (rhbz#1775133, rhbz#1775134, rhbz#1775137) -- qemu: Drop disabled CPU features unknown to QEMU (rhbz#1775133, rhbz#1775134, rhbz#1775137) -- cputest: Add data for Ice Lake Server CPU (rhbz#1775133, rhbz#1775134, rhbz#1775137) -- cpu_map: Drop pconfig from Icelake-Server CPU model (rhbz#1775133, rhbz#1775134, rhbz#1775137) -- qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal (rhbz#1775133, rhbz#1775134, rhbz#1775137) +* Thu Nov 21 2019 Jiri Denemark - 4.5.0-36 +- cpu_conf: Pass policy to CPU feature filtering callbacks (rhbz#1749672, rhbz#1756156, rhbz#1721608) +- qemuxml2*test: Add tests for Icelake-Server, -pconfig (rhbz#1749672, rhbz#1756156, rhbz#1721608) +- qemu: Drop disabled CPU features unknown to QEMU (rhbz#1749672, rhbz#1756156, rhbz#1721608) +- cputest: Add data for Ice Lake Server CPU (rhbz#1749672, rhbz#1756156, rhbz#1721608) +- cpu_map: Drop pconfig from Icelake-Server CPU model (rhbz#1749672, rhbz#1756156, rhbz#1721608) +- qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal (rhbz#1749672, rhbz#1756156, rhbz#1721608) * Mon Sep 16 2019 Jiri Denemark - 4.5.0-35 - vircgroupv2: fix setting cpu.max period (rhbz#1749227)