import qemu-kvm-4.2.0-34.module+el8.3.0+9828+7aab3355.3
This commit is contained in:
commit
1661622e08
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
SOURCES/qemu-4.2.0.tar.xz
|
1
.qemu-kvm.metadata
Normal file
1
.qemu-kvm.metadata
Normal file
@ -0,0 +1 @@
|
||||
b27aa828a8457bd8551ae3c81b80cc365e1f6bfe SOURCES/qemu-4.2.0.tar.xz
|
167
SOURCES/0005-Initial-redhat-build.patch
Normal file
167
SOURCES/0005-Initial-redhat-build.patch
Normal file
@ -0,0 +1,167 @@
|
||||
From 4df157781801c50224373be57fa3c8c3741c0535 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 12 Oct 2018 07:31:11 +0200
|
||||
Subject: Initial redhat build
|
||||
|
||||
This patch introduces redhat build structure in redhat subdirectory. In addition,
|
||||
several issues are fixed in QEMU tree:
|
||||
|
||||
- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm
|
||||
- As we use qemu-kvm as name in all places, this is updated to be consistent
|
||||
- Man page renamed from qemu to qemu-kvm
|
||||
- man page is installed using make install so we have to fix it in qemu tree
|
||||
- Use "/share/qemu-kvm" as SHARE_SUFFIX
|
||||
- We reconfigured our share to qemu-kvm to be consistent with used name
|
||||
|
||||
This rebase includes changes up to qemu-kvm-4.1.0-18.el8
|
||||
|
||||
Rebase notes (3.1.0):
|
||||
- added new configure options
|
||||
|
||||
Rebase notes (4.0.0):
|
||||
- Added dependency to perl-Test-Harness (upstream)
|
||||
- Added dependency to python3-sphinx (upstream)
|
||||
- Change location of icons (upstream)
|
||||
- Remove .desktop file (added upstream)
|
||||
- Added qemu-trace-stap (added upstream)
|
||||
- Removed elf2dmp (added upstream)
|
||||
- Remove .buildinfo
|
||||
- Added pvh.bin rom (added upstream)
|
||||
- Added interop documentation files
|
||||
- Use python module instead of qemu.py (upstream)
|
||||
|
||||
Rebase notes (4.1.0):
|
||||
- Remove edk2 files generated by build
|
||||
- Switch to rhel-8.1-candidate build target
|
||||
- Remove specs documentation
|
||||
- Switched from libssh2 to libssh
|
||||
- Add rc0 tarball usage hacks
|
||||
- Added BuildRequires for wget, rpm-build and python3-sphinx
|
||||
- Removed new unpacked files
|
||||
- Update configure line to use new options
|
||||
|
||||
Rebase notes (4.2.0):
|
||||
- Disable iotest run during make check
|
||||
- README renamed to README.rst (upstream)
|
||||
- Removed ui-spice-app.so
|
||||
- Added relevant changes from "505f7f4 redhat: Adding slirp to the exploded tree"
|
||||
- Removed qemu-ga.8 install from spec file - installed by make
|
||||
- Removed spapr-rtas.bin (upstream)
|
||||
- Require newer SLOF (20191022)
|
||||
|
||||
Merged patches (3.1.0):
|
||||
- 01f0c9f RHEL8: Add disable configure options to qemu spec file
|
||||
- Spec file cleanups
|
||||
|
||||
Merged patches (4.0.0):
|
||||
- aa4297c Add edk2 Requires to qemu-kvm
|
||||
- d124ff5779 Fixing brew build target
|
||||
- eb204b5 Introduce the qemu-kvm-tests rpm
|
||||
- 223cf0c Load kvm module during boot (partial)
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- ebb6e97 redhat: Fix LOCALVERSION creation
|
||||
- b0ab0cc redhat: enable tpmdev passthrough (not disabling tests)
|
||||
- 7cb3c4a Enable libpmem to support nvdimm
|
||||
- 8943607 qemu-kvm.spec: bump libseccomp >= 2.4.0
|
||||
- 27b7c44 rh: set CONFIG_BOCHS_DISPLAY=y for x86 (partial)
|
||||
- e1fe9fe x86_64-rh-devices: enable TPM emulation (partial)
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- 69e1fb2 enable virgla
|
||||
- d4f6115 enable virgl, for real this time ...
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
.gitignore | 1 +
|
||||
Makefile | 3 +-
|
||||
configure | 1 +
|
||||
os-posix.c | 2 +-
|
||||
redhat/Makefile | 82 +
|
||||
redhat/Makefile.common | 51 +
|
||||
redhat/README.tests | 39 +
|
||||
redhat/qemu-kvm.spec.template | 2434 +++++++++++++++++++++++++++++
|
||||
redhat/scripts/process-patches.sh | 7 +-
|
||||
tests/Makefile.include | 2 +-
|
||||
ui/vnc.c | 2 +-
|
||||
11 files changed, 2615 insertions(+), 9 deletions(-)
|
||||
create mode 100644 redhat/Makefile
|
||||
create mode 100644 redhat/Makefile.common
|
||||
create mode 100644 redhat/README.tests
|
||||
create mode 100644 redhat/qemu-kvm.spec.template
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index b437a346d7..086727dbb9 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -512,6 +512,7 @@ CAP_CFLAGS += -DCAPSTONE_HAS_ARM
|
||||
CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
|
||||
CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
|
||||
CAP_CFLAGS += -DCAPSTONE_HAS_X86
|
||||
+CAP_CFLAGS += -Wp,-D_GLIBCXX_ASSERTIONS
|
||||
|
||||
.PHONY: capstone/all
|
||||
capstone/all: .git-submodule-status
|
||||
@@ -826,7 +827,7 @@ install-doc: $(DOCS) install-sphinxdocs
|
||||
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
|
||||
ifdef CONFIG_POSIX
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
|
||||
- $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
|
||||
+ $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1/qemu-kvm.1"
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
|
||||
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
|
||||
$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
|
||||
diff --git a/configure b/configure
|
||||
index 6099be1d84..16564f8ccc 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -2424,6 +2424,7 @@ if test "$seccomp" != "no" ; then
|
||||
seccomp="no"
|
||||
fi
|
||||
fi
|
||||
+
|
||||
##########################################
|
||||
# xen probe
|
||||
|
||||
diff --git a/os-posix.c b/os-posix.c
|
||||
index 86cffd2c7d..1c9f86768d 100644
|
||||
--- a/os-posix.c
|
||||
+++ b/os-posix.c
|
||||
@@ -83,7 +83,7 @@ void os_setup_signal_handling(void)
|
||||
/* Find a likely location for support files using the location of the binary.
|
||||
For installed binaries this will be "$bindir/../share/qemu". When
|
||||
running from the build tree this will be "$bindir/../pc-bios". */
|
||||
-#define SHARE_SUFFIX "/share/qemu"
|
||||
+#define SHARE_SUFFIX "/share/qemu-kvm"
|
||||
#define BUILD_SUFFIX "/pc-bios"
|
||||
char *os_find_datadir(void)
|
||||
{
|
||||
diff --git a/tests/Makefile.include b/tests/Makefile.include
|
||||
index 8566f5f119..b483790cf3 100644
|
||||
--- a/tests/Makefile.include
|
||||
+++ b/tests/Makefile.include
|
||||
@@ -1194,7 +1194,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR)
|
||||
check-qapi-schema: check-tests/qapi-schema/frontend check-tests/qapi-schema/doc-good.texi
|
||||
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
|
||||
check-block: $(patsubst %,check-%, $(check-block-y))
|
||||
-check: check-block check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
|
||||
+check: check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
|
||||
check-clean:
|
||||
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
|
||||
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
|
||||
diff --git a/ui/vnc.c b/ui/vnc.c
|
||||
index 87b8045afe..ecf6276f5b 100644
|
||||
--- a/ui/vnc.c
|
||||
+++ b/ui/vnc.c
|
||||
@@ -3987,7 +3987,7 @@ void vnc_display_open(const char *id, Error **errp)
|
||||
|
||||
#ifdef CONFIG_VNC_SASL
|
||||
if (sasl) {
|
||||
- int saslErr = sasl_server_init(NULL, "qemu");
|
||||
+ int saslErr = sasl_server_init(NULL, "qemu-kvm");
|
||||
|
||||
if (saslErr != SASL_OK) {
|
||||
error_setg(errp, "Failed to initialize SASL auth: %s",
|
||||
--
|
||||
2.21.0
|
||||
|
994
SOURCES/0006-Enable-disable-devices-for-RHEL.patch
Normal file
994
SOURCES/0006-Enable-disable-devices-for-RHEL.patch
Normal file
@ -0,0 +1,994 @@
|
||||
From 67511676246cce57becbd2dcf5abccf08d9ef737 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Mon, 11 Jan 2016 11:53:33 +0100
|
||||
Subject: Enable/disable devices for RHEL
|
||||
|
||||
This commit adds all changes related to changes in supported devices.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase notes (qemu 3.1.0)
|
||||
- spapr_rng disabled in default_config
|
||||
- new hyperv.mak in default configs
|
||||
- Move changes from x86_64-softmmu.mak to i386-softmmu.mak
|
||||
- Added CONFIG_VIRTIO_MMIO to aarch64-softmmu.mak
|
||||
- Removed config_vga_isa.c changes as no longer needed
|
||||
- Removed new devices
|
||||
|
||||
Rebase notes (4.0.0):
|
||||
- Added CONFIG_PCI_EXPRESS_GENERIC_BRIDGE for aarch64-softmmu.mak
|
||||
- Added CONFIG_ARM_VIRT for aarch64-softmmu.mak
|
||||
- Switch to KConfig (upstream)
|
||||
- Using device whitelist + without-defualt-devices option
|
||||
|
||||
Rebase notes (4.1.0):
|
||||
- Added CONFIG_USB_OHCI_PCI for ppc64
|
||||
- Added CONFIG_XIVE_KVM for ppc64
|
||||
- Added CONFIG_ACPI_PCI for x86_64
|
||||
- Added CONFIG_SEMIHOSTING for aarch64
|
||||
- Cleanup aarch64 devices
|
||||
- Do not build a15mpcore.c
|
||||
- Removed ide-isa.c stub file
|
||||
- Use CONFIG_USB_EHCI_PCI on x86_64 (new upstream)
|
||||
|
||||
Rebase notes (4.2.0-rc0):
|
||||
- Use conditional build for isa-superio.c (upstream change)
|
||||
- Rename PCI_PIIX to PCI_I440FX (upstream change)
|
||||
|
||||
Rebase notes (4.2.0-rc3):
|
||||
- Disabled ccid-card-emulated (patch 92566)
|
||||
- Disabled vfio-pci-igd-lpc-bridge (patch 92565)
|
||||
|
||||
Merged patches (qemu 3.1.0):
|
||||
- d51e082 Re-enable CONFIG_HYPERV_TESTDEV
|
||||
- 4b889f3 Declare cirrus-vga as deprecated
|
||||
- b579d32 Do not build bluetooth support
|
||||
- 3eef52a Disable CONFIG_IPMI and CONFIG_I2C for ppc64
|
||||
- 9caf292 Disable CONFIG_CAN_BUS and CONFIG_CAN_SJA1000
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- 20a51f6 fdc: Revert downstream disablement of device "floppy"
|
||||
- f869cc0 fdc: Restrict floppy controllers to RHEL-7 machine types
|
||||
- 5909721 aarch64: Compile out IOH3420
|
||||
- 27b7c44 rh: set CONFIG_BOCHS_DISPLAY=y for x86 (partial)
|
||||
- 495a27d x86_64-rh-devices: add missing TPM passthrough
|
||||
- e1fe9fe x86_64-rh-devices: enable TPM emulation (partial)
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- f7587dd RHEL: disable hostmem-memfd
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
Makefile.objs | 4 +-
|
||||
backends/Makefile.objs | 3 +-
|
||||
default-configs/aarch64-rh-devices.mak | 20 +++++
|
||||
default-configs/aarch64-softmmu.mak | 10 ++-
|
||||
default-configs/ppc64-rh-devices.mak | 32 ++++++++
|
||||
default-configs/ppc64-softmmu.mak | 8 +-
|
||||
default-configs/rh-virtio.mak | 10 +++
|
||||
default-configs/s390x-rh-devices.mak | 15 ++++
|
||||
default-configs/s390x-softmmu.mak | 4 +-
|
||||
default-configs/x86_64-rh-devices.mak | 100 +++++++++++++++++++++++++
|
||||
default-configs/x86_64-softmmu.mak | 4 +-
|
||||
hw/acpi/ich9.c | 4 +-
|
||||
hw/arm/Makefile.objs | 2 +-
|
||||
hw/block/fdc.c | 10 +++
|
||||
hw/bt/Makefile.objs | 4 +-
|
||||
hw/cpu/Makefile.objs | 5 +-
|
||||
hw/display/Makefile.objs | 5 +-
|
||||
hw/display/cirrus_vga.c | 3 +
|
||||
hw/ide/piix.c | 5 +-
|
||||
hw/input/pckbd.c | 2 +
|
||||
hw/net/e1000.c | 2 +
|
||||
hw/pci-host/i440fx.c | 4 +
|
||||
hw/ppc/spapr_cpu_core.c | 2 +
|
||||
hw/usb/Makefile.objs | 4 +-
|
||||
hw/vfio/pci-quirks.c | 9 +++
|
||||
hw/vfio/pci.c | 5 ++
|
||||
qemu-options.hx | 7 +-
|
||||
redhat/qemu-kvm.spec.template | 5 +-
|
||||
target/arm/cpu.c | 4 +-
|
||||
target/i386/cpu.c | 35 +++++++--
|
||||
target/ppc/cpu-models.c | 10 +++
|
||||
target/s390x/cpu_models.c | 3 +
|
||||
target/s390x/kvm.c | 8 ++
|
||||
util/memfd.c | 2 +-
|
||||
vl.c | 8 +-
|
||||
35 files changed, 317 insertions(+), 41 deletions(-)
|
||||
create mode 100644 default-configs/aarch64-rh-devices.mak
|
||||
create mode 100644 default-configs/ppc64-rh-devices.mak
|
||||
create mode 100644 default-configs/rh-virtio.mak
|
||||
create mode 100644 default-configs/s390x-rh-devices.mak
|
||||
create mode 100644 default-configs/x86_64-rh-devices.mak
|
||||
|
||||
diff --git a/Makefile.objs b/Makefile.objs
|
||||
index 11ba1a36bd..fcf63e1096 100644
|
||||
--- a/Makefile.objs
|
||||
+++ b/Makefile.objs
|
||||
@@ -65,8 +65,8 @@ common-obj-y += replay/
|
||||
|
||||
common-obj-y += ui/
|
||||
common-obj-m += ui/
|
||||
-common-obj-y += bt-host.o bt-vhci.o
|
||||
-bt-host.o-cflags := $(BLUEZ_CFLAGS)
|
||||
+#common-obj-y += bt-host.o bt-vhci.o
|
||||
+#bt-host.o-cflags := $(BLUEZ_CFLAGS)
|
||||
|
||||
common-obj-y += dma-helpers.o
|
||||
common-obj-y += vl.o
|
||||
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
|
||||
index f0691116e8..f328d404bf 100644
|
||||
--- a/backends/Makefile.objs
|
||||
+++ b/backends/Makefile.objs
|
||||
@@ -16,4 +16,5 @@ endif
|
||||
|
||||
common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
|
||||
|
||||
-common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
|
||||
+# RHEL: disable memfd
|
||||
+# common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
|
||||
diff --git a/default-configs/aarch64-rh-devices.mak b/default-configs/aarch64-rh-devices.mak
|
||||
new file mode 100644
|
||||
index 0000000000..a1ed641174
|
||||
--- /dev/null
|
||||
+++ b/default-configs/aarch64-rh-devices.mak
|
||||
@@ -0,0 +1,20 @@
|
||||
+include rh-virtio.mak
|
||||
+
|
||||
+CONFIG_ARM_GIC_KVM=y
|
||||
+CONFIG_ARM_SMMUV3=y
|
||||
+CONFIG_ARM_V7M=y
|
||||
+CONFIG_ARM_VIRT=y
|
||||
+CONFIG_EDID=y
|
||||
+CONFIG_PCIE_PORT=y
|
||||
+CONFIG_PCI_DEVICES=y
|
||||
+CONFIG_PCI_TESTDEV=y
|
||||
+CONFIG_PFLASH_CFI01=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_SEMIHOSTING=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI=y
|
||||
+CONFIG_VFIO=y
|
||||
+CONFIG_VFIO_PCI=y
|
||||
+CONFIG_VIRTIO_MMIO=y
|
||||
+CONFIG_VIRTIO_PCI=y
|
||||
+CONFIG_XIO3130=y
|
||||
diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak
|
||||
index 958b1e08e4..8f6867d48a 100644
|
||||
--- a/default-configs/aarch64-softmmu.mak
|
||||
+++ b/default-configs/aarch64-softmmu.mak
|
||||
@@ -1,8 +1,10 @@
|
||||
# Default configuration for aarch64-softmmu
|
||||
|
||||
# We support all the 32 bit boards so need all their config
|
||||
-include arm-softmmu.mak
|
||||
+#include arm-softmmu.mak
|
||||
|
||||
-CONFIG_XLNX_ZYNQMP_ARM=y
|
||||
-CONFIG_XLNX_VERSAL=y
|
||||
-CONFIG_SBSA_REF=y
|
||||
+#CONFIG_XLNX_ZYNQMP_ARM=y
|
||||
+#CONFIG_XLNX_VERSAL=y
|
||||
+#CONFIG_SBSA_REF=y
|
||||
+
|
||||
+include aarch64-rh-devices.mak
|
||||
diff --git a/default-configs/ppc64-rh-devices.mak b/default-configs/ppc64-rh-devices.mak
|
||||
new file mode 100644
|
||||
index 0000000000..35f2106d06
|
||||
--- /dev/null
|
||||
+++ b/default-configs/ppc64-rh-devices.mak
|
||||
@@ -0,0 +1,32 @@
|
||||
+include rh-virtio.mak
|
||||
+
|
||||
+CONFIG_DIMM=y
|
||||
+CONFIG_MEM_DEVICE=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_PCI_DEVICES=y
|
||||
+CONFIG_PCI_TESTDEV=y
|
||||
+CONFIG_PSERIES=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_SPAPR_VSCSI=y
|
||||
+CONFIG_TEST_DEVICES=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_OHCI=y
|
||||
+CONFIG_USB_OHCI_PCI=y
|
||||
+CONFIG_USB_SMARTCARD=y
|
||||
+CONFIG_USB_STORAGE_BOT=y
|
||||
+CONFIG_USB_XHCI=y
|
||||
+CONFIG_USB_XHCI_NEC=y
|
||||
+CONFIG_VFIO=y
|
||||
+CONFIG_VFIO_PCI=y
|
||||
+CONFIG_VGA=y
|
||||
+CONFIG_VGA_PCI=y
|
||||
+CONFIG_VHOST_USER=y
|
||||
+CONFIG_VIRTIO_PCI=y
|
||||
+CONFIG_VIRTIO_VGA=y
|
||||
+CONFIG_WDT_IB6300ESB=y
|
||||
+CONFIG_XICS=y
|
||||
+CONFIG_XICS_KVM=y
|
||||
+CONFIG_XICS_SPAPR=y
|
||||
+CONFIG_XIVE=y
|
||||
+CONFIG_XIVE_SPAPR=y
|
||||
+CONFIG_XIVE_KVM=y
|
||||
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
|
||||
index cca52665d9..fec354f327 100644
|
||||
--- a/default-configs/ppc64-softmmu.mak
|
||||
+++ b/default-configs/ppc64-softmmu.mak
|
||||
@@ -1,10 +1,12 @@
|
||||
# Default configuration for ppc64-softmmu
|
||||
|
||||
# Include all 32-bit boards
|
||||
-include ppc-softmmu.mak
|
||||
+#include ppc-softmmu.mak
|
||||
|
||||
# For PowerNV
|
||||
-CONFIG_POWERNV=y
|
||||
+#CONFIG_POWERNV=y
|
||||
|
||||
# For pSeries
|
||||
-CONFIG_PSERIES=y
|
||||
+#CONFIG_PSERIES=y
|
||||
+
|
||||
+include ppc64-rh-devices.mak
|
||||
diff --git a/default-configs/rh-virtio.mak b/default-configs/rh-virtio.mak
|
||||
new file mode 100644
|
||||
index 0000000000..94ede1b5f6
|
||||
--- /dev/null
|
||||
+++ b/default-configs/rh-virtio.mak
|
||||
@@ -0,0 +1,10 @@
|
||||
+CONFIG_VIRTIO=y
|
||||
+CONFIG_VIRTIO_BALLOON=y
|
||||
+CONFIG_VIRTIO_BLK=y
|
||||
+CONFIG_VIRTIO_GPU=y
|
||||
+CONFIG_VIRTIO_INPUT=y
|
||||
+CONFIG_VIRTIO_INPUT_HOST=y
|
||||
+CONFIG_VIRTIO_NET=y
|
||||
+CONFIG_VIRTIO_RNG=y
|
||||
+CONFIG_VIRTIO_SCSI=y
|
||||
+CONFIG_VIRTIO_SERIAL=y
|
||||
diff --git a/default-configs/s390x-rh-devices.mak b/default-configs/s390x-rh-devices.mak
|
||||
new file mode 100644
|
||||
index 0000000000..c3c73fe752
|
||||
--- /dev/null
|
||||
+++ b/default-configs/s390x-rh-devices.mak
|
||||
@@ -0,0 +1,15 @@
|
||||
+include rh-virtio.mak
|
||||
+
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_S390_CCW_VIRTIO=y
|
||||
+CONFIG_S390_FLIC=y
|
||||
+CONFIG_S390_FLIC_KVM=y
|
||||
+CONFIG_SCLPCONSOLE=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_TERMINAL3270=y
|
||||
+CONFIG_VFIO=y
|
||||
+CONFIG_VFIO_AP=y
|
||||
+CONFIG_VFIO_PCI=y
|
||||
+CONFIG_VHOST_USER=y
|
||||
+CONFIG_VIRTIO_CCW=y
|
||||
+CONFIG_WDT_DIAG288=y
|
||||
diff --git a/default-configs/s390x-softmmu.mak b/default-configs/s390x-softmmu.mak
|
||||
index f2287a133f..3e2e388e91 100644
|
||||
--- a/default-configs/s390x-softmmu.mak
|
||||
+++ b/default-configs/s390x-softmmu.mak
|
||||
@@ -10,4 +10,6 @@
|
||||
|
||||
# Boards:
|
||||
#
|
||||
-CONFIG_S390_CCW_VIRTIO=y
|
||||
+#CONFIG_S390_CCW_VIRTIO=y
|
||||
+
|
||||
+include s390x-rh-devices.mak
|
||||
diff --git a/default-configs/x86_64-rh-devices.mak b/default-configs/x86_64-rh-devices.mak
|
||||
new file mode 100644
|
||||
index 0000000000..d59b6d9bb5
|
||||
--- /dev/null
|
||||
+++ b/default-configs/x86_64-rh-devices.mak
|
||||
@@ -0,0 +1,100 @@
|
||||
+include rh-virtio.mak
|
||||
+
|
||||
+CONFIG_AC97=y
|
||||
+CONFIG_ACPI=y
|
||||
+CONFIG_ACPI_PCI=y
|
||||
+CONFIG_ACPI_CPU_HOTPLUG=y
|
||||
+CONFIG_ACPI_MEMORY_HOTPLUG=y
|
||||
+CONFIG_ACPI_NVDIMM=y
|
||||
+CONFIG_ACPI_SMBUS=y
|
||||
+CONFIG_ACPI_VMGENID=y
|
||||
+CONFIG_ACPI_X86=y
|
||||
+CONFIG_ACPI_X86_ICH=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_APIC=y
|
||||
+CONFIG_APM=y
|
||||
+CONFIG_BOCHS_DISPLAY=y
|
||||
+CONFIG_DIMM=y
|
||||
+CONFIG_E1000E_PCI_EXPRESS=y
|
||||
+CONFIG_E1000_PCI=y
|
||||
+CONFIG_EDU=y
|
||||
+CONFIG_FDC=y
|
||||
+CONFIG_FW_CFG_DMA=y
|
||||
+CONFIG_HDA=y
|
||||
+CONFIG_HYPERV=y
|
||||
+CONFIG_HYPERV_TESTDEV=y
|
||||
+CONFIG_I2C=y
|
||||
+CONFIG_I440FX=y
|
||||
+CONFIG_I8254=y
|
||||
+CONFIG_I8257=y
|
||||
+CONFIG_I8259=y
|
||||
+CONFIG_I82801B11=y
|
||||
+CONFIG_IDE_CORE=y
|
||||
+CONFIG_IDE_PCI=y
|
||||
+CONFIG_IDE_PIIX=y
|
||||
+CONFIG_IDE_QDEV=y
|
||||
+CONFIG_IOAPIC=y
|
||||
+CONFIG_IOH3420=y
|
||||
+CONFIG_ISA_BUS=y
|
||||
+CONFIG_ISA_DEBUG=y
|
||||
+CONFIG_ISA_TESTDEV=y
|
||||
+CONFIG_LPC_ICH9=y
|
||||
+CONFIG_MC146818RTC=y
|
||||
+CONFIG_MEM_DEVICE=y
|
||||
+CONFIG_NVDIMM=y
|
||||
+CONFIG_OPENGL=y
|
||||
+CONFIG_PAM=y
|
||||
+CONFIG_PC=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_PCIE_PORT=y
|
||||
+CONFIG_PCI_DEVICES=y
|
||||
+CONFIG_PCI_EXPRESS=y
|
||||
+CONFIG_PCI_EXPRESS_Q35=y
|
||||
+CONFIG_PCI_I440FX=y
|
||||
+CONFIG_PCI_TESTDEV=y
|
||||
+CONFIG_PCKBD=y
|
||||
+CONFIG_PCSPK=y
|
||||
+CONFIG_PC_ACPI=y
|
||||
+CONFIG_PC_PCI=y
|
||||
+CONFIG_PFLASH_CFI01=y
|
||||
+CONFIG_PVPANIC=y
|
||||
+CONFIG_PXB=y
|
||||
+CONFIG_Q35=y
|
||||
+CONFIG_QXL=y
|
||||
+CONFIG_RTL8139_PCI=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_SERIAL=y
|
||||
+CONFIG_SERIAL_ISA=y
|
||||
+CONFIG_SERIAL_PCI=y
|
||||
+CONFIG_SEV=y
|
||||
+CONFIG_SGA=y
|
||||
+CONFIG_SMBIOS=y
|
||||
+CONFIG_SMBUS_EEPROM=y
|
||||
+CONFIG_SPICE=y
|
||||
+CONFIG_TEST_DEVICES=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_EHCI=y
|
||||
+CONFIG_USB_EHCI_PCI=y
|
||||
+CONFIG_USB_SMARTCARD=y
|
||||
+CONFIG_USB_STORAGE_BOT=y
|
||||
+CONFIG_USB_UHCI=y
|
||||
+CONFIG_USB_XHCI=y
|
||||
+CONFIG_USB_XHCI_NEC=y
|
||||
+CONFIG_VFIO=y
|
||||
+CONFIG_VFIO_PCI=y
|
||||
+CONFIG_VGA=y
|
||||
+CONFIG_VGA_CIRRUS=y
|
||||
+CONFIG_VGA_PCI=y
|
||||
+CONFIG_VHOST_USER=y
|
||||
+CONFIG_VIRTIO_PCI=y
|
||||
+CONFIG_VIRTIO_VGA=y
|
||||
+CONFIG_VMMOUSE=y
|
||||
+CONFIG_VMPORT=y
|
||||
+CONFIG_VTD=y
|
||||
+CONFIG_WDT_IB6300ESB=y
|
||||
+CONFIG_WDT_IB700=y
|
||||
+CONFIG_XIO3130=y
|
||||
+CONFIG_TPM_CRB=y
|
||||
+CONFIG_TPM_TIS=y
|
||||
+CONFIG_TPM_EMULATOR=y
|
||||
+CONFIG_TPM_PASSTHROUGH=y
|
||||
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
|
||||
index 64b2ee2960..b5de7e5279 100644
|
||||
--- a/default-configs/x86_64-softmmu.mak
|
||||
+++ b/default-configs/x86_64-softmmu.mak
|
||||
@@ -1,3 +1,5 @@
|
||||
# Default configuration for x86_64-softmmu
|
||||
|
||||
-include i386-softmmu.mak
|
||||
+#include i386-softmmu.mak
|
||||
+
|
||||
+include x86_64-rh-devices.mak
|
||||
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
|
||||
index 2034dd749e..ab203ad448 100644
|
||||
--- a/hw/acpi/ich9.c
|
||||
+++ b/hw/acpi/ich9.c
|
||||
@@ -449,8 +449,8 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
|
||||
static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
|
||||
pm->acpi_memory_hotplug.is_enabled = true;
|
||||
pm->cpu_hotplug_legacy = true;
|
||||
- pm->disable_s3 = 0;
|
||||
- pm->disable_s4 = 0;
|
||||
+ pm->disable_s3 = 1;
|
||||
+ pm->disable_s4 = 1;
|
||||
pm->s4_val = 2;
|
||||
|
||||
object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
|
||||
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
|
||||
index fe749f65fd..2aa1a9efdd 100644
|
||||
--- a/hw/arm/Makefile.objs
|
||||
+++ b/hw/arm/Makefile.objs
|
||||
@@ -27,7 +27,7 @@ obj-$(CONFIG_VEXPRESS) += vexpress.o
|
||||
obj-$(CONFIG_ZYNQ) += xilinx_zynq.o
|
||||
obj-$(CONFIG_SABRELITE) += sabrelite.o
|
||||
|
||||
-obj-$(CONFIG_ARM_V7M) += armv7m.o
|
||||
+#obj-$(CONFIG_ARM_V7M) += armv7m.o
|
||||
obj-$(CONFIG_EXYNOS4) += exynos4210.o
|
||||
obj-$(CONFIG_PXA2XX) += pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
|
||||
obj-$(CONFIG_DIGIC) += digic.o
|
||||
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
|
||||
index ac5d31e8c1..e925bac002 100644
|
||||
--- a/hw/block/fdc.c
|
||||
+++ b/hw/block/fdc.c
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "qemu/module.h"
|
||||
#include "trace.h"
|
||||
|
||||
+#include "hw/boards.h"
|
||||
+
|
||||
/********************************************************/
|
||||
/* debug Floppy devices */
|
||||
|
||||
@@ -2638,6 +2640,14 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
|
||||
int i, j;
|
||||
static int command_tables_inited = 0;
|
||||
|
||||
+ /* Restricted for Red Hat Enterprise Linux: */
|
||||
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
|
||||
+ if (!strstr(mc->name, "-rhel7.")) {
|
||||
+ error_setg(errp, "Device %s is not supported with machine type %s",
|
||||
+ object_get_typename(OBJECT(dev)), mc->name);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
|
||||
error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'");
|
||||
}
|
||||
diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs
|
||||
index 867a7d2e8a..e678e9ee3c 100644
|
||||
--- a/hw/bt/Makefile.objs
|
||||
+++ b/hw/bt/Makefile.objs
|
||||
@@ -1,3 +1,3 @@
|
||||
-common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
|
||||
-common-obj-y += hci-csr.o
|
||||
+#common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
|
||||
+#common-obj-y += hci-csr.o
|
||||
|
||||
diff --git a/hw/cpu/Makefile.objs b/hw/cpu/Makefile.objs
|
||||
index 8db9e8a7b3..1601ea93c7 100644
|
||||
--- a/hw/cpu/Makefile.objs
|
||||
+++ b/hw/cpu/Makefile.objs
|
||||
@@ -1,5 +1,6 @@
|
||||
obj-$(CONFIG_ARM11MPCORE) += arm11mpcore.o
|
||||
obj-$(CONFIG_REALVIEW) += realview_mpcore.o
|
||||
obj-$(CONFIG_A9MPCORE) += a9mpcore.o
|
||||
-obj-$(CONFIG_A15MPCORE) += a15mpcore.o
|
||||
-common-obj-y += core.o cluster.o
|
||||
+#obj-$(CONFIG_A15MPCORE) += a15mpcore.o
|
||||
+common-obj-y += core.o
|
||||
+# cluster.o
|
||||
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
|
||||
index f2182e3bef..3d0cda1b52 100644
|
||||
--- a/hw/display/Makefile.objs
|
||||
+++ b/hw/display/Makefile.objs
|
||||
@@ -1,8 +1,9 @@
|
||||
common-obj-$(CONFIG_DDC) += i2c-ddc.o
|
||||
common-obj-$(CONFIG_EDID) += edid-generate.o edid-region.o
|
||||
|
||||
-common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
|
||||
-common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
|
||||
+# Disabled for Red Hat Enterprise Linux
|
||||
+#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
|
||||
+#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
|
||||
|
||||
common-obj-$(CONFIG_ADS7846) += ads7846.o
|
||||
common-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
|
||||
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
||||
index cd283e53b4..93afa26fda 100644
|
||||
--- a/hw/display/cirrus_vga.c
|
||||
+++ b/hw/display/cirrus_vga.c
|
||||
@@ -2975,6 +2975,9 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp)
|
||||
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
|
||||
int16_t device_id = pc->device_id;
|
||||
|
||||
+ warn_report("'cirrus-vga' is deprecated, "
|
||||
+ "please use a different VGA card instead");
|
||||
+
|
||||
/* follow real hardware, cirrus card emulated has 4 MB video memory.
|
||||
Also accept 8 MB/16 MB for backward compatibility. */
|
||||
if (s->vga.vram_size_mb != 4 && s->vga.vram_size_mb != 8 &&
|
||||
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
|
||||
index db313dd3b1..e14858ca64 100644
|
||||
--- a/hw/ide/piix.c
|
||||
+++ b/hw/ide/piix.c
|
||||
@@ -251,7 +251,8 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
|
||||
k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
|
||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
- dc->hotpluggable = false;
|
||||
+ /* Disabled for Red Hat Enterprise Linux: */
|
||||
+ dc->user_creatable = false;
|
||||
}
|
||||
|
||||
static const TypeInfo piix3_ide_info = {
|
||||
@@ -279,6 +280,8 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
|
||||
k->class_id = PCI_CLASS_STORAGE_IDE;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
dc->hotpluggable = false;
|
||||
+ /* Disabled for Red Hat Enterprise Linux: */
|
||||
+ dc->user_creatable = false;
|
||||
}
|
||||
|
||||
static const TypeInfo piix4_ide_info = {
|
||||
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
|
||||
index f0acfd86f7..390eb6579c 100644
|
||||
--- a/hw/input/pckbd.c
|
||||
+++ b/hw/input/pckbd.c
|
||||
@@ -571,6 +571,8 @@ static void i8042_class_initfn(ObjectClass *klass, void *data)
|
||||
dc->realize = i8042_realizefn;
|
||||
dc->vmsd = &vmstate_kbd_isa;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
+ /* Disabled for Red Hat Enterprise Linux: */
|
||||
+ dc->user_creatable = false;
|
||||
}
|
||||
|
||||
static const TypeInfo i8042_info = {
|
||||
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
|
||||
index a73f8d404e..fc73fdd6fa 100644
|
||||
--- a/hw/net/e1000.c
|
||||
+++ b/hw/net/e1000.c
|
||||
@@ -1795,6 +1795,7 @@ static const E1000Info e1000_devices[] = {
|
||||
.revision = 0x03,
|
||||
.phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT,
|
||||
},
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux 7 */
|
||||
{
|
||||
.name = "e1000-82544gc",
|
||||
.device_id = E1000_DEV_ID_82544GC_COPPER,
|
||||
@@ -1807,6 +1808,7 @@ static const E1000Info e1000_devices[] = {
|
||||
.revision = 0x03,
|
||||
.phy_id2 = E1000_PHY_ID2_8254xx_DEFAULT,
|
||||
},
|
||||
+#endif
|
||||
};
|
||||
|
||||
static void e1000_register_types(void)
|
||||
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
|
||||
index f27131102d..17f10efae2 100644
|
||||
--- a/hw/pci-host/i440fx.c
|
||||
+++ b/hw/pci-host/i440fx.c
|
||||
@@ -386,6 +386,7 @@ static const TypeInfo i440fx_info = {
|
||||
},
|
||||
};
|
||||
|
||||
+#if 0 /* Disabled in Red Hat Enterprise Linux */
|
||||
/* IGD Passthrough Host Bridge. */
|
||||
typedef struct {
|
||||
uint8_t offset;
|
||||
@@ -469,6 +470,7 @@ static const TypeInfo igd_passthrough_i440fx_info = {
|
||||
.instance_size = sizeof(PCII440FXState),
|
||||
.class_init = igd_passthrough_i440fx_class_init,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
|
||||
PCIBus *rootbus)
|
||||
@@ -514,7 +516,9 @@ static const TypeInfo i440fx_pcihost_info = {
|
||||
static void i440fx_register_types(void)
|
||||
{
|
||||
type_register_static(&i440fx_info);
|
||||
+#if 0 /* Disabled in Red Hat Enterprise Linux */
|
||||
type_register_static(&igd_passthrough_i440fx_info);
|
||||
+#endif
|
||||
type_register_static(&i440fx_pcihost_info);
|
||||
}
|
||||
|
||||
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
|
||||
index 8339c4c0f8..301cd7b4e4 100644
|
||||
--- a/hw/ppc/spapr_cpu_core.c
|
||||
+++ b/hw/ppc/spapr_cpu_core.c
|
||||
@@ -403,10 +403,12 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {
|
||||
.instance_size = sizeof(SpaprCpuCore),
|
||||
.class_size = sizeof(SpaprCpuCoreClass),
|
||||
},
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"),
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"),
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"),
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("power5+_v2.1"),
|
||||
+#endif
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"),
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("power7+_v2.1"),
|
||||
DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"),
|
||||
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
|
||||
index 303ac084a0..700a91886e 100644
|
||||
--- a/hw/usb/Makefile.objs
|
||||
+++ b/hw/usb/Makefile.objs
|
||||
@@ -30,7 +30,9 @@ common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o
|
||||
ifeq ($(CONFIG_USB_SMARTCARD),y)
|
||||
common-obj-y += dev-smartcard-reader.o
|
||||
common-obj-$(CONFIG_SMARTCARD) += smartcard.mo
|
||||
-smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
|
||||
+# Disabled for Red Hat Enterprise Linux:
|
||||
+# smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
|
||||
+smartcard.mo-objs := ccid-card-passthru.o
|
||||
smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
|
||||
smartcard.mo-libs := $(SMARTCARD_LIBS)
|
||||
endif
|
||||
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
|
||||
index 136f3a9ad6..4505ffe48a 100644
|
||||
--- a/hw/vfio/pci-quirks.c
|
||||
+++ b/hw/vfio/pci-quirks.c
|
||||
@@ -1166,6 +1166,7 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
|
||||
trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name);
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
/*
|
||||
* Intel IGD support
|
||||
*
|
||||
@@ -1239,6 +1240,7 @@ static int igd_gen(VFIOPCIDevice *vdev)
|
||||
|
||||
return 8; /* Assume newer is compatible */
|
||||
}
|
||||
+#endif
|
||||
|
||||
typedef struct VFIOIGDQuirk {
|
||||
struct VFIOPCIDevice *vdev;
|
||||
@@ -1311,6 +1313,7 @@ typedef struct {
|
||||
uint8_t len;
|
||||
} IGDHostInfo;
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static const IGDHostInfo igd_host_bridge_infos[] = {
|
||||
{PCI_REVISION_ID, 2},
|
||||
{PCI_SUBSYSTEM_VENDOR_ID, 2},
|
||||
@@ -1559,9 +1562,11 @@ static const MemoryRegionOps vfio_igd_index_quirk = {
|
||||
.write = vfio_igd_quirk_index_write,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
|
||||
{
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
struct vfio_region_info *rom = NULL, *opregion = NULL,
|
||||
*host = NULL, *lpc = NULL;
|
||||
VFIOQuirk *quirk;
|
||||
@@ -1572,6 +1577,7 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
|
||||
uint32_t gmch;
|
||||
uint16_t cmd_orig, cmd;
|
||||
Error *err = NULL;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* This must be an Intel VGA device at address 00:02.0 for us to even
|
||||
@@ -1585,6 +1591,8 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
|
||||
return;
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
+
|
||||
/*
|
||||
* We need to create an LPC/ISA bridge at PCI bus address 00:1f.0 that we
|
||||
* can stuff host values into, so if there's already one there and it's not
|
||||
@@ -1809,6 +1817,7 @@ out:
|
||||
g_free(opregion);
|
||||
g_free(host);
|
||||
g_free(lpc);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
||||
index 2d40b396f2..c8534d3035 100644
|
||||
--- a/hw/vfio/pci.c
|
||||
+++ b/hw/vfio/pci.c
|
||||
@@ -3220,6 +3220,7 @@ static const TypeInfo vfio_pci_dev_info = {
|
||||
},
|
||||
};
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static Property vfio_pci_dev_nohotplug_properties[] = {
|
||||
DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
@@ -3239,11 +3240,15 @@ static const TypeInfo vfio_pci_nohotplug_dev_info = {
|
||||
.instance_size = sizeof(VFIOPCIDevice),
|
||||
.class_init = vfio_pci_nohotplug_dev_class_init,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static void register_vfio_pci_dev_type(void)
|
||||
{
|
||||
type_register_static(&vfio_pci_dev_info);
|
||||
+
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
type_register_static(&vfio_pci_nohotplug_dev_info);
|
||||
+#endif
|
||||
}
|
||||
|
||||
type_init(register_vfio_pci_dev_type)
|
||||
diff --git a/qemu-options.hx b/qemu-options.hx
|
||||
index 65c9473b73..fc17aca631 100644
|
||||
--- a/qemu-options.hx
|
||||
+++ b/qemu-options.hx
|
||||
@@ -2111,11 +2111,6 @@ ETEXI
|
||||
|
||||
DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
|
||||
"-no-hpet disable HPET\n", QEMU_ARCH_I386)
|
||||
-STEXI
|
||||
-@item -no-hpet
|
||||
-@findex -no-hpet
|
||||
-Disable HPET support.
|
||||
-ETEXI
|
||||
|
||||
DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
|
||||
"-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n"
|
||||
@@ -3125,6 +3120,7 @@ STEXI
|
||||
ETEXI
|
||||
DEFHEADING()
|
||||
|
||||
+#if 0
|
||||
DEFHEADING(Bluetooth(R) options:)
|
||||
STEXI
|
||||
@table @option
|
||||
@@ -3203,6 +3199,7 @@ STEXI
|
||||
@end table
|
||||
ETEXI
|
||||
DEFHEADING()
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_TPM
|
||||
DEFHEADING(TPM device options:)
|
||||
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
|
||||
index 7a4ac9339b..3788fc3c4a 100644
|
||||
--- a/target/arm/cpu.c
|
||||
+++ b/target/arm/cpu.c
|
||||
@@ -2744,7 +2744,9 @@ static void arm_cpu_register_types(void)
|
||||
type_register_static(&idau_interface_type_info);
|
||||
|
||||
while (info->name) {
|
||||
- cpu_register(info);
|
||||
+ /* RHEL specific: Filter out unsupported cpu models */
|
||||
+ if (!strcmp(info->name, "cortex-a15"))
|
||||
+ cpu_register(info);
|
||||
info++;
|
||||
}
|
||||
|
||||
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
||||
index 69f518a21a..1b7880ae3a 100644
|
||||
--- a/target/i386/cpu.c
|
||||
+++ b/target/i386/cpu.c
|
||||
@@ -1835,14 +1835,14 @@ static X86CPUDefinition builtin_x86_defs[] = {
|
||||
.family = 6,
|
||||
.model = 6,
|
||||
.stepping = 3,
|
||||
- .features[FEAT_1_EDX] =
|
||||
- PPRO_FEATURES |
|
||||
- CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
|
||||
- CPUID_PSE36,
|
||||
- .features[FEAT_1_ECX] =
|
||||
- CPUID_EXT_SSE3 | CPUID_EXT_CX16,
|
||||
- .features[FEAT_8000_0001_EDX] =
|
||||
- CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
|
||||
+ .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
|
||||
+ CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
|
||||
+ CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC |
|
||||
+ CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC |
|
||||
+ CPUID_PSE | CPUID_DE | CPUID_FP87,
|
||||
+ .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3,
|
||||
+ .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_NX |
|
||||
+ CPUID_EXT2_SYSCALL,
|
||||
.features[FEAT_8000_0001_ECX] =
|
||||
CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM,
|
||||
.xlevel = 0x8000000A,
|
||||
@@ -2128,6 +2128,25 @@ static X86CPUDefinition builtin_x86_defs[] = {
|
||||
.xlevel = 0x80000008,
|
||||
.model_id = "Intel(R) Atom(TM) CPU N270 @ 1.60GHz",
|
||||
},
|
||||
+ {
|
||||
+ .name = "cpu64-rhel6",
|
||||
+ .level = 4,
|
||||
+ .vendor = CPUID_VENDOR_AMD,
|
||||
+ .family = 6,
|
||||
+ .model = 13,
|
||||
+ .stepping = 3,
|
||||
+ .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
|
||||
+ CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
|
||||
+ CPUID_MCA | CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC |
|
||||
+ CPUID_CX8 | CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC |
|
||||
+ CPUID_PSE | CPUID_DE | CPUID_FP87,
|
||||
+ .features[FEAT_1_ECX] = CPUID_EXT_CX16 | CPUID_EXT_SSE3,
|
||||
+ .features[FEAT_8000_0001_EDX] = CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
|
||||
+ .features[FEAT_8000_0001_ECX] = CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
|
||||
+ CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
|
||||
+ .xlevel = 0x8000000A,
|
||||
+ .model_id = "QEMU Virtual CPU version (cpu64-rhel6)",
|
||||
+ },
|
||||
{
|
||||
.name = "Conroe",
|
||||
.level = 10,
|
||||
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
|
||||
index 086548e9b9..1bbf378c18 100644
|
||||
--- a/target/ppc/cpu-models.c
|
||||
+++ b/target/ppc/cpu-models.c
|
||||
@@ -66,6 +66,7 @@
|
||||
#define POWERPC_DEF(_name, _pvr, _type, _desc) \
|
||||
POWERPC_DEF_SVR(_name, _desc, _pvr, POWERPC_SVR_NONE, _type)
|
||||
|
||||
+#if 0 /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */
|
||||
/* Embedded PowerPC */
|
||||
/* PowerPC 401 family */
|
||||
POWERPC_DEF("401", CPU_POWERPC_401, 401,
|
||||
@@ -740,8 +741,10 @@
|
||||
"PowerPC 7447A v1.2 (G4)")
|
||||
POWERPC_DEF("7457a_v1.2", CPU_POWERPC_74x7A_v12, 7455,
|
||||
"PowerPC 7457A v1.2 (G4)")
|
||||
+#endif
|
||||
/* 64 bits PowerPC */
|
||||
#if defined(TARGET_PPC64)
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970,
|
||||
"PowerPC 970 v2.2")
|
||||
POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970,
|
||||
@@ -760,6 +763,7 @@
|
||||
"PowerPC 970MP v1.1")
|
||||
POWERPC_DEF("power5+_v2.1", CPU_POWERPC_POWER5P_v21, POWER5P,
|
||||
"POWER5+ v2.1")
|
||||
+#endif
|
||||
POWERPC_DEF("power7_v2.3", CPU_POWERPC_POWER7_v23, POWER7,
|
||||
"POWER7 v2.3")
|
||||
POWERPC_DEF("power7+_v2.1", CPU_POWERPC_POWER7P_v21, POWER7,
|
||||
@@ -780,6 +784,7 @@
|
||||
/* PowerPC CPU aliases */
|
||||
|
||||
PowerPCCPUAlias ppc_cpu_aliases[] = {
|
||||
+#if 0 /* Embedded and 32-bit CPUs disabled for Red Hat Enterprise Linux */
|
||||
{ "403", "403gc" },
|
||||
{ "405", "405d4" },
|
||||
{ "405cr", "405crc" },
|
||||
@@ -938,12 +943,15 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
|
||||
{ "7447a", "7447a_v1.2" },
|
||||
{ "7457a", "7457a_v1.2" },
|
||||
{ "apollo7pm", "7457a_v1.0" },
|
||||
+#endif
|
||||
#if defined(TARGET_PPC64)
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
{ "970", "970_v2.2" },
|
||||
{ "970fx", "970fx_v3.1" },
|
||||
{ "970mp", "970mp_v1.1" },
|
||||
{ "power5+", "power5+_v2.1" },
|
||||
{ "power5gs", "power5+_v2.1" },
|
||||
+#endif
|
||||
{ "power7", "power7_v2.3" },
|
||||
{ "power7+", "power7+_v2.1" },
|
||||
{ "power8e", "power8e_v2.1" },
|
||||
@@ -952,6 +960,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
|
||||
{ "power9", "power9_v2.0" },
|
||||
#endif
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
/* Generic PowerPCs */
|
||||
#if defined(TARGET_PPC64)
|
||||
{ "ppc64", "970fx_v3.1" },
|
||||
@@ -959,5 +968,6 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
|
||||
{ "ppc32", "604" },
|
||||
{ "ppc", "604" },
|
||||
{ "default", "604" },
|
||||
+#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
|
||||
index 7e92fb2e15..be718220d7 100644
|
||||
--- a/target/s390x/cpu_models.c
|
||||
+++ b/target/s390x/cpu_models.c
|
||||
@@ -404,6 +404,9 @@ static void check_unavailable_features(const S390CPUModel *max_model,
|
||||
(max_model->def->gen == model->def->gen &&
|
||||
max_model->def->ec_ga < model->def->ec_ga)) {
|
||||
list_add_feat("type", unavailable);
|
||||
+ } else if (model->def->gen < 11 && kvm_enabled()) {
|
||||
+ /* Older CPU models are not supported on Red Hat Enterprise Linux */
|
||||
+ list_add_feat("type", unavailable);
|
||||
}
|
||||
|
||||
/* detect missing features if any to properly report them */
|
||||
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
|
||||
index 0c9d14b4b1..a02d569537 100644
|
||||
--- a/target/s390x/kvm.c
|
||||
+++ b/target/s390x/kvm.c
|
||||
@@ -2387,6 +2387,14 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
|
||||
error_setg(errp, "KVM doesn't support CPU models");
|
||||
return;
|
||||
}
|
||||
+
|
||||
+ /* Older CPU models are not supported on Red Hat Enterprise Linux */
|
||||
+ if (model->def->gen < 11) {
|
||||
+ error_setg(errp, "KVM: Unsupported CPU type specified: %s",
|
||||
+ MACHINE(qdev_get_machine())->cpu_type);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
prop.cpuid = s390_cpuid_from_cpu_model(model);
|
||||
prop.ibc = s390_ibc_from_cpu_model(model);
|
||||
/* configure cpu features indicated via STFL(e) */
|
||||
diff --git a/util/memfd.c b/util/memfd.c
|
||||
index 4a3c07e0be..3303ec9da4 100644
|
||||
--- a/util/memfd.c
|
||||
+++ b/util/memfd.c
|
||||
@@ -193,7 +193,7 @@ bool qemu_memfd_alloc_check(void)
|
||||
*/
|
||||
bool qemu_memfd_check(unsigned int flags)
|
||||
{
|
||||
-#ifdef CONFIG_LINUX
|
||||
+#if 0 /* RHEL: memfd support disabled */
|
||||
int mfd = memfd_create("test", flags | MFD_CLOEXEC);
|
||||
|
||||
if (mfd >= 0) {
|
||||
diff --git a/vl.c b/vl.c
|
||||
index 6a65a64bfd..668a34577e 100644
|
||||
--- a/vl.c
|
||||
+++ b/vl.c
|
||||
@@ -166,7 +166,7 @@ Chardev *parallel_hds[MAX_PARALLEL_PORTS];
|
||||
int win2k_install_hack = 0;
|
||||
int singlestep = 0;
|
||||
int acpi_enabled = 1;
|
||||
-int no_hpet = 0;
|
||||
+int no_hpet = 1; /* Always disabled for Red Hat Enterprise Linux */
|
||||
int fd_bootchk = 1;
|
||||
static int no_reboot;
|
||||
int no_shutdown = 0;
|
||||
@@ -914,6 +914,7 @@ static void configure_rtc(QemuOpts *opts)
|
||||
}
|
||||
}
|
||||
|
||||
+#if 0 // Disabled for Red Hat Enterprise Linux
|
||||
/***********************************************************/
|
||||
/* Bluetooth support */
|
||||
static int nb_hcis;
|
||||
@@ -1035,6 +1036,7 @@ static int bt_parse(const char *opt)
|
||||
error_report("bad bluetooth parameter '%s'", opt);
|
||||
return 1;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static int parse_name(void *opaque, QemuOpts *opts, Error **errp)
|
||||
{
|
||||
@@ -3128,6 +3130,7 @@ int main(int argc, char **argv, char **envp)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
case QEMU_OPTION_bt:
|
||||
warn_report("The bluetooth subsystem is deprecated and will "
|
||||
"be removed soon. If the bluetooth subsystem is "
|
||||
@@ -3135,6 +3138,7 @@ int main(int argc, char **argv, char **envp)
|
||||
"qemu-devel@nongnu.org with your usecase.");
|
||||
add_device_config(DEV_BT, optarg);
|
||||
break;
|
||||
+#endif
|
||||
case QEMU_OPTION_audio_help:
|
||||
audio_legacy_help();
|
||||
exit (0);
|
||||
@@ -4282,9 +4286,11 @@ int main(int argc, char **argv, char **envp)
|
||||
|
||||
tpm_init();
|
||||
|
||||
+#if 0 // Disabled for Red Hat Enterprise Linux
|
||||
/* init the bluetooth world */
|
||||
if (foreach_device_config(DEV_BT, bt_parse))
|
||||
exit(1);
|
||||
+#endif
|
||||
|
||||
if (!xen_enabled()) {
|
||||
/* On 32-bit hosts, QEMU is limited by virtual address space */
|
||||
--
|
||||
2.21.0
|
||||
|
675
SOURCES/0007-Machine-type-related-general-changes.patch
Normal file
675
SOURCES/0007-Machine-type-related-general-changes.patch
Normal file
@ -0,0 +1,675 @@
|
||||
From 113078b23a4747b07eb363719d7cbc0af403dd2a Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 09:54:45 +0100
|
||||
Subject: Machine type related general changes
|
||||
|
||||
This patch is first part of original "Add RHEL machine types" patch we
|
||||
split to allow easier review. It contains changes not related to any
|
||||
architecture.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (4.0.0):
|
||||
- Remove e1000 device duplication changes to reflect upstream solution
|
||||
- Rewrite machine compat properties to upstream solution
|
||||
|
||||
Rebase changes (4.1.0):
|
||||
- Removed optional flag for machine compat properties (upstream)
|
||||
- Remove c3e002cb chunk from hw/net/e1000.c
|
||||
- Reorder compat structures
|
||||
- Use one format for compat scructures
|
||||
- Added compat for virtio-balloon-pci.any_layout for rhel71
|
||||
|
||||
Merged patches (4.0.0):
|
||||
- d4c0957 compat: Generic HW_COMPAT_RHEL7_6
|
||||
- cbac773 virtio: Make disable-legacy/disable-modern compat properties optional
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- 479ad30 redhat: fix cut'n'paste garbage in hw_compat comments
|
||||
- f19738e compat: Generic hw_compat_rhel_8_0
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- 9f2bfaa machine types: Update hw_compat_rhel_8_0 from hw_compat_4_0
|
||||
- ca4a5e8 virtio: Make disable-legacy/disable-modern compat properties optional
|
||||
- compat: Generic hw_compat_rhel_8_1 (patch 93040/92956)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/acpi/ich9.c | 16 ++++
|
||||
hw/acpi/piix4.c | 5 +-
|
||||
hw/char/serial.c | 16 ++++
|
||||
hw/core/machine.c | 170 ++++++++++++++++++++++++++++++++++++++++
|
||||
hw/display/vga-isa.c | 2 +-
|
||||
hw/net/e1000e.c | 21 +++++
|
||||
hw/net/rtl8139.c | 4 +-
|
||||
hw/rtc/mc146818rtc.c | 6 ++
|
||||
hw/smbios/smbios.c | 1 +
|
||||
hw/timer/i8254_common.c | 2 +-
|
||||
hw/usb/hcd-uhci.c | 4 +-
|
||||
hw/usb/hcd-xhci.c | 20 +++++
|
||||
hw/usb/hcd-xhci.h | 2 +
|
||||
include/hw/acpi/ich9.h | 3 +
|
||||
include/hw/boards.h | 24 ++++++
|
||||
include/hw/usb.h | 4 +
|
||||
migration/migration.c | 2 +
|
||||
migration/migration.h | 5 ++
|
||||
18 files changed, 301 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
|
||||
index ab203ad448..7ec26884e8 100644
|
||||
--- a/hw/acpi/ich9.c
|
||||
+++ b/hw/acpi/ich9.c
|
||||
@@ -444,6 +444,18 @@ static void ich9_pm_set_enable_tco(Object *obj, bool value, Error **errp)
|
||||
s->pm.enable_tco = value;
|
||||
}
|
||||
|
||||
+static bool ich9_pm_get_force_rev1_fadt(Object *obj, Error **errp)
|
||||
+{
|
||||
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
|
||||
+ return s->pm.force_rev1_fadt;
|
||||
+}
|
||||
+
|
||||
+static void ich9_pm_set_force_rev1_fadt(Object *obj, bool value, Error **errp)
|
||||
+{
|
||||
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
|
||||
+ s->pm.force_rev1_fadt = value;
|
||||
+}
|
||||
+
|
||||
void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
|
||||
{
|
||||
static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
|
||||
@@ -468,6 +480,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
|
||||
ich9_pm_get_cpu_hotplug_legacy,
|
||||
ich9_pm_set_cpu_hotplug_legacy,
|
||||
NULL);
|
||||
+ object_property_add_bool(obj, "__com.redhat_force-rev1-fadt",
|
||||
+ ich9_pm_get_force_rev1_fadt,
|
||||
+ ich9_pm_set_force_rev1_fadt,
|
||||
+ NULL);
|
||||
object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8",
|
||||
ich9_pm_get_disable_s3,
|
||||
ich9_pm_set_disable_s3,
|
||||
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
|
||||
index 93aec2dd2c..3a26193cbe 100644
|
||||
--- a/hw/acpi/piix4.c
|
||||
+++ b/hw/acpi/piix4.c
|
||||
@@ -274,6 +274,7 @@ static const VMStateDescription vmstate_acpi = {
|
||||
.name = "piix4_pm",
|
||||
.version_id = 3,
|
||||
.minimum_version_id = 3,
|
||||
+ .minimum_version_id = 2,
|
||||
.post_load = vmstate_acpi_post_load,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
|
||||
@@ -627,8 +628,8 @@ static void piix4_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
|
||||
|
||||
static Property piix4_pm_properties[] = {
|
||||
DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
|
||||
- DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
|
||||
- DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0),
|
||||
+ DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 1),
|
||||
+ DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 1),
|
||||
DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
|
||||
DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState,
|
||||
use_acpi_pci_hotplug, true),
|
||||
diff --git a/hw/char/serial.c b/hw/char/serial.c
|
||||
index b4aa250950..0012f0e44d 100644
|
||||
--- a/hw/char/serial.c
|
||||
+++ b/hw/char/serial.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "sysemu/runstate.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
+#include "migration/migration.h"
|
||||
|
||||
//#define DEBUG_SERIAL
|
||||
|
||||
@@ -703,6 +704,9 @@ static int serial_post_load(void *opaque, int version_id)
|
||||
static bool serial_thr_ipending_needed(void *opaque)
|
||||
{
|
||||
SerialState *s = opaque;
|
||||
+ if (migrate_pre_2_2) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
if (s->ier & UART_IER_THRI) {
|
||||
bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
|
||||
@@ -784,6 +788,10 @@ static const VMStateDescription vmstate_serial_xmit_fifo = {
|
||||
static bool serial_fifo_timeout_timer_needed(void *opaque)
|
||||
{
|
||||
SerialState *s = (SerialState *)opaque;
|
||||
+ if (migrate_pre_2_2) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return timer_pending(s->fifo_timeout_timer);
|
||||
}
|
||||
|
||||
@@ -801,6 +809,10 @@ static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
|
||||
static bool serial_timeout_ipending_needed(void *opaque)
|
||||
{
|
||||
SerialState *s = (SerialState *)opaque;
|
||||
+ if (migrate_pre_2_2) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return s->timeout_ipending != 0;
|
||||
}
|
||||
|
||||
@@ -818,6 +830,10 @@ static const VMStateDescription vmstate_serial_timeout_ipending = {
|
||||
static bool serial_poll_needed(void *opaque)
|
||||
{
|
||||
SerialState *s = (SerialState *)opaque;
|
||||
+ if (migrate_pre_2_2) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return s->poll_msl >= 0;
|
||||
}
|
||||
|
||||
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
||||
index 1689ad3bf8..e0e0eec8bf 100644
|
||||
--- a/hw/core/machine.c
|
||||
+++ b/hw/core/machine.c
|
||||
@@ -27,6 +27,176 @@
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/mem/nvdimm.h"
|
||||
|
||||
+/*
|
||||
+ * The same as hw_compat_4_1
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_8_1[] = {
|
||||
+ /* hw_compat_rhel_8_1 from hw_compat_4_1 */
|
||||
+ { "virtio-pci", "x-pcie-flr-init", "off" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_8_1_len = G_N_ELEMENTS(hw_compat_rhel_8_1);
|
||||
+
|
||||
+/* The same as hw_compat_3_1
|
||||
+ * format of array has been changed by:
|
||||
+ * 6c36bddf5340 ("machine: Use shorter format for GlobalProperty arrays")
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_8_0[] = {
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "pcie-root-port", "x-speed", "2_5" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "pcie-root-port", "x-width", "1" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "tpm-crb", "ppi", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "tpm-tis", "ppi", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "usb-kbd", "serial", "42" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "usb-mouse", "serial", "42" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "usb-tablet", "serial", "42" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "virtio-blk-device", "discard", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 */
|
||||
+ { "virtio-blk-device", "write-zeroes", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "VGA", "edid", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "secondary-vga", "edid", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "bochs-display", "edid", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "virtio-vga", "edid", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "virtio-gpu-pci", "edid", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
+ { "virtio-device", "use-started", "false" },
|
||||
+ /* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */
|
||||
+ { "pcie-root-port-base", "disable-acs", "true" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_8_0_len = G_N_ELEMENTS(hw_compat_rhel_8_0);
|
||||
+
|
||||
+/* The same as hw_compat_3_0 + hw_compat_2_12
|
||||
+ * except that
|
||||
+ * there's nothing in 3_0
|
||||
+ * migration.decompress-error-check=off was in 7.5 from bz 1584139
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_7_6[] = {
|
||||
+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */
|
||||
+ { "hda-audio", "use-timer", "false" },
|
||||
+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */
|
||||
+ { "cirrus-vga", "global-vmstate", "true" },
|
||||
+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */
|
||||
+ { "VGA", "global-vmstate", "true" },
|
||||
+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */
|
||||
+ { "vmware-svga", "global-vmstate", "true" },
|
||||
+ /* hw_compat_rhel_7_6 from hw_compat_2_12 */
|
||||
+ { "qxl-vga", "global-vmstate", "true" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_7_6_len = G_N_ELEMENTS(hw_compat_rhel_7_6);
|
||||
+
|
||||
+/* The same as hw_compat_2_11 + hw_compat_2_10 */
|
||||
+GlobalProperty hw_compat_rhel_7_5[] = {
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_11 */
|
||||
+ { "hpet", "hpet-offset-saved", "false" },
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_11 */
|
||||
+ { "virtio-blk-pci", "vectors", "2" },
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_11 */
|
||||
+ { "vhost-user-blk-pci", "vectors", "2" },
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_11
|
||||
+ bz 1608778 modified for our naming */
|
||||
+ { "e1000-82540em", "migrate_tso_props", "off" },
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_10 */
|
||||
+ { "virtio-mouse-device", "wheel-axis", "false" },
|
||||
+ /* hw_compat_rhel_7_5 from hw_compat_2_10 */
|
||||
+ { "virtio-tablet-device", "wheel-axis", "false" },
|
||||
+ { "cirrus-vga", "vgamem_mb", "16" },
|
||||
+ { "migration", "decompress-error-check", "off" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_7_5_len = G_N_ELEMENTS(hw_compat_rhel_7_5);
|
||||
+
|
||||
+/* Mostly like hw_compat_2_9 except
|
||||
+ * x-mtu-bypass-backend, x-migrate-msix has already been
|
||||
+ * backported to RHEL7.4. shpc was already on in 7.4.
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_7_4[] = {
|
||||
+ { "intel-iommu", "pt", "off" },
|
||||
+};
|
||||
+
|
||||
+const size_t hw_compat_rhel_7_4_len = G_N_ELEMENTS(hw_compat_rhel_7_4);
|
||||
+/* Mostly like HW_COMPAT_2_6 + HW_COMPAT_2_7 + HW_COMPAT_2_8 except
|
||||
+ * disable-modern, disable-legacy, page-per-vq have already been
|
||||
+ * backported to RHEL7.3
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_7_3[] = {
|
||||
+ { "virtio-mmio", "format_transport_address", "off" },
|
||||
+ { "virtio-serial-device", "emergency-write", "off" },
|
||||
+ { "ioapic", "version", "0x11" },
|
||||
+ { "intel-iommu", "x-buggy-eim", "true" },
|
||||
+ { "virtio-pci", "x-ignore-backend-features", "on" },
|
||||
+ { "fw_cfg_mem", "x-file-slots", stringify(0x10) },
|
||||
+ { "fw_cfg_io", "x-file-slots", stringify(0x10) },
|
||||
+ { "pflash_cfi01", "old-multiple-chip-handling", "on" },
|
||||
+ { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" },
|
||||
+ { "virtio-pci", "x-pcie-deverr-init", "off" },
|
||||
+ { "virtio-pci", "x-pcie-lnkctl-init", "off" },
|
||||
+ { "virtio-pci", "x-pcie-pm-init", "off" },
|
||||
+ { "virtio-net-device", "x-mtu-bypass-backend", "off" },
|
||||
+ { "e1000e", "__redhat_e1000e_7_3_intr_state", "on" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_7_3_len = G_N_ELEMENTS(hw_compat_rhel_7_3);
|
||||
+
|
||||
+/* Mostly like hw_compat_2_4 + 2_3 but:
|
||||
+ * we don't need "any_layout" as it has been backported to 7.2
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_7_2[] = {
|
||||
+ { "virtio-blk-device", "scsi", "true" },
|
||||
+ { "e1000-82540em", "extra_mac_registers", "off" },
|
||||
+ { "virtio-pci", "x-disable-pcie", "on" },
|
||||
+ { "virtio-pci", "migrate-extra", "off" },
|
||||
+ { "fw_cfg_mem", "dma_enabled", "off" },
|
||||
+ { "fw_cfg_io", "dma_enabled", "off" },
|
||||
+ { "isa-fdc", "fallback", "144" },
|
||||
+ /* Optional because not all virtio-pci devices support legacy mode */
|
||||
+ { "virtio-pci", "disable-modern", "on", .optional = true },
|
||||
+ { "virtio-pci", "disable-legacy", "off", .optional = true },
|
||||
+ { TYPE_PCI_DEVICE, "x-pcie-lnksta-dllla", "off" },
|
||||
+ { "virtio-pci", "page-per-vq", "on" },
|
||||
+ /* hw_compat_rhel_7_2 - introduced with 2.10.0 */
|
||||
+ { "migration", "send-section-footer", "off" },
|
||||
+ /* hw_compat_rhel_7_2 - introduced with 2.10.0 */
|
||||
+ { "migration", "store-global-state", "off",
|
||||
+ },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_7_2_len = G_N_ELEMENTS(hw_compat_rhel_7_2);
|
||||
+
|
||||
+/* Mostly like hw_compat_2_1 but:
|
||||
+ * we don't need virtio-scsi-pci since 7.0 already had that on
|
||||
+ *
|
||||
+ * RH: Note, qemu-extended-regs should have been enabled in the 7.1
|
||||
+ * machine type, but was accidentally turned off in 7.2 onwards.
|
||||
+ */
|
||||
+GlobalProperty hw_compat_rhel_7_1[] = {
|
||||
+ { "intel-hda-generic", "old_msi_addr", "on" },
|
||||
+ { "VGA", "qemu-extended-regs", "off" },
|
||||
+ { "secondary-vga", "qemu-extended-regs", "off" },
|
||||
+ { "usb-mouse", "usb_version", stringify(1) },
|
||||
+ { "usb-kbd", "usb_version", stringify(1) },
|
||||
+ { "virtio-pci", "virtio-pci-bus-master-bug-migration", "on" },
|
||||
+ { "virtio-blk-pci", "any_layout", "off" },
|
||||
+ { "virtio-balloon-pci", "any_layout", "off" },
|
||||
+ { "virtio-serial-pci", "any_layout", "off" },
|
||||
+ { "virtio-9p-pci", "any_layout", "off" },
|
||||
+ { "virtio-rng-pci", "any_layout", "off" },
|
||||
+ /* HW_COMPAT_RHEL7_1 - introduced with 2.10.0 */
|
||||
+ { "migration", "send-configuration", "off" },
|
||||
+};
|
||||
+const size_t hw_compat_rhel_7_1_len = G_N_ELEMENTS(hw_compat_rhel_7_1);
|
||||
+
|
||||
GlobalProperty hw_compat_4_1[] = {
|
||||
{ "virtio-pci", "x-pcie-flr-init", "off" },
|
||||
};
|
||||
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
|
||||
index 873e5e9706..d1a2efe47e 100644
|
||||
--- a/hw/display/vga-isa.c
|
||||
+++ b/hw/display/vga-isa.c
|
||||
@@ -82,7 +82,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property vga_isa_properties[] = {
|
||||
- DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
|
||||
+ DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 16),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
|
||||
index b69fd7d8ad..d8be50a1ce 100644
|
||||
--- a/hw/net/e1000e.c
|
||||
+++ b/hw/net/e1000e.c
|
||||
@@ -79,6 +79,11 @@ typedef struct E1000EState {
|
||||
|
||||
E1000ECore core;
|
||||
|
||||
+ /* 7.3 had the intr_state field that was in the original e1000e code
|
||||
+ * but that was removed prior to 2.7's release
|
||||
+ */
|
||||
+ bool redhat_7_3_intr_state_enable;
|
||||
+ uint32_t redhat_7_3_intr_state;
|
||||
} E1000EState;
|
||||
|
||||
#define E1000E_MMIO_IDX 0
|
||||
@@ -94,6 +99,10 @@ typedef struct E1000EState {
|
||||
#define E1000E_MSIX_TABLE (0x0000)
|
||||
#define E1000E_MSIX_PBA (0x2000)
|
||||
|
||||
+/* Values as in RHEL 7.3 build and original upstream */
|
||||
+#define RH_E1000E_USE_MSI BIT(0)
|
||||
+#define RH_E1000E_USE_MSIX BIT(1)
|
||||
+
|
||||
static uint64_t
|
||||
e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size)
|
||||
{
|
||||
@@ -305,6 +314,8 @@ e1000e_init_msix(E1000EState *s)
|
||||
} else {
|
||||
if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) {
|
||||
msix_uninit(d, &s->msix, &s->msix);
|
||||
+ } else {
|
||||
+ s->redhat_7_3_intr_state |= RH_E1000E_USE_MSIX;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,6 +487,8 @@ static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp)
|
||||
ret = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
|
||||
if (ret) {
|
||||
trace_e1000e_msi_init_fail(ret);
|
||||
+ } else {
|
||||
+ s->redhat_7_3_intr_state |= RH_E1000E_USE_MSI;
|
||||
}
|
||||
|
||||
if (e1000e_add_pm_capability(pci_dev, e1000e_pmrb_offset,
|
||||
@@ -599,6 +612,11 @@ static const VMStateDescription e1000e_vmstate_intr_timer = {
|
||||
VMSTATE_STRUCT_ARRAY(_f, _s, _num, 0, \
|
||||
e1000e_vmstate_intr_timer, E1000IntrDelayTimer)
|
||||
|
||||
+static bool rhel_7_3_check(void *opaque, int version_id)
|
||||
+{
|
||||
+ return ((E1000EState *)opaque)->redhat_7_3_intr_state_enable;
|
||||
+}
|
||||
+
|
||||
static const VMStateDescription e1000e_vmstate = {
|
||||
.name = "e1000e",
|
||||
.version_id = 1,
|
||||
@@ -610,6 +628,7 @@ static const VMStateDescription e1000e_vmstate = {
|
||||
VMSTATE_MSIX(parent_obj, E1000EState),
|
||||
|
||||
VMSTATE_UINT32(ioaddr, E1000EState),
|
||||
+ VMSTATE_UINT32_TEST(redhat_7_3_intr_state, E1000EState, rhel_7_3_check),
|
||||
VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState),
|
||||
VMSTATE_UINT8(core.rx_desc_len, E1000EState),
|
||||
VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState,
|
||||
@@ -658,6 +677,8 @@ static PropertyInfo e1000e_prop_disable_vnet,
|
||||
|
||||
static Property e1000e_properties[] = {
|
||||
DEFINE_NIC_PROPERTIES(E1000EState, conf),
|
||||
+ DEFINE_PROP_BOOL("__redhat_e1000e_7_3_intr_state", E1000EState,
|
||||
+ redhat_7_3_intr_state_enable, false),
|
||||
DEFINE_PROP_SIGNED("disable_vnet_hdr", E1000EState, disable_vnet, false,
|
||||
e1000e_prop_disable_vnet, bool),
|
||||
DEFINE_PROP_SIGNED("subsys_ven", E1000EState, subsys_ven,
|
||||
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
|
||||
index 88a97d756d..21d80e96cf 100644
|
||||
--- a/hw/net/rtl8139.c
|
||||
+++ b/hw/net/rtl8139.c
|
||||
@@ -3177,7 +3177,7 @@ static int rtl8139_pre_save(void *opaque)
|
||||
|
||||
static const VMStateDescription vmstate_rtl8139 = {
|
||||
.name = "rtl8139",
|
||||
- .version_id = 5,
|
||||
+ .version_id = 4,
|
||||
.minimum_version_id = 3,
|
||||
.post_load = rtl8139_post_load,
|
||||
.pre_save = rtl8139_pre_save,
|
||||
@@ -3258,7 +3258,9 @@ static const VMStateDescription vmstate_rtl8139 = {
|
||||
VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State),
|
||||
VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State),
|
||||
VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State),
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */
|
||||
VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5),
|
||||
+#endif
|
||||
VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State),
|
||||
VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State),
|
||||
|
||||
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
|
||||
index 74ae74bc5c..73820517df 100644
|
||||
--- a/hw/rtc/mc146818rtc.c
|
||||
+++ b/hw/rtc/mc146818rtc.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "qapi/visitor.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/rtc/mc146818rtc_regs.h"
|
||||
+#include "migration/migration.h"
|
||||
|
||||
#ifdef TARGET_I386
|
||||
#include "qapi/qapi-commands-misc-target.h"
|
||||
@@ -820,6 +821,11 @@ static int rtc_post_load(void *opaque, int version_id)
|
||||
static bool rtc_irq_reinject_on_ack_count_needed(void *opaque)
|
||||
{
|
||||
RTCState *s = (RTCState *)opaque;
|
||||
+
|
||||
+ if (migrate_pre_2_2) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return s->irq_reinject_on_ack_count != 0;
|
||||
}
|
||||
|
||||
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
|
||||
index 11d476c4a2..e6e9355384 100644
|
||||
--- a/hw/smbios/smbios.c
|
||||
+++ b/hw/smbios/smbios.c
|
||||
@@ -777,6 +777,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
|
||||
SMBIOS_SET_DEFAULT(type1.product, product);
|
||||
SMBIOS_SET_DEFAULT(type1.version, version);
|
||||
+ SMBIOS_SET_DEFAULT(type1.family, "Red Hat Enterprise Linux");
|
||||
SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer);
|
||||
SMBIOS_SET_DEFAULT(type2.product, product);
|
||||
SMBIOS_SET_DEFAULT(type2.version, version);
|
||||
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
|
||||
index 050875b497..32935da46c 100644
|
||||
--- a/hw/timer/i8254_common.c
|
||||
+++ b/hw/timer/i8254_common.c
|
||||
@@ -231,7 +231,7 @@ static const VMStateDescription vmstate_pit_common = {
|
||||
.pre_save = pit_dispatch_pre_save,
|
||||
.post_load = pit_dispatch_post_load,
|
||||
.fields = (VMStateField[]) {
|
||||
- VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
|
||||
+ VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */
|
||||
VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
|
||||
vmstate_pit_channel, PITChannelState),
|
||||
VMSTATE_INT64(channels[0].next_transition_time,
|
||||
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
|
||||
index 23507ad3b5..9fd87a7ad9 100644
|
||||
--- a/hw/usb/hcd-uhci.c
|
||||
+++ b/hw/usb/hcd-uhci.c
|
||||
@@ -1219,12 +1219,14 @@ static void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
|
||||
UHCIState *s = UHCI(dev);
|
||||
uint8_t *pci_conf = s->dev.config;
|
||||
int i;
|
||||
+ int irq_pin;
|
||||
|
||||
pci_conf[PCI_CLASS_PROG] = 0x00;
|
||||
/* TODO: reset value should be 0. */
|
||||
pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
|
||||
|
||||
- pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
|
||||
+ irq_pin = u->info.irq_pin;
|
||||
+ pci_config_set_interrupt_pin(pci_conf, irq_pin + 1);
|
||||
|
||||
if (s->masterbus) {
|
||||
USBPort *ports[NB_PORTS];
|
||||
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
|
||||
index 80988bb305..8fed2eedd6 100644
|
||||
--- a/hw/usb/hcd-xhci.c
|
||||
+++ b/hw/usb/hcd-xhci.c
|
||||
@@ -3590,9 +3590,27 @@ static const VMStateDescription vmstate_xhci_slot = {
|
||||
}
|
||||
};
|
||||
|
||||
+static int xhci_event_pre_save(void *opaque)
|
||||
+{
|
||||
+ XHCIEvent *s = opaque;
|
||||
+
|
||||
+ s->cve_2014_5263_a = ((uint8_t *)&s->type)[0];
|
||||
+ s->cve_2014_5263_b = ((uint8_t *)&s->type)[1];
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+bool migrate_cve_2014_5263_xhci_fields;
|
||||
+
|
||||
+static bool xhci_event_cve_2014_5263(void *opaque, int version_id)
|
||||
+{
|
||||
+ return migrate_cve_2014_5263_xhci_fields;
|
||||
+}
|
||||
+
|
||||
static const VMStateDescription vmstate_xhci_event = {
|
||||
.name = "xhci-event",
|
||||
.version_id = 1,
|
||||
+ .pre_save = xhci_event_pre_save,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(type, XHCIEvent),
|
||||
VMSTATE_UINT32(ccode, XHCIEvent),
|
||||
@@ -3601,6 +3619,8 @@ static const VMStateDescription vmstate_xhci_event = {
|
||||
VMSTATE_UINT32(flags, XHCIEvent),
|
||||
VMSTATE_UINT8(slotid, XHCIEvent),
|
||||
VMSTATE_UINT8(epid, XHCIEvent),
|
||||
+ VMSTATE_UINT8_TEST(cve_2014_5263_a, XHCIEvent, xhci_event_cve_2014_5263),
|
||||
+ VMSTATE_UINT8_TEST(cve_2014_5263_b, XHCIEvent, xhci_event_cve_2014_5263),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
|
||||
index 2fad4df2a7..f554b671e3 100644
|
||||
--- a/hw/usb/hcd-xhci.h
|
||||
+++ b/hw/usb/hcd-xhci.h
|
||||
@@ -157,6 +157,8 @@ typedef struct XHCIEvent {
|
||||
uint32_t flags;
|
||||
uint8_t slotid;
|
||||
uint8_t epid;
|
||||
+ uint8_t cve_2014_5263_a;
|
||||
+ uint8_t cve_2014_5263_b;
|
||||
} XHCIEvent;
|
||||
|
||||
typedef struct XHCIInterrupter {
|
||||
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
|
||||
index 41568d1837..1a23ccc412 100644
|
||||
--- a/include/hw/acpi/ich9.h
|
||||
+++ b/include/hw/acpi/ich9.h
|
||||
@@ -61,6 +61,9 @@ typedef struct ICH9LPCPMRegs {
|
||||
uint8_t smm_enabled;
|
||||
bool enable_tco;
|
||||
TCOIORegs tco_regs;
|
||||
+
|
||||
+ /* RH addition, see bz 1489800 */
|
||||
+ bool force_rev1_fadt;
|
||||
} ICH9LPCPMRegs;
|
||||
|
||||
#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
|
||||
diff --git a/include/hw/boards.h b/include/hw/boards.h
|
||||
index de45087f34..6f85a0e032 100644
|
||||
--- a/include/hw/boards.h
|
||||
+++ b/include/hw/boards.h
|
||||
@@ -377,4 +377,28 @@ extern const size_t hw_compat_2_2_len;
|
||||
extern GlobalProperty hw_compat_2_1[];
|
||||
extern const size_t hw_compat_2_1_len;
|
||||
|
||||
+extern GlobalProperty hw_compat_rhel_8_1[];
|
||||
+extern const size_t hw_compat_rhel_8_1_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_8_0[];
|
||||
+extern const size_t hw_compat_rhel_8_0_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_6[];
|
||||
+extern const size_t hw_compat_rhel_7_6_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_5[];
|
||||
+extern const size_t hw_compat_rhel_7_5_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_4[];
|
||||
+extern const size_t hw_compat_rhel_7_4_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_3[];
|
||||
+extern const size_t hw_compat_rhel_7_3_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_2[];
|
||||
+extern const size_t hw_compat_rhel_7_2_len;
|
||||
+
|
||||
+extern GlobalProperty hw_compat_rhel_7_1[];
|
||||
+extern const size_t hw_compat_rhel_7_1_len;
|
||||
+
|
||||
#endif
|
||||
diff --git a/include/hw/usb.h b/include/hw/usb.h
|
||||
index c24d968a19..b353438ea0 100644
|
||||
--- a/include/hw/usb.h
|
||||
+++ b/include/hw/usb.h
|
||||
@@ -605,4 +605,8 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
|
||||
uint8_t interface_class, uint8_t interface_subclass,
|
||||
uint8_t interface_protocol);
|
||||
|
||||
+
|
||||
+/* hcd-xhci.c -- rhel7.0.0 machine type compatibility */
|
||||
+extern bool migrate_cve_2014_5263_xhci_fields;
|
||||
+
|
||||
#endif
|
||||
diff --git a/migration/migration.c b/migration/migration.c
|
||||
index 354ad072fa..30c53c623b 100644
|
||||
--- a/migration/migration.c
|
||||
+++ b/migration/migration.c
|
||||
@@ -121,6 +121,8 @@ enum mig_rp_message_type {
|
||||
MIG_RP_MSG_MAX
|
||||
};
|
||||
|
||||
+bool migrate_pre_2_2;
|
||||
+
|
||||
/* When we add fault tolerance, we could have several
|
||||
migrations at once. For now we don't need to add
|
||||
dynamic creation of migration */
|
||||
diff --git a/migration/migration.h b/migration/migration.h
|
||||
index 79b3dda146..0b1b0d4df5 100644
|
||||
--- a/migration/migration.h
|
||||
+++ b/migration/migration.h
|
||||
@@ -335,6 +335,11 @@ void init_dirty_bitmap_incoming_migration(void);
|
||||
void migrate_add_address(SocketAddress *address);
|
||||
|
||||
int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque);
|
||||
+/*
|
||||
+ * Disables a load of subsections that were added in 2.2/rh7.2 for backwards
|
||||
+ * migration compatibility.
|
||||
+ */
|
||||
+extern bool migrate_pre_2_2;
|
||||
|
||||
#define qemu_ram_foreach_block \
|
||||
#warning "Use foreach_not_ignored_block in migration code"
|
||||
--
|
||||
2.21.0
|
||||
|
276
SOURCES/0008-Add-aarch64-machine-types.patch
Normal file
276
SOURCES/0008-Add-aarch64-machine-types.patch
Normal file
@ -0,0 +1,276 @@
|
||||
From 49164264d9928f73961acbbe4d56d8dfa23d8099 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 19 Oct 2018 12:53:31 +0200
|
||||
Subject: Add aarch64 machine types
|
||||
|
||||
Adding changes to add RHEL machine types for aarch64 architecture.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (4.0.0):
|
||||
- Use upstream compat handling
|
||||
|
||||
Rebase changes (4.1.0-rc0):
|
||||
- Removed a15memmap (upstream)
|
||||
- Use virt_flash_create in rhel800_virt_instance_init
|
||||
|
||||
Rebase changes (4.2.0-rc0):
|
||||
- Set numa_mem_supported
|
||||
|
||||
Rebase notes (4.2.0-rc3):
|
||||
- aarch64: Add virt-rhel8.2.0 machine type for ARM (patch 92246)
|
||||
- aarch64: virt: Allow more than 1TB of RAM (patch 92249)
|
||||
- aarch64: virt: Allow PCDIMM instantiation (patch 92247)
|
||||
- aarch64: virt: Enhance the comment related to gic-version (patch 92248)
|
||||
|
||||
Merged patches (4.0.0):
|
||||
- 7bfdb4c aarch64: Add virt-rhel8.0.0 machine type for ARM
|
||||
- 3433e69 aarch64: Set virt-rhel8.0.0 max_cpus to 512
|
||||
- 4d20863 aarch64: Use 256MB ECAM region by default
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- c3e39ef aarch64: Add virt-rhel8.1.0 machine type for ARM
|
||||
- 59a46d1 aarch64: Allow ARM VIRT iommu option in RHEL8.1 machine
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/arm/virt.c | 161 +++++++++++++++++++++++++++++++++++++++++-
|
||||
include/hw/arm/virt.h | 11 +++
|
||||
2 files changed, 171 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||||
index d4bedc2607..e10839100e 100644
|
||||
--- a/hw/arm/virt.c
|
||||
+++ b/hw/arm/virt.c
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "hw/mem/nvdimm.h"
|
||||
#include "hw/acpi/generic_event_device.h"
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
|
||||
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
|
||||
void *data) \
|
||||
@@ -98,7 +99,49 @@
|
||||
DEFINE_VIRT_MACHINE_LATEST(major, minor, true)
|
||||
#define DEFINE_VIRT_MACHINE(major, minor) \
|
||||
DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
|
||||
-
|
||||
+#endif /* disabled for RHEL */
|
||||
+
|
||||
+#define DEFINE_RHEL_MACHINE_LATEST(m, n, s, latest) \
|
||||
+ static void rhel##m##n##s##_virt_class_init(ObjectClass *oc, \
|
||||
+ void *data) \
|
||||
+ { \
|
||||
+ MachineClass *mc = MACHINE_CLASS(oc); \
|
||||
+ rhel##m##n##s##_virt_options(mc); \
|
||||
+ mc->desc = "RHEL " # m "." # n "." # s " ARM Virtual Machine"; \
|
||||
+ if (latest) { \
|
||||
+ mc->alias = "virt"; \
|
||||
+ mc->is_default = 1; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ static const TypeInfo rhel##m##n##s##_machvirt_info = { \
|
||||
+ .name = MACHINE_TYPE_NAME("virt-rhel" # m "." # n "." # s), \
|
||||
+ .parent = TYPE_RHEL_MACHINE, \
|
||||
+ .instance_init = rhel##m##n##s##_virt_instance_init, \
|
||||
+ .class_init = rhel##m##n##s##_virt_class_init, \
|
||||
+ }; \
|
||||
+ static void rhel##m##n##s##_machvirt_init(void) \
|
||||
+ { \
|
||||
+ type_register_static(&rhel##m##n##s##_machvirt_info); \
|
||||
+ } \
|
||||
+ type_init(rhel##m##n##s##_machvirt_init);
|
||||
+
|
||||
+#define DEFINE_RHEL_MACHINE_AS_LATEST(major, minor, subminor) \
|
||||
+ DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, true)
|
||||
+#define DEFINE_RHEL_MACHINE(major, minor, subminor) \
|
||||
+ DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, false)
|
||||
+
|
||||
+/* This variable is for changes to properties that are RHEL specific,
|
||||
+ * different to the current upstream and to be applied to the latest
|
||||
+ * machine type.
|
||||
+ */
|
||||
+GlobalProperty arm_rhel_compat[] = {
|
||||
+ {
|
||||
+ .driver = "virtio-net-pci",
|
||||
+ .property = "romfile",
|
||||
+ .value = "",
|
||||
+ },
|
||||
+};
|
||||
+const size_t arm_rhel_compat_len = G_N_ELEMENTS(arm_rhel_compat);
|
||||
|
||||
/* Number of external interrupt lines to configure the GIC with */
|
||||
#define NUM_IRQS 256
|
||||
@@ -1763,6 +1806,7 @@ static void machvirt_init(MachineState *machine)
|
||||
qemu_add_machine_init_done_notifier(&vms->machine_done);
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static bool virt_get_secure(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
@@ -1791,6 +1835,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
|
||||
vms->virt = value;
|
||||
}
|
||||
|
||||
+#endif /* disabled for RHEL */
|
||||
static bool virt_get_highmem(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
@@ -2022,6 +2067,7 @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
|
||||
return requested_pa_size > 40 ? requested_pa_size : 0;
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void virt_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
@@ -2258,3 +2304,116 @@ static void virt_machine_2_6_options(MachineClass *mc)
|
||||
vmc->no_pmu = true;
|
||||
}
|
||||
DEFINE_VIRT_MACHINE(2, 6)
|
||||
+#endif /* disabled for RHEL */
|
||||
+
|
||||
+static void rhel_machine_class_init(ObjectClass *oc, void *data)
|
||||
+{
|
||||
+ MachineClass *mc = MACHINE_CLASS(oc);
|
||||
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
||||
+
|
||||
+ mc->family = "virt-rhel-Z";
|
||||
+ mc->init = machvirt_init;
|
||||
+ /* Start with max_cpus set to 512, which is the maximum supported by KVM.
|
||||
+ * The value may be reduced later when we have more information about the
|
||||
+ * configuration of the particular instance.
|
||||
+ */
|
||||
+ mc->max_cpus = 512;
|
||||
+ mc->block_default_type = IF_VIRTIO;
|
||||
+ mc->no_cdrom = 1;
|
||||
+ mc->pci_allow_0_address = true;
|
||||
+ /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */
|
||||
+ mc->minimum_page_bits = 12;
|
||||
+ mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
|
||||
+ mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
|
||||
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
|
||||
+ mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
|
||||
+ mc->kvm_type = virt_kvm_type;
|
||||
+ assert(!mc->get_hotplug_handler);
|
||||
+ mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
|
||||
+ hc->pre_plug = virt_machine_device_pre_plug_cb;
|
||||
+ hc->plug = virt_machine_device_plug_cb;
|
||||
+ hc->unplug_request = virt_machine_device_unplug_request_cb;
|
||||
+ mc->numa_mem_supported = true;
|
||||
+ mc->auto_enable_numa_with_memhp = true;
|
||||
+}
|
||||
+
|
||||
+static const TypeInfo rhel_machine_info = {
|
||||
+ .name = TYPE_RHEL_MACHINE,
|
||||
+ .parent = TYPE_MACHINE,
|
||||
+ .abstract = true,
|
||||
+ .instance_size = sizeof(VirtMachineState),
|
||||
+ .class_size = sizeof(VirtMachineClass),
|
||||
+ .class_init = rhel_machine_class_init,
|
||||
+ .interfaces = (InterfaceInfo[]) {
|
||||
+ { TYPE_HOTPLUG_HANDLER },
|
||||
+ { }
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static void rhel_machine_init(void)
|
||||
+{
|
||||
+ type_register_static(&rhel_machine_info);
|
||||
+}
|
||||
+type_init(rhel_machine_init);
|
||||
+
|
||||
+static void rhel820_virt_instance_init(Object *obj)
|
||||
+{
|
||||
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
|
||||
+
|
||||
+ /* EL3 is disabled by default and non-configurable for RHEL */
|
||||
+ vms->secure = false;
|
||||
+ /* EL2 is disabled by default and non-configurable for RHEL */
|
||||
+ vms->virt = false;
|
||||
+ /* High memory is enabled by default for RHEL */
|
||||
+ vms->highmem = true;
|
||||
+ object_property_add_bool(obj, "highmem", virt_get_highmem,
|
||||
+ virt_set_highmem, NULL);
|
||||
+ object_property_set_description(obj, "highmem",
|
||||
+ "Set on/off to enable/disable using "
|
||||
+ "physical address space above 32 bits",
|
||||
+ NULL);
|
||||
+ /*
|
||||
+ * Default GIC type is still v2, but became configurable for RHEL. We
|
||||
+ * keep v2 instead of max as TCG CI test cases require an MSI controller
|
||||
+ * and there is no userspace ITS MSI emulation available.
|
||||
+ */
|
||||
+ vms->gic_version = 2;
|
||||
+ object_property_add_str(obj, "gic-version", virt_get_gic_version,
|
||||
+ virt_set_gic_version, NULL);
|
||||
+ object_property_set_description(obj, "gic-version",
|
||||
+ "Set GIC version. "
|
||||
+ "Valid values are 2, 3 and host", NULL);
|
||||
+
|
||||
+ vms->highmem_ecam = !vmc->no_highmem_ecam;
|
||||
+
|
||||
+ if (vmc->no_its) {
|
||||
+ vms->its = false;
|
||||
+ } else {
|
||||
+ /* Default allows ITS instantiation */
|
||||
+ vms->its = true;
|
||||
+ object_property_add_bool(obj, "its", virt_get_its,
|
||||
+ virt_set_its, NULL);
|
||||
+ object_property_set_description(obj, "its",
|
||||
+ "Set on/off to enable/disable "
|
||||
+ "ITS instantiation",
|
||||
+ NULL);
|
||||
+ }
|
||||
+
|
||||
+ /* Default disallows iommu instantiation */
|
||||
+ vms->iommu = VIRT_IOMMU_NONE;
|
||||
+ object_property_add_str(obj, "iommu", virt_get_iommu, virt_set_iommu, NULL);
|
||||
+ object_property_set_description(obj, "iommu",
|
||||
+ "Set the IOMMU type. "
|
||||
+ "Valid values are none and smmuv3",
|
||||
+ NULL);
|
||||
+
|
||||
+ vms->irqmap=a15irqmap;
|
||||
+ virt_flash_create(vms);
|
||||
+}
|
||||
+
|
||||
+static void rhel820_virt_options(MachineClass *mc)
|
||||
+{
|
||||
+ compat_props_add(mc->compat_props, arm_rhel_compat, arm_rhel_compat_len);
|
||||
+}
|
||||
+DEFINE_RHEL_MACHINE_AS_LATEST(8, 2, 0)
|
||||
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
|
||||
index 0b41083e9d..53fdf16563 100644
|
||||
--- a/include/hw/arm/virt.h
|
||||
+++ b/include/hw/arm/virt.h
|
||||
@@ -142,6 +142,7 @@ typedef struct {
|
||||
|
||||
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
|
||||
|
||||
+#if 0 /* disabled for Red Hat Enterprise Linux */
|
||||
#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
|
||||
#define VIRT_MACHINE(obj) \
|
||||
OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
|
||||
@@ -150,6 +151,16 @@ typedef struct {
|
||||
#define VIRT_MACHINE_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
|
||||
|
||||
+#else
|
||||
+#define TYPE_RHEL_MACHINE MACHINE_TYPE_NAME("virt-rhel")
|
||||
+#define VIRT_MACHINE(obj) \
|
||||
+ OBJECT_CHECK(VirtMachineState, (obj), TYPE_RHEL_MACHINE)
|
||||
+#define VIRT_MACHINE_GET_CLASS(obj) \
|
||||
+ OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_RHEL_MACHINE)
|
||||
+#define VIRT_MACHINE_CLASS(klass) \
|
||||
+ OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_RHEL_MACHINE)
|
||||
+#endif
|
||||
+
|
||||
void virt_acpi_setup(VirtMachineState *vms);
|
||||
|
||||
/* Return the number of used redistributor regions */
|
||||
--
|
||||
2.21.0
|
||||
|
463
SOURCES/0009-Add-ppc64-machine-types.patch
Normal file
463
SOURCES/0009-Add-ppc64-machine-types.patch
Normal file
@ -0,0 +1,463 @@
|
||||
From 136eae41007e2e5b0d693cc656f3ec36cbabf16f Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 19 Oct 2018 13:27:13 +0200
|
||||
Subject: Add ppc64 machine types
|
||||
|
||||
Adding changes to add RHEL machine types for ppc64 architecture.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (4.0.0):
|
||||
- remove instance options and use upstream solution
|
||||
- Use upstream compat handling
|
||||
- Replace SPAPR_PCI_2_7_MMIO_WIN_SIZE with value (changed upstream)
|
||||
- re-add handling of instance_options (removed upstream)
|
||||
- Use p8 as default for rhel machine types (p9 default upstream)
|
||||
- sPAPRMachineClass renamed to SpaprMachineClass (upstream)
|
||||
|
||||
Rebase changes (4.1.0):
|
||||
- Update format for compat structures
|
||||
|
||||
Merged patches (4.0.0):
|
||||
- 467d59a redhat: define pseries-rhel8.0.0 machine type
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- f21757edc target/ppc/spapr: Enable mitigations by default for pseries-4.0 machine type
|
||||
- 2511c63 redhat: sync pseries-rhel7.6.0 with rhel-av-8.0.1
|
||||
- 89f01da redhat: define pseries-rhel8.1.0 machine type
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- bcba728 redhat: update pseries-rhel8.1.0 machine type
|
||||
- redhat: update pseries-rhel-7.6.0 machine type (patch 93039)
|
||||
- redhat: define pseries-rhel8.2.0 machine type (patch 93041)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/ppc/spapr.c | 278 ++++++++++++++++++++++++++++++++++++++++
|
||||
hw/ppc/spapr_cpu_core.c | 13 ++
|
||||
include/hw/ppc/spapr.h | 1 +
|
||||
target/ppc/compat.c | 13 +-
|
||||
target/ppc/cpu.h | 1 +
|
||||
5 files changed, 305 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
||||
index e076f6023c..8749c72066 100644
|
||||
--- a/hw/ppc/spapr.c
|
||||
+++ b/hw/ppc/spapr.c
|
||||
@@ -4447,6 +4447,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
||||
smc->linux_pci_probe = true;
|
||||
smc->smp_threads_vsmt = true;
|
||||
smc->nr_xirqs = SPAPR_NR_XIRQS;
|
||||
+ smc->has_power9_support = true;
|
||||
}
|
||||
|
||||
static const TypeInfo spapr_machine_info = {
|
||||
@@ -4491,6 +4492,7 @@ static const TypeInfo spapr_machine_info = {
|
||||
} \
|
||||
type_init(spapr_machine_register_##suffix)
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
/*
|
||||
* pseries-4.2
|
||||
*/
|
||||
@@ -4520,6 +4522,7 @@ static void spapr_machine_4_1_class_options(MachineClass *mc)
|
||||
}
|
||||
|
||||
DEFINE_SPAPR_MACHINE(4_1, "4.1", false);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* pseries-4.0
|
||||
@@ -4536,6 +4539,7 @@ static void phb_placement_4_0(SpaprMachineState *spapr, uint32_t index,
|
||||
*nv2atsd = 0;
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void spapr_machine_4_0_class_options(MachineClass *mc)
|
||||
{
|
||||
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
@@ -4695,6 +4699,7 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false);
|
||||
/*
|
||||
* pseries-2.7
|
||||
*/
|
||||
+#endif
|
||||
|
||||
static void phb_placement_2_7(SpaprMachineState *spapr, uint32_t index,
|
||||
uint64_t *buid, hwaddr *pio,
|
||||
@@ -4749,6 +4754,7 @@ static void phb_placement_2_7(SpaprMachineState *spapr, uint32_t index,
|
||||
*nv2atsd = 0;
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void spapr_machine_2_7_class_options(MachineClass *mc)
|
||||
{
|
||||
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
@@ -4863,6 +4869,278 @@ static void spapr_machine_2_1_class_options(MachineClass *mc)
|
||||
compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len);
|
||||
}
|
||||
DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel8.2.0
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel820_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ /* Defaults for the latest behaviour inherited from the base class */
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel820, "rhel8.2.0", true);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel8.1.0
|
||||
+ * like pseries-4.1
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel810_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+ static GlobalProperty compat[] = {
|
||||
+ /* Only allow 4kiB and 64kiB IOMMU pagesizes */
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pgsz", "0x11000" },
|
||||
+ };
|
||||
+
|
||||
+ spapr_machine_rhel820_class_options(mc);
|
||||
+
|
||||
+ /* from pseries-4.1 */
|
||||
+ smc->linux_pci_probe = false;
|
||||
+ smc->smp_threads_vsmt = false;
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_1,
|
||||
+ hw_compat_rhel_8_1_len);
|
||||
+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
|
||||
+
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel810, "rhel8.1.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel8.0.0
|
||||
+ * like pseries-3.1 and pseries-4.0
|
||||
+ * except SPAPR_CAP_CFPC, SPAPR_CAP_SBBC and SPAPR_CAP_IBS
|
||||
+ * that have been backported to pseries-rhel8.0.0
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel800_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel810_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_0,
|
||||
+ hw_compat_rhel_8_0_len);
|
||||
+
|
||||
+ /* pseries-4.0 */
|
||||
+ smc->phb_placement = phb_placement_4_0;
|
||||
+ smc->irq = &spapr_irq_xics;
|
||||
+ smc->pre_4_1_migration = true;
|
||||
+
|
||||
+ /* pseries-3.1 */
|
||||
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
|
||||
+ smc->update_dt_enabled = false;
|
||||
+ smc->dr_phb_enabled = false;
|
||||
+ smc->broken_host_serial_model = true;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_OFF;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel800, "rhel8.0.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.6.0
|
||||
+ * like spapr_compat_2_12 and spapr_compat_3_0
|
||||
+ * spapr_compat_0 is empty
|
||||
+ */
|
||||
+GlobalProperty spapr_compat_rhel7_6[] = {
|
||||
+ { TYPE_POWERPC_CPU, "pre-3.0-migration", "on" },
|
||||
+ { TYPE_SPAPR_CPU_CORE, "pre-3.0-migration", "on" },
|
||||
+};
|
||||
+const size_t spapr_compat_rhel7_6_len = G_N_ELEMENTS(spapr_compat_rhel7_6);
|
||||
+
|
||||
+
|
||||
+static void spapr_machine_rhel760_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel800_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
|
||||
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_6, spapr_compat_rhel7_6_len);
|
||||
+
|
||||
+ /* from spapr_machine_3_0_class_options() */
|
||||
+ smc->legacy_irq_allocation = true;
|
||||
+ smc->nr_xirqs = 0x400;
|
||||
+ smc->irq = &spapr_irq_xics_legacy;
|
||||
+
|
||||
+ /* from spapr_machine_2_12_class_options() */
|
||||
+ /* We depend on kvm_enabled() to choose a default value for the
|
||||
+ * hpt-max-page-size capability. Of course we can't do it here
|
||||
+ * because this is too early and the HW accelerator isn't initialzed
|
||||
+ * yet. Postpone this to machine init (see default_caps_with_cpu()).
|
||||
+ */
|
||||
+ smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 0;
|
||||
+
|
||||
+ /* SPAPR_CAP_WORKAROUND enabled in pseries-rhel800 by
|
||||
+ * f21757edc554
|
||||
+ * "Enable mitigations by default for pseries-4.0 machine type")
|
||||
+ */
|
||||
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel760, "rhel7.6.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.6.0-sxxm
|
||||
+ *
|
||||
+ * pseries-rhel7.6.0 with speculative execution exploit mitigations enabled by default
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel760sxxm_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel760_class_options(mc);
|
||||
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel760sxxm, "rhel7.6.0-sxxm", false);
|
||||
+
|
||||
+static void spapr_machine_rhel750_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ spapr_machine_rhel760_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel750, "rhel7.5.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.5.0-sxxm
|
||||
+ *
|
||||
+ * pseries-rhel7.5.0 with speculative execution exploit mitigations enabled by default
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel750sxxm_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel750_class_options(mc);
|
||||
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel750sxxm, "rhel7.5.0-sxxm", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.4.0
|
||||
+ * like spapr_compat_2_9
|
||||
+ */
|
||||
+GlobalProperty spapr_compat_rhel7_4[] = {
|
||||
+ { TYPE_POWERPC_CPU, "pre-2.10-migration", "on" },
|
||||
+};
|
||||
+const size_t spapr_compat_rhel7_4_len = G_N_ELEMENTS(spapr_compat_rhel7_4);
|
||||
+
|
||||
+static void spapr_machine_rhel740_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel750_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
|
||||
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_4, spapr_compat_rhel7_4_len);
|
||||
+ mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
|
||||
+ smc->has_power9_support = false;
|
||||
+ smc->pre_2_10_has_unused_icps = true;
|
||||
+ smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel740, "rhel7.4.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.4.0-sxxm
|
||||
+ *
|
||||
+ * pseries-rhel7.4.0 with speculative execution exploit mitigations enabled by default
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel740sxxm_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel740_class_options(mc);
|
||||
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel740sxxm, "rhel7.4.0-sxxm", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.3.0
|
||||
+ * like spapr_compat_2_6/_2_7/_2_8 but "ddw" has been backported to RHEL7_3
|
||||
+ */
|
||||
+GlobalProperty spapr_compat_rhel7_3[] = {
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem_win_size", "0xf80000000" },
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem64_win_size", "0" },
|
||||
+ { TYPE_POWERPC_CPU, "pre-2.8-migration", "on" },
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-2.8-migration", "on" },
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "pcie-extended-configuration-space", "off" },
|
||||
+};
|
||||
+const size_t spapr_compat_rhel7_3_len = G_N_ELEMENTS(spapr_compat_rhel7_3);
|
||||
+
|
||||
+static void spapr_machine_rhel730_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel740_class_options(mc);
|
||||
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3");
|
||||
+ mc->default_machine_opts = "modern-hotplug-events=off";
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
|
||||
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_3, spapr_compat_rhel7_3_len);
|
||||
+
|
||||
+ smc->phb_placement = phb_placement_2_7;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel730, "rhel7.3.0", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.3.0-sxxm
|
||||
+ *
|
||||
+ * pseries-rhel7.3.0 with speculative execution exploit mitigations enabled by default
|
||||
+ */
|
||||
+
|
||||
+static void spapr_machine_rhel730sxxm_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel730_class_options(mc);
|
||||
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
||||
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel730sxxm, "rhel7.3.0-sxxm", false);
|
||||
+
|
||||
+/*
|
||||
+ * pseries-rhel7.2.0
|
||||
+ */
|
||||
+/* Should be like spapr_compat_2_5 + 2_4 + 2_3, but "dynamic-reconfiguration"
|
||||
+ * has been backported to RHEL7_2 so we don't need it here.
|
||||
+ */
|
||||
+
|
||||
+GlobalProperty spapr_compat_rhel7_2[] = {
|
||||
+ { "spapr-vlan", "use-rx-buffer-pools", "off" },
|
||||
+ { TYPE_SPAPR_PCI_HOST_BRIDGE, "ddw", "off" },
|
||||
+};
|
||||
+const size_t spapr_compat_rhel7_2_len = G_N_ELEMENTS(spapr_compat_rhel7_2);
|
||||
+
|
||||
+static void spapr_machine_rhel720_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+
|
||||
+ spapr_machine_rhel730_class_options(mc);
|
||||
+ smc->use_ohci_by_default = true;
|
||||
+ mc->has_hotpluggable_cpus = NULL;
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_2, hw_compat_rhel_7_2_len);
|
||||
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_2, spapr_compat_rhel7_2_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_SPAPR_MACHINE(rhel720, "rhel7.2.0", false);
|
||||
|
||||
static void spapr_machine_register_types(void)
|
||||
{
|
||||
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
|
||||
index 301cd7b4e4..ba5a8fb82b 100644
|
||||
--- a/hw/ppc/spapr_cpu_core.c
|
||||
+++ b/hw/ppc/spapr_cpu_core.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "sysemu/reset.h"
|
||||
#include "sysemu/hw_accel.h"
|
||||
#include "qemu/error-report.h"
|
||||
+#include "cpu-models.h"
|
||||
|
||||
static void spapr_reset_vcpu(PowerPCCPU *cpu)
|
||||
{
|
||||
@@ -242,6 +243,7 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUState *cs = CPU(cpu);
|
||||
Error *local_err = NULL;
|
||||
+ SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
|
||||
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);
|
||||
if (local_err) {
|
||||
@@ -254,6 +256,17 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
||||
cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
|
||||
kvmppc_set_papr(cpu);
|
||||
|
||||
+ if (!smc->has_power9_support &&
|
||||
+ (((spapr->max_compat_pvr &&
|
||||
+ ppc_compat_cmp(spapr->max_compat_pvr,
|
||||
+ CPU_POWERPC_LOGICAL_3_00) >= 0)) ||
|
||||
+ (!spapr->max_compat_pvr &&
|
||||
+ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) {
|
||||
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
+ "POWER9 CPU is not supported by this machine class");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (spapr_irq_cpu_intc_create(spapr, cpu, &local_err) < 0) {
|
||||
goto error_intc_create;
|
||||
}
|
||||
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
||||
index d5ab5ea7b2..aa89cc4a95 100644
|
||||
--- a/include/hw/ppc/spapr.h
|
||||
+++ b/include/hw/ppc/spapr.h
|
||||
@@ -125,6 +125,7 @@ struct SpaprMachineClass {
|
||||
bool linux_pci_probe;
|
||||
bool smp_threads_vsmt; /* set VSMT to smp_threads by default */
|
||||
|
||||
+ bool has_power9_support;
|
||||
void (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
|
||||
uint64_t *buid, hwaddr *pio,
|
||||
hwaddr *mmio32, hwaddr *mmio64,
|
||||
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
|
||||
index 7de4bf3122..3e2e35342d 100644
|
||||
--- a/target/ppc/compat.c
|
||||
+++ b/target/ppc/compat.c
|
||||
@@ -105,8 +105,19 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2)
|
||||
+{
|
||||
+ const CompatInfo *compat1 = compat_by_pvr(pvr1);
|
||||
+ const CompatInfo *compat2 = compat_by_pvr(pvr2);
|
||||
+
|
||||
+ g_assert(compat1);
|
||||
+ g_assert(compat2);
|
||||
+
|
||||
+ return compat1 - compat2;
|
||||
+}
|
||||
+
|
||||
static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,
|
||||
- uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
||||
+ uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
||||
{
|
||||
const CompatInfo *compat = compat_by_pvr(compat_pvr);
|
||||
const CompatInfo *min = compat_by_pvr(min_compat_pvr);
|
||||
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
||||
index e3e82327b7..5c53801cfd 100644
|
||||
--- a/target/ppc/cpu.h
|
||||
+++ b/target/ppc/cpu.h
|
||||
@@ -1367,6 +1367,7 @@ static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)
|
||||
|
||||
/* Compatibility modes */
|
||||
#if defined(TARGET_PPC64)
|
||||
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2);
|
||||
bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
|
||||
uint32_t min_compat_pvr, uint32_t max_compat_pvr);
|
||||
bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr,
|
||||
--
|
||||
2.21.0
|
||||
|
126
SOURCES/0010-Add-s390x-machine-types.patch
Normal file
126
SOURCES/0010-Add-s390x-machine-types.patch
Normal file
@ -0,0 +1,126 @@
|
||||
From 0842700b3a01891c316e9169fa651f26714cafa5 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 19 Oct 2018 13:47:32 +0200
|
||||
Subject: Add s390x machine types
|
||||
|
||||
Adding changes to add RHEL machine types for s390x architecture.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (weekly-4.1.0):
|
||||
- Use upstream compat handling
|
||||
|
||||
Merged patches (3.1.0):
|
||||
- 29df663 s390x/cpumodel: default enable bpb and ppa15 for z196 and later
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- 6c200d665b hw/s390x/s390-virtio-ccw: Add machine types for RHEL8.0.0
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- fb192e5 redhat: s390x: Rename s390-ccw-virtio-rhel8.0.0 to s390-ccw-virtio-rhel8.1.0
|
||||
- a9b22e8 redhat: s390x: Add proper compatibility options for the -rhel7.6.0 machine
|
||||
- hw/s390x: Add the s390-ccw-virtio-rhel8.2.0 machine types (patch 92954)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/s390x/s390-virtio-ccw.c | 70 +++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 69 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
|
||||
index d3edeef0ad..c2c83d2fce 100644
|
||||
--- a/hw/s390x/s390-virtio-ccw.c
|
||||
+++ b/hw/s390x/s390-virtio-ccw.c
|
||||
@@ -615,7 +615,7 @@ bool css_migration_enabled(void)
|
||||
{ \
|
||||
MachineClass *mc = MACHINE_CLASS(oc); \
|
||||
ccw_machine_##suffix##_class_options(mc); \
|
||||
- mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
|
||||
+ mc->desc = "VirtIO-ccw based S390 machine " verstr; \
|
||||
if (latest) { \
|
||||
mc->alias = "s390-ccw-virtio"; \
|
||||
mc->is_default = 1; \
|
||||
@@ -639,6 +639,7 @@ bool css_migration_enabled(void)
|
||||
} \
|
||||
type_init(ccw_machine_register_##suffix)
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void ccw_machine_4_2_instance_options(MachineState *machine)
|
||||
{
|
||||
}
|
||||
@@ -866,6 +867,73 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
|
||||
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
|
||||
}
|
||||
DEFINE_CCW_MACHINE(2_4, "2.4", false);
|
||||
+#endif
|
||||
+
|
||||
+static void ccw_machine_rhel820_instance_options(MachineState *machine)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static void ccw_machine_rhel820_class_options(MachineClass *mc)
|
||||
+{
|
||||
+}
|
||||
+DEFINE_CCW_MACHINE(rhel820, "rhel8.2.0", true);
|
||||
+
|
||||
+static void ccw_machine_rhel760_instance_options(MachineState *machine)
|
||||
+{
|
||||
+ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 };
|
||||
+
|
||||
+ ccw_machine_rhel820_instance_options(machine);
|
||||
+
|
||||
+ s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat);
|
||||
+
|
||||
+ /* The multiple-epoch facility was not available with rhel7.6.0 on z14GA1 */
|
||||
+ s390_cpudef_featoff(14, 1, S390_FEAT_MULTIPLE_EPOCH);
|
||||
+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QSIE);
|
||||
+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QTOUE);
|
||||
+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOE);
|
||||
+ s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOUE);
|
||||
+}
|
||||
+
|
||||
+static void ccw_machine_rhel760_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ ccw_machine_rhel820_class_options(mc);
|
||||
+ /* We never published the s390x version of RHEL-AV 8.0 and 8.1, so add this here */
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
|
||||
+}
|
||||
+DEFINE_CCW_MACHINE(rhel760, "rhel7.6.0", false);
|
||||
+
|
||||
+static void ccw_machine_rhel750_instance_options(MachineState *machine)
|
||||
+{
|
||||
+ static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 };
|
||||
+ ccw_machine_rhel760_instance_options(machine);
|
||||
+
|
||||
+ /* before 2.12 we emulated the very first z900, and RHEL 7.5 is
|
||||
+ based on 2.10 */
|
||||
+ s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat);
|
||||
+
|
||||
+ /* bpb and ppa15 were only in the full model in RHEL 7.5 */
|
||||
+ s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15);
|
||||
+ s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB);
|
||||
+}
|
||||
+
|
||||
+GlobalProperty ccw_compat_rhel_7_5[] = {
|
||||
+ {
|
||||
+ .driver = TYPE_SCLP_EVENT_FACILITY,
|
||||
+ .property = "allow_all_mask_sizes",
|
||||
+ .value = "off",
|
||||
+ },
|
||||
+};
|
||||
+const size_t ccw_compat_rhel_7_5_len = G_N_ELEMENTS(ccw_compat_rhel_7_5);
|
||||
+
|
||||
+static void ccw_machine_rhel750_class_options(MachineClass *mc)
|
||||
+{
|
||||
+ ccw_machine_rhel760_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
|
||||
+ compat_props_add(mc->compat_props, ccw_compat_rhel_7_5, ccw_compat_rhel_7_5_len);
|
||||
+ S390_MACHINE_CLASS(mc)->hpage_1m_allowed = false;
|
||||
+}
|
||||
+DEFINE_CCW_MACHINE(rhel750, "rhel7.5.0", false);
|
||||
|
||||
static void ccw_machine_register_types(void)
|
||||
{
|
||||
--
|
||||
2.21.0
|
||||
|
897
SOURCES/0011-Add-x86_64-machine-types.patch
Normal file
897
SOURCES/0011-Add-x86_64-machine-types.patch
Normal file
@ -0,0 +1,897 @@
|
||||
From 2ebaeca6e26950f401a8169d1324be2bafd11741 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 19 Oct 2018 13:10:31 +0200
|
||||
Subject: Add x86_64 machine types
|
||||
|
||||
Adding changes to add RHEL machine types for x86_64 architecture.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (qemu-4.0.0):
|
||||
- Use upstream compat handling
|
||||
|
||||
Rebase notes (3.1.0):
|
||||
- Removed xsave changes
|
||||
|
||||
Rebase notes (4.1.0):
|
||||
- Updated format for compat structures
|
||||
|
||||
Rebase notes (4.2.0-rc2):
|
||||
- Use X86MachineClass for save_tsc_khz (upstream change)
|
||||
|
||||
Merged patches (4.1.0):
|
||||
- f4dc802 pc: 7.5 compat entries
|
||||
- 456ed3e pc: PC_RHEL7_6_COMPAT
|
||||
- 04119ee pc: Add compat for pc-i440fx-rhel7.6.0 machine type
|
||||
- b3b3687 pc: Add pc-q35-8.0.0 machine type
|
||||
- 8d46fc6 pc: Add x-migrate-smi-count=off to PC_RHEL7_6_COMPAT
|
||||
- 1de7949 kvm: clear out KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT for older machine types
|
||||
- 18cf0d7 target/i386: Disable MPX support on named CPU models (partialy)
|
||||
- 2660667 rhel: Set host-phys-bits-limit=48 on rhel machine-types
|
||||
|
||||
Merged patches (4.2.0):
|
||||
- 7d5c2ef pc: Don't make die-id mandatory unless necessary
|
||||
- e42808c x86 machine types: pc_rhel_8_0_compat
|
||||
- 9de83a8 x86 machine types: q35: Fixup units_per_default_bus
|
||||
- 6df1559 x86 machine types: Fixup dynamic sysbus entries
|
||||
- 0784125 x86 machine types: add pc-q35-rhel8.1.0
|
||||
- machines/x86: Add rhel 8.2 machine type (patch 92959)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/i386/acpi-build.c | 3 +
|
||||
hw/i386/pc.c | 263 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
hw/i386/pc_piix.c | 210 +++++++++++++++++++++++++++++++++-
|
||||
hw/i386/pc_q35.c | 156 ++++++++++++++++++++++++-
|
||||
include/hw/boards.h | 2 +
|
||||
include/hw/i386/pc.h | 33 ++++++
|
||||
target/i386/cpu.c | 9 +-
|
||||
target/i386/kvm.c | 4 +
|
||||
8 files changed, 673 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
|
||||
index 12ff55fcfb..64001893ab 100644
|
||||
--- a/hw/i386/acpi-build.c
|
||||
+++ b/hw/i386/acpi-build.c
|
||||
@@ -204,6 +204,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
|
||||
pm->fadt.reset_reg = r;
|
||||
pm->fadt.reset_val = 0xf;
|
||||
pm->fadt.flags |= 1 << ACPI_FADT_F_RESET_REG_SUP;
|
||||
+ if (object_property_get_bool(lpc,
|
||||
+ "__com.redhat_force-rev1-fadt", NULL))
|
||||
+ pm->fadt.rev = 1;
|
||||
pm->cpu_hp_io_base = ICH9_CPU_HOTPLUG_IO_BASE;
|
||||
}
|
||||
|
||||
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
|
||||
index ac08e63604..61e70e4811 100644
|
||||
--- a/hw/i386/pc.c
|
||||
+++ b/hw/i386/pc.c
|
||||
@@ -344,6 +344,261 @@ GlobalProperty pc_compat_1_4[] = {
|
||||
};
|
||||
const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4);
|
||||
|
||||
+/* This macro is for changes to properties that are RHEL specific,
|
||||
+ * different to the current upstream and to be applied to the latest
|
||||
+ * machine type.
|
||||
+ */
|
||||
+GlobalProperty pc_rhel_compat[] = {
|
||||
+ { TYPE_X86_CPU, "host-phys-bits", "on" },
|
||||
+ { TYPE_X86_CPU, "host-phys-bits-limit", "48" },
|
||||
+ /* bz 1508330 */
|
||||
+ { "vfio-pci", "x-no-geforce-quirks", "on" },
|
||||
+};
|
||||
+const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat);
|
||||
+
|
||||
+/* pc_rhel_8_1_compat is empty since pc_4_1_compat is */
|
||||
+GlobalProperty pc_rhel_8_1_compat[] = { };
|
||||
+const size_t pc_rhel_8_1_compat_len = G_N_ELEMENTS(pc_rhel_8_1_compat);
|
||||
+
|
||||
+GlobalProperty pc_rhel_8_0_compat[] = {
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "intel-iommu", "dma-drain", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G4" "-" TYPE_X86_CPU, "npt", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G4" "-" TYPE_X86_CPU, "nrip-save", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G5" "-" TYPE_X86_CPU, "npt", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Opteron_G5" "-" TYPE_X86_CPU, "nrip-save", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "EPYC" "-" TYPE_X86_CPU, "npt", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" },
|
||||
+ /** The mpx=on entries from pc_compat_3_1 are in pc_rhel_7_6_compat **/
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { "Cascadelake-Server" "-" TYPE_X86_CPU, "stepping", "5" },
|
||||
+ /* pc_rhel_8_0_compat from pc_compat_3_1 */
|
||||
+ { TYPE_X86_CPU, "x-intel-pt-auto-level", "off" },
|
||||
+};
|
||||
+const size_t pc_rhel_8_0_compat_len = G_N_ELEMENTS(pc_rhel_8_0_compat);
|
||||
+
|
||||
+/* Similar to PC_COMPAT_3_0 + PC_COMPAT_2_12, but:
|
||||
+ * all of the 2_12 stuff was already in 7.6 from bz 1481253
|
||||
+ * x-migrate-smi-count comes from PC_COMPAT_2_11 but
|
||||
+ * is really tied to kernel version so keep it off on 7.x
|
||||
+ * machine types irrespective of host.
|
||||
+ */
|
||||
+GlobalProperty pc_rhel_7_6_compat[] = {
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_3_0 */
|
||||
+ { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_3_0 */
|
||||
+ { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_3_0 */
|
||||
+ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { TYPE_X86_CPU, "x-migrate-smi-count", "off" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Cascadelake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Icelake-Client" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+ /* pc_rhel_7_6_compat from pc_compat_2_11 */
|
||||
+ { "Icelake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
|
||||
+};
|
||||
+const size_t pc_rhel_7_6_compat_len = G_N_ELEMENTS(pc_rhel_7_6_compat);
|
||||
+
|
||||
+/* Similar to PC_COMPAT_2_11 + PC_COMPAT_2_10, but:
|
||||
+ * - x-hv-max-vps was backported to 7.5
|
||||
+ * - x-pci-hole64-fix was backported to 7.5
|
||||
+ */
|
||||
+GlobalProperty pc_rhel_7_5_compat[] = {
|
||||
+ /* pc_rhel_7_5_compat from pc_compat_2_11 */
|
||||
+ { "Skylake-Server" "-" TYPE_X86_CPU, "clflushopt", "off" },
|
||||
+ /* pc_rhel_7_5_compat from pc_compat_2_12 */
|
||||
+ { TYPE_X86_CPU, "legacy-cache", "on" },
|
||||
+ /* pc_rhel_7_5_compat from pc_compat_2_12 */
|
||||
+ { TYPE_X86_CPU, "topoext", "off" },
|
||||
+ /* pc_rhel_7_5_compat from pc_compat_2_12 */
|
||||
+ { "EPYC-" TYPE_X86_CPU, "xlevel", stringify(0x8000000a) },
|
||||
+ /* pc_rhel_7_5_compat from pc_compat_2_12 */
|
||||
+ { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", stringify(0x8000000a) },
|
||||
+};
|
||||
+const size_t pc_rhel_7_5_compat_len = G_N_ELEMENTS(pc_rhel_7_5_compat);
|
||||
+
|
||||
+GlobalProperty pc_rhel_7_4_compat[] = {
|
||||
+ /* pc_rhel_7_4_compat from pc_compat_2_9 */
|
||||
+ { "mch", "extended-tseg-mbytes", stringify(0) },
|
||||
+ /* bz 1489800 */
|
||||
+ { "ICH9-LPC", "__com.redhat_force-rev1-fadt", "on" },
|
||||
+ /* pc_rhel_7_4_compat from pc_compat_2_10 */
|
||||
+ { "i440FX-pcihost", "x-pci-hole64-fix", "off" },
|
||||
+ /* pc_rhel_7_4_compat from pc_compat_2_10 */
|
||||
+ { "q35-pcihost", "x-pci-hole64-fix", "off" },
|
||||
+ /* pc_rhel_7_4_compat from pc_compat_2_10 */
|
||||
+ { TYPE_X86_CPU, "x-hv-max-vps", "0x40" },
|
||||
+};
|
||||
+const size_t pc_rhel_7_4_compat_len = G_N_ELEMENTS(pc_rhel_7_4_compat);
|
||||
+
|
||||
+GlobalProperty pc_rhel_7_3_compat[] = {
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_8 */
|
||||
+ { "kvmclock", "x-mach-use-reliable-get-clock", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { TYPE_X86_CPU, "l3-cache", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { TYPE_X86_CPU, "full-cpuid-auto-level", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "family", "15" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "model", "6" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "stepping", "1" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_7 */
|
||||
+ { "isa-pcspk", "migrate", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_6 */
|
||||
+ { TYPE_X86_CPU, "cpuid-0xb", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_8 */
|
||||
+ { "ICH9-LPC", "x-smi-broadcast", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_8 */
|
||||
+ { TYPE_X86_CPU, "vmware-cpuid-freq", "off" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_8 */
|
||||
+ { "Haswell-" TYPE_X86_CPU, "stepping", "1" },
|
||||
+ /* pc_rhel_7_3_compat from pc_compat_2_3 added in 2.9*/
|
||||
+ { TYPE_X86_CPU, "kvm-no-smi-migration", "on" },
|
||||
+};
|
||||
+const size_t pc_rhel_7_3_compat_len = G_N_ELEMENTS(pc_rhel_7_3_compat);
|
||||
+
|
||||
+GlobalProperty pc_rhel_7_2_compat[] = {
|
||||
+ { "phenom" "-" TYPE_X86_CPU, "rdtscp", "off"},
|
||||
+ { "qemu64" "-" TYPE_X86_CPU, "sse4a", "on" },
|
||||
+ { "qemu64" "-" TYPE_X86_CPU, "abm", "on" },
|
||||
+ { "Haswell-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Haswell-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Haswell-noTSX-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Haswell-noTSX-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Broadwell-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Broadwell-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Broadwell-noTSX-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "Broadwell-noTSX-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
|
||||
+ { "host" "-" TYPE_X86_CPU, "host-cache-info", "on" },
|
||||
+ { TYPE_X86_CPU, "check", "off" },
|
||||
+ { "qemu32" "-" TYPE_X86_CPU, "popcnt", "on" },
|
||||
+ { TYPE_X86_CPU, "arat", "off" },
|
||||
+ { "usb-redir", "streams", "off" },
|
||||
+ { TYPE_X86_CPU, "fill-mtrr-mask", "off" },
|
||||
+ { "apic-common", "legacy-instance-id", "on" },
|
||||
+};
|
||||
+const size_t pc_rhel_7_2_compat_len = G_N_ELEMENTS(pc_rhel_7_2_compat);
|
||||
+
|
||||
+GlobalProperty pc_rhel_7_1_compat[] = {
|
||||
+ { "kvm64" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "kvm32" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Conroe" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Penryn" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Nehalem" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Nehalem-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Westmere" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Westmere-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "SandyBridge" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "SandyBridge-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Haswell" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Haswell-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Broadwell" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Broadwell-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Opteron_G1" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Opteron_G2" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Opteron_G4" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Opteron_G5" "-" TYPE_X86_CPU, "vme", "off" },
|
||||
+ { "Haswell" "-" TYPE_X86_CPU, "f16c", "off" },
|
||||
+ { "Haswell-IBRS" "-" TYPE_X86_CPU, "f16c", "off" },
|
||||
+ { "Haswell" "-" TYPE_X86_CPU, "rdrand", "off" },
|
||||
+ { "Haswell-IBRS" "-" TYPE_X86_CPU, "rdrand", "off" },
|
||||
+ { "Broadwell" "-" TYPE_X86_CPU, "f16c", "off" },
|
||||
+ { "Broadwell-IBRS" "-" TYPE_X86_CPU, "f16c", "off" },
|
||||
+ { "Broadwell" "-" TYPE_X86_CPU, "rdrand", "off" },
|
||||
+ { "Broadwell-IBRS" "-" TYPE_X86_CPU, "rdrand", "off" },
|
||||
+ { "coreduo" "-" TYPE_X86_CPU, "vmx", "on" },
|
||||
+ { "core2duo" "-" TYPE_X86_CPU, "vmx", "on" },
|
||||
+ { "qemu64" "-" TYPE_X86_CPU, "min-level", stringify(4) },
|
||||
+ { "kvm64" "-" TYPE_X86_CPU, "min-level", stringify(5) },
|
||||
+ { "pentium3" "-" TYPE_X86_CPU, "min-level", stringify(2) },
|
||||
+ { "n270" "-" TYPE_X86_CPU, "min-level", stringify(5) },
|
||||
+ { "Conroe" "-" TYPE_X86_CPU, "min-level", stringify(4) },
|
||||
+ { "Penryn" "-" TYPE_X86_CPU, "min-level", stringify(4) },
|
||||
+ { "Nehalem" "-" TYPE_X86_CPU, "min-level", stringify(4) },
|
||||
+ { "n270" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Penryn" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Conroe" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Nehalem" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Westmere" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "SandyBridge" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "IvyBridge" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Haswell" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Haswell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Broadwell" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+ { "Broadwell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
|
||||
+};
|
||||
+const size_t pc_rhel_7_1_compat_len = G_N_ELEMENTS(pc_rhel_7_1_compat);
|
||||
+
|
||||
+/*
|
||||
+ * The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine
|
||||
+ * types as the PC_COMPAT_* do for upstream types.
|
||||
+ * PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_*
|
||||
+ * between our base and 1.5, less stuff backported to RHEL-7.0
|
||||
+ * (usb-device.msos-desc), less stuff for devices we changed
|
||||
+ * (qemu64-x86_64-cpu) or don't support (hpet, pci-serial-2x,
|
||||
+ * pci-serial-4x) in 7.0.
|
||||
+ */
|
||||
+GlobalProperty pc_rhel_7_0_compat[] = {
|
||||
+ { "virtio-scsi-pci", "any_layout", "off" },
|
||||
+ { "PIIX4_PM", "memory-hotplug-support", "off" },
|
||||
+ { "apic", "version", stringify(0x11) },
|
||||
+ { "nec-usb-xhci", "superspeed-ports-first", "off" },
|
||||
+ { "nec-usb-xhci", "force-pcie-endcap", "on" },
|
||||
+ { "pci-serial", "prog_if", stringify(0) },
|
||||
+ { "virtio-net-pci", "guest_announce", "off" },
|
||||
+ { "ICH9-LPC", "memory-hotplug-support", "off" },
|
||||
+ { "xio3130-downstream", COMPAT_PROP_PCP, "off" },
|
||||
+ { "ioh3420", COMPAT_PROP_PCP, "off" },
|
||||
+ { "PIIX4_PM", "acpi-pci-hotplug-with-bridge-support", "off" },
|
||||
+ { "e1000", "mitigation", "off" },
|
||||
+ { "virtio-net-pci", "ctrl_guest_offloads", "off" },
|
||||
+ { "Conroe" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Penryn" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Nehalem" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Nehalem-IBRS" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Westmere" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Westmere-IBRS" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Opteron_G1" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Opteron_G2" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Opteron_G3" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Opteron_G4" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+ { "Opteron_G5" "-" TYPE_X86_CPU, "x2apic", "on" },
|
||||
+};
|
||||
+const size_t pc_rhel_7_0_compat_len = G_N_ELEMENTS(pc_rhel_7_0_compat);
|
||||
+
|
||||
void gsi_handler(void *opaque, int n, int level)
|
||||
{
|
||||
GSIState *s = opaque;
|
||||
@@ -1225,7 +1480,8 @@ void pc_memory_init(PCMachineState *pcms,
|
||||
option_rom_mr = g_malloc(sizeof(*option_rom_mr));
|
||||
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
|
||||
&error_fatal);
|
||||
- if (pcmc->pci_enabled) {
|
||||
+ /* RH difference: See bz 1489800, explicitly make ROM ro */
|
||||
+ if (pcmc->pc_rom_ro) {
|
||||
memory_region_set_readonly(option_rom_mr, true);
|
||||
}
|
||||
memory_region_add_subregion_overlap(rom_memory,
|
||||
@@ -2198,6 +2454,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
|
||||
pcmc->linuxboot_dma_enabled = true;
|
||||
pcmc->pvh_enabled = true;
|
||||
assert(!mc->get_hotplug_handler);
|
||||
+ pcmc->pc_rom_ro = true;
|
||||
+ mc->async_pf_vmexit_disable = false;
|
||||
mc->get_hotplug_handler = pc_get_hotplug_handler;
|
||||
mc->hotplug_allowed = pc_hotplug_allowed;
|
||||
mc->cpu_index_to_instance_props = x86_cpu_index_to_props;
|
||||
@@ -2209,7 +2467,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
|
||||
mc->hot_add_cpu = pc_hot_add_cpu;
|
||||
mc->smp_parse = pc_smp_parse;
|
||||
mc->block_default_type = IF_IDE;
|
||||
- mc->max_cpus = 255;
|
||||
+ /* 240: max CPU count for RHEL */
|
||||
+ mc->max_cpus = 240;
|
||||
mc->reset = pc_machine_reset;
|
||||
mc->wakeup = pc_machine_wakeup;
|
||||
hc->pre_plug = pc_machine_device_pre_plug_cb;
|
||||
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
|
||||
index 1bd70d1abb..bd7fdb99bb 100644
|
||||
--- a/hw/i386/pc_piix.c
|
||||
+++ b/hw/i386/pc_piix.c
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "cpu.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
+#include "migration/migration.h"
|
||||
#ifdef CONFIG_XEN
|
||||
#include <xen/hvm/hvm_info_table.h>
|
||||
#include "hw/xen/xen_pt.h"
|
||||
@@ -173,8 +174,8 @@ static void pc_init1(MachineState *machine,
|
||||
if (pcmc->smbios_defaults) {
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
/* These values are guest ABI, do not change */
|
||||
- smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
|
||||
- mc->name, pcmc->smbios_legacy_mode,
|
||||
+ smbios_set_defaults("Red Hat", "KVM",
|
||||
+ mc->desc, pcmc->smbios_legacy_mode,
|
||||
pcmc->smbios_uuid_encoded,
|
||||
SMBIOS_ENTRY_POINT_21);
|
||||
}
|
||||
@@ -307,6 +308,7 @@ else {
|
||||
* hw_compat_*, pc_compat_*, or * pc_*_machine_options().
|
||||
*/
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void pc_compat_2_3_fn(MachineState *machine)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(machine);
|
||||
@@ -1026,3 +1028,207 @@ static void xenfv_machine_options(MachineClass *m)
|
||||
DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
|
||||
xenfv_machine_options);
|
||||
#endif
|
||||
+#endif /* Disabled for Red Hat Enterprise Linux */
|
||||
+
|
||||
+/* Red Hat Enterprise Linux machine types */
|
||||
+
|
||||
+/* Options for the latest rhel7 machine type */
|
||||
+static void pc_machine_rhel7_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ m->family = "pc_piix_Y";
|
||||
+ m->default_machine_opts = "firmware=bios-256k.bin";
|
||||
+ pcmc->default_nic_model = "e1000";
|
||||
+ m->default_display = "std";
|
||||
+ m->no_parallel = 1;
|
||||
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
|
||||
+ m->alias = "pc";
|
||||
+ m->is_default = 1;
|
||||
+}
|
||||
+
|
||||
+static void pc_init_rhel760(MachineState *machine)
|
||||
+{
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel760_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_machine_rhel7_options(m);
|
||||
+ m->desc = "RHEL 7.6.0 PC (i440FX + PIIX, 1996)";
|
||||
+ m->async_pf_vmexit_disable = true;
|
||||
+ m->smbus_no_migration_support = true;
|
||||
+ pcmc->pvh_enabled = false;
|
||||
+ pcmc->default_cpu_version = CPU_VERSION_LEGACY;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len);
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len);
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel760, "pc-i440fx-rhel7.6.0", pc_init_rhel760,
|
||||
+ pc_machine_rhel760_options);
|
||||
+
|
||||
+static void pc_init_rhel750(MachineState *machine)
|
||||
+{
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel750_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_machine_rhel760_options(m);
|
||||
+ m->alias = NULL;
|
||||
+ m->is_default = 0;
|
||||
+ m->desc = "RHEL 7.5.0 PC (i440FX + PIIX, 1996)";
|
||||
+ m->auto_enable_numa_with_memhp = false;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_5_compat, pc_rhel_7_5_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel750, "pc-i440fx-rhel7.5.0", pc_init_rhel750,
|
||||
+ pc_machine_rhel750_options);
|
||||
+
|
||||
+static void pc_init_rhel740(MachineState *machine)
|
||||
+{
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel740_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_machine_rhel750_options(m);
|
||||
+ m->desc = "RHEL 7.4.0 PC (i440FX + PIIX, 1996)";
|
||||
+ m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
|
||||
+ pcmc->pc_rom_ro = false;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_4_compat, pc_rhel_7_4_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel740, "pc-i440fx-rhel7.4.0", pc_init_rhel740,
|
||||
+ pc_machine_rhel740_options);
|
||||
+
|
||||
+static void pc_init_rhel730(MachineState *machine)
|
||||
+{
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel730_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_machine_rhel740_options(m);
|
||||
+ m->desc = "RHEL 7.3.0 PC (i440FX + PIIX, 1996)";
|
||||
+ pcmc->linuxboot_dma_enabled = false;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_3_compat, pc_rhel_7_3_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel730, "pc-i440fx-rhel7.3.0", pc_init_rhel730,
|
||||
+ pc_machine_rhel730_options);
|
||||
+
|
||||
+
|
||||
+static void pc_init_rhel720(MachineState *machine)
|
||||
+{
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel720_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
|
||||
+ pc_machine_rhel730_options(m);
|
||||
+ m->desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)";
|
||||
+ /* From pc_i440fx_2_5_machine_options */
|
||||
+ x86mc->save_tsc_khz = false;
|
||||
+ m->legacy_fw_cfg_order = 1;
|
||||
+ /* Note: broken_reserved_end was already in 7.2 */
|
||||
+ /* From pc_i440fx_2_6_machine_options */
|
||||
+ pcmc->legacy_cpu_hotplug = true;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_2, hw_compat_rhel_7_2_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_2_compat, pc_rhel_7_2_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel720, "pc-i440fx-rhel7.2.0", pc_init_rhel720,
|
||||
+ pc_machine_rhel720_options);
|
||||
+
|
||||
+static void pc_compat_rhel710(MachineState *machine)
|
||||
+{
|
||||
+ PCMachineState *pcms = PC_MACHINE(machine);
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
+
|
||||
+ /* From pc_compat_2_2 */
|
||||
+ pcmc->rsdp_in_ram = false;
|
||||
+ machine->suppress_vmdesc = true;
|
||||
+
|
||||
+ /* From pc_compat_2_1 */
|
||||
+ pcmc->smbios_uuid_encoded = false;
|
||||
+ x86_cpu_change_kvm_default("svm", NULL);
|
||||
+ pcmc->enforce_aligned_dimm = false;
|
||||
+
|
||||
+ /* Disable all the extra subsections that were added in 2.2 */
|
||||
+ migrate_pre_2_2 = true;
|
||||
+
|
||||
+ /* From pc_i440fx_2_4_machine_options */
|
||||
+ pcmc->broken_reserved_end = true;
|
||||
+}
|
||||
+
|
||||
+static void pc_init_rhel710(MachineState *machine)
|
||||
+{
|
||||
+ pc_compat_rhel710(machine);
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel710_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_machine_rhel720_options(m);
|
||||
+ m->family = "pc_piix_Y";
|
||||
+ m->desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)";
|
||||
+ m->default_display = "cirrus";
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_1, hw_compat_rhel_7_1_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_1_compat, pc_rhel_7_1_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel710, "pc-i440fx-rhel7.1.0", pc_init_rhel710,
|
||||
+ pc_machine_rhel710_options);
|
||||
+
|
||||
+static void pc_compat_rhel700(MachineState *machine)
|
||||
+{
|
||||
+ PCMachineState *pcms = PC_MACHINE(machine);
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
+
|
||||
+ pc_compat_rhel710(machine);
|
||||
+
|
||||
+ /* Upstream enables it for everyone, we're a little more selective */
|
||||
+ x86_cpu_change_kvm_default("x2apic", NULL);
|
||||
+ x86_cpu_change_kvm_default("svm", NULL);
|
||||
+ pcmc->legacy_acpi_table_size = 6418; /* see pc_compat_2_0() */
|
||||
+ pcmc->smbios_legacy_mode = true;
|
||||
+ pcmc->has_reserved_memory = false;
|
||||
+ migrate_cve_2014_5263_xhci_fields = true;
|
||||
+}
|
||||
+
|
||||
+static void pc_init_rhel700(MachineState *machine)
|
||||
+{
|
||||
+ pc_compat_rhel700(machine);
|
||||
+ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
|
||||
+ TYPE_I440FX_PCI_DEVICE);
|
||||
+}
|
||||
+
|
||||
+static void pc_machine_rhel700_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_machine_rhel710_options(m);
|
||||
+ m->family = "pc_piix_Y";
|
||||
+ m->desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)";
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_0_compat, pc_rhel_7_0_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(rhel700, "pc-i440fx-rhel7.0.0", pc_init_rhel700,
|
||||
+ pc_machine_rhel700_options);
|
||||
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
|
||||
index 385e5cffb1..7531d8ed76 100644
|
||||
--- a/hw/i386/pc_q35.c
|
||||
+++ b/hw/i386/pc_q35.c
|
||||
@@ -197,8 +197,8 @@ static void pc_q35_init(MachineState *machine)
|
||||
|
||||
if (pcmc->smbios_defaults) {
|
||||
/* These values are guest ABI, do not change */
|
||||
- smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
|
||||
- mc->name, pcmc->smbios_legacy_mode,
|
||||
+ smbios_set_defaults("Red Hat", "KVM",
|
||||
+ mc->desc, pcmc->smbios_legacy_mode,
|
||||
pcmc->smbios_uuid_encoded,
|
||||
SMBIOS_ENTRY_POINT_21);
|
||||
}
|
||||
@@ -330,6 +330,7 @@ static void pc_q35_init(MachineState *machine)
|
||||
DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
|
||||
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void pc_q35_machine_options(MachineClass *m)
|
||||
{
|
||||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
@@ -533,3 +534,154 @@ static void pc_q35_2_4_machine_options(MachineClass *m)
|
||||
|
||||
DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
|
||||
pc_q35_2_4_machine_options);
|
||||
+#endif /* Disabled for Red Hat Enterprise Linux */
|
||||
+
|
||||
+/* Red Hat Enterprise Linux machine types */
|
||||
+
|
||||
+/* Options for the latest rhel q35 machine type */
|
||||
+static void pc_q35_machine_rhel_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pcmc->default_nic_model = "e1000e";
|
||||
+ m->family = "pc_q35_Z";
|
||||
+ m->units_per_default_bus = 1;
|
||||
+ m->default_machine_opts = "firmware=bios-256k.bin";
|
||||
+ m->default_display = "std";
|
||||
+ m->no_floppy = 1;
|
||||
+ m->no_parallel = 1;
|
||||
+ pcmc->default_cpu_version = 1;
|
||||
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
|
||||
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
|
||||
+ machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
|
||||
+ m->alias = "q35";
|
||||
+ m->max_cpus = 384;
|
||||
+ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_init_rhel820(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel820_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_q35_machine_rhel_options(m);
|
||||
+ m->desc = "RHEL-8.2.0 PC (Q35 + ICH9, 2009)";
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel820, "pc-q35-rhel8.2.0", pc_q35_init_rhel820,
|
||||
+ pc_q35_machine_rhel820_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel810(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel810_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_q35_machine_rhel820_options(m);
|
||||
+ m->desc = "RHEL-8.1.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->alias = NULL;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel810, "pc-q35-rhel8.1.0", pc_q35_init_rhel810,
|
||||
+ pc_q35_machine_rhel810_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel800(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel800_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_q35_machine_rhel810_options(m);
|
||||
+ m->desc = "RHEL-8.0.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->smbus_no_migration_support = true;
|
||||
+ m->alias = NULL;
|
||||
+ pcmc->pvh_enabled = false;
|
||||
+ pcmc->default_cpu_version = CPU_VERSION_LEGACY;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel800, "pc-q35-rhel8.0.0", pc_q35_init_rhel800,
|
||||
+ pc_q35_machine_rhel800_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel760(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel760_options(MachineClass *m)
|
||||
+{
|
||||
+ pc_q35_machine_rhel800_options(m);
|
||||
+ m->alias = NULL;
|
||||
+ m->desc = "RHEL-7.6.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->async_pf_vmexit_disable = true;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel760, "pc-q35-rhel7.6.0", pc_q35_init_rhel760,
|
||||
+ pc_q35_machine_rhel760_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel750(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel750_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_q35_machine_rhel760_options(m);
|
||||
+ m->alias = NULL;
|
||||
+ m->desc = "RHEL-7.5.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->auto_enable_numa_with_memhp = false;
|
||||
+ pcmc->default_nic_model = "e1000";
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_5_compat, pc_rhel_7_5_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel750, "pc-q35-rhel7.5.0", pc_q35_init_rhel750,
|
||||
+ pc_q35_machine_rhel750_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel740(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel740_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_q35_machine_rhel750_options(m);
|
||||
+ m->desc = "RHEL-7.4.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
|
||||
+ pcmc->pc_rom_ro = false;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_4_compat, pc_rhel_7_4_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel740, "pc-q35-rhel7.4.0", pc_q35_init_rhel740,
|
||||
+ pc_q35_machine_rhel740_options);
|
||||
+
|
||||
+static void pc_q35_init_rhel730(MachineState *machine)
|
||||
+{
|
||||
+ pc_q35_init(machine);
|
||||
+}
|
||||
+
|
||||
+static void pc_q35_machine_rhel730_options(MachineClass *m)
|
||||
+{
|
||||
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
+ pc_q35_machine_rhel740_options(m);
|
||||
+ m->desc = "RHEL-7.3.0 PC (Q35 + ICH9, 2009)";
|
||||
+ m->max_cpus = 255;
|
||||
+ pcmc->linuxboot_dma_enabled = false;
|
||||
+ compat_props_add(m->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
|
||||
+ compat_props_add(m->compat_props, pc_rhel_7_3_compat, pc_rhel_7_3_compat_len);
|
||||
+}
|
||||
+
|
||||
+DEFINE_PC_MACHINE(q35_rhel730, "pc-q35-rhel7.3.0", pc_q35_init_rhel730,
|
||||
+ pc_q35_machine_rhel730_options);
|
||||
diff --git a/include/hw/boards.h b/include/hw/boards.h
|
||||
index 6f85a0e032..2920bdef5b 100644
|
||||
--- a/include/hw/boards.h
|
||||
+++ b/include/hw/boards.h
|
||||
@@ -222,6 +222,8 @@ struct MachineClass {
|
||||
const char **valid_cpu_types;
|
||||
strList *allowed_dynamic_sysbus_devices;
|
||||
bool auto_enable_numa_with_memhp;
|
||||
+ /* RHEL only */
|
||||
+ bool async_pf_vmexit_disable;
|
||||
void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
|
||||
int nb_nodes, ram_addr_t size);
|
||||
bool ignore_boot_device_suffixes;
|
||||
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
|
||||
index 1f86eba3f9..2e362c8faa 100644
|
||||
--- a/include/hw/i386/pc.h
|
||||
+++ b/include/hw/i386/pc.h
|
||||
@@ -124,6 +124,9 @@ typedef struct PCMachineClass {
|
||||
|
||||
/* use PVH to load kernels that support this feature */
|
||||
bool pvh_enabled;
|
||||
+
|
||||
+ /* RH only, see bz 1489800 */
|
||||
+ bool pc_rom_ro;
|
||||
} PCMachineClass;
|
||||
|
||||
#define TYPE_PC_MACHINE "generic-pc-machine"
|
||||
@@ -300,6 +303,36 @@ extern const size_t pc_compat_1_5_len;
|
||||
extern GlobalProperty pc_compat_1_4[];
|
||||
extern const size_t pc_compat_1_4_len;
|
||||
|
||||
+extern GlobalProperty pc_rhel_compat[];
|
||||
+extern const size_t pc_rhel_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_8_1_compat[];
|
||||
+extern const size_t pc_rhel_8_1_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_8_0_compat[];
|
||||
+extern const size_t pc_rhel_8_0_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_6_compat[];
|
||||
+extern const size_t pc_rhel_7_6_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_5_compat[];
|
||||
+extern const size_t pc_rhel_7_5_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_4_compat[];
|
||||
+extern const size_t pc_rhel_7_4_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_3_compat[];
|
||||
+extern const size_t pc_rhel_7_3_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_2_compat[];
|
||||
+extern const size_t pc_rhel_7_2_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_1_compat[];
|
||||
+extern const size_t pc_rhel_7_1_compat_len;
|
||||
+
|
||||
+extern GlobalProperty pc_rhel_7_0_compat[];
|
||||
+extern const size_t pc_rhel_7_0_compat_len;
|
||||
+
|
||||
/* Helper for setting model-id for CPU models that changed model-id
|
||||
* depending on QEMU versions up to QEMU 2.4.
|
||||
*/
|
||||
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
||||
index 1b7880ae3a..790db778ab 100644
|
||||
--- a/target/i386/cpu.c
|
||||
+++ b/target/i386/cpu.c
|
||||
@@ -1829,11 +1829,17 @@ static CPUCaches epyc_cache_info = {
|
||||
|
||||
static X86CPUDefinition builtin_x86_defs[] = {
|
||||
{
|
||||
+ /* qemu64 is the default CPU model for all *-rhel7.* machine-types.
|
||||
+ * The default on RHEL-6 was cpu64-rhel6.
|
||||
+ * libvirt assumes that qemu64 is the default for _all_ machine-types,
|
||||
+ * so we should try to keep qemu64 and cpu64-rhel6 as similar as
|
||||
+ * possible.
|
||||
+ */
|
||||
.name = "qemu64",
|
||||
.level = 0xd,
|
||||
.vendor = CPUID_VENDOR_AMD,
|
||||
.family = 6,
|
||||
- .model = 6,
|
||||
+ .model = 13,
|
||||
.stepping = 3,
|
||||
.features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
|
||||
CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
|
||||
@@ -3932,6 +3938,7 @@ static PropValue kvm_default_props[] = {
|
||||
{ "acpi", "off" },
|
||||
{ "monitor", "off" },
|
||||
{ "svm", "off" },
|
||||
+ { "kvm-pv-unhalt", "on" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
|
||||
index 1d10046a6c..86d9a1f364 100644
|
||||
--- a/target/i386/kvm.c
|
||||
+++ b/target/i386/kvm.c
|
||||
@@ -3079,6 +3079,7 @@ static int kvm_get_msrs(X86CPU *cpu)
|
||||
struct kvm_msr_entry *msrs = cpu->kvm_msr_buf->entries;
|
||||
int ret, i;
|
||||
uint64_t mtrr_top_bits;
|
||||
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
|
||||
|
||||
kvm_msr_buf_reset(cpu);
|
||||
|
||||
@@ -3388,6 +3389,9 @@ static int kvm_get_msrs(X86CPU *cpu)
|
||||
break;
|
||||
case MSR_KVM_ASYNC_PF_EN:
|
||||
env->async_pf_en_msr = msrs[i].data;
|
||||
+ if (mc->async_pf_vmexit_disable) {
|
||||
+ env->async_pf_en_msr &= ~(1ULL << 2);
|
||||
+ }
|
||||
break;
|
||||
case MSR_KVM_PV_EOI_EN:
|
||||
env->pv_eoi_en_msr = msrs[i].data;
|
||||
--
|
||||
2.21.0
|
||||
|
307
SOURCES/0012-Enable-make-check.patch
Normal file
307
SOURCES/0012-Enable-make-check.patch
Normal file
@ -0,0 +1,307 @@
|
||||
From 154215041df085271a780a2989f4f481226e3e34 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 19 Oct 2018 13:48:41 +0200
|
||||
Subject: Enable make check
|
||||
|
||||
Fixing tests after device disabling and machine types changes and enabling
|
||||
make check run during build.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase changes (4.0.0):
|
||||
- Remove testing for pseries-2.7 in endianess test
|
||||
- Disable device-plug-test on s390x as it use disabled device
|
||||
- Do not run cpu-plug-tests on 7.3 and older machine types
|
||||
|
||||
Rebase changes (4.1.0-rc0):
|
||||
- removed iotests 068
|
||||
|
||||
Rebase changes (4.1.0-rc1):
|
||||
- remove all 205 tests (unstable)
|
||||
|
||||
Rebase changes (4.2.0-rc0):
|
||||
- partially disable hd-geo-test (requires lsi53c895a)
|
||||
|
||||
Merged patches (4.0.0):
|
||||
- f7ffd13 Remove 7 qcow2 and luks iotests that are taking > 25 sec to run during the fast train build proce
|
||||
|
||||
Merged patches (4.1.0-rc0):
|
||||
- 41288ff redhat: Remove raw iotest 205
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
redhat/qemu-kvm.spec.template | 2 +-
|
||||
tests/Makefile.include | 10 +++++-----
|
||||
tests/boot-serial-test.c | 6 +++++-
|
||||
tests/cpu-plug-test.c | 4 ++--
|
||||
tests/e1000-test.c | 2 ++
|
||||
tests/hd-geo-test.c | 4 ++++
|
||||
tests/prom-env-test.c | 4 ++++
|
||||
tests/qemu-iotests/051 | 12 ++++++------
|
||||
tests/qemu-iotests/group | 4 ++--
|
||||
tests/test-x86-cpuid-compat.c | 2 ++
|
||||
tests/usb-hcd-xhci-test.c | 4 ++++
|
||||
11 files changed, 37 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/tests/Makefile.include b/tests/Makefile.include
|
||||
index b483790cf3..53bdbdfee0 100644
|
||||
--- a/tests/Makefile.include
|
||||
+++ b/tests/Makefile.include
|
||||
@@ -172,7 +172,7 @@ check-qtest-i386-y += tests/ide-test$(EXESUF)
|
||||
check-qtest-i386-y += tests/ahci-test$(EXESUF)
|
||||
check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
|
||||
check-qtest-i386-y += tests/boot-order-test$(EXESUF)
|
||||
-check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
|
||||
+#check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
|
||||
check-qtest-i386-$(CONFIG_SGA) += tests/boot-serial-test$(EXESUF)
|
||||
check-qtest-i386-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
||||
check-qtest-i386-y += tests/rtc-test$(EXESUF)
|
||||
@@ -230,7 +230,7 @@ check-qtest-mips64el-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
||||
check-qtest-moxie-y += tests/boot-serial-test$(EXESUF)
|
||||
|
||||
check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
||||
-check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
|
||||
+#check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
|
||||
check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
|
||||
check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
|
||||
check-qtest-ppc-y += tests/boot-serial-test$(EXESUF)
|
||||
@@ -244,8 +244,8 @@ check-qtest-ppc64-$(CONFIG_PSERIES) += tests/rtas-test$(EXESUF)
|
||||
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
||||
check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
||||
check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
|
||||
-check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
||||
-check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
||||
+#check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
||||
+#check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
||||
check-qtest-ppc64-$(CONFIG_RTL8139_PCI) += tests/test-filter-redirector$(EXESUF)
|
||||
check-qtest-ppc64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
||||
check-qtest-ppc64-y += tests/numa-test$(EXESUF)
|
||||
@@ -291,7 +291,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
||||
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
||||
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
|
||||
check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
|
||||
-check-qtest-s390x-y += tests/device-plug-test$(EXESUF)
|
||||
+#check-qtest-s390x-y += tests/device-plug-test$(EXESUF)
|
||||
check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
|
||||
check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
|
||||
check-qtest-s390x-y += tests/migration-test$(EXESUF)
|
||||
diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
|
||||
index d3a54a0ba5..33ce72b89c 100644
|
||||
--- a/tests/boot-serial-test.c
|
||||
+++ b/tests/boot-serial-test.c
|
||||
@@ -108,19 +108,23 @@ static testdef_t tests[] = {
|
||||
{ "ppc", "g3beige", "", "PowerPC,750" },
|
||||
{ "ppc", "mac99", "", "PowerPC,G4" },
|
||||
{ "ppc", "sam460ex", "-m 256", "DRAM: 256 MiB" },
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
{ "ppc64", "ppce500", "", "U-Boot" },
|
||||
{ "ppc64", "40p", "-m 192", "Memory: 192M" },
|
||||
{ "ppc64", "mac99", "", "PowerPC,970FX" },
|
||||
+#endif
|
||||
{ "ppc64", "pseries",
|
||||
"-machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken",
|
||||
"Open Firmware" },
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
{ "ppc64", "powernv8", "", "OPAL" },
|
||||
{ "ppc64", "powernv9", "", "OPAL" },
|
||||
{ "ppc64", "sam460ex", "-device e1000", "8086 100e" },
|
||||
+#endif
|
||||
{ "i386", "isapc", "-cpu qemu32 -device sga", "SGABIOS" },
|
||||
{ "i386", "pc", "-device sga", "SGABIOS" },
|
||||
{ "i386", "q35", "-device sga", "SGABIOS" },
|
||||
- { "x86_64", "isapc", "-cpu qemu32 -device sga", "SGABIOS" },
|
||||
+ { "x86_64", "pc", "-cpu qemu32 -device sga", "SGABIOS" },
|
||||
{ "x86_64", "q35", "-device sga", "SGABIOS" },
|
||||
{ "sparc", "LX", "", "TMS390S10" },
|
||||
{ "sparc", "SS-4", "", "MB86904" },
|
||||
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
|
||||
index 30e514bbfb..a04beae1c6 100644
|
||||
--- a/tests/cpu-plug-test.c
|
||||
+++ b/tests/cpu-plug-test.c
|
||||
@@ -185,8 +185,8 @@ static void add_pseries_test_case(const char *mname)
|
||||
char *path;
|
||||
PlugTestData *data;
|
||||
|
||||
- if (!g_str_has_prefix(mname, "pseries-") ||
|
||||
- (g_str_has_prefix(mname, "pseries-2.") && atoi(&mname[10]) < 7)) {
|
||||
+ if (!g_str_has_prefix(mname, "pseries-rhel") ||
|
||||
+ (g_str_has_prefix(mname, "pseries-rhel7.") && atoi(&mname[14]) < 4)) {
|
||||
return;
|
||||
}
|
||||
data = g_new(PlugTestData, 1);
|
||||
diff --git a/tests/e1000-test.c b/tests/e1000-test.c
|
||||
index c387984ef6..c89112d6f8 100644
|
||||
--- a/tests/e1000-test.c
|
||||
+++ b/tests/e1000-test.c
|
||||
@@ -22,9 +22,11 @@ struct QE1000 {
|
||||
|
||||
static const char *models[] = {
|
||||
"e1000",
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
"e1000-82540em",
|
||||
"e1000-82544gc",
|
||||
"e1000-82545em",
|
||||
+#endif
|
||||
};
|
||||
|
||||
static void *e1000_get_driver(void *obj, const char *interface)
|
||||
diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c
|
||||
index 7e86c5416c..cc068bad87 100644
|
||||
--- a/tests/hd-geo-test.c
|
||||
+++ b/tests/hd-geo-test.c
|
||||
@@ -732,6 +732,7 @@ static void test_override_ide(void)
|
||||
test_override(args, expected);
|
||||
}
|
||||
|
||||
+#if 0 /* Require lsi53c895a - not supported on RHEL */
|
||||
static void test_override_scsi(void)
|
||||
{
|
||||
TestArgs *args = create_args();
|
||||
@@ -776,6 +777,7 @@ static void test_override_scsi_2_controllers(void)
|
||||
add_scsi_disk(args, 3, 1, 0, 1, 2, 0, 1, 0);
|
||||
test_override(args, expected);
|
||||
}
|
||||
+#endif
|
||||
|
||||
static void test_override_virtio_blk(void)
|
||||
{
|
||||
@@ -951,9 +953,11 @@ int main(int argc, char **argv)
|
||||
qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chst);
|
||||
if (have_qemu_img()) {
|
||||
qtest_add_func("hd-geo/override/ide", test_override_ide);
|
||||
+#if 0 /* Require lsi53c895a - not supported on RHEL */
|
||||
qtest_add_func("hd-geo/override/scsi", test_override_scsi);
|
||||
qtest_add_func("hd-geo/override/scsi_2_controllers",
|
||||
test_override_scsi_2_controllers);
|
||||
+#endif
|
||||
qtest_add_func("hd-geo/override/virtio_blk", test_override_virtio_blk);
|
||||
qtest_add_func("hd-geo/override/zero_chs", test_override_zero_chs);
|
||||
qtest_add_func("hd-geo/override/scsi_hot_unplug",
|
||||
diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c
|
||||
index 61bc1d1e7b..028d45c7d7 100644
|
||||
--- a/tests/prom-env-test.c
|
||||
+++ b/tests/prom-env-test.c
|
||||
@@ -88,10 +88,14 @@ int main(int argc, char *argv[])
|
||||
if (!strcmp(arch, "ppc")) {
|
||||
add_tests(ppc_machines);
|
||||
} else if (!strcmp(arch, "ppc64")) {
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
add_tests(ppc_machines);
|
||||
if (g_test_slow()) {
|
||||
+#endif
|
||||
qtest_add_data_func("prom-env/pseries", "pseries", test_machine);
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
}
|
||||
+#endif
|
||||
} else if (!strcmp(arch, "sparc")) {
|
||||
add_tests(sparc_machines);
|
||||
} else if (!strcmp(arch, "sparc64")) {
|
||||
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
|
||||
index 53bcdbc911..b387e0c233 100755
|
||||
--- a/tests/qemu-iotests/051
|
||||
+++ b/tests/qemu-iotests/051
|
||||
@@ -181,11 +181,11 @@ run_qemu -drive if=virtio
|
||||
case "$QEMU_DEFAULT_MACHINE" in
|
||||
pc)
|
||||
run_qemu -drive if=none,id=disk -device ide-cd,drive=disk
|
||||
- run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk
|
||||
+# run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk
|
||||
run_qemu -drive if=none,id=disk -device ide-drive,drive=disk
|
||||
run_qemu -drive if=none,id=disk -device ide-hd,drive=disk
|
||||
- run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk
|
||||
- run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk
|
||||
+# run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk
|
||||
+# run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
@@ -234,11 +234,11 @@ run_qemu -drive file="$TEST_IMG",if=virtio,readonly=on
|
||||
case "$QEMU_DEFAULT_MACHINE" in
|
||||
pc)
|
||||
run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-cd,drive=disk
|
||||
- run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk
|
||||
+# run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk
|
||||
run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-drive,drive=disk
|
||||
run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device ide-hd,drive=disk
|
||||
- run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk
|
||||
- run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk
|
||||
+# run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk
|
||||
+# run_qemu -drive file="$TEST_IMG",if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
||||
index 6b10a6a762..06cc734b26 100644
|
||||
--- a/tests/qemu-iotests/group
|
||||
+++ b/tests/qemu-iotests/group
|
||||
@@ -92,7 +92,7 @@
|
||||
068 rw quick
|
||||
069 rw auto quick
|
||||
070 rw quick
|
||||
-071 rw auto quick
|
||||
+# 071 rw auto quick -- requires whitelisted blkverify
|
||||
072 rw auto quick
|
||||
073 rw auto quick
|
||||
074 rw auto quick
|
||||
@@ -120,7 +120,7 @@
|
||||
096 rw quick
|
||||
097 rw auto backing
|
||||
098 rw auto backing quick
|
||||
-099 rw auto quick
|
||||
+# 099 rw auto quick -- requires whitelisted blkverify
|
||||
# 100 was removed, do not reuse
|
||||
101 rw quick
|
||||
102 rw quick
|
||||
diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c
|
||||
index 772287bdb4..e7c075ed98 100644
|
||||
--- a/tests/test-x86-cpuid-compat.c
|
||||
+++ b/tests/test-x86-cpuid-compat.c
|
||||
@@ -300,6 +300,7 @@ int main(int argc, char **argv)
|
||||
"-cpu 486,xlevel2=0xC0000002,+xstore",
|
||||
"xlevel2", 0xC0000002);
|
||||
|
||||
+#if 0 /* Disabled in Red Hat Enterprise Linux */
|
||||
/* Check compatibility of old machine-types that didn't
|
||||
* auto-increase level/xlevel/xlevel2: */
|
||||
|
||||
@@ -350,6 +351,7 @@ int main(int argc, char **argv)
|
||||
add_cpuid_test("x86/cpuid/xlevel-compat/pc-i440fx-2.4/npt-on",
|
||||
"-machine pc-i440fx-2.4 -cpu SandyBridge,+npt",
|
||||
"xlevel", 0x80000008);
|
||||
+#endif
|
||||
|
||||
/* Test feature parsing */
|
||||
add_feature_test("x86/cpuid/features/plus",
|
||||
diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c
|
||||
index 10ef9d2a91..3855873050 100644
|
||||
--- a/tests/usb-hcd-xhci-test.c
|
||||
+++ b/tests/usb-hcd-xhci-test.c
|
||||
@@ -21,6 +21,7 @@ static void test_xhci_hotplug(void)
|
||||
usb_test_hotplug(global_qtest, "xhci", "1", NULL);
|
||||
}
|
||||
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static void test_usb_uas_hotplug(void)
|
||||
{
|
||||
QTestState *qts = global_qtest;
|
||||
@@ -36,6 +37,7 @@ static void test_usb_uas_hotplug(void)
|
||||
qtest_qmp_device_del(qts, "scsihd");
|
||||
qtest_qmp_device_del(qts, "uas");
|
||||
}
|
||||
+#endif
|
||||
|
||||
static void test_usb_ccid_hotplug(void)
|
||||
{
|
||||
@@ -56,7 +58,9 @@ int main(int argc, char **argv)
|
||||
|
||||
qtest_add_func("/xhci/pci/init", test_xhci_init);
|
||||
qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug);
|
||||
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
|
||||
+#endif
|
||||
qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
|
||||
|
||||
qtest_start("-device nec-usb-xhci,id=xhci"
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,114 @@
|
||||
From de433da59448eaad4ac1b902d07d57b57f922aff Mon Sep 17 00:00:00 2001
|
||||
From: Bandan Das <bsd@redhat.com>
|
||||
Date: Tue, 3 Dec 2013 20:05:13 +0100
|
||||
Subject: vfio: cap number of devices that can be assigned
|
||||
|
||||
RH-Author: Bandan Das <bsd@redhat.com>
|
||||
Message-id: <1386101113-31560-3-git-send-email-bsd@redhat.com>
|
||||
Patchwork-id: 55984
|
||||
O-Subject: [PATCH RHEL7 qemu-kvm v2 2/2] vfio: cap number of devices that can be assigned
|
||||
Bugzilla: 678368
|
||||
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
||||
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
|
||||
Go through all groups to get count of total number of devices
|
||||
active to enforce limit
|
||||
|
||||
Reasoning from Alex for the limit(32) - Assuming 3 slots per
|
||||
device, with 125 slots (number of memory slots for RHEL 7),
|
||||
we can support almost 40 devices and still have few slots left
|
||||
for other uses. Stepping down a bit, the number 32 arbitrarily
|
||||
matches the number of slots on a PCI bus and is also a nice power
|
||||
of two.
|
||||
|
||||
Signed-off-by: Bandan Das <bsd@redhat.com>
|
||||
|
||||
Rebase notes (2.8.0):
|
||||
- removed return value for vfio_realize (commit 1a22aca)
|
||||
|
||||
Merged patches (2.9.0):
|
||||
- 17eb774 vfio: Use error_setg when reporting max assigned device overshoot
|
||||
|
||||
Merged patches (4.1.0-rc3):
|
||||
- 2b89558 vfio: increase the cap on number of assigned devices to 64
|
||||
|
||||
(cherry picked from commit 9fa3c9fc6dfcde76d80db1aa601b2d577f72ceec)
|
||||
(cherry picked from commit 3cb35556dc7d994f203d732fe952f95fcdb03c0a)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/vfio/pci.c | 29 ++++++++++++++++++++++++++++-
|
||||
hw/vfio/pci.h | 1 +
|
||||
2 files changed, 29 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
||||
index c8534d3035..309535f306 100644
|
||||
--- a/hw/vfio/pci.c
|
||||
+++ b/hw/vfio/pci.c
|
||||
@@ -47,6 +47,9 @@
|
||||
|
||||
#define TYPE_VFIO_PCI_NOHOTPLUG "vfio-pci-nohotplug"
|
||||
|
||||
+/* RHEL only: Set once for the first assigned dev */
|
||||
+static uint16_t device_limit;
|
||||
+
|
||||
static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
|
||||
static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
|
||||
|
||||
@@ -2722,9 +2725,30 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||
ssize_t len;
|
||||
struct stat st;
|
||||
int groupid;
|
||||
- int i, ret;
|
||||
+ int ret, i = 0;
|
||||
bool is_mdev;
|
||||
|
||||
+ if (device_limit && device_limit != vdev->assigned_device_limit) {
|
||||
+ error_setg(errp, "Assigned device limit has been redefined. "
|
||||
+ "Old:%d, New:%d",
|
||||
+ device_limit, vdev->assigned_device_limit);
|
||||
+ return;
|
||||
+ } else {
|
||||
+ device_limit = vdev->assigned_device_limit;
|
||||
+ }
|
||||
+
|
||||
+ QLIST_FOREACH(group, &vfio_group_list, next) {
|
||||
+ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (i >= vdev->assigned_device_limit) {
|
||||
+ error_setg(errp, "Maximum supported vfio devices (%d) "
|
||||
+ "already attached", vdev->assigned_device_limit);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (!vdev->vbasedev.sysfsdev) {
|
||||
if (!(~vdev->host.domain || ~vdev->host.bus ||
|
||||
~vdev->host.slot || ~vdev->host.function)) {
|
||||
@@ -3167,6 +3191,9 @@ static Property vfio_pci_dev_properties[] = {
|
||||
DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false),
|
||||
DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice,
|
||||
no_geforce_quirks, false),
|
||||
+ /* RHEL only */
|
||||
+ DEFINE_PROP_UINT16("x-assigned-device-limit", VFIOPCIDevice,
|
||||
+ assigned_device_limit, 64),
|
||||
DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd,
|
||||
false),
|
||||
DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd,
|
||||
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
|
||||
index 35626cd63e..0cd4803aee 100644
|
||||
--- a/hw/vfio/pci.h
|
||||
+++ b/hw/vfio/pci.h
|
||||
@@ -135,6 +135,7 @@ typedef struct VFIOPCIDevice {
|
||||
EventNotifier err_notifier;
|
||||
EventNotifier req_notifier;
|
||||
int (*resetfn)(struct VFIOPCIDevice *);
|
||||
+ uint16_t assigned_device_limit;
|
||||
uint32_t vendor_id;
|
||||
uint32_t device_id;
|
||||
uint32_t sub_vendor_id;
|
||||
--
|
||||
2.21.0
|
||||
|
58
SOURCES/0014-Add-support-statement-to-help-output.patch
Normal file
58
SOURCES/0014-Add-support-statement-to-help-output.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 2754dd8da8975757753fd491985d5e7b36966106 Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Date: Wed, 4 Dec 2013 18:53:17 +0100
|
||||
Subject: Add support statement to -help output
|
||||
|
||||
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Message-id: <1386183197-27761-1-git-send-email-ehabkost@redhat.com>
|
||||
Patchwork-id: 55994
|
||||
O-Subject: [qemu-kvm RHEL7 PATCH] Add support statement to -help output
|
||||
Bugzilla: 972773
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: knoel@redhat.com
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
Add support statement to -help output, reporting direct qemu-kvm usage
|
||||
as unsupported by Red Hat, and advising users to use libvirt instead.
|
||||
|
||||
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
(cherry picked from commit 2a07700936e39856cc9f149c6a6517f0715536a6)
|
||||
(cherry picked from commit 5dd2f4706e2fef945771949e59a8fcc1b5452de9)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
vl.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/vl.c b/vl.c
|
||||
index 668a34577e..9f3e7e7733 100644
|
||||
--- a/vl.c
|
||||
+++ b/vl.c
|
||||
@@ -1822,9 +1822,17 @@ static void version(void)
|
||||
QEMU_COPYRIGHT "\n");
|
||||
}
|
||||
|
||||
+static void print_rh_warning(void)
|
||||
+{
|
||||
+ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\n"
|
||||
+ "WARNING: Use libvirt as the stable management interface.\n"
|
||||
+ "WARNING: Some command line options listed here may not be available in future releases.\n\n");
|
||||
+}
|
||||
+
|
||||
static void help(int exitcode)
|
||||
{
|
||||
version();
|
||||
+ print_rh_warning();
|
||||
printf("usage: %s [options] [disk_image]\n\n"
|
||||
"'disk_image' is a raw hard disk image for IDE hard disk 0\n\n",
|
||||
error_get_progname());
|
||||
@@ -1841,6 +1849,7 @@ static void help(int exitcode)
|
||||
"\n"
|
||||
QEMU_HELP_BOTTOM "\n");
|
||||
|
||||
+ print_rh_warning();
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
152
SOURCES/0015-globally-limit-the-maximum-number-of-CPUs.patch
Normal file
152
SOURCES/0015-globally-limit-the-maximum-number-of-CPUs.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From c9c3cf721b0e9e359418f64c2a5121c3f8b5d27a Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jones <drjones@redhat.com>
|
||||
Date: Tue, 21 Jan 2014 10:46:52 +0100
|
||||
Subject: globally limit the maximum number of CPUs
|
||||
|
||||
We now globally limit the number of VCPUs.
|
||||
Especially, there is no way one can specify more than
|
||||
max_cpus VCPUs for a VM.
|
||||
|
||||
This allows us the restore the ppc max_cpus limitation to the upstream
|
||||
default and minimize the ppc hack in kvm-all.c.
|
||||
|
||||
Signed-off-by: David Hildenbrand <david@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Signed-off-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
|
||||
|
||||
Rebase notes (2.11.0):
|
||||
- Removed CONFIG_RHV reference
|
||||
- Update commit log
|
||||
|
||||
Merged patches (2.11.0):
|
||||
- 92fef14623 redhat: remove manual max_cpus limitations for ppc
|
||||
- bb722e9eff redhat: globally limit the maximum number of CPUs
|
||||
- fdeef3c1c7 RHEL: Set vcpus hard limit to 240 for Power
|
||||
- 0584216921 Match POWER max cpus to x86
|
||||
|
||||
Signed-off-by: Andrew Jones <drjones@redhat.com>
|
||||
(cherry picked from commit a4ceb63bdc5cbac19f5f633ec761b9de0dedb55e)
|
||||
(cherry picked from commit a1f26d85171b4d554225150053700e93ba6eba10)
|
||||
|
||||
redhat: globally limit the maximum number of CPUs
|
||||
|
||||
RH-Author: David Hildenbrand <david@redhat.com>
|
||||
Message-id: <20180109103253.24517-2-david@redhat.com>
|
||||
Patchwork-id: 78531
|
||||
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 1/2] redhat: globally limit the maximum number of CPUs
|
||||
Bugzilla: 1527449
|
||||
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
||||
|
||||
Upstream-status: n/a
|
||||
|
||||
For RHEL, we support 240, for RHV up to 384 VCPUs. Let's limit this
|
||||
globally instead of fixing up all machines. This way, we can easily
|
||||
change (increase) the product specific levels later.
|
||||
|
||||
Signed-off-by: David Hildenbrand <david@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
redhat: remove manual max_cpus limitations for ppc
|
||||
|
||||
RH-Author: David Hildenbrand <david@redhat.com>
|
||||
Message-id: <20180109103253.24517-3-david@redhat.com>
|
||||
Patchwork-id: 78532
|
||||
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 2/2] redhat: remove manual max_cpus limitations for ppc
|
||||
Bugzilla: 1527449
|
||||
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
||||
|
||||
Upstream-status: n/a
|
||||
|
||||
RH-Author: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: <1390301212-15344-1-git-send-email-drjones@redhat.com>
|
||||
Patchwork-id: 56862
|
||||
O-Subject: [RHEL7.0 qemu-kvm PATCH v6] use recommended max vcpu count
|
||||
Bugzilla: 998708
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
|
||||
|
||||
The recommended vcpu max limit (KVM_CAP_NR_VCPUS) should be used instead
|
||||
of the actual max vcpu limit (KVM_CAP_MAX_VCPUS) to give an error.
|
||||
|
||||
This commit matches the limit to current KVM_CAP_NR_VCPUS value.
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
accel/kvm/kvm-all.c | 12 ++++++++++++
|
||||
vl.c | 18 ++++++++++++++++++
|
||||
2 files changed, 30 insertions(+)
|
||||
|
||||
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
|
||||
index ca00daa2f5..dc3ed7f04e 100644
|
||||
--- a/accel/kvm/kvm-all.c
|
||||
+++ b/accel/kvm/kvm-all.c
|
||||
@@ -1943,6 +1943,18 @@ static int kvm_init(MachineState *ms)
|
||||
soft_vcpus_limit = kvm_recommended_vcpus(s);
|
||||
hard_vcpus_limit = kvm_max_vcpus(s);
|
||||
|
||||
+#ifdef HOST_PPC64
|
||||
+ /*
|
||||
+ * On POWER, the kernel advertises a soft limit based on the
|
||||
+ * number of CPU threads on the host. We want to allow exceeding
|
||||
+ * this for testing purposes, so we don't want to set hard limit
|
||||
+ * to soft limit as on x86.
|
||||
+ */
|
||||
+#else
|
||||
+ /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
|
||||
+ hard_vcpus_limit = soft_vcpus_limit;
|
||||
+#endif
|
||||
+
|
||||
while (nc->name) {
|
||||
if (nc->num > soft_vcpus_limit) {
|
||||
warn_report("Number of %s cpus requested (%d) exceeds "
|
||||
diff --git a/vl.c b/vl.c
|
||||
index 9f3e7e7733..1550aa2aaa 100644
|
||||
--- a/vl.c
|
||||
+++ b/vl.c
|
||||
@@ -134,6 +134,8 @@ int main(int argc, char **argv)
|
||||
|
||||
#define MAX_VIRTIO_CONSOLES 1
|
||||
|
||||
+#define RHEL_MAX_CPUS 384
|
||||
+
|
||||
static const char *data_dir[16];
|
||||
static int data_dir_idx;
|
||||
const char *bios_name = NULL;
|
||||
@@ -1339,6 +1341,20 @@ static MachineClass *find_default_machine(GSList *machines)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
|
||||
+static void limit_max_cpus_in_machines(void)
|
||||
+{
|
||||
+ GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
|
||||
+
|
||||
+ for (el = machines; el; el = el->next) {
|
||||
+ MachineClass *mc = el->data;
|
||||
+
|
||||
+ if (mc->max_cpus > RHEL_MAX_CPUS) {
|
||||
+ mc->max_cpus = RHEL_MAX_CPUS;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int machine_help_func(QemuOpts *opts, MachineState *machine)
|
||||
{
|
||||
ObjectProperty *prop;
|
||||
@@ -3857,6 +3873,8 @@ int main(int argc, char **argv, char **envp)
|
||||
"mutually exclusive");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
+ /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
|
||||
+ limit_max_cpus_in_machines();
|
||||
|
||||
configure_rtc(qemu_find_opts_singleton("rtc"));
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
121
SOURCES/0016-Add-support-for-simpletrace.patch
Normal file
121
SOURCES/0016-Add-support-for-simpletrace.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From 26128b3ede339e292a3c50a84e3248af46ecd0ec Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 8 Oct 2015 09:50:17 +0200
|
||||
Subject: Add support for simpletrace
|
||||
|
||||
As simpletrace is upstream, we just need to properly handle it during rpmbuild.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
Rebase notes (3.1.0):
|
||||
- Fixed python 2 to python3 switch
|
||||
|
||||
Rebase notes (2.9.0):
|
||||
- Added group argument for tracetool.py (upstream)
|
||||
|
||||
Rebase notes (2.8.0):
|
||||
- Changed tracetool.py parameters
|
||||
|
||||
Merged patches (2.3.0):
|
||||
- db959d6 redhat/qemu-kvm.spec.template: Install qemu-kvm-simpletrace.stp
|
||||
- 5292fc3 trace: add SystemTap init scripts for simpletrace bridge
|
||||
- eda9e5e simpletrace: install simpletrace.py
|
||||
- 85c4c8f trace: add systemtap-initscript README file to RPM
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
.gitignore | 2 ++
|
||||
Makefile | 4 +++
|
||||
README.systemtap | 43 +++++++++++++++++++++++++
|
||||
redhat/qemu-kvm.spec.template | 26 ++++++++++++++-
|
||||
scripts/systemtap/conf.d/qemu_kvm.conf | 4 +++
|
||||
scripts/systemtap/script.d/qemu_kvm.stp | 1 +
|
||||
6 files changed, 79 insertions(+), 1 deletion(-)
|
||||
create mode 100644 README.systemtap
|
||||
create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
|
||||
create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 086727dbb9..4254950f7f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -939,6 +939,10 @@ endif
|
||||
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
|
||||
done
|
||||
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
|
||||
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/script.d"
|
||||
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(qemu_datadir)/systemtap/script.d/"
|
||||
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d"
|
||||
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d/"
|
||||
|
||||
.PHONY: ctags
|
||||
ctags:
|
||||
diff --git a/README.systemtap b/README.systemtap
|
||||
new file mode 100644
|
||||
index 0000000000..ad913fc990
|
||||
--- /dev/null
|
||||
+++ b/README.systemtap
|
||||
@@ -0,0 +1,43 @@
|
||||
+QEMU tracing using systemtap-initscript
|
||||
+---------------------------------------
|
||||
+
|
||||
+You can capture QEMU trace data all the time using systemtap-initscript. This
|
||||
+uses SystemTap's flight recorder mode to trace all running guests to a
|
||||
+fixed-size buffer on the host. Old trace entries are overwritten by new
|
||||
+entries when the buffer size wraps.
|
||||
+
|
||||
+1. Install the systemtap-initscript package:
|
||||
+ # yum install systemtap-initscript
|
||||
+
|
||||
+2. Install the systemtap scripts and the conf file:
|
||||
+ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
|
||||
+ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
|
||||
+
|
||||
+The set of trace events to enable is given in qemu_kvm.stp. This SystemTap
|
||||
+script can be customized to add or remove trace events provided in
|
||||
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
|
||||
+
|
||||
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
|
||||
+recorder buffer size and whether to store traces in memory only or disk too.
|
||||
+See stap(1) for option documentation.
|
||||
+
|
||||
+3. Start the systemtap service.
|
||||
+ # service systemtap start qemu_kvm
|
||||
+
|
||||
+4. Make the service start at boot time.
|
||||
+ # chkconfig systemtap on
|
||||
+
|
||||
+5. Confirm that the service works.
|
||||
+ # service systemtap status qemu_kvm
|
||||
+ qemu_kvm is running...
|
||||
+
|
||||
+When you want to inspect the trace buffer, perform the following steps:
|
||||
+
|
||||
+1. Dump the trace buffer.
|
||||
+ # staprun -A qemu_kvm >/tmp/trace.log
|
||||
+
|
||||
+2. Start the systemtap service because the preceding step stops the service.
|
||||
+ # service systemtap start qemu_kvm
|
||||
+
|
||||
+3. Translate the trace record to readable format.
|
||||
+ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
|
||||
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
|
||||
new file mode 100644
|
||||
index 0000000000..372d8160a4
|
||||
--- /dev/null
|
||||
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
|
||||
@@ -0,0 +1,4 @@
|
||||
+# Force load uprobes (see BZ#1118352)
|
||||
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
|
||||
+
|
||||
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
|
||||
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
|
||||
new file mode 100644
|
||||
index 0000000000..c04abf9449
|
||||
--- /dev/null
|
||||
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
|
||||
@@ -0,0 +1 @@
|
||||
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,118 @@
|
||||
From 97ed62562b883c384346bfef3e1c7e379f03ccab Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Fri, 30 Nov 2018 09:11:03 +0100
|
||||
Subject: Use qemu-kvm in documentation instead of qemu-system-<arch>
|
||||
|
||||
Patchwork-id: 62380
|
||||
O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCHv4] Use qemu-kvm in documentation instead of qemu-system-i386
|
||||
Bugzilla: 1140620
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
We change the name and location of qemu-kvm binaries. Update documentation
|
||||
to reflect this change. Only architectures available in RHEL are updated.
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
docs/qemu-block-drivers.texi | 2 +-
|
||||
docs/qemu-cpu-models.texi | 2 +-
|
||||
qemu-doc.texi | 6 +++---
|
||||
qemu-options.hx | 16 ++++++++--------
|
||||
4 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
|
||||
index 2c7ea49c32..5d0afb3dee 100644
|
||||
--- a/docs/qemu-block-drivers.texi
|
||||
+++ b/docs/qemu-block-drivers.texi
|
||||
@@ -2,7 +2,7 @@
|
||||
QEMU block driver reference manual
|
||||
@c man end
|
||||
|
||||
-@set qemu_system qemu-system-x86_64
|
||||
+@set qemu_system qemu-kvm
|
||||
|
||||
@c man begin DESCRIPTION
|
||||
|
||||
diff --git a/docs/qemu-cpu-models.texi b/docs/qemu-cpu-models.texi
|
||||
index f88a1def0d..c82cf8fab7 100644
|
||||
--- a/docs/qemu-cpu-models.texi
|
||||
+++ b/docs/qemu-cpu-models.texi
|
||||
@@ -2,7 +2,7 @@
|
||||
QEMU / KVM CPU model configuration
|
||||
@c man end
|
||||
|
||||
-@set qemu_system_x86 qemu-system-x86_64
|
||||
+@set qemu_system_x86 qemu-kvm
|
||||
|
||||
@c man begin DESCRIPTION
|
||||
|
||||
diff --git a/qemu-doc.texi b/qemu-doc.texi
|
||||
index 3ddf5c0a68..d460f8d2c0 100644
|
||||
--- a/qemu-doc.texi
|
||||
+++ b/qemu-doc.texi
|
||||
@@ -11,8 +11,8 @@
|
||||
@paragraphindent 0
|
||||
@c %**end of header
|
||||
|
||||
-@set qemu_system qemu-system-x86_64
|
||||
-@set qemu_system_x86 qemu-system-x86_64
|
||||
+@set qemu_system qemu-kvm
|
||||
+@set qemu_system_x86 qemu-kvm
|
||||
|
||||
@ifinfo
|
||||
@direntry
|
||||
@@ -1827,7 +1827,7 @@ Set the initial VGA graphic mode. The default is 800x600x32.
|
||||
Set OpenBIOS variables in NVRAM, for example:
|
||||
|
||||
@example
|
||||
-qemu-system-ppc -prom-env 'auto-boot?=false' \
|
||||
+qemu-kvm -prom-env 'auto-boot?=false' \
|
||||
-prom-env 'boot-device=hd:2,\yaboot' \
|
||||
-prom-env 'boot-args=conf=hd:2,\yaboot.conf'
|
||||
@end example
|
||||
diff --git a/qemu-options.hx b/qemu-options.hx
|
||||
index fc17aca631..df1d27b6f2 100644
|
||||
--- a/qemu-options.hx
|
||||
+++ b/qemu-options.hx
|
||||
@@ -2737,11 +2737,11 @@ be created for multiqueue vhost-user.
|
||||
|
||||
Example:
|
||||
@example
|
||||
-qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
|
||||
- -numa node,memdev=mem \
|
||||
- -chardev socket,id=chr0,path=/path/to/socket \
|
||||
- -netdev type=vhost-user,id=net0,chardev=chr0 \
|
||||
- -device virtio-net-pci,netdev=net0
|
||||
+qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
|
||||
+ -numa node,memdev=mem \
|
||||
+ -chardev socket,id=chr0,path=/path/to/socket \
|
||||
+ -netdev type=vhost-user,id=net0,chardev=chr0 \
|
||||
+ -device virtio-net-pci,netdev=net0
|
||||
@end example
|
||||
|
||||
@item -netdev hubport,id=@var{id},hubid=@var{hubid}[,netdev=@var{nd}]
|
||||
@@ -3631,14 +3631,14 @@ ETEXI
|
||||
|
||||
DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
|
||||
"-realtime [mlock=on|off]\n"
|
||||
- " run qemu with realtime features\n"
|
||||
+ " run qemu-kvm with realtime features\n"
|
||||
" mlock=on|off controls mlock support (default: on)\n",
|
||||
QEMU_ARCH_ALL)
|
||||
STEXI
|
||||
@item -realtime mlock=on|off
|
||||
@findex -realtime
|
||||
-Run qemu with realtime features.
|
||||
-mlocking qemu and guest memory can be enabled via @option{mlock=on}
|
||||
+Run qemu-kvm with realtime features.
|
||||
+mlocking qemu-kvm and guest memory can be enabled via @option{mlock=on}
|
||||
(enabled by default).
|
||||
ETEXI
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
96
SOURCES/0018-usb-xhci-Fix-PCI-capability-order.patch
Normal file
96
SOURCES/0018-usb-xhci-Fix-PCI-capability-order.patch
Normal file
@ -0,0 +1,96 @@
|
||||
From b13a7d3527c5c91e7a50236de30a2244b8453911 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Fri, 5 May 2017 19:06:14 +0200
|
||||
Subject: usb-xhci: Fix PCI capability order
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20170505190614.15987-2-dgilbert@redhat.com>
|
||||
Patchwork-id: 75038
|
||||
O-Subject: [RHEL-7.4 qemu-kvm-rhev PATCH 1/1] usb-xhci: Fix PCI capability order
|
||||
Bugzilla: 1447874
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
||||
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
|
||||
Upstream commit 1108b2f8a9 in 2.7.0 changed the order
|
||||
of the PCI capability chain in the XHCI pci device in the case
|
||||
where the device has the PCIe endpoint capability (i.e. only
|
||||
older machine types, pc-i440fx-2.0 upstream, pc-i440fx-rhel7.0.0
|
||||
apparently for us).
|
||||
|
||||
Changing the order breaks migration compatibility; fixing this
|
||||
upstream would mean breaking the same case going from 2.7.0->current
|
||||
that currently works 2.7.0->2.9.0 - so upstream it's a choice
|
||||
of two breakages.
|
||||
|
||||
Since we never released 2.7.0/2.8.0 we can fix this downstream.
|
||||
|
||||
This reverts the order so that we create the capabilities in the
|
||||
order:
|
||||
PCIe
|
||||
MSI
|
||||
MSI-X
|
||||
|
||||
The symptom is:
|
||||
qemu-kvm: get_pci_config_device: Bad config data: i=0x71 read: a0 device: 0 cmask: ff wmask: 0 w1cmask:0
|
||||
qemu-kvm: Failed to load PCIDevice:config
|
||||
qemu-kvm: Failed to load xhci:parent_obj
|
||||
qemu-kvm: error while loading state for instance 0x0 of device '0000:00:0d.0/xhci'
|
||||
qemu-kvm: load of migration failed: Invalid argument
|
||||
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
--
|
||||
Rebase notes (2.9.0):
|
||||
- Change in assert condition (upstream)
|
||||
|
||||
(cherry picked from commit aad727a5ecde1ad4935eb8427604d4df5a1f1f35)
|
||||
(cherry picked from commit 2dd7402227e77d748a7375233ac9e7feab244bda)
|
||||
|
||||
Conflicts:
|
||||
hw/usb/hcd-xhci.c
|
||||
|
||||
(cherry picked from commit a42f86dc906cc7d2c16d02bf125ed76847b469cb)
|
||||
(cherry picked from commit 992ab2e4f6e15d3e51bc716763aa8d6f45c6d29d)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/usb/hcd-xhci.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
|
||||
index 8fed2eedd6..d2b9744030 100644
|
||||
--- a/hw/usb/hcd-xhci.c
|
||||
+++ b/hw/usb/hcd-xhci.c
|
||||
@@ -3403,6 +3403,12 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp)
|
||||
xhci->max_pstreams_mask = 0;
|
||||
}
|
||||
|
||||
+ if (pci_bus_is_express(pci_get_bus(dev)) ||
|
||||
+ xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
|
||||
+ ret = pcie_endpoint_cap_init(dev, 0xa0);
|
||||
+ assert(ret > 0);
|
||||
+ }
|
||||
+
|
||||
if (xhci->msi != ON_OFF_AUTO_OFF) {
|
||||
ret = msi_init(dev, 0x70, xhci->numintrs, true, false, &err);
|
||||
/* Any error other than -ENOTSUP(board's MSI support is broken)
|
||||
@@ -3451,12 +3457,6 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp)
|
||||
PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64,
|
||||
&xhci->mem);
|
||||
|
||||
- if (pci_bus_is_express(pci_get_bus(dev)) ||
|
||||
- xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
|
||||
- ret = pcie_endpoint_cap_init(dev, 0xa0);
|
||||
- assert(ret > 0);
|
||||
- }
|
||||
-
|
||||
if (xhci->msix != ON_OFF_AUTO_OFF) {
|
||||
/* TODO check for errors, and should fail when msix=on */
|
||||
msix_init(dev, xhci->numintrs,
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 3fab8f5e8a9e190c1ed6916ac13c7c4d65e874b7 Mon Sep 17 00:00:00 2001
|
||||
From: Fam Zheng <famz@redhat.com>
|
||||
Date: Wed, 14 Jun 2017 15:37:01 +0200
|
||||
Subject: virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
|
||||
|
||||
RH-Author: Fam Zheng <famz@redhat.com>
|
||||
Message-id: <20170614153701.14757-1-famz@redhat.com>
|
||||
Patchwork-id: 75613
|
||||
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH v3] virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
|
||||
Bugzilla: 1378816
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
We need a fix for RHEL 7.4 and 7.3.z, but unfortunately upstream isn't
|
||||
ready. If it were, the changes will be too invasive. To have an idea:
|
||||
|
||||
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg05400.html
|
||||
|
||||
is an incomplete attempt to fix part of the issue, and the remaining
|
||||
work unfortunately involve even more complex changes.
|
||||
|
||||
As a band-aid, this partially reverts the effect of ef8875b
|
||||
(virtio-scsi: Remove op blocker for dataplane, since v2.7). We cannot
|
||||
simply revert that commit as a whole because we already shipped it in
|
||||
qemu-kvm-rhev 7.3, since when, block jobs has been possible. We should
|
||||
only block what has been broken. Also, faithfully reverting the above
|
||||
commit means adding back the removed op blocker, but that is not enough,
|
||||
because it still crashes when inserting media into an initially empty
|
||||
scsi-cd.
|
||||
|
||||
All in all, scsi-cd on virtio-scsi-dataplane has basically been unusable
|
||||
unless the scsi-cd never enters an empty state, so, disable it
|
||||
altogether. Otherwise it would be much more difficult to avoid
|
||||
crashing.
|
||||
|
||||
Signed-off-by: Fam Zheng <famz@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
(cherry picked from commit b0caf00bbc35c7d89e02999bdce86e1f867728e8)
|
||||
(cherry picked from commit c9c4f117d8b507c2f86035c282d537c0a327364f)
|
||||
(cherry picked from commit 5d586bb2543337f0ff172c6ce942dba3acbcedff)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/scsi/virtio-scsi.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
|
||||
index e8b2b64d09..54108c0056 100644
|
||||
--- a/hw/scsi/virtio-scsi.c
|
||||
+++ b/hw/scsi/virtio-scsi.c
|
||||
@@ -808,6 +808,15 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
SCSIDevice *sd = SCSI_DEVICE(dev);
|
||||
int ret;
|
||||
|
||||
+ /* XXX: Remove this check once block backend is capable of handling
|
||||
+ * AioContext change upon eject/insert.
|
||||
+ * s->ctx is NULL if ioeventfd is off, s->ctx is qemu_get_aio_context() if
|
||||
+ * data plane is not used, both cases are safe for scsi-cd. */
|
||||
+ if (s->ctx && s->ctx != qemu_get_aio_context() &&
|
||||
+ object_dynamic_cast(OBJECT(dev), "scsi-cd")) {
|
||||
+ error_setg(errp, "scsi-cd is not supported by data plane");
|
||||
+ return;
|
||||
+ }
|
||||
if (s->ctx && !s->dataplane_fenced) {
|
||||
if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
|
||||
return;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 148e9e80a3a430615b552075082fad22d007d851 Mon Sep 17 00:00:00 2001
|
||||
From: David Gibson <dgibson@redhat.com>
|
||||
Date: Wed, 6 Feb 2019 03:58:56 +0000
|
||||
Subject: BZ1653590: Require at least 64kiB pages for downstream guests & hosts
|
||||
|
||||
RH-Author: David Gibson <dgibson@redhat.com>
|
||||
Message-id: <20190206035856.19058-1-dgibson@redhat.com>
|
||||
Patchwork-id: 84246
|
||||
O-Subject: [RHELAV-8.0/rhel qemu-kvm PATCH] BZ1653590: Require at least 64kiB pages for downstream guests & hosts
|
||||
Bugzilla: 1653590
|
||||
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
||||
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
|
||||
Most current POWER guests require 64kiB page support, so that's the default
|
||||
for the cap-hpt-max-pagesize option in qemu which limits available guest
|
||||
page sizes. We warn if the value is set smaller than that, but don't
|
||||
outright fail upstream, because we need to allow for the possibility of
|
||||
guest (and/or host) kernels configured for 4kiB page sizes.
|
||||
|
||||
Downstream, however, we simply don't support 4kiB pagesize configured
|
||||
kernels in guest or host, so we can have qemu simply error out in this
|
||||
situation.
|
||||
|
||||
Testing: Attempted to start a guest with cap-hpt-max-page-size=4k and verified
|
||||
it failed immediately with a qemu error
|
||||
|
||||
Signed-off-by: David Gibson <dgibson@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/ppc/spapr_caps.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
|
||||
index 481dfd2a27..805f38533e 100644
|
||||
--- a/hw/ppc/spapr_caps.c
|
||||
+++ b/hw/ppc/spapr_caps.c
|
||||
@@ -351,12 +351,19 @@ void spapr_check_pagesize(SpaprMachineState *spapr, hwaddr pagesize,
|
||||
static void cap_hpt_maxpagesize_apply(SpaprMachineState *spapr,
|
||||
uint8_t val, Error **errp)
|
||||
{
|
||||
+#if 0 /* disabled for RHEL */
|
||||
if (val < 12) {
|
||||
error_setg(errp, "Require at least 4kiB hpt-max-page-size");
|
||||
return;
|
||||
} else if (val < 16) {
|
||||
warn_report("Many guests require at least 64kiB hpt-max-page-size");
|
||||
}
|
||||
+#else /* Only page sizes >=64kiB supported for RHEL */
|
||||
+ if (val < 16) {
|
||||
+ error_setg(errp, "Require at least 64kiB hpt-max-page-size");
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
spapr_check_pagesize(spapr, qemu_minrampagesize(), errp);
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,61 @@
|
||||
From ab9ebc29bb9bb142e73a160750a451d40bfe9746 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
|
||||
Date: Mon, 16 Sep 2019 17:07:00 +0100
|
||||
Subject: Using ip_deq after m_free might read pointers from an allocation
|
||||
reuse.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Message-id: <20190916170700.647-2-philmd@redhat.com>
|
||||
Patchwork-id: 90470
|
||||
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/1] Using ip_deq after m_free might read pointers from an allocation reuse.
|
||||
Bugzilla: 1749737
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
|
||||
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
|
||||
This would be difficult to exploit, but that is still related with
|
||||
CVE-2019-14378 which generates fragmented IP packets that would trigger this
|
||||
issue and at least produce a DoS.
|
||||
|
||||
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
(cherry picked from libslirp commit c59279437eda91841b9d26079c70b8a540d41204)
|
||||
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
slirp/src/ip_input.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
|
||||
index 8c75d91495..df1c846ade 100644
|
||||
--- a/slirp/src/ip_input.c
|
||||
+++ b/slirp/src/ip_input.c
|
||||
@@ -292,6 +292,7 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
|
||||
*/
|
||||
while (q != (struct ipasfrag *)&fp->frag_link &&
|
||||
ip->ip_off + ip->ip_len > q->ipf_off) {
|
||||
+ struct ipasfrag *prev;
|
||||
i = (ip->ip_off + ip->ip_len) - q->ipf_off;
|
||||
if (i < q->ipf_len) {
|
||||
q->ipf_len -= i;
|
||||
@@ -299,9 +300,11 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
|
||||
m_adj(dtom(slirp, q), i);
|
||||
break;
|
||||
}
|
||||
+ prev = q;
|
||||
q = q->ipf_next;
|
||||
- m_free(dtom(slirp, q->ipf_prev));
|
||||
- ip_deq(q->ipf_prev);
|
||||
+ ip_deq(prev);
|
||||
+ m_free(dtom(slirp, prev));
|
||||
+
|
||||
}
|
||||
|
||||
insert:
|
||||
--
|
||||
2.21.0
|
||||
|
1
SOURCES/81-kvm-rhel.rules
Normal file
1
SOURCES/81-kvm-rhel.rules
Normal file
@ -0,0 +1 @@
|
||||
DEVPATH=="*/kvm", ACTION=="change", RUN+="/lib/udev/udev-kvm-check $env{COUNT} $env{EVENT}"
|
5
SOURCES/85-kvm.preset
Normal file
5
SOURCES/85-kvm.preset
Normal file
@ -0,0 +1,5 @@
|
||||
# Enable kvm-setup by default. This can have odd side effects on
|
||||
# PowerNV systems that aren't intended as KVM hosts, but at present we
|
||||
# only support RHEL on PowerNV for the purpose of being a RHEV host.
|
||||
|
||||
enable kvm-setup.service
|
10
SOURCES/95-kvm-memlock.conf
Normal file
10
SOURCES/95-kvm-memlock.conf
Normal file
@ -0,0 +1,10 @@
|
||||
# The KVM HV implementation on Power can require a significant amount
|
||||
# of unswappable memory (about half of which also needs to be host
|
||||
# physically contiguous) to hold the guest's Hash Page Table (HPT) -
|
||||
# roughly 1/64th of the guest's RAM size, minimum 16MiB.
|
||||
#
|
||||
# These limits allow unprivileged users to start smallish VMs, such as
|
||||
# those used by libguestfs.
|
||||
#
|
||||
* hard memlock 65536
|
||||
* soft memlock 65536
|
2
SOURCES/99-qemu-guest-agent.rules
Normal file
2
SOURCES/99-qemu-guest-agent.rules
Normal file
@ -0,0 +1,2 @@
|
||||
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \
|
||||
TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"
|
39
SOURCES/README.tests
Normal file
39
SOURCES/README.tests
Normal file
@ -0,0 +1,39 @@
|
||||
qemu-kvm-tests README
|
||||
=====================
|
||||
|
||||
The qemu-kvm-tests rpm contains tests that can be used to verify the
|
||||
functionality of the installed qemu-kvm package
|
||||
|
||||
When installed, the files from this rpm will be arranged in the following
|
||||
directory structure
|
||||
|
||||
tests-src/
|
||||
├── README
|
||||
├── scripts
|
||||
│ ├── qemu.py
|
||||
│ └── qmp
|
||||
└── tests
|
||||
├── acceptance
|
||||
├── Makefile.include
|
||||
└── qemu-iotests
|
||||
|
||||
The tests/ directory within the tests-src/ directory is setup to remain a copy
|
||||
of a subset of the tests/ directory from the QEMU source tree
|
||||
|
||||
The avocado_qemu tests and qemu-iotests, along with files required for the
|
||||
execution of the avocado_qemu tests (scripts/qemu.py and scripts/qmp/) will be
|
||||
installed in a new location - /usr/lib64/qemu-kvm/tests-src/
|
||||
|
||||
avocado_qemu tests:
|
||||
The avocado_qemu tests can be executed by running the following avocado command:
|
||||
avocado run -p qemu_bin=/usr/libexec/qemu-kvm /usr/lib64/qemu-kvm/tests/acceptance/
|
||||
Avocado needs to be installed separately using either pip or from source as
|
||||
Avocado is not being packaged for RHEL-8.
|
||||
|
||||
qemu-iotests:
|
||||
symlinks to corresponding binaries need to be created for QEMU_PROG,
|
||||
QEMU_IO_PROG, QEMU_IMG_PROG, and QEMU_NBD_PROG before the iotests can be
|
||||
executed.
|
||||
|
||||
The primary purpose of this package is to make these tests available to be
|
||||
executed as gating tests for the virt module in the RHEL-8 OSCI environment.
|
1
SOURCES/bridge.conf
Normal file
1
SOURCES/bridge.conf
Normal file
@ -0,0 +1 @@
|
||||
allow virbr0
|
13
SOURCES/ksm.service
Normal file
13
SOURCES/ksm.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Kernel Samepage Merging
|
||||
ConditionPathExists=/sys/kernel/mm/ksm
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/sysconfig/ksm
|
||||
ExecStart=/usr/libexec/ksmctl start
|
||||
ExecStop=/usr/libexec/ksmctl stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
4
SOURCES/ksm.sysconfig
Normal file
4
SOURCES/ksm.sysconfig
Normal file
@ -0,0 +1,4 @@
|
||||
# The maximum number of unswappable kernel pages
|
||||
# which may be allocated by ksm (0 for unlimited)
|
||||
# If unset, defaults to half of total memory
|
||||
# KSM_MAX_KERNEL_PAGES=
|
77
SOURCES/ksmctl.c
Normal file
77
SOURCES/ksmctl.c
Normal file
@ -0,0 +1,77 @@
|
||||
/* Start/stop KSM, for systemd.
|
||||
* Copyright (C) 2009, 2011 Red Hat, Inc.
|
||||
* Written by Paolo Bonzini <pbonzini@redhat.com>.
|
||||
* Based on the original sysvinit script by Dan Kenigsberg <danken@redhat.com>
|
||||
* This file is distributed under the GNU General Public License, version 2
|
||||
* or later. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define KSM_MAX_KERNEL_PAGES_FILE "/sys/kernel/mm/ksm/max_kernel_pages"
|
||||
#define KSM_RUN_FILE "/sys/kernel/mm/ksm/run"
|
||||
|
||||
char *program_name;
|
||||
|
||||
int usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s {start|stop}\n", program_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int write_value(uint64_t value, char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
if (!(fp = fopen(filename, "w")) ||
|
||||
fprintf(fp, "%llu\n", (unsigned long long) value) == EOF ||
|
||||
fflush(fp) == EOF ||
|
||||
fclose(fp) == EOF)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t ksm_max_kernel_pages()
|
||||
{
|
||||
char *var = getenv("KSM_MAX_KERNEL_PAGES");
|
||||
char *endptr;
|
||||
uint64_t value;
|
||||
if (var && *var) {
|
||||
value = strtoll(var, &endptr, 0);
|
||||
if (value < LLONG_MAX && !*endptr)
|
||||
return value;
|
||||
}
|
||||
/* Unless KSM_MAX_KERNEL_PAGES is set, let KSM munch up to half of
|
||||
* total memory. */
|
||||
return sysconf(_SC_PHYS_PAGES) / 2;
|
||||
}
|
||||
|
||||
int start(void)
|
||||
{
|
||||
if (access(KSM_MAX_KERNEL_PAGES_FILE, R_OK) >= 0)
|
||||
write_value(ksm_max_kernel_pages(), KSM_MAX_KERNEL_PAGES_FILE);
|
||||
return write_value(1, KSM_RUN_FILE);
|
||||
}
|
||||
|
||||
int stop(void)
|
||||
{
|
||||
return write_value(0, KSM_RUN_FILE);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
program_name = argv[0];
|
||||
if (argc < 2) {
|
||||
return usage();
|
||||
} else if (!strcmp(argv[1], "start")) {
|
||||
return start();
|
||||
} else if (!strcmp(argv[1], "stop")) {
|
||||
return stop();
|
||||
} else {
|
||||
return usage();
|
||||
}
|
||||
}
|
139
SOURCES/ksmtuned
Normal file
139
SOURCES/ksmtuned
Normal file
@ -0,0 +1,139 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
|
||||
# Released under the GPL
|
||||
#
|
||||
# Author: Dan Kenigsberg <danken@redhat.com>
|
||||
#
|
||||
# ksmtuned - a simple script that controls whether (and with what vigor) ksm
|
||||
# should search for duplicated pages.
|
||||
#
|
||||
# starts ksm when memory commited to qemu processes exceeds a threshold, and
|
||||
# make ksm work harder and harder untill memory load falls below that
|
||||
# threshold.
|
||||
#
|
||||
# send SIGUSR1 to this process right after a new qemu process is started, or
|
||||
# following its death, to retune ksm accordingly
|
||||
#
|
||||
# needs testing and ironing. contact danken@redhat.com if something breaks.
|
||||
|
||||
if [ -f /etc/ksmtuned.conf ]; then
|
||||
. /etc/ksmtuned.conf
|
||||
fi
|
||||
|
||||
debug() {
|
||||
if [ -n "$DEBUG" ]; then
|
||||
s="`/bin/date`: $*"
|
||||
[ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
|
||||
KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
|
||||
KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}
|
||||
|
||||
KSM_NPAGES_MIN=${KSM_NPAGES_MIN:-64}
|
||||
KSM_NPAGES_MAX=${KSM_NPAGES_MAX:-1250}
|
||||
# millisecond sleep between ksm scans for 16Gb server. Smaller servers sleep
|
||||
# more, bigger sleep less.
|
||||
KSM_SLEEP_MSEC=${KSM_SLEEP_MSEC:-10}
|
||||
|
||||
KSM_THRES_COEF=${KSM_THRES_COEF:-20}
|
||||
KSM_THRES_CONST=${KSM_THRES_CONST:-2048}
|
||||
|
||||
total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
|
||||
debug total $total
|
||||
|
||||
npages=0
|
||||
sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
|
||||
[ $sleep -le 10 ] && sleep=10
|
||||
debug sleep $sleep
|
||||
thres=$[total * KSM_THRES_COEF / 100]
|
||||
if [ $KSM_THRES_CONST -gt $thres ]; then
|
||||
thres=$KSM_THRES_CONST
|
||||
fi
|
||||
debug thres $thres
|
||||
|
||||
KSMCTL () {
|
||||
case x$1 in
|
||||
xstop)
|
||||
echo 0 > /sys/kernel/mm/ksm/run
|
||||
;;
|
||||
xstart)
|
||||
echo $2 > /sys/kernel/mm/ksm/pages_to_scan
|
||||
echo $3 > /sys/kernel/mm/ksm/sleep_millisecs
|
||||
echo 1 > /sys/kernel/mm/ksm/run
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
committed_memory () {
|
||||
# calculate how much memory is committed to running qemu processes
|
||||
local pidlist
|
||||
pidlist=$(pgrep -d ' ' -- '^qemu(-(kvm|system-.+)|:.{1,11})$')
|
||||
if [ -n "$pidlist" ]; then
|
||||
ps -p "$pidlist" -o rsz=
|
||||
fi | awk '{ sum += $1 }; END { print 0+sum }'
|
||||
}
|
||||
|
||||
free_memory () {
|
||||
awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END {print free}' \
|
||||
/proc/meminfo
|
||||
}
|
||||
|
||||
increase_npages() {
|
||||
local delta
|
||||
delta=${1:-0}
|
||||
npages=$[npages + delta]
|
||||
if [ $npages -lt $KSM_NPAGES_MIN ]; then
|
||||
npages=$KSM_NPAGES_MIN
|
||||
elif [ $npages -gt $KSM_NPAGES_MAX ]; then
|
||||
npages=$KSM_NPAGES_MAX
|
||||
fi
|
||||
echo $npages
|
||||
}
|
||||
|
||||
|
||||
adjust () {
|
||||
local free committed
|
||||
free=`free_memory`
|
||||
committed=`committed_memory`
|
||||
debug committed $committed free $free
|
||||
if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
|
||||
KSMCTL stop
|
||||
debug "$[committed + thres] < $total and free > $thres, stop ksm"
|
||||
return 1
|
||||
fi
|
||||
debug "$[committed + thres] > $total, start ksm"
|
||||
if [ $free -lt $thres ]; then
|
||||
npages=`increase_npages $KSM_NPAGES_BOOST`
|
||||
debug "$free < $thres, boost"
|
||||
else
|
||||
npages=`increase_npages $KSM_NPAGES_DECAY`
|
||||
debug "$free > $thres, decay"
|
||||
fi
|
||||
KSMCTL start $npages $sleep
|
||||
debug "KSMCTL start $npages $sleep"
|
||||
return 0
|
||||
}
|
||||
|
||||
function nothing () {
|
||||
:
|
||||
}
|
||||
|
||||
loop () {
|
||||
trap nothing SIGUSR1
|
||||
while true
|
||||
do
|
||||
sleep $KSM_MONITOR_INTERVAL &
|
||||
wait $!
|
||||
adjust
|
||||
done
|
||||
}
|
||||
|
||||
PIDFILE=${PIDFILE-/var/run/ksmtune.pid}
|
||||
if touch "$PIDFILE"; then
|
||||
loop &
|
||||
echo $! > "$PIDFILE"
|
||||
fi
|
21
SOURCES/ksmtuned.conf
Normal file
21
SOURCES/ksmtuned.conf
Normal file
@ -0,0 +1,21 @@
|
||||
# Configuration file for ksmtuned.
|
||||
|
||||
# How long ksmtuned should sleep between tuning adjustments
|
||||
# KSM_MONITOR_INTERVAL=60
|
||||
|
||||
# Millisecond sleep between ksm scans for 16Gb server.
|
||||
# Smaller servers sleep more, bigger sleep less.
|
||||
# KSM_SLEEP_MSEC=10
|
||||
|
||||
# KSM_NPAGES_BOOST=300
|
||||
# KSM_NPAGES_DECAY=-50
|
||||
# KSM_NPAGES_MIN=64
|
||||
# KSM_NPAGES_MAX=1250
|
||||
|
||||
# KSM_THRES_COEF=20
|
||||
# KSM_THRES_CONST=2048
|
||||
|
||||
# uncomment the following if you want ksmtuned debug info
|
||||
|
||||
# LOGFILE=/var/log/ksmtuned
|
||||
# DEBUG=1
|
12
SOURCES/ksmtuned.service
Normal file
12
SOURCES/ksmtuned.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Kernel Samepage Merging (KSM) Tuning Daemon
|
||||
After=ksm.service
|
||||
Requires=ksm.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/ksmtuned
|
||||
ExecReload=/bin/kill -USR1 $MAINPID
|
||||
Type=forking
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,41 @@
|
||||
From ff8529dcbf86b3a086d64dd630cf6a687603c571 Mon Sep 17 00:00:00 2001
|
||||
From: "plai@redhat.com" <plai@redhat.com>
|
||||
Date: Thu, 21 May 2020 23:56:55 +0100
|
||||
Subject: [PATCH 12/12] ACPI: add expected files for HMAT tests (acpihmat)
|
||||
|
||||
RH-Author: plai@redhat.com
|
||||
Message-id: <20200521235655.27141-12-plai@redhat.com>
|
||||
Patchwork-id: 96742
|
||||
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 11/11] ACPI: add expected files for HMAT tests (acpihmat)
|
||||
Bugzilla: 1600217
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
|
||||
From: "Michael S. Tsirkin" <mst@redhat.com>
|
||||
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit 48892c6c8def6624a0ed57e2bd6c2a0a9878b973)
|
||||
Signed-off-by: Paul Lai <plai@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/bios-tables-test-allowed-diff.h | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/tests/bios-tables-test-allowed-diff.h b/tests/bios-tables-test-allowed-diff.h
|
||||
index 3c9e0c9..dfb8523 100644
|
||||
--- a/tests/bios-tables-test-allowed-diff.h
|
||||
+++ b/tests/bios-tables-test-allowed-diff.h
|
||||
@@ -1,9 +1 @@
|
||||
/* List of comma-separated changed AML files to ignore */
|
||||
-"tests/data/acpi/pc/APIC.acpihmat",
|
||||
-"tests/data/acpi/pc/SRAT.acpihmat",
|
||||
-"tests/data/acpi/pc/HMAT.acpihmat",
|
||||
-"tests/data/acpi/pc/DSDT.acpihmat",
|
||||
-"tests/data/acpi/q35/APIC.acpihmat",
|
||||
-"tests/data/acpi/q35/SRAT.acpihmat",
|
||||
-"tests/data/acpi/q35/HMAT.acpihmat",
|
||||
-"tests/data/acpi/q35/DSDT.acpihmat",
|
||||
--
|
||||
1.8.3.1
|
||||
|
58
SOURCES/kvm-Don-t-leak-memory-when-reallocation-fails.patch
Normal file
58
SOURCES/kvm-Don-t-leak-memory-when-reallocation-fails.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From bcb6107f98d7b1edf687d7afd552a4528b7e673b Mon Sep 17 00:00:00 2001
|
||||
From: jmaloy <jmaloy@redhat.com>
|
||||
Date: Tue, 12 May 2020 21:15:13 +0100
|
||||
Subject: [PATCH 2/7] Don't leak memory when reallocation fails.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: jmaloy <jmaloy@redhat.com>
|
||||
Message-id: <20200512211514.1398384-2-jmaloy@redhat.com>
|
||||
Patchwork-id: 96412
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/2] Don't leak memory when reallocation fails.
|
||||
Bugzilla: 1749737
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
From: Jindrich Novy <jnovy@redhat.com>
|
||||
|
||||
Signed-off-by: Jindrich Novy <jnovy@redhat.com>
|
||||
[ Marc-André - modified to use a temporary variable ]
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
(cherry picked from libslirp commit d171af3732a0610a25334b06b77fa547bd677918)
|
||||
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
slirp/src/sbuf.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
|
||||
index abced48..0569c34 100644
|
||||
--- a/slirp/src/sbuf.c
|
||||
+++ b/slirp/src/sbuf.c
|
||||
@@ -39,13 +39,16 @@ void sbreserve(struct sbuf *sb, int size)
|
||||
if (sb->sb_data) {
|
||||
/* Already alloced, realloc if necessary */
|
||||
if (sb->sb_datalen != size) {
|
||||
- sb->sb_wptr = sb->sb_rptr = sb->sb_data =
|
||||
- (char *)realloc(sb->sb_data, size);
|
||||
+ char *new = realloc(sb->sb_data, size);
|
||||
sb->sb_cc = 0;
|
||||
- if (sb->sb_wptr)
|
||||
+ if (new) {
|
||||
+ sb->sb_data = sb->sb_wptr = sb->sb_rptr = new;
|
||||
sb->sb_datalen = size;
|
||||
- else
|
||||
+ } else {
|
||||
+ free(sb->sb_data);
|
||||
+ sb->sb_data = sb->sb_wptr = sb->sb_rptr = NULL;
|
||||
sb->sb_datalen = 0;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
sb->sb_wptr = sb->sb_rptr = sb->sb_data = (char *)malloc(size);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,60 @@
|
||||
From a33ea192428d9c9307f1140f3e25631a6ef7657c Mon Sep 17 00:00:00 2001
|
||||
From: Jon Maloy <jmaloy@redhat.com>
|
||||
Date: Sat, 20 Jun 2020 15:02:59 -0400
|
||||
Subject: [PATCH 12/12] Fix use-afte-free in ip_reass() (CVE-2020-1983)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Jon Maloy <jmaloy@redhat.com>
|
||||
Message-id: <20200620150259.3352467-2-jmaloy@redhat.com>
|
||||
Patchwork-id: 97678
|
||||
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 1/1] Fix use-afte-free in ip_reass() (CVE-2020-1983)
|
||||
Bugzilla: 1838070
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
The q pointer is updated when the mbuf data is moved from m_dat to
|
||||
m_ext.
|
||||
|
||||
m_ext buffer may also be realloc()'ed and moved during m_cat():
|
||||
q should also be updated in this case.
|
||||
|
||||
Reported-by: Aviv Sasson <asasson@paloaltonetworks.com>
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
|
||||
(cherry picked from libslirp commit 9bd6c5913271eabcb7768a58197ed3301fe19f2d)
|
||||
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
slirp/src/ip_input.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
|
||||
index df1c846ade..0f5d522ec1 100644
|
||||
--- a/slirp/src/ip_input.c
|
||||
+++ b/slirp/src/ip_input.c
|
||||
@@ -329,7 +329,7 @@ insert:
|
||||
q = fp->frag_link.next;
|
||||
m = dtom(slirp, q);
|
||||
|
||||
- int was_ext = m->m_flags & M_EXT;
|
||||
+ int delta = (char *)q - (m->m_flags & M_EXT ? m->m_ext : m->m_dat);
|
||||
|
||||
q = (struct ipasfrag *)q->ipf_next;
|
||||
while (q != (struct ipasfrag *)&fp->frag_link) {
|
||||
@@ -353,8 +353,7 @@ insert:
|
||||
* the old buffer (in the mbuf), so we must point ip
|
||||
* into the new buffer.
|
||||
*/
|
||||
- if (!was_ext && m->m_flags & M_EXT) {
|
||||
- int delta = (char *)q - m->m_dat;
|
||||
+ if (m->m_flags & M_EXT) {
|
||||
q = (struct ipasfrag *)(m->m_ext + delta);
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,55 @@
|
||||
From e3bec8c83459a68ae0c08e2ae0f1dbef24872d59 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Tue, 2 Jun 2020 02:34:09 +0100
|
||||
Subject: [PATCH 04/26] MAINTAINERS: fix qcow2-bitmap.c under Dirty Bitmaps
|
||||
header
|
||||
|
||||
RH-Author: Eric Blake <eblake@redhat.com>
|
||||
Message-id: <20200602023420.2133649-2-eblake@redhat.com>
|
||||
Patchwork-id: 97068
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 01/12] MAINTAINERS: fix qcow2-bitmap.c under Dirty Bitmaps header
|
||||
Bugzilla: 1779893 1779904
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
|
||||
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
|
||||
Somehow I wrote not full path to the file. Fix that.
|
||||
|
||||
Also, while being here, rearrange entries, so that includes go first,
|
||||
then block, than migration, than util.
|
||||
|
||||
Fixes: 052db8e71444d
|
||||
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 00637c6b0b67694127cc01dd75f3626da23acdaa)
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
MAINTAINERS | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index d1b3e26..3a81ac9 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1873,12 +1873,12 @@ M: John Snow <jsnow@redhat.com>
|
||||
R: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
L: qemu-block@nongnu.org
|
||||
S: Supported
|
||||
-F: util/hbitmap.c
|
||||
-F: block/dirty-bitmap.c
|
||||
F: include/qemu/hbitmap.h
|
||||
F: include/block/dirty-bitmap.h
|
||||
-F: qcow2-bitmap.c
|
||||
+F: block/dirty-bitmap.c
|
||||
+F: block/qcow2-bitmap.c
|
||||
F: migration/block-dirty-bitmap.c
|
||||
+F: util/hbitmap.c
|
||||
F: tests/test-hbitmap.c
|
||||
F: docs/interop/bitmaps.rst
|
||||
T: git https://github.com/jnsnow/qemu.git bitmaps
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,53 @@
|
||||
From 481357ea8ae32b6894860c296cf6a2898260195f Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Fri, 17 Jan 2020 13:18:27 +0100
|
||||
Subject: [PATCH 4/4] RHEL: hw/i386: disable nested PERF_GLOBAL_CTRL MSR
|
||||
support
|
||||
|
||||
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Message-id: <20200117131827.20361-1-pbonzini@redhat.com>
|
||||
Patchwork-id: 93405
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v3] RHEL: hw/i386: disable nested PERF_GLOBAL_CTRL MSR support
|
||||
Bugzilla: 1559846
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
BZ: 1559846
|
||||
BRANCH: rhel-av-8.2.0
|
||||
BREW: 25775160
|
||||
UPSTREAM: RHEL only
|
||||
|
||||
Nested PERF_GLOBAL_CTRL support is not present in the 8.2 kernel. Drop the
|
||||
features via compat properties, they will be moved to 8.2 machine type compat
|
||||
properties in the 8.3 timeframe.
|
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
No change, for v2 I mistakenly wrote "origin/rhel-av-8.2.0" as the
|
||||
branch. :(
|
||||
|
||||
hw/i386/pc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
hw/i386/pc.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
|
||||
index 61e70e4..73a0f11 100644
|
||||
--- a/hw/i386/pc.c
|
||||
+++ b/hw/i386/pc.c
|
||||
@@ -351,6 +351,8 @@ const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4);
|
||||
GlobalProperty pc_rhel_compat[] = {
|
||||
{ TYPE_X86_CPU, "host-phys-bits", "on" },
|
||||
{ TYPE_X86_CPU, "host-phys-bits-limit", "48" },
|
||||
+ { TYPE_X86_CPU, "vmx-entry-load-perf-global-ctrl", "off" },
|
||||
+ { TYPE_X86_CPU, "vmx-exit-load-perf-global-ctrl", "off" },
|
||||
/* bz 1508330 */
|
||||
{ "vfio-pci", "x-no-geforce-quirks", "on" },
|
||||
};
|
||||
--
|
||||
1.8.3.1
|
||||
|
115
SOURCES/kvm-Reallocate-dirty_bmap-when-we-change-a-slot.patch
Normal file
115
SOURCES/kvm-Reallocate-dirty_bmap-when-we-change-a-slot.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From c477581ccc6962651d4d6c702a6c3e2fcc5e4205 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Thu, 2 Jan 2020 11:56:51 +0000
|
||||
Subject: [PATCH 2/2] kvm: Reallocate dirty_bmap when we change a slot
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20200102115651.140177-1-dgilbert@redhat.com>
|
||||
Patchwork-id: 93256
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/1] kvm: Reallocate dirty_bmap when we change a slot
|
||||
Bugzilla: 1772774
|
||||
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
|
||||
bz: https://bugzilla.redhat.com/show_bug.cgi?id=1772774
|
||||
brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=25575691
|
||||
branch: rhel-av-8.2.0
|
||||
|
||||
kvm_set_phys_mem can be called to reallocate a slot by something the
|
||||
guest does (e.g. writing to PAM and other chipset registers).
|
||||
This can happen in the middle of a migration, and if we're unlucky
|
||||
it can now happen between the split 'sync' and 'clear'; the clear
|
||||
asserts if there's no bmap to clear. Recreate the bmap whenever
|
||||
we change the slot, keeping the clear path happy.
|
||||
|
||||
Typically this is triggered by the guest rebooting during a migrate.
|
||||
|
||||
Corresponds to:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1772774
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1771032
|
||||
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Reviewed-by: Peter Xu <peterx@redhat.com>
|
||||
(cherry picked from commit 9b3a31c745b61758aaa5466a3a9fc0526d409188)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
accel/kvm/kvm-all.c | 44 +++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 29 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
|
||||
index dc3ed7f..5007bda 100644
|
||||
--- a/accel/kvm/kvm-all.c
|
||||
+++ b/accel/kvm/kvm-all.c
|
||||
@@ -518,6 +518,27 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
|
||||
|
||||
#define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
|
||||
|
||||
+/* Allocate the dirty bitmap for a slot */
|
||||
+static void kvm_memslot_init_dirty_bitmap(KVMSlot *mem)
|
||||
+{
|
||||
+ /*
|
||||
+ * XXX bad kernel interface alert
|
||||
+ * For dirty bitmap, kernel allocates array of size aligned to
|
||||
+ * bits-per-long. But for case when the kernel is 64bits and
|
||||
+ * the userspace is 32bits, userspace can't align to the same
|
||||
+ * bits-per-long, since sizeof(long) is different between kernel
|
||||
+ * and user space. This way, userspace will provide buffer which
|
||||
+ * may be 4 bytes less than the kernel will use, resulting in
|
||||
+ * userspace memory corruption (which is not detectable by valgrind
|
||||
+ * too, in most cases).
|
||||
+ * So for now, let's align to 64 instead of HOST_LONG_BITS here, in
|
||||
+ * a hope that sizeof(long) won't become >8 any time soon.
|
||||
+ */
|
||||
+ hwaddr bitmap_size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS),
|
||||
+ /*HOST_LONG_BITS*/ 64) / 8;
|
||||
+ mem->dirty_bmap = g_malloc0(bitmap_size);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* kvm_physical_sync_dirty_bitmap - Sync dirty bitmap from kernel space
|
||||
*
|
||||
@@ -550,23 +571,9 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryListener *kml,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- /* XXX bad kernel interface alert
|
||||
- * For dirty bitmap, kernel allocates array of size aligned to
|
||||
- * bits-per-long. But for case when the kernel is 64bits and
|
||||
- * the userspace is 32bits, userspace can't align to the same
|
||||
- * bits-per-long, since sizeof(long) is different between kernel
|
||||
- * and user space. This way, userspace will provide buffer which
|
||||
- * may be 4 bytes less than the kernel will use, resulting in
|
||||
- * userspace memory corruption (which is not detectable by valgrind
|
||||
- * too, in most cases).
|
||||
- * So for now, let's align to 64 instead of HOST_LONG_BITS here, in
|
||||
- * a hope that sizeof(long) won't become >8 any time soon.
|
||||
- */
|
||||
if (!mem->dirty_bmap) {
|
||||
- hwaddr bitmap_size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS),
|
||||
- /*HOST_LONG_BITS*/ 64) / 8;
|
||||
/* Allocate on the first log_sync, once and for all */
|
||||
- mem->dirty_bmap = g_malloc0(bitmap_size);
|
||||
+ kvm_memslot_init_dirty_bitmap(mem);
|
||||
}
|
||||
|
||||
d.dirty_bitmap = mem->dirty_bmap;
|
||||
@@ -1067,6 +1074,13 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
|
||||
mem->ram = ram;
|
||||
mem->flags = kvm_mem_flags(mr);
|
||||
|
||||
+ if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
|
||||
+ /*
|
||||
+ * Reallocate the bmap; it means it doesn't disappear in
|
||||
+ * middle of a migrate.
|
||||
+ */
|
||||
+ kvm_memslot_init_dirty_bitmap(mem);
|
||||
+ }
|
||||
err = kvm_set_user_memory_region(kml, mem, true);
|
||||
if (err) {
|
||||
fprintf(stderr, "%s: error registering slot: %s\n", __func__,
|
||||
--
|
||||
1.8.3.1
|
||||
|
118
SOURCES/kvm-Replace-remaining-malloc-free-user-with-glib.patch
Normal file
118
SOURCES/kvm-Replace-remaining-malloc-free-user-with-glib.patch
Normal file
@ -0,0 +1,118 @@
|
||||
From c012dc9b501d96a2ff54a8a7a182726043b69aeb Mon Sep 17 00:00:00 2001
|
||||
From: jmaloy <jmaloy@redhat.com>
|
||||
Date: Tue, 12 May 2020 21:15:14 +0100
|
||||
Subject: [PATCH 3/7] Replace remaining malloc/free user with glib
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: jmaloy <jmaloy@redhat.com>
|
||||
Message-id: <20200512211514.1398384-3-jmaloy@redhat.com>
|
||||
Patchwork-id: 96413
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 2/2] Replace remaining malloc/free user with glib
|
||||
Bugzilla: 1749737
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
glib mem functions are already used in various places. Let's not mix
|
||||
the two, and instead abort on OOM conditions.
|
||||
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
(cherry picked from libslirp commit 3a494648526be4eb96cba739a816a60e933ffd14)
|
||||
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
slirp/src/sbuf.c | 21 ++++++---------------
|
||||
slirp/src/socket.c | 2 +-
|
||||
slirp/src/tcp_subr.c | 8 ++------
|
||||
3 files changed, 9 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
|
||||
index 0569c34..eab87f3 100644
|
||||
--- a/slirp/src/sbuf.c
|
||||
+++ b/slirp/src/sbuf.c
|
||||
@@ -9,7 +9,7 @@ static void sbappendsb(struct sbuf *sb, struct mbuf *m);
|
||||
|
||||
void sbfree(struct sbuf *sb)
|
||||
{
|
||||
- free(sb->sb_data);
|
||||
+ g_free(sb->sb_data);
|
||||
}
|
||||
|
||||
bool sbdrop(struct sbuf *sb, int num)
|
||||
@@ -39,24 +39,15 @@ void sbreserve(struct sbuf *sb, int size)
|
||||
if (sb->sb_data) {
|
||||
/* Already alloced, realloc if necessary */
|
||||
if (sb->sb_datalen != size) {
|
||||
- char *new = realloc(sb->sb_data, size);
|
||||
+ char *new = g_realloc(sb->sb_data, size);
|
||||
sb->sb_cc = 0;
|
||||
- if (new) {
|
||||
- sb->sb_data = sb->sb_wptr = sb->sb_rptr = new;
|
||||
- sb->sb_datalen = size;
|
||||
- } else {
|
||||
- free(sb->sb_data);
|
||||
- sb->sb_data = sb->sb_wptr = sb->sb_rptr = NULL;
|
||||
- sb->sb_datalen = 0;
|
||||
- }
|
||||
+ sb->sb_data = sb->sb_wptr = sb->sb_rptr = new;
|
||||
+ sb->sb_datalen = size;
|
||||
}
|
||||
} else {
|
||||
- sb->sb_wptr = sb->sb_rptr = sb->sb_data = (char *)malloc(size);
|
||||
+ sb->sb_wptr = sb->sb_rptr = sb->sb_data = g_malloc(size);
|
||||
sb->sb_cc = 0;
|
||||
- if (sb->sb_wptr)
|
||||
- sb->sb_datalen = size;
|
||||
- else
|
||||
- sb->sb_datalen = 0;
|
||||
+ sb->sb_datalen = size;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/slirp/src/socket.c b/slirp/src/socket.c
|
||||
index 34daffc..ace18bf 100644
|
||||
--- a/slirp/src/socket.c
|
||||
+++ b/slirp/src/socket.c
|
||||
@@ -95,7 +95,7 @@ void sofree(struct socket *so)
|
||||
remque(so); /* crashes if so is not in a queue */
|
||||
|
||||
if (so->so_tcpcb) {
|
||||
- free(so->so_tcpcb);
|
||||
+ g_free(so->so_tcpcb);
|
||||
}
|
||||
g_free(so);
|
||||
}
|
||||
diff --git a/slirp/src/tcp_subr.c b/slirp/src/tcp_subr.c
|
||||
index 26d4ead..4e5a801 100644
|
||||
--- a/slirp/src/tcp_subr.c
|
||||
+++ b/slirp/src/tcp_subr.c
|
||||
@@ -255,11 +255,7 @@ struct tcpcb *tcp_newtcpcb(struct socket *so)
|
||||
{
|
||||
register struct tcpcb *tp;
|
||||
|
||||
- tp = (struct tcpcb *)malloc(sizeof(*tp));
|
||||
- if (tp == NULL)
|
||||
- return ((struct tcpcb *)0);
|
||||
-
|
||||
- memset((char *)tp, 0, sizeof(struct tcpcb));
|
||||
+ tp = g_new0(struct tcpcb, 1);
|
||||
tp->seg_next = tp->seg_prev = (struct tcpiphdr *)tp;
|
||||
tp->t_maxseg = (so->so_ffamily == AF_INET) ? TCP_MSS : TCP6_MSS;
|
||||
|
||||
@@ -330,7 +326,7 @@ struct tcpcb *tcp_close(struct tcpcb *tp)
|
||||
remque(tcpiphdr2qlink(tcpiphdr_prev(t)));
|
||||
m_free(m);
|
||||
}
|
||||
- free(tp);
|
||||
+ g_free(tp);
|
||||
so->so_tcpcb = NULL;
|
||||
/* clobber input socket cache if we're closing the cached connection */
|
||||
if (so == slirp->tcp_last_so)
|
||||
--
|
||||
1.8.3.1
|
||||
|
58
SOURCES/kvm-Revert-RHEL-disable-hostmem-memfd.patch
Normal file
58
SOURCES/kvm-Revert-RHEL-disable-hostmem-memfd.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 559d5899473dea180ced39a32bfbfbf2310c6e04 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Mon, 25 May 2020 15:33:06 +0100
|
||||
Subject: [PATCH 4/7] Revert "RHEL: disable hostmem-memfd"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: <20200525153306.15373-1-marcandre.lureau@redhat.com>
|
||||
Patchwork-id: 96747
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH] Revert "RHEL: disable hostmem-memfd"
|
||||
Bugzilla: 1839030
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1839030
|
||||
BRANCH: rhel-av-8.2.1
|
||||
UPSTREAM: RHEL-only
|
||||
BREW: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=28817132
|
||||
|
||||
This reverts commit f7587ddb9a2731bf678a24156b6285dda79a4b2b.
|
||||
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
backends/Makefile.objs | 3 +--
|
||||
util/memfd.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/backends/Makefile.objs b/backends/Makefile.objs
|
||||
index f328d40..f069111 100644
|
||||
--- a/backends/Makefile.objs
|
||||
+++ b/backends/Makefile.objs
|
||||
@@ -16,5 +16,4 @@ endif
|
||||
|
||||
common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
|
||||
|
||||
-# RHEL: disable memfd
|
||||
-# common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
|
||||
+common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
|
||||
diff --git a/util/memfd.c b/util/memfd.c
|
||||
index 3303ec9..4a3c07e 100644
|
||||
--- a/util/memfd.c
|
||||
+++ b/util/memfd.c
|
||||
@@ -193,7 +193,7 @@ bool qemu_memfd_alloc_check(void)
|
||||
*/
|
||||
bool qemu_memfd_check(unsigned int flags)
|
||||
{
|
||||
-#if 0 /* RHEL: memfd support disabled */
|
||||
+#ifdef CONFIG_LINUX
|
||||
int mfd = memfd_create("test", flags | MFD_CLOEXEC);
|
||||
|
||||
if (mfd >= 0) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,121 @@
|
||||
From 71b5267ed33f9e60bc98acbabcbed62f01a96ff4 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 30 Mar 2020 11:19:23 +0100
|
||||
Subject: [PATCH 3/4] Revert "mirror: Don't let an operation wait for itself"
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200330111924.22938-2-kwolf@redhat.com>
|
||||
Patchwork-id: 94464
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] Revert "mirror: Don't let an operation wait for itself"
|
||||
Bugzilla: 1794692
|
||||
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
This reverts commit 7e6c4ff792734e196c8ca82564c56b5e7c6288ca.
|
||||
|
||||
The fix was incomplete as it only protected against requests waiting for
|
||||
themselves, but not against requests waiting for each other. We need a
|
||||
different solution.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200326153628.4869-2-kwolf@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 9178f4fe5f083064f5c91f04d98c815ce5a5af1c)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/mirror.c | 21 +++++++++------------
|
||||
1 file changed, 9 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/block/mirror.c b/block/mirror.c
|
||||
index cacbc70..8959e42 100644
|
||||
--- a/block/mirror.c
|
||||
+++ b/block/mirror.c
|
||||
@@ -283,14 +283,11 @@ static int mirror_cow_align(MirrorBlockJob *s, int64_t *offset,
|
||||
}
|
||||
|
||||
static inline void coroutine_fn
|
||||
-mirror_wait_for_any_operation(MirrorBlockJob *s, MirrorOp *self, bool active)
|
||||
+mirror_wait_for_any_operation(MirrorBlockJob *s, bool active)
|
||||
{
|
||||
MirrorOp *op;
|
||||
|
||||
QTAILQ_FOREACH(op, &s->ops_in_flight, next) {
|
||||
- if (self == op) {
|
||||
- continue;
|
||||
- }
|
||||
/* Do not wait on pseudo ops, because it may in turn wait on
|
||||
* some other operation to start, which may in fact be the
|
||||
* caller of this function. Since there is only one pseudo op
|
||||
@@ -305,10 +302,10 @@ mirror_wait_for_any_operation(MirrorBlockJob *s, MirrorOp *self, bool active)
|
||||
}
|
||||
|
||||
static inline void coroutine_fn
|
||||
-mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s, MirrorOp *self)
|
||||
+mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s)
|
||||
{
|
||||
/* Only non-active operations use up in-flight slots */
|
||||
- mirror_wait_for_any_operation(s, self, false);
|
||||
+ mirror_wait_for_any_operation(s, false);
|
||||
}
|
||||
|
||||
/* Perform a mirror copy operation.
|
||||
@@ -351,7 +348,7 @@ static void coroutine_fn mirror_co_read(void *opaque)
|
||||
|
||||
while (s->buf_free_count < nb_chunks) {
|
||||
trace_mirror_yield_in_flight(s, op->offset, s->in_flight);
|
||||
- mirror_wait_for_free_in_flight_slot(s, op);
|
||||
+ mirror_wait_for_free_in_flight_slot(s);
|
||||
}
|
||||
|
||||
/* Now make a QEMUIOVector taking enough granularity-sized chunks
|
||||
@@ -558,7 +555,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
||||
|
||||
while (s->in_flight >= MAX_IN_FLIGHT) {
|
||||
trace_mirror_yield_in_flight(s, offset, s->in_flight);
|
||||
- mirror_wait_for_free_in_flight_slot(s, pseudo_op);
|
||||
+ mirror_wait_for_free_in_flight_slot(s);
|
||||
}
|
||||
|
||||
if (s->ret < 0) {
|
||||
@@ -612,7 +609,7 @@ static void mirror_free_init(MirrorBlockJob *s)
|
||||
static void coroutine_fn mirror_wait_for_all_io(MirrorBlockJob *s)
|
||||
{
|
||||
while (s->in_flight > 0) {
|
||||
- mirror_wait_for_free_in_flight_slot(s, NULL);
|
||||
+ mirror_wait_for_free_in_flight_slot(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +794,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
|
||||
if (s->in_flight >= MAX_IN_FLIGHT) {
|
||||
trace_mirror_yield(s, UINT64_MAX, s->buf_free_count,
|
||||
s->in_flight);
|
||||
- mirror_wait_for_free_in_flight_slot(s, NULL);
|
||||
+ mirror_wait_for_free_in_flight_slot(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -950,7 +947,7 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
||||
/* Do not start passive operations while there are active
|
||||
* writes in progress */
|
||||
while (s->in_active_write_counter) {
|
||||
- mirror_wait_for_any_operation(s, NULL, true);
|
||||
+ mirror_wait_for_any_operation(s, true);
|
||||
}
|
||||
|
||||
if (s->ret < 0) {
|
||||
@@ -976,7 +973,7 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
||||
if (s->in_flight >= MAX_IN_FLIGHT || s->buf_free_count == 0 ||
|
||||
(cnt == 0 && s->in_flight > 0)) {
|
||||
trace_mirror_yield(s, cnt, s->buf_free_count, s->in_flight);
|
||||
- mirror_wait_for_free_in_flight_slot(s, NULL);
|
||||
+ mirror_wait_for_free_in_flight_slot(s);
|
||||
continue;
|
||||
} else if (cnt != 0) {
|
||||
delay_ns = mirror_iteration(s);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,63 @@
|
||||
From ceb6d97674b8bc9a072db1be4167411bc0ee48d7 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Mon, 27 Jan 2020 19:02:02 +0100
|
||||
Subject: [PATCH 091/116] Virtiofsd: fix memory leak on fuse queueinfo
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20200127190227.40942-88-dgilbert@redhat.com>
|
||||
Patchwork-id: 93542
|
||||
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 087/112] Virtiofsd: fix memory leak on fuse queueinfo
|
||||
Bugzilla: 1694164
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
|
||||
From: Liu Bo <bo.liu@linux.alibaba.com>
|
||||
|
||||
For fuse's queueinfo, both queueinfo array and queueinfos are allocated in
|
||||
fv_queue_set_started() but not cleaned up when the daemon process quits.
|
||||
|
||||
This fixes the leak in proper places.
|
||||
|
||||
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
|
||||
Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
|
||||
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
(cherry picked from commit 740b0b700a6338a1cf60c26229651ac5f6724944)
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
tools/virtiofsd/fuse_virtio.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
|
||||
index b7948de..fb8d6d1 100644
|
||||
--- a/tools/virtiofsd/fuse_virtio.c
|
||||
+++ b/tools/virtiofsd/fuse_virtio.c
|
||||
@@ -625,6 +625,8 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
|
||||
}
|
||||
close(ourqi->kill_fd);
|
||||
ourqi->kick_fd = -1;
|
||||
+ free(vud->qi[qidx]);
|
||||
+ vud->qi[qidx] = NULL;
|
||||
}
|
||||
|
||||
/* Callback from libvhost-user on start or stop of a queue */
|
||||
@@ -884,6 +886,12 @@ int virtio_session_mount(struct fuse_session *se)
|
||||
void virtio_session_close(struct fuse_session *se)
|
||||
{
|
||||
close(se->vu_socketfd);
|
||||
+
|
||||
+ if (!se->virtio_dev) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ free(se->virtio_dev->qi);
|
||||
free(se->virtio_dev);
|
||||
se->virtio_dev = NULL;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 0d5a09173eb75b7e56122c2aefb2646a2be58400 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Xu <peterx@redhat.com>
|
||||
Date: Fri, 31 Jan 2020 17:12:57 +0000
|
||||
Subject: [PATCH 15/15] apic: Use 32bit APIC ID for migration instance ID
|
||||
|
||||
RH-Author: Peter Xu <peterx@redhat.com>
|
||||
Message-id: <20200131171257.1066593-4-peterx@redhat.com>
|
||||
Patchwork-id: 93628
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 3/3] apic: Use 32bit APIC ID for migration instance ID
|
||||
Bugzilla: 1529231
|
||||
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
||||
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
|
||||
Migration is silently broken now with x2apic config like this:
|
||||
|
||||
-smp 200,maxcpus=288,sockets=2,cores=72,threads=2 \
|
||||
-device intel-iommu,intremap=on,eim=on
|
||||
|
||||
After migration, the guest kernel could hang at anything, due to
|
||||
x2apic bit not migrated correctly in IA32_APIC_BASE on some vcpus, so
|
||||
any operations related to x2apic could be broken then (e.g., RDMSR on
|
||||
x2apic MSRs could fail because KVM would think that the vcpu hasn't
|
||||
enabled x2apic at all).
|
||||
|
||||
The issue is that the x2apic bit was never applied correctly for vcpus
|
||||
whose ID > 255 when migrate completes, and that's because when we
|
||||
migrate APIC we use the APICCommonState.id as instance ID of the
|
||||
migration stream, while that's too short for x2apic.
|
||||
|
||||
Let's use the newly introduced initial_apic_id for that.
|
||||
|
||||
Signed-off-by: Peter Xu <peterx@redhat.com>
|
||||
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
||||
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
||||
(cherry picked from commit 0ab994867c365db21e15f9503922c79234d8e40e)
|
||||
Signed-off-by: Peter Xu <peterx@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/intc/apic_common.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
|
||||
index 54b8731..b5dbeb6 100644
|
||||
--- a/hw/intc/apic_common.c
|
||||
+++ b/hw/intc/apic_common.c
|
||||
@@ -268,7 +268,10 @@ static void apic_common_realize(DeviceState *dev, Error **errp)
|
||||
APICCommonState *s = APIC_COMMON(dev);
|
||||
APICCommonClass *info;
|
||||
static DeviceState *vapic;
|
||||
- uint32_t instance_id = s->id;
|
||||
+ uint32_t instance_id = s->initial_apic_id;
|
||||
+
|
||||
+ /* Normally initial APIC ID should be no more than hundreds */
|
||||
+ assert(instance_id != VMSTATE_INSTANCE_ID_ANY);
|
||||
|
||||
info = APIC_COMMON_GET_CLASS(s);
|
||||
info->realize(dev, errp);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,51 @@
|
||||
From fba183faf8ce819262a1a47f8531ea68051cdce7 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 3 Jun 2020 16:03:19 +0100
|
||||
Subject: [PATCH 20/26] backup: Improve error for bdrv_getlength() failure
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200603160325.67506-6-kwolf@redhat.com>
|
||||
Patchwork-id: 97103
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 05/11] backup: Improve error for bdrv_getlength() failure
|
||||
Bugzilla: 1778593
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
bdrv_get_device_name() will be an empty string with modern management
|
||||
tools that don't use -drive. Use bdrv_get_device_or_node_name() instead
|
||||
so that the node name is used if the BlockBackend is anonymous.
|
||||
|
||||
While at it, start with upper case to make the message consistent with
|
||||
the rest of the function.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Message-Id: <20200430142755.315494-3-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 58226634c4b02af7b10862f7fbd3610a344bfb7f)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/block/backup.c b/block/backup.c
|
||||
index ec50946..7c6ddd2 100644
|
||||
--- a/block/backup.c
|
||||
+++ b/block/backup.c
|
||||
@@ -408,8 +408,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||
|
||||
len = bdrv_getlength(bs);
|
||||
if (len < 0) {
|
||||
- error_setg_errno(errp, -len, "unable to get length for '%s'",
|
||||
- bdrv_get_device_name(bs));
|
||||
+ error_setg_errno(errp, -len, "Unable to get length for '%s'",
|
||||
+ bdrv_get_device_or_node_name(bs));
|
||||
goto error;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,124 @@
|
||||
From e56abd782be8bb41bb07c0317d008f95ec9a8ee5 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 3 Jun 2020 16:03:20 +0100
|
||||
Subject: [PATCH 21/26] backup: Make sure that source and target size match
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200603160325.67506-7-kwolf@redhat.com>
|
||||
Patchwork-id: 97107
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 06/11] backup: Make sure that source and target size match
|
||||
Bugzilla: 1778593
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
Since the introduction of a backup filter node in commit 00e30f05d, the
|
||||
backup block job crashes when the target image is smaller than the
|
||||
source image because it will try to write after the end of the target
|
||||
node without having BLK_PERM_RESIZE. (Previously, the BlockBackend layer
|
||||
would have caught this and errored out gracefully.)
|
||||
|
||||
We can fix this and even do better than the old behaviour: Check that
|
||||
source and target have the same image size at the start of the block job
|
||||
and unshare BLK_PERM_RESIZE. (This permission was already unshared
|
||||
before the same commit 00e30f05d, but the BlockBackend that was used to
|
||||
make the restriction was removed without a replacement.) This will
|
||||
immediately error out when starting the job instead of only when writing
|
||||
to a block that doesn't exist in the target.
|
||||
|
||||
Longer target than source would technically work because we would never
|
||||
write to blocks that don't exist, but semantically these are invalid,
|
||||
too, because a backup is supposed to create a copy, not just an image
|
||||
that starts with a copy.
|
||||
|
||||
Fixes: 00e30f05de1d19586345ec373970ef4c192c6270
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1778593
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200430142755.315494-4-kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 958a04bd32af18d9a207bcc78046e56a202aebc2)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup-top.c | 14 +++++++++-----
|
||||
block/backup.c | 14 +++++++++++++-
|
||||
2 files changed, 22 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/block/backup-top.c b/block/backup-top.c
|
||||
index b8d863f..6756091 100644
|
||||
--- a/block/backup-top.c
|
||||
+++ b/block/backup-top.c
|
||||
@@ -143,8 +143,10 @@ static void backup_top_child_perm(BlockDriverState *bs, BdrvChild *c,
|
||||
*
|
||||
* Share write to target (child_file), to not interfere
|
||||
* with guest writes to its disk which may be in target backing chain.
|
||||
+ * Can't resize during a backup block job because we check the size
|
||||
+ * only upfront.
|
||||
*/
|
||||
- *nshared = BLK_PERM_ALL;
|
||||
+ *nshared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
|
||||
*nperm = BLK_PERM_WRITE;
|
||||
} else {
|
||||
/* Source child */
|
||||
@@ -154,7 +156,7 @@ static void backup_top_child_perm(BlockDriverState *bs, BdrvChild *c,
|
||||
if (perm & BLK_PERM_WRITE) {
|
||||
*nperm = *nperm | BLK_PERM_CONSISTENT_READ;
|
||||
}
|
||||
- *nshared &= ~BLK_PERM_WRITE;
|
||||
+ *nshared &= ~(BLK_PERM_WRITE | BLK_PERM_RESIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,10 +189,12 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
BDRVBackupTopState *state;
|
||||
- BlockDriverState *top = bdrv_new_open_driver(&bdrv_backup_top_filter,
|
||||
- filter_node_name,
|
||||
- BDRV_O_RDWR, errp);
|
||||
+ BlockDriverState *top;
|
||||
+
|
||||
+ assert(source->total_sectors == target->total_sectors);
|
||||
|
||||
+ top = bdrv_new_open_driver(&bdrv_backup_top_filter, filter_node_name,
|
||||
+ BDRV_O_RDWR, errp);
|
||||
if (!top) {
|
||||
return NULL;
|
||||
}
|
||||
diff --git a/block/backup.c b/block/backup.c
|
||||
index 7c6ddd2..821c9fb 100644
|
||||
--- a/block/backup.c
|
||||
+++ b/block/backup.c
|
||||
@@ -348,7 +348,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||
BlockCompletionFunc *cb, void *opaque,
|
||||
JobTxn *txn, Error **errp)
|
||||
{
|
||||
- int64_t len;
|
||||
+ int64_t len, target_len;
|
||||
BackupBlockJob *job = NULL;
|
||||
int64_t cluster_size;
|
||||
BdrvRequestFlags write_flags;
|
||||
@@ -413,6 +413,18 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ target_len = bdrv_getlength(target);
|
||||
+ if (target_len < 0) {
|
||||
+ error_setg_errno(errp, -target_len, "Unable to get length for '%s'",
|
||||
+ bdrv_get_device_or_node_name(bs));
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (target_len != len) {
|
||||
+ error_setg(errp, "Source and target image have different sizes");
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
cluster_size = backup_calculate_cluster_size(target, errp);
|
||||
if (cluster_size < 0) {
|
||||
goto error;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,57 @@
|
||||
From 619b3aac9790a7ca7c01846144395a318a9ab250 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 8 Apr 2020 17:29:14 +0100
|
||||
Subject: [PATCH 3/6] backup: don't acquire aio_context in backup_clean
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200408172917.18712-4-kwolf@redhat.com>
|
||||
Patchwork-id: 94596
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 3/6] backup: don't acquire aio_context in backup_clean
|
||||
Bugzilla: 1817621
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
From: Stefan Reiter <s.reiter@proxmox.com>
|
||||
|
||||
All code-paths leading to backup_clean (via job_clean) have the job's
|
||||
context already acquired. The job's context is guaranteed to be the same
|
||||
as the one used by backup_top via backup_job_create.
|
||||
|
||||
Since the previous logic effectively acquired the lock twice, this
|
||||
broke cleanup of backups for disks using IO threads, since the BDRV_POLL_WHILE
|
||||
in bdrv_backup_top_drop -> bdrv_do_drained_begin would only release the lock
|
||||
once, thus deadlocking with the IO thread.
|
||||
|
||||
This is a partial revert of 0abf2581717a19.
|
||||
|
||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200407115651.69472-4-s.reiter@proxmox.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit eca0f3524a4eb57d03a56b0cbcef5527a0981ce4)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/block/backup.c b/block/backup.c
|
||||
index 1383e21..ec50946 100644
|
||||
--- a/block/backup.c
|
||||
+++ b/block/backup.c
|
||||
@@ -135,11 +135,7 @@ static void backup_abort(Job *job)
|
||||
static void backup_clean(Job *job)
|
||||
{
|
||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
|
||||
- AioContext *aio_context = bdrv_get_aio_context(s->backup_top);
|
||||
-
|
||||
- aio_context_acquire(aio_context);
|
||||
bdrv_backup_top_drop(s->backup_top);
|
||||
- aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
void backup_do_checkpoint(BlockJob *job, Error **errp)
|
||||
--
|
||||
1.8.3.1
|
||||
|
56
SOURCES/kvm-backup-top-Begin-drain-earlier.patch
Normal file
56
SOURCES/kvm-backup-top-Begin-drain-earlier.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From bc78ee07bf400cbff0021367e05d308870471710 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:45 +0000
|
||||
Subject: [PATCH 12/18] backup-top: Begin drain earlier
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-6-slp@redhat.com>
|
||||
Patchwork-id: 93757
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 5/9] backup-top: Begin drain earlier
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
When dropping backup-top, we need to drain the node before freeing the
|
||||
BlockCopyState. Otherwise, requests may still be in flight and then the
|
||||
assertion in shres_destroy() will fail.
|
||||
|
||||
(This becomes visible in intermittent failure of 056.)
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-id: 20191219182638.104621-1-mreitz@redhat.com
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 503ca1262bab2c11c533a4816d1ff4297d4f58a6)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup-top.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/block/backup-top.c b/block/backup-top.c
|
||||
index 7cdb1f8..818d3f2 100644
|
||||
--- a/block/backup-top.c
|
||||
+++ b/block/backup-top.c
|
||||
@@ -257,12 +257,12 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
BDRVBackupTopState *s = bs->opaque;
|
||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||
|
||||
- block_copy_state_free(s->bcs);
|
||||
-
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
+ block_copy_state_free(s->bcs);
|
||||
+
|
||||
s->active = false;
|
||||
bdrv_child_refresh_perms(bs, bs->backing, &error_abort);
|
||||
bdrv_replace_node(bs, backing_bs(bs), &error_abort);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,116 @@
|
||||
From 0ef6691ce8964bb2bbd677756c4e594793ca3ad8 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:01 +0000
|
||||
Subject: [PATCH 04/18] block: Activate recursively even for already active
|
||||
nodes
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-4-kwolf@redhat.com>
|
||||
Patchwork-id: 93749
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 3/6] block: Activate recursively even for already active nodes
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
bdrv_invalidate_cache_all() assumes that all nodes in a given subtree
|
||||
are either active or inactive when it starts. Therefore, as soon as it
|
||||
arrives at an already active node, it stops.
|
||||
|
||||
However, this assumption is wrong. For example, it's possible to take a
|
||||
snapshot of an inactive node, which results in an active overlay over an
|
||||
inactive backing file. The active overlay is probably also the root node
|
||||
of an inactive BlockBackend (blk->disable_perm == true).
|
||||
|
||||
In this case, bdrv_invalidate_cache_all() does not need to do anything
|
||||
to activate the overlay node, but it still needs to recurse into the
|
||||
children and the parents to make sure that after returning success,
|
||||
really everything is activated.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 7bb4941ace471fc7dd6ded4749b95b9622baa6ed)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 50 ++++++++++++++++++++++++--------------------------
|
||||
1 file changed, 24 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 473eb6e..2e5e8b6 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -5335,10 +5335,6 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!(bs->open_flags & BDRV_O_INACTIVE)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
QLIST_FOREACH(child, &bs->children, next) {
|
||||
bdrv_co_invalidate_cache(child->bs, &local_err);
|
||||
if (local_err) {
|
||||
@@ -5360,34 +5356,36 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
|
||||
* just keep the extended permissions for the next time that an activation
|
||||
* of the image is tried.
|
||||
*/
|
||||
- bs->open_flags &= ~BDRV_O_INACTIVE;
|
||||
- bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
|
||||
- ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err);
|
||||
- if (ret < 0) {
|
||||
- bs->open_flags |= BDRV_O_INACTIVE;
|
||||
- error_propagate(errp, local_err);
|
||||
- return;
|
||||
- }
|
||||
- bdrv_set_perm(bs, perm, shared_perm);
|
||||
-
|
||||
- if (bs->drv->bdrv_co_invalidate_cache) {
|
||||
- bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
|
||||
- if (local_err) {
|
||||
+ if (bs->open_flags & BDRV_O_INACTIVE) {
|
||||
+ bs->open_flags &= ~BDRV_O_INACTIVE;
|
||||
+ bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
|
||||
+ ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err);
|
||||
+ if (ret < 0) {
|
||||
bs->open_flags |= BDRV_O_INACTIVE;
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
- }
|
||||
+ bdrv_set_perm(bs, perm, shared_perm);
|
||||
|
||||
- FOR_EACH_DIRTY_BITMAP(bs, bm) {
|
||||
- bdrv_dirty_bitmap_skip_store(bm, false);
|
||||
- }
|
||||
+ if (bs->drv->bdrv_co_invalidate_cache) {
|
||||
+ bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
|
||||
+ if (local_err) {
|
||||
+ bs->open_flags |= BDRV_O_INACTIVE;
|
||||
+ error_propagate(errp, local_err);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- ret = refresh_total_sectors(bs, bs->total_sectors);
|
||||
- if (ret < 0) {
|
||||
- bs->open_flags |= BDRV_O_INACTIVE;
|
||||
- error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
||||
- return;
|
||||
+ FOR_EACH_DIRTY_BITMAP(bs, bm) {
|
||||
+ bdrv_dirty_bitmap_skip_store(bm, false);
|
||||
+ }
|
||||
+
|
||||
+ ret = refresh_total_sectors(bs, bs->total_sectors);
|
||||
+ if (ret < 0) {
|
||||
+ bs->open_flags |= BDRV_O_INACTIVE;
|
||||
+ error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
QLIST_FOREACH(parent, &bs->parents, next_parent) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,283 @@
|
||||
From 13e2076f5c4adbc9a3f96c8978150aa5e423e14a Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 15:01:30 +0100
|
||||
Subject: [PATCH 02/17] block: Add flags to BlockDriver.bdrv_co_truncate()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200608150140.38218-2-kwolf@redhat.com>
|
||||
Patchwork-id: 97448
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 01/11] block: Add flags to BlockDriver.bdrv_co_truncate()
|
||||
Bugzilla: 1780574
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
This adds a new BdrvRequestFlags parameter to the .bdrv_co_truncate()
|
||||
driver callbacks, and a supported_truncate_flags field in
|
||||
BlockDriverState that allows drivers to advertise support for request
|
||||
flags in the context of truncate.
|
||||
|
||||
For now, we always pass 0 and no drivers declare support for any flag.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200424125448.63318-2-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 92b92799dc8662b6f71809100a4aabc1ae408ebb)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/crypto.c | 3 ++-
|
||||
block/file-posix.c | 2 +-
|
||||
block/file-win32.c | 2 +-
|
||||
block/gluster.c | 1 +
|
||||
block/io.c | 8 +++++++-
|
||||
block/iscsi.c | 2 +-
|
||||
block/nfs.c | 3 ++-
|
||||
block/qcow2.c | 2 +-
|
||||
block/qed.c | 1 +
|
||||
block/raw-format.c | 2 +-
|
||||
block/rbd.c | 1 +
|
||||
block/sheepdog.c | 4 ++--
|
||||
block/ssh.c | 2 +-
|
||||
include/block/block_int.h | 10 +++++++++-
|
||||
tests/test-block-iothread.c | 3 ++-
|
||||
15 files changed, 33 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/block/crypto.c b/block/crypto.c
|
||||
index 5e3b15c..6e4b726 100644
|
||||
--- a/block/crypto.c
|
||||
+++ b/block/crypto.c
|
||||
@@ -299,7 +299,8 @@ static int block_crypto_co_create_generic(BlockDriverState *bs,
|
||||
|
||||
static int coroutine_fn
|
||||
block_crypto_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockCrypto *crypto = bs->opaque;
|
||||
uint64_t payload_offset =
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index 1609598..7551e8d 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -2021,7 +2021,7 @@ raw_regular_truncate(BlockDriverState *bs, int fd, int64_t offset,
|
||||
|
||||
static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
struct stat st;
|
||||
diff --git a/block/file-win32.c b/block/file-win32.c
|
||||
index 1585983..a6b0dda 100644
|
||||
--- a/block/file-win32.c
|
||||
+++ b/block/file-win32.c
|
||||
@@ -469,7 +469,7 @@ static void raw_close(BlockDriverState *bs)
|
||||
|
||||
static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
LONG low, high;
|
||||
diff --git a/block/gluster.c b/block/gluster.c
|
||||
index 0aa1f2c..d06df90 100644
|
||||
--- a/block/gluster.c
|
||||
+++ b/block/gluster.c
|
||||
@@ -1228,6 +1228,7 @@ static coroutine_fn int qemu_gluster_co_truncate(BlockDriverState *bs,
|
||||
int64_t offset,
|
||||
bool exact,
|
||||
PreallocMode prealloc,
|
||||
+ BdrvRequestFlags flags,
|
||||
Error **errp)
|
||||
{
|
||||
BDRVGlusterState *s = bs->opaque;
|
||||
diff --git a/block/io.c b/block/io.c
|
||||
index f75777f..549e5a4 100644
|
||||
--- a/block/io.c
|
||||
+++ b/block/io.c
|
||||
@@ -3320,6 +3320,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
BlockDriverState *bs = child->bs;
|
||||
BlockDriver *drv = bs->drv;
|
||||
BdrvTrackedRequest req;
|
||||
+ BdrvRequestFlags flags = 0;
|
||||
int64_t old_size, new_bytes;
|
||||
int ret;
|
||||
|
||||
@@ -3370,7 +3371,12 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
}
|
||||
|
||||
if (drv->bdrv_co_truncate) {
|
||||
- ret = drv->bdrv_co_truncate(bs, offset, exact, prealloc, errp);
|
||||
+ if (flags & ~bs->supported_truncate_flags) {
|
||||
+ error_setg(errp, "Block driver does not support requested flags");
|
||||
+ ret = -ENOTSUP;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ ret = drv->bdrv_co_truncate(bs, offset, exact, prealloc, flags, errp);
|
||||
} else if (bs->file && drv->is_filter) {
|
||||
ret = bdrv_co_truncate(bs->file, offset, exact, prealloc, errp);
|
||||
} else {
|
||||
diff --git a/block/iscsi.c b/block/iscsi.c
|
||||
index 16b0716..0bea2d3 100644
|
||||
--- a/block/iscsi.c
|
||||
+++ b/block/iscsi.c
|
||||
@@ -2125,7 +2125,7 @@ static void iscsi_reopen_commit(BDRVReopenState *reopen_state)
|
||||
|
||||
static int coroutine_fn iscsi_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
IscsiLun *iscsilun = bs->opaque;
|
||||
int64_t cur_length;
|
||||
diff --git a/block/nfs.c b/block/nfs.c
|
||||
index cc2413d..2393fbf 100644
|
||||
--- a/block/nfs.c
|
||||
+++ b/block/nfs.c
|
||||
@@ -755,7 +755,8 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
|
||||
|
||||
static int coroutine_fn
|
||||
nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags,
|
||||
+ Error **errp)
|
||||
{
|
||||
NFSClient *client = bs->opaque;
|
||||
int ret;
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index dbd870a..977445e 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -3948,7 +3948,7 @@ fail:
|
||||
|
||||
static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
uint64_t old_length;
|
||||
diff --git a/block/qed.c b/block/qed.c
|
||||
index 1af9b3c..fb6100b 100644
|
||||
--- a/block/qed.c
|
||||
+++ b/block/qed.c
|
||||
@@ -1467,6 +1467,7 @@ static int coroutine_fn bdrv_qed_co_truncate(BlockDriverState *bs,
|
||||
int64_t offset,
|
||||
bool exact,
|
||||
PreallocMode prealloc,
|
||||
+ BdrvRequestFlags flags,
|
||||
Error **errp)
|
||||
{
|
||||
BDRVQEDState *s = bs->opaque;
|
||||
diff --git a/block/raw-format.c b/block/raw-format.c
|
||||
index 4bb54f4..f994c4a 100644
|
||||
--- a/block/raw-format.c
|
||||
+++ b/block/raw-format.c
|
||||
@@ -371,7 +371,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
|
||||
static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
diff --git a/block/rbd.c b/block/rbd.c
|
||||
index 8847259..fcdb60a 100644
|
||||
--- a/block/rbd.c
|
||||
+++ b/block/rbd.c
|
||||
@@ -1090,6 +1090,7 @@ static int coroutine_fn qemu_rbd_co_truncate(BlockDriverState *bs,
|
||||
int64_t offset,
|
||||
bool exact,
|
||||
PreallocMode prealloc,
|
||||
+ BdrvRequestFlags flags,
|
||||
Error **errp)
|
||||
{
|
||||
int r;
|
||||
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
||||
index a8a7e32..077aed8 100644
|
||||
--- a/block/sheepdog.c
|
||||
+++ b/block/sheepdog.c
|
||||
@@ -2288,7 +2288,7 @@ static int64_t sd_getlength(BlockDriverState *bs)
|
||||
|
||||
static int coroutine_fn sd_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVSheepdogState *s = bs->opaque;
|
||||
int ret, fd;
|
||||
@@ -2604,7 +2604,7 @@ static coroutine_fn int sd_co_writev(BlockDriverState *bs, int64_t sector_num,
|
||||
|
||||
assert(!flags);
|
||||
if (offset > s->inode.vdi_size) {
|
||||
- ret = sd_co_truncate(bs, offset, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ ret = sd_co_truncate(bs, offset, false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
diff --git a/block/ssh.c b/block/ssh.c
|
||||
index 84e9282..9eb33df 100644
|
||||
--- a/block/ssh.c
|
||||
+++ b/block/ssh.c
|
||||
@@ -1298,7 +1298,7 @@ static int64_t ssh_getlength(BlockDriverState *bs)
|
||||
|
||||
static int coroutine_fn ssh_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp)
|
||||
+ BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
BDRVSSHState *s = bs->opaque;
|
||||
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index 876a83d..41f13ec 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -356,7 +356,7 @@ struct BlockDriver {
|
||||
*/
|
||||
int coroutine_fn (*bdrv_co_truncate)(BlockDriverState *bs, int64_t offset,
|
||||
bool exact, PreallocMode prealloc,
|
||||
- Error **errp);
|
||||
+ BdrvRequestFlags flags, Error **errp);
|
||||
|
||||
int64_t (*bdrv_getlength)(BlockDriverState *bs);
|
||||
bool has_variable_length;
|
||||
@@ -849,6 +849,14 @@ struct BlockDriverState {
|
||||
/* Flags honored during pwrite_zeroes (so far: BDRV_REQ_FUA,
|
||||
* BDRV_REQ_MAY_UNMAP, BDRV_REQ_WRITE_UNCHANGED) */
|
||||
unsigned int supported_zero_flags;
|
||||
+ /*
|
||||
+ * Flags honoured during truncate (so far: BDRV_REQ_ZERO_WRITE).
|
||||
+ *
|
||||
+ * If BDRV_REQ_ZERO_WRITE is given, the truncate operation must make sure
|
||||
+ * that any added space reads as all zeros. If this can't be guaranteed,
|
||||
+ * the operation must fail.
|
||||
+ */
|
||||
+ unsigned int supported_truncate_flags;
|
||||
|
||||
/* the following member gives a name to every node on the bs graph. */
|
||||
char node_name[32];
|
||||
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
|
||||
index 0c86180..2f3b763 100644
|
||||
--- a/tests/test-block-iothread.c
|
||||
+++ b/tests/test-block-iothread.c
|
||||
@@ -46,7 +46,8 @@ static int coroutine_fn bdrv_test_co_pdiscard(BlockDriverState *bs,
|
||||
|
||||
static int coroutine_fn
|
||||
bdrv_test_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags,
|
||||
+ Error **errp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
353
SOURCES/kvm-block-Add-flags-to-bdrv-_co-_truncate.patch
Normal file
353
SOURCES/kvm-block-Add-flags-to-bdrv-_co-_truncate.patch
Normal file
@ -0,0 +1,353 @@
|
||||
From 50127f0ff9e13a15fd5bfeb2662e2404ff20f364 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 15:01:31 +0100
|
||||
Subject: [PATCH 03/17] block: Add flags to bdrv(_co)_truncate()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200608150140.38218-3-kwolf@redhat.com>
|
||||
Patchwork-id: 97445
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 02/11] block: Add flags to bdrv(_co)_truncate()
|
||||
Bugzilla: 1780574
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
Now that block drivers can support flags for .bdrv_co_truncate, expose
|
||||
the parameter in the node level interfaces bdrv_co_truncate() and
|
||||
bdrv_truncate().
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200424125448.63318-3-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 7b8e4857426f2e2de2441749996c6161b550bada)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/block-backend.c | 2 +-
|
||||
block/crypto.c | 2 +-
|
||||
block/io.c | 12 +++++++-----
|
||||
block/parallels.c | 6 +++---
|
||||
block/qcow.c | 4 ++--
|
||||
block/qcow2-refcount.c | 2 +-
|
||||
block/qcow2.c | 15 +++++++++------
|
||||
block/raw-format.c | 2 +-
|
||||
block/vhdx-log.c | 2 +-
|
||||
block/vhdx.c | 2 +-
|
||||
block/vmdk.c | 2 +-
|
||||
include/block/block.h | 5 +++--
|
||||
tests/test-block-iothread.c | 6 +++---
|
||||
13 files changed, 34 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||
index 38ae413..8be2006 100644
|
||||
--- a/block/block-backend.c
|
||||
+++ b/block/block-backend.c
|
||||
@@ -2144,7 +2144,7 @@ int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- return bdrv_truncate(blk->root, offset, exact, prealloc, errp);
|
||||
+ return bdrv_truncate(blk->root, offset, exact, prealloc, 0, errp);
|
||||
}
|
||||
|
||||
int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
|
||||
diff --git a/block/crypto.c b/block/crypto.c
|
||||
index 6e4b726..fcb4a97 100644
|
||||
--- a/block/crypto.c
|
||||
+++ b/block/crypto.c
|
||||
@@ -313,7 +313,7 @@ block_crypto_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
|
||||
|
||||
offset += payload_offset;
|
||||
|
||||
- return bdrv_co_truncate(bs->file, offset, exact, prealloc, errp);
|
||||
+ return bdrv_co_truncate(bs->file, offset, exact, prealloc, 0, errp);
|
||||
}
|
||||
|
||||
static void block_crypto_close(BlockDriverState *bs)
|
||||
diff --git a/block/io.c b/block/io.c
|
||||
index 549e5a4..3235ce5 100644
|
||||
--- a/block/io.c
|
||||
+++ b/block/io.c
|
||||
@@ -3315,12 +3315,12 @@ static void bdrv_parent_cb_resize(BlockDriverState *bs)
|
||||
* 'offset' bytes in length.
|
||||
*/
|
||||
int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockDriverState *bs = child->bs;
|
||||
BlockDriver *drv = bs->drv;
|
||||
BdrvTrackedRequest req;
|
||||
- BdrvRequestFlags flags = 0;
|
||||
int64_t old_size, new_bytes;
|
||||
int ret;
|
||||
|
||||
@@ -3378,7 +3378,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
}
|
||||
ret = drv->bdrv_co_truncate(bs, offset, exact, prealloc, flags, errp);
|
||||
} else if (bs->file && drv->is_filter) {
|
||||
- ret = bdrv_co_truncate(bs->file, offset, exact, prealloc, errp);
|
||||
+ ret = bdrv_co_truncate(bs->file, offset, exact, prealloc, flags, errp);
|
||||
} else {
|
||||
error_setg(errp, "Image format driver does not support resize");
|
||||
ret = -ENOTSUP;
|
||||
@@ -3411,6 +3411,7 @@ typedef struct TruncateCo {
|
||||
int64_t offset;
|
||||
bool exact;
|
||||
PreallocMode prealloc;
|
||||
+ BdrvRequestFlags flags;
|
||||
Error **errp;
|
||||
int ret;
|
||||
} TruncateCo;
|
||||
@@ -3419,12 +3420,12 @@ static void coroutine_fn bdrv_truncate_co_entry(void *opaque)
|
||||
{
|
||||
TruncateCo *tco = opaque;
|
||||
tco->ret = bdrv_co_truncate(tco->child, tco->offset, tco->exact,
|
||||
- tco->prealloc, tco->errp);
|
||||
+ tco->prealloc, tco->flags, tco->errp);
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
int bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
Coroutine *co;
|
||||
TruncateCo tco = {
|
||||
@@ -3432,6 +3433,7 @@ int bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
.offset = offset,
|
||||
.exact = exact,
|
||||
.prealloc = prealloc,
|
||||
+ .flags = flags,
|
||||
.errp = errp,
|
||||
.ret = NOT_DONE,
|
||||
};
|
||||
diff --git a/block/parallels.c b/block/parallels.c
|
||||
index 6d4ed77..2be92cf 100644
|
||||
--- a/block/parallels.c
|
||||
+++ b/block/parallels.c
|
||||
@@ -203,7 +203,7 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
|
||||
} else {
|
||||
ret = bdrv_truncate(bs->file,
|
||||
(s->data_end + space) << BDRV_SECTOR_BITS,
|
||||
- false, PREALLOC_MODE_OFF, NULL);
|
||||
+ false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
}
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
@@ -493,7 +493,7 @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs,
|
||||
* That means we have to pass exact=true.
|
||||
*/
|
||||
ret = bdrv_truncate(bs->file, res->image_end_offset, true,
|
||||
- PREALLOC_MODE_OFF, &local_err);
|
||||
+ PREALLOC_MODE_OFF, 0, &local_err);
|
||||
if (ret < 0) {
|
||||
error_report_err(local_err);
|
||||
res->check_errors++;
|
||||
@@ -889,7 +889,7 @@ static void parallels_close(BlockDriverState *bs)
|
||||
|
||||
/* errors are ignored, so we might as well pass exact=true */
|
||||
bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
}
|
||||
|
||||
g_free(s->bat_dirty_bmap);
|
||||
diff --git a/block/qcow.c b/block/qcow.c
|
||||
index 8973e4e..6b5f226 100644
|
||||
--- a/block/qcow.c
|
||||
+++ b/block/qcow.c
|
||||
@@ -480,7 +480,7 @@ static int get_cluster_offset(BlockDriverState *bs,
|
||||
return -E2BIG;
|
||||
}
|
||||
ret = bdrv_truncate(bs->file, cluster_offset + s->cluster_size,
|
||||
- false, PREALLOC_MODE_OFF, NULL);
|
||||
+ false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -1035,7 +1035,7 @@ static int qcow_make_empty(BlockDriverState *bs)
|
||||
l1_length) < 0)
|
||||
return -1;
|
||||
ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length, false,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
|
||||
index f67ac6b..3a90d75 100644
|
||||
--- a/block/qcow2-refcount.c
|
||||
+++ b/block/qcow2-refcount.c
|
||||
@@ -2017,7 +2017,7 @@ static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
|
||||
}
|
||||
|
||||
ret = bdrv_truncate(bs->file, offset + s->cluster_size, false,
|
||||
- PREALLOC_MODE_OFF, &local_err);
|
||||
+ PREALLOC_MODE_OFF, 0, &local_err);
|
||||
if (ret < 0) {
|
||||
error_report_err(local_err);
|
||||
goto resize_fail;
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index 977445e..c0fdcb9 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -3082,7 +3082,7 @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
|
||||
mode = PREALLOC_MODE_OFF;
|
||||
}
|
||||
ret = bdrv_co_truncate(s->data_file, host_offset + cur_bytes, false,
|
||||
- mode, errp);
|
||||
+ mode, 0, errp);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -4044,7 +4044,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
* always fulfilled, so there is no need to pass it on.)
|
||||
*/
|
||||
bdrv_co_truncate(bs->file, (last_cluster + 1) * s->cluster_size,
|
||||
- false, PREALLOC_MODE_OFF, &local_err);
|
||||
+ false, PREALLOC_MODE_OFF, 0, &local_err);
|
||||
if (local_err) {
|
||||
warn_reportf_err(local_err,
|
||||
"Failed to truncate the tail of the image: ");
|
||||
@@ -4066,7 +4066,8 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
* file should be resized to the exact target size, too,
|
||||
* so we pass @exact here.
|
||||
*/
|
||||
- ret = bdrv_co_truncate(s->data_file, offset, exact, prealloc, errp);
|
||||
+ ret = bdrv_co_truncate(s->data_file, offset, exact, prealloc, 0,
|
||||
+ errp);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -4152,7 +4153,8 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
new_file_size = allocation_start +
|
||||
nb_new_data_clusters * s->cluster_size;
|
||||
/* Image file grows, so @exact does not matter */
|
||||
- ret = bdrv_co_truncate(bs->file, new_file_size, false, prealloc, errp);
|
||||
+ ret = bdrv_co_truncate(bs->file, new_file_size, false, prealloc, 0,
|
||||
+ errp);
|
||||
if (ret < 0) {
|
||||
error_prepend(errp, "Failed to resize underlying file: ");
|
||||
qcow2_free_clusters(bs, allocation_start,
|
||||
@@ -4255,7 +4257,8 @@ qcow2_co_pwritev_compressed_part(BlockDriverState *bs,
|
||||
if (len < 0) {
|
||||
return len;
|
||||
}
|
||||
- return bdrv_co_truncate(bs->file, len, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ return bdrv_co_truncate(bs->file, len, false, PREALLOC_MODE_OFF, 0,
|
||||
+ NULL);
|
||||
}
|
||||
|
||||
if (offset_into_cluster(s, offset)) {
|
||||
@@ -4493,7 +4496,7 @@ static int make_completely_empty(BlockDriverState *bs)
|
||||
}
|
||||
|
||||
ret = bdrv_truncate(bs->file, (3 + l1_clusters) * s->cluster_size, false,
|
||||
- PREALLOC_MODE_OFF, &local_err);
|
||||
+ PREALLOC_MODE_OFF, 0, &local_err);
|
||||
if (ret < 0) {
|
||||
error_report_err(local_err);
|
||||
goto fail;
|
||||
diff --git a/block/raw-format.c b/block/raw-format.c
|
||||
index f994c4a..c3acf9a 100644
|
||||
--- a/block/raw-format.c
|
||||
+++ b/block/raw-format.c
|
||||
@@ -387,7 +387,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
s->size = offset;
|
||||
offset += s->offset;
|
||||
- return bdrv_co_truncate(bs->file, offset, exact, prealloc, errp);
|
||||
+ return bdrv_co_truncate(bs->file, offset, exact, prealloc, 0, errp);
|
||||
}
|
||||
|
||||
static void raw_eject(BlockDriverState *bs, bool eject_flag)
|
||||
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
|
||||
index 13a49c2..404fb5f 100644
|
||||
--- a/block/vhdx-log.c
|
||||
+++ b/block/vhdx-log.c
|
||||
@@ -558,7 +558,7 @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
|
||||
goto exit;
|
||||
}
|
||||
ret = bdrv_truncate(bs->file, new_file_size, false,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
diff --git a/block/vhdx.c b/block/vhdx.c
|
||||
index 33e57cd..5dfbb20 100644
|
||||
--- a/block/vhdx.c
|
||||
+++ b/block/vhdx.c
|
||||
@@ -1264,7 +1264,7 @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s,
|
||||
}
|
||||
|
||||
return bdrv_truncate(bs->file, *new_offset + s->block_size, false,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/block/vmdk.c b/block/vmdk.c
|
||||
index eb726f2..1bbf937 100644
|
||||
--- a/block/vmdk.c
|
||||
+++ b/block/vmdk.c
|
||||
@@ -2077,7 +2077,7 @@ vmdk_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
|
||||
}
|
||||
length = QEMU_ALIGN_UP(length, BDRV_SECTOR_SIZE);
|
||||
ret = bdrv_truncate(s->extents[i].file, length, false,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
diff --git a/include/block/block.h b/include/block/block.h
|
||||
index b2a3074..4913596 100644
|
||||
--- a/include/block/block.h
|
||||
+++ b/include/block/block.h
|
||||
@@ -348,9 +348,10 @@ BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
|
||||
void bdrv_refresh_filename(BlockDriverState *bs);
|
||||
|
||||
int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp);
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags,
|
||||
+ Error **errp);
|
||||
int bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp);
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
|
||||
|
||||
int64_t bdrv_nb_sectors(BlockDriverState *bs);
|
||||
int64_t bdrv_getlength(BlockDriverState *bs);
|
||||
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
|
||||
index 2f3b763..71e9bce 100644
|
||||
--- a/tests/test-block-iothread.c
|
||||
+++ b/tests/test-block-iothread.c
|
||||
@@ -186,18 +186,18 @@ static void test_sync_op_truncate(BdrvChild *c)
|
||||
int ret;
|
||||
|
||||
/* Normal success path */
|
||||
- ret = bdrv_truncate(c, 65536, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ ret = bdrv_truncate(c, 65536, false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
g_assert_cmpint(ret, ==, 0);
|
||||
|
||||
/* Early error: Negative offset */
|
||||
- ret = bdrv_truncate(c, -2, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ ret = bdrv_truncate(c, -2, false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
g_assert_cmpint(ret, ==, -EINVAL);
|
||||
|
||||
/* Error: Read-only image */
|
||||
c->bs->read_only = true;
|
||||
c->bs->open_flags &= ~BDRV_O_RDWR;
|
||||
|
||||
- ret = bdrv_truncate(c, 65536, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ ret = bdrv_truncate(c, 65536, false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
g_assert_cmpint(ret, ==, -EACCES);
|
||||
|
||||
c->bs->read_only = false;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,105 @@
|
||||
From c8ecaea34f03b8ddda7d2b41b0d6f397469c8959 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 10 Jun 2020 18:32:02 -0400
|
||||
Subject: [PATCH 2/2] block: Call attention to truncation of long NBD exports
|
||||
|
||||
RH-Author: Eric Blake <eblake@redhat.com>
|
||||
Message-id: <20200610183202.3780750-3-eblake@redhat.com>
|
||||
Patchwork-id: 97495
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 2/2] block: Call attention to truncation of long NBD exports
|
||||
Bugzilla: 1845384
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Commit 93676c88 relaxed our NBD client code to request export names up
|
||||
to the NBD protocol maximum of 4096 bytes without NUL terminator, even
|
||||
though the block layer can't store anything longer than 4096 bytes
|
||||
including NUL terminator for display to the user. Since this means
|
||||
there are some export names where we have to truncate things, we can
|
||||
at least try to make the truncation a bit more obvious for the user.
|
||||
Note that in spite of the truncated display name, we can still
|
||||
communicate with an NBD server using such a long export name; this was
|
||||
deemed nicer than refusing to even connect to such a server (since the
|
||||
server may not be under our control, and since determining our actual
|
||||
length limits gets tricky when nbd://host:port/export and
|
||||
nbd+unix:///export?socket=/path are themselves variable-length
|
||||
expansions beyond the export name but count towards the block layer
|
||||
name length).
|
||||
|
||||
Reported-by: Xueqiang Wei <xuwei@redhat.com>
|
||||
Fixes: https://bugzilla.redhat.com/1843684
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Message-Id: <20200610163741.3745251-3-eblake@redhat.com>
|
||||
(cherry picked from commit 5c86bdf1208916ece0b87e1151c9b48ee54faa3e)
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||
---
|
||||
block.c | 7 +++++--
|
||||
block/nbd.c | 21 +++++++++++++--------
|
||||
2 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 12c8941879..57740d312e 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -6683,8 +6683,11 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
||||
pstrcpy(bs->filename, sizeof(bs->filename), bs->exact_filename);
|
||||
} else {
|
||||
QString *json = qobject_to_json(QOBJECT(bs->full_open_options));
|
||||
- snprintf(bs->filename, sizeof(bs->filename), "json:%s",
|
||||
- qstring_get_str(json));
|
||||
+ if (snprintf(bs->filename, sizeof(bs->filename), "json:%s",
|
||||
+ qstring_get_str(json)) >= sizeof(bs->filename)) {
|
||||
+ /* Give user a hint if we truncated things. */
|
||||
+ strcpy(bs->filename + sizeof(bs->filename) - 4, "...");
|
||||
+ }
|
||||
qobject_unref(json);
|
||||
}
|
||||
}
|
||||
diff --git a/block/nbd.c b/block/nbd.c
|
||||
index 927915d93d..5bb154017d 100644
|
||||
--- a/block/nbd.c
|
||||
+++ b/block/nbd.c
|
||||
@@ -1978,6 +1978,7 @@ static void nbd_refresh_filename(BlockDriverState *bs)
|
||||
{
|
||||
BDRVNBDState *s = bs->opaque;
|
||||
const char *host = NULL, *port = NULL, *path = NULL;
|
||||
+ size_t len = 0;
|
||||
|
||||
if (s->saddr->type == SOCKET_ADDRESS_TYPE_INET) {
|
||||
const InetSocketAddress *inet = &s->saddr->u.inet;
|
||||
@@ -1990,17 +1991,21 @@ static void nbd_refresh_filename(BlockDriverState *bs)
|
||||
} /* else can't represent as pseudo-filename */
|
||||
|
||||
if (path && s->export) {
|
||||
- snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
- "nbd+unix:///%s?socket=%s", s->export, path);
|
||||
+ len = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
+ "nbd+unix:///%s?socket=%s", s->export, path);
|
||||
} else if (path && !s->export) {
|
||||
- snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
- "nbd+unix://?socket=%s", path);
|
||||
+ len = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
+ "nbd+unix://?socket=%s", path);
|
||||
} else if (host && s->export) {
|
||||
- snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
- "nbd://%s:%s/%s", host, port, s->export);
|
||||
+ len = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
+ "nbd://%s:%s/%s", host, port, s->export);
|
||||
} else if (host && !s->export) {
|
||||
- snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
- "nbd://%s:%s", host, port);
|
||||
+ len = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
|
||||
+ "nbd://%s:%s", host, port);
|
||||
+ }
|
||||
+ if (len > sizeof(bs->exact_filename)) {
|
||||
+ /* Name is too long to represent exactly, so leave it empty. */
|
||||
+ bs->exact_filename[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,84 @@
|
||||
From f17b37b58a57d849d2ff5fa04f149d9415803a39 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 8 Apr 2020 17:29:17 +0100
|
||||
Subject: [PATCH 6/6] block: Fix blk->in_flight during blk_wait_while_drained()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200408172917.18712-7-kwolf@redhat.com>
|
||||
Patchwork-id: 94599
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 6/6] block: Fix blk->in_flight during blk_wait_while_drained()
|
||||
Bugzilla: 1817621
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
Waiting in blk_wait_while_drained() while blk->in_flight is increased
|
||||
for the current request is wrong because it will cause the drain
|
||||
operation to deadlock.
|
||||
|
||||
This patch makes sure that blk_wait_while_drained() is called with
|
||||
blk->in_flight increased exactly once for the current request, and that
|
||||
it temporarily decreases the counter while it waits.
|
||||
|
||||
Fixes: cf3129323f900ef5ddbccbe86e4fa801e88c566e
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200407121259.21350-4-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 7f16476fab14fc32388e0ebae793f64673848efa)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/block-backend.c | 17 +++++------------
|
||||
1 file changed, 5 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||
index 610dbfa..38ae413 100644
|
||||
--- a/block/block-backend.c
|
||||
+++ b/block/block-backend.c
|
||||
@@ -1140,10 +1140,15 @@ static int blk_check_byte_request(BlockBackend *blk, int64_t offset,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
static void coroutine_fn blk_wait_while_drained(BlockBackend *blk)
|
||||
{
|
||||
+ assert(blk->in_flight > 0);
|
||||
+
|
||||
if (blk->quiesce_counter && !blk->disable_request_queuing) {
|
||||
+ blk_dec_in_flight(blk);
|
||||
qemu_co_queue_wait(&blk->queued_requests, NULL);
|
||||
+ blk_inc_in_flight(blk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1418,12 +1423,6 @@ static void blk_aio_read_entry(void *opaque)
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- if (rwco->blk->quiesce_counter) {
|
||||
- blk_dec_in_flight(rwco->blk);
|
||||
- blk_wait_while_drained(rwco->blk);
|
||||
- blk_inc_in_flight(rwco->blk);
|
||||
- }
|
||||
-
|
||||
assert(qiov->size == acb->bytes);
|
||||
rwco->ret = blk_do_preadv(rwco->blk, rwco->offset, acb->bytes,
|
||||
qiov, rwco->flags);
|
||||
@@ -1436,12 +1435,6 @@ static void blk_aio_write_entry(void *opaque)
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- if (rwco->blk->quiesce_counter) {
|
||||
- blk_dec_in_flight(rwco->blk);
|
||||
- blk_wait_while_drained(rwco->blk);
|
||||
- blk_inc_in_flight(rwco->blk);
|
||||
- }
|
||||
-
|
||||
assert(!qiov || qiov->size == acb->bytes);
|
||||
rwco->ret = blk_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes,
|
||||
qiov, 0, rwco->flags);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,91 @@
|
||||
From 5774af5a3c713d0c93010c30453812eae6a749cd Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:37 +0000
|
||||
Subject: [PATCH 17/20] block: Fix cross-AioContext blockdev-snapshot
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-12-kwolf@redhat.com>
|
||||
Patchwork-id: 94286
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 11/13] block: Fix cross-AioContext blockdev-snapshot
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
external_snapshot_prepare() tries to move the overlay to the AioContext
|
||||
of the backing file (the snapshotted node). However, it's possible that
|
||||
this doesn't work, but the backing file can instead be moved to the
|
||||
overlay's AioContext (e.g. opening the backing chain for a mirror
|
||||
target).
|
||||
|
||||
bdrv_append() already indirectly uses bdrv_attach_node(), which takes
|
||||
care to move nodes to make sure they use the same AioContext and which
|
||||
tries both directions.
|
||||
|
||||
So the problem has a simple fix: Just delete the unnecessary extra
|
||||
bdrv_try_set_aio_context() call in external_snapshot_prepare() and
|
||||
instead assert in bdrv_append() that both nodes were indeed moved to the
|
||||
same AioContext.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200310113831.27293-6-kwolf@redhat.com>
|
||||
Tested-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 30dd65f307b647eef8156c4a33bd007823ef85cb)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 1 +
|
||||
blockdev.c | 16 ----------------
|
||||
2 files changed, 1 insertion(+), 16 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 354d388..ec29b1e 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -4327,6 +4327,7 @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
|
||||
bdrv_ref(from);
|
||||
|
||||
assert(qemu_get_current_aio_context() == qemu_get_aio_context());
|
||||
+ assert(bdrv_get_aio_context(from) == bdrv_get_aio_context(to));
|
||||
bdrv_drained_begin(from);
|
||||
|
||||
/* Put all parents into @list and calculate their cumulative permissions */
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 7918533..c8d4b51 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1535,9 +1535,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
DO_UPCAST(ExternalSnapshotState, common, common);
|
||||
TransactionAction *action = common->action;
|
||||
AioContext *aio_context;
|
||||
- AioContext *old_context;
|
||||
uint64_t perm, shared;
|
||||
- int ret;
|
||||
|
||||
/* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar
|
||||
* purpose but a different set of parameters */
|
||||
@@ -1678,20 +1676,6 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
- old_context = bdrv_get_aio_context(state->new_bs);
|
||||
- aio_context_release(aio_context);
|
||||
- aio_context_acquire(old_context);
|
||||
-
|
||||
- ret = bdrv_try_set_aio_context(state->new_bs, aio_context, errp);
|
||||
-
|
||||
- aio_context_release(old_context);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- if (ret < 0) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
/* This removes our old bs and adds the new bs. This is an operation that
|
||||
* can fail, so we need to do it in .prepare; undoing it for abort is
|
||||
* always possible. */
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 05452efd7e0fb0522099ae09a396f8f97e66014a Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 11 Mar 2020 10:51:47 +0000
|
||||
Subject: [PATCH 06/20] block: Fix leak in bdrv_create_file_fallback()
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200311105147.13208-7-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94229
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 6/6] block: Fix leak in bdrv_create_file_fallback()
|
||||
Bugzilla: 1640894
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
@options is leaked by the first two return statements in this function.
|
||||
|
||||
Note that blk_new_open() takes the reference to @options even on
|
||||
failure, so all we need to do to fix the leak is to move the QDict
|
||||
allocation down to where we actually need it.
|
||||
|
||||
Reported-by: Coverity (CID 1419884)
|
||||
Fixes: fd17146cd93d1704cd96d7c2757b325fc7aac6fd
|
||||
("block: Generic file creation fallback")
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200225155618.133412-1-mreitz@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit eeea1faa099f82328f5831cf252f8ce0a59a9287)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 3beec7f..e1a4e38 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -600,7 +600,7 @@ static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
|
||||
QemuOpts *opts, Error **errp)
|
||||
{
|
||||
BlockBackend *blk;
|
||||
- QDict *options = qdict_new();
|
||||
+ QDict *options;
|
||||
int64_t size = 0;
|
||||
char *buf = NULL;
|
||||
PreallocMode prealloc;
|
||||
@@ -623,6 +623,7 @@ static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
+ options = qdict_new();
|
||||
qdict_put_str(options, "driver", drv->format_name);
|
||||
|
||||
blk = blk_new_open(filename, NULL, options,
|
||||
--
|
||||
1.8.3.1
|
||||
|
227
SOURCES/kvm-block-Generic-file-creation-fallback.patch
Normal file
227
SOURCES/kvm-block-Generic-file-creation-fallback.patch
Normal file
@ -0,0 +1,227 @@
|
||||
From 882d09226b7f45b72c5b7763c4c4aba182e0f8a1 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 11 Mar 2020 10:51:43 +0000
|
||||
Subject: [PATCH 02/20] block: Generic file creation fallback
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200311105147.13208-3-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94227
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 2/6] block: Generic file creation fallback
|
||||
Bugzilla: 1640894
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
If a protocol driver does not support image creation, we can see whether
|
||||
maybe the file exists already. If so, just truncating it will be
|
||||
sufficient.
|
||||
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200122164532.178040-3-mreitz@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit fd17146cd93d1704cd96d7c2757b325fc7aac6fd)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 147 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 2e5e8b6..3beec7f 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -532,20 +532,139 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
||||
+/**
|
||||
+ * Helper function for bdrv_create_file_fallback(): Resize @blk to at
|
||||
+ * least the given @minimum_size.
|
||||
+ *
|
||||
+ * On success, return @blk's actual length.
|
||||
+ * Otherwise, return -errno.
|
||||
+ */
|
||||
+static int64_t create_file_fallback_truncate(BlockBackend *blk,
|
||||
+ int64_t minimum_size, Error **errp)
|
||||
{
|
||||
- BlockDriver *drv;
|
||||
+ Error *local_err = NULL;
|
||||
+ int64_t size;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = blk_truncate(blk, minimum_size, false, PREALLOC_MODE_OFF, &local_err);
|
||||
+ if (ret < 0 && ret != -ENOTSUP) {
|
||||
+ error_propagate(errp, local_err);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ size = blk_getlength(blk);
|
||||
+ if (size < 0) {
|
||||
+ error_free(local_err);
|
||||
+ error_setg_errno(errp, -size,
|
||||
+ "Failed to inquire the new image file's length");
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ if (size < minimum_size) {
|
||||
+ /* Need to grow the image, but we failed to do that */
|
||||
+ error_propagate(errp, local_err);
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
+
|
||||
+ error_free(local_err);
|
||||
+ local_err = NULL;
|
||||
+
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Helper function for bdrv_create_file_fallback(): Zero the first
|
||||
+ * sector to remove any potentially pre-existing image header.
|
||||
+ */
|
||||
+static int create_file_fallback_zero_first_sector(BlockBackend *blk,
|
||||
+ int64_t current_size,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ int64_t bytes_to_clear;
|
||||
+ int ret;
|
||||
+
|
||||
+ bytes_to_clear = MIN(current_size, BDRV_SECTOR_SIZE);
|
||||
+ if (bytes_to_clear) {
|
||||
+ ret = blk_pwrite_zeroes(blk, 0, bytes_to_clear, BDRV_REQ_MAY_UNMAP);
|
||||
+ if (ret < 0) {
|
||||
+ error_setg_errno(errp, -ret,
|
||||
+ "Failed to clear the new image's first sector");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
|
||||
+ QemuOpts *opts, Error **errp)
|
||||
+{
|
||||
+ BlockBackend *blk;
|
||||
+ QDict *options = qdict_new();
|
||||
+ int64_t size = 0;
|
||||
+ char *buf = NULL;
|
||||
+ PreallocMode prealloc;
|
||||
Error *local_err = NULL;
|
||||
int ret;
|
||||
|
||||
+ size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
|
||||
+ buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
|
||||
+ prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
|
||||
+ PREALLOC_MODE_OFF, &local_err);
|
||||
+ g_free(buf);
|
||||
+ if (local_err) {
|
||||
+ error_propagate(errp, local_err);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (prealloc != PREALLOC_MODE_OFF) {
|
||||
+ error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
+ PreallocMode_str(prealloc));
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
+
|
||||
+ qdict_put_str(options, "driver", drv->format_name);
|
||||
+
|
||||
+ blk = blk_new_open(filename, NULL, options,
|
||||
+ BDRV_O_RDWR | BDRV_O_RESIZE, errp);
|
||||
+ if (!blk) {
|
||||
+ error_prepend(errp, "Protocol driver '%s' does not support image "
|
||||
+ "creation, and opening the image failed: ",
|
||||
+ drv->format_name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ size = create_file_fallback_truncate(blk, size, errp);
|
||||
+ if (size < 0) {
|
||||
+ ret = size;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ ret = create_file_fallback_zero_first_sector(blk, size, errp);
|
||||
+ if (ret < 0) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+out:
|
||||
+ blk_unref(blk);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
||||
+{
|
||||
+ BlockDriver *drv;
|
||||
+
|
||||
drv = bdrv_find_protocol(filename, true, errp);
|
||||
if (drv == NULL) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
- ret = bdrv_create(drv, filename, opts, &local_err);
|
||||
- error_propagate(errp, local_err);
|
||||
- return ret;
|
||||
+ if (drv->bdrv_co_create_opts) {
|
||||
+ return bdrv_create(drv, filename, opts, errp);
|
||||
+ } else {
|
||||
+ return bdrv_create_file_fallback(filename, drv, opts, errp);
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1422,6 +1541,24 @@ QemuOptsList bdrv_runtime_opts = {
|
||||
},
|
||||
};
|
||||
|
||||
+static QemuOptsList fallback_create_opts = {
|
||||
+ .name = "fallback-create-opts",
|
||||
+ .head = QTAILQ_HEAD_INITIALIZER(fallback_create_opts.head),
|
||||
+ .desc = {
|
||||
+ {
|
||||
+ .name = BLOCK_OPT_SIZE,
|
||||
+ .type = QEMU_OPT_SIZE,
|
||||
+ .help = "Virtual disk size"
|
||||
+ },
|
||||
+ {
|
||||
+ .name = BLOCK_OPT_PREALLOC,
|
||||
+ .type = QEMU_OPT_STRING,
|
||||
+ .help = "Preallocation mode (allowed values: off)"
|
||||
+ },
|
||||
+ { /* end of list */ }
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* Common part for opening disk images and files
|
||||
*
|
||||
@@ -5743,14 +5880,12 @@ void bdrv_img_create(const char *filename, const char *fmt,
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!proto_drv->create_opts) {
|
||||
- error_setg(errp, "Protocol driver '%s' does not support image creation",
|
||||
- proto_drv->format_name);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
create_opts = qemu_opts_append(create_opts, drv->create_opts);
|
||||
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
||||
+ if (proto_drv->create_opts) {
|
||||
+ create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
||||
+ } else {
|
||||
+ create_opts = qemu_opts_append(create_opts, &fallback_create_opts);
|
||||
+ }
|
||||
|
||||
/* Create parameter list with default values */
|
||||
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,295 @@
|
||||
From 52cc1d1cd2f695c5761d65baec961d14552a79ed Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 8 Apr 2020 17:29:16 +0100
|
||||
Subject: [PATCH 5/6] block: Increase BB.in_flight for coroutine and sync
|
||||
interfaces
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200408172917.18712-6-kwolf@redhat.com>
|
||||
Patchwork-id: 94600
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 5/6] block: Increase BB.in_flight for coroutine and sync interfaces
|
||||
Bugzilla: 1817621
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
External callers of blk_co_*() and of the synchronous blk_*() functions
|
||||
don't currently increase the BlockBackend.in_flight counter, but calls
|
||||
from blk_aio_*() do, so there is an inconsistency whether the counter
|
||||
has been increased or not.
|
||||
|
||||
This patch moves the actual operations to static functions that can
|
||||
later know they will always be called with in_flight increased exactly
|
||||
once, even for external callers using the blk_co_*() coroutine
|
||||
interfaces.
|
||||
|
||||
If the public blk_co_*() interface is unused, remove it.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200407121259.21350-3-kwolf@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit fbb92b6798894d3bf62fe3578d99fa62c720b242)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/block-backend.c | 103 ++++++++++++++++++++++++++++++++---------
|
||||
include/sysemu/block-backend.h | 1 -
|
||||
2 files changed, 80 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||
index 17b2e87..610dbfa 100644
|
||||
--- a/block/block-backend.c
|
||||
+++ b/block/block-backend.c
|
||||
@@ -1147,9 +1147,10 @@ static void coroutine_fn blk_wait_while_drained(BlockBackend *blk)
|
||||
}
|
||||
}
|
||||
|
||||
-int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
||||
- unsigned int bytes, QEMUIOVector *qiov,
|
||||
- BdrvRequestFlags flags)
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
+static int coroutine_fn
|
||||
+blk_do_preadv(BlockBackend *blk, int64_t offset, unsigned int bytes,
|
||||
+ QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||
{
|
||||
int ret;
|
||||
BlockDriverState *bs;
|
||||
@@ -1178,10 +1179,24 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
|
||||
- unsigned int bytes,
|
||||
- QEMUIOVector *qiov, size_t qiov_offset,
|
||||
- BdrvRequestFlags flags)
|
||||
+int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
||||
+ unsigned int bytes, QEMUIOVector *qiov,
|
||||
+ BdrvRequestFlags flags)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ blk_inc_in_flight(blk);
|
||||
+ ret = blk_do_preadv(blk, offset, bytes, qiov, flags);
|
||||
+ blk_dec_in_flight(blk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
+static int coroutine_fn
|
||||
+blk_do_pwritev_part(BlockBackend *blk, int64_t offset, unsigned int bytes,
|
||||
+ QEMUIOVector *qiov, size_t qiov_offset,
|
||||
+ BdrvRequestFlags flags)
|
||||
{
|
||||
int ret;
|
||||
BlockDriverState *bs;
|
||||
@@ -1214,6 +1229,20 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset,
|
||||
+ unsigned int bytes,
|
||||
+ QEMUIOVector *qiov, size_t qiov_offset,
|
||||
+ BdrvRequestFlags flags)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ blk_inc_in_flight(blk);
|
||||
+ ret = blk_do_pwritev_part(blk, offset, bytes, qiov, qiov_offset, flags);
|
||||
+ blk_dec_in_flight(blk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
|
||||
unsigned int bytes, QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags)
|
||||
@@ -1234,7 +1263,7 @@ static void blk_read_entry(void *opaque)
|
||||
BlkRwCo *rwco = opaque;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- rwco->ret = blk_co_preadv(rwco->blk, rwco->offset, qiov->size,
|
||||
+ rwco->ret = blk_do_preadv(rwco->blk, rwco->offset, qiov->size,
|
||||
qiov, rwco->flags);
|
||||
aio_wait_kick();
|
||||
}
|
||||
@@ -1244,8 +1273,8 @@ static void blk_write_entry(void *opaque)
|
||||
BlkRwCo *rwco = opaque;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- rwco->ret = blk_co_pwritev(rwco->blk, rwco->offset, qiov->size,
|
||||
- qiov, rwco->flags);
|
||||
+ rwco->ret = blk_do_pwritev_part(rwco->blk, rwco->offset, qiov->size,
|
||||
+ qiov, 0, rwco->flags);
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
@@ -1262,6 +1291,7 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
|
||||
.ret = NOT_DONE,
|
||||
};
|
||||
|
||||
+ blk_inc_in_flight(blk);
|
||||
if (qemu_in_coroutine()) {
|
||||
/* Fast-path if already in coroutine context */
|
||||
co_entry(&rwco);
|
||||
@@ -1270,6 +1300,7 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
|
||||
bdrv_coroutine_enter(blk_bs(blk), co);
|
||||
BDRV_POLL_WHILE(blk_bs(blk), rwco.ret == NOT_DONE);
|
||||
}
|
||||
+ blk_dec_in_flight(blk);
|
||||
|
||||
return rwco.ret;
|
||||
}
|
||||
@@ -1394,7 +1425,7 @@ static void blk_aio_read_entry(void *opaque)
|
||||
}
|
||||
|
||||
assert(qiov->size == acb->bytes);
|
||||
- rwco->ret = blk_co_preadv(rwco->blk, rwco->offset, acb->bytes,
|
||||
+ rwco->ret = blk_do_preadv(rwco->blk, rwco->offset, acb->bytes,
|
||||
qiov, rwco->flags);
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
@@ -1412,8 +1443,8 @@ static void blk_aio_write_entry(void *opaque)
|
||||
}
|
||||
|
||||
assert(!qiov || qiov->size == acb->bytes);
|
||||
- rwco->ret = blk_co_pwritev(rwco->blk, rwco->offset, acb->bytes,
|
||||
- qiov, rwco->flags);
|
||||
+ rwco->ret = blk_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes,
|
||||
+ qiov, 0, rwco->flags);
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
|
||||
@@ -1498,7 +1529,9 @@ void blk_aio_cancel_async(BlockAIOCB *acb)
|
||||
bdrv_aio_cancel_async(acb);
|
||||
}
|
||||
|
||||
-int blk_co_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
+static int coroutine_fn
|
||||
+blk_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
|
||||
{
|
||||
blk_wait_while_drained(blk);
|
||||
|
||||
@@ -1514,8 +1547,7 @@ static void blk_ioctl_entry(void *opaque)
|
||||
BlkRwCo *rwco = opaque;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset,
|
||||
- qiov->iov[0].iov_base);
|
||||
+ rwco->ret = blk_do_ioctl(rwco->blk, rwco->offset, qiov->iov[0].iov_base);
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
@@ -1529,7 +1561,7 @@ static void blk_aio_ioctl_entry(void *opaque)
|
||||
BlkAioEmAIOCB *acb = opaque;
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
|
||||
- rwco->ret = blk_co_ioctl(rwco->blk, rwco->offset, rwco->iobuf);
|
||||
+ rwco->ret = blk_do_ioctl(rwco->blk, rwco->offset, rwco->iobuf);
|
||||
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
@@ -1540,7 +1572,9 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
|
||||
return blk_aio_prwv(blk, req, 0, buf, blk_aio_ioctl_entry, 0, cb, opaque);
|
||||
}
|
||||
|
||||
-int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
+static int coroutine_fn
|
||||
+blk_do_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -1559,7 +1593,7 @@ static void blk_aio_pdiscard_entry(void *opaque)
|
||||
BlkAioEmAIOCB *acb = opaque;
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
|
||||
- rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
|
||||
+ rwco->ret = blk_do_pdiscard(rwco->blk, rwco->offset, acb->bytes);
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
|
||||
@@ -1571,12 +1605,23 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
|
||||
cb, opaque);
|
||||
}
|
||||
|
||||
+int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ blk_inc_in_flight(blk);
|
||||
+ ret = blk_do_pdiscard(blk, offset, bytes);
|
||||
+ blk_dec_in_flight(blk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void blk_pdiscard_entry(void *opaque)
|
||||
{
|
||||
BlkRwCo *rwco = opaque;
|
||||
QEMUIOVector *qiov = rwco->iobuf;
|
||||
|
||||
- rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
|
||||
+ rwco->ret = blk_do_pdiscard(rwco->blk, rwco->offset, qiov->size);
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
@@ -1585,7 +1630,8 @@ int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
|
||||
}
|
||||
|
||||
-int blk_co_flush(BlockBackend *blk)
|
||||
+/* To be called between exactly one pair of blk_inc/dec_in_flight() */
|
||||
+static int coroutine_fn blk_do_flush(BlockBackend *blk)
|
||||
{
|
||||
blk_wait_while_drained(blk);
|
||||
|
||||
@@ -1601,7 +1647,7 @@ static void blk_aio_flush_entry(void *opaque)
|
||||
BlkAioEmAIOCB *acb = opaque;
|
||||
BlkRwCo *rwco = &acb->rwco;
|
||||
|
||||
- rwco->ret = blk_co_flush(rwco->blk);
|
||||
+ rwco->ret = blk_do_flush(rwco->blk);
|
||||
blk_aio_complete(acb);
|
||||
}
|
||||
|
||||
@@ -1611,10 +1657,21 @@ BlockAIOCB *blk_aio_flush(BlockBackend *blk,
|
||||
return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
|
||||
}
|
||||
|
||||
+int coroutine_fn blk_co_flush(BlockBackend *blk)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ blk_inc_in_flight(blk);
|
||||
+ ret = blk_do_flush(blk);
|
||||
+ blk_dec_in_flight(blk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void blk_flush_entry(void *opaque)
|
||||
{
|
||||
BlkRwCo *rwco = opaque;
|
||||
- rwco->ret = blk_co_flush(rwco->blk);
|
||||
+ rwco->ret = blk_do_flush(rwco->blk);
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
|
||||
index b198dec..9bbdbd6 100644
|
||||
--- a/include/sysemu/block-backend.h
|
||||
+++ b/include/sysemu/block-backend.h
|
||||
@@ -171,7 +171,6 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int bytes,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
void blk_aio_cancel(BlockAIOCB *acb);
|
||||
void blk_aio_cancel_async(BlockAIOCB *acb);
|
||||
-int blk_co_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
|
||||
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
|
||||
BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,65 @@
|
||||
From f7dd953c2d0380cef3c351afb03d68c6fcda1dca Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:28 +0000
|
||||
Subject: [PATCH 08/20] block: Introduce 'bdrv_reopen_commit_post' step
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-3-kwolf@redhat.com>
|
||||
Patchwork-id: 94278
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 02/13] block: Introduce 'bdrv_reopen_commit_post' step
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
Add another step in the reopen process where driver can execute code
|
||||
after permission changes are comitted.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Message-Id: <adc02cf591c3cb34e98e33518eb1c540a0f27db1.1582893284.git.pkrempa@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 17e1e2be5f9e84e0298e28e70675655b43e225ea)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 9 +++++++++
|
||||
include/block/block_int.h | 1 +
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index e1a4e38..a744bb5 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -3657,6 +3657,15 @@ cleanup_perm:
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (ret == 0) {
|
||||
+ QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) {
|
||||
+ BlockDriverState *bs = bs_entry->state.bs;
|
||||
+
|
||||
+ if (bs->drv->bdrv_reopen_commit_post)
|
||||
+ bs->drv->bdrv_reopen_commit_post(&bs_entry->state);
|
||||
+ }
|
||||
+ }
|
||||
cleanup:
|
||||
QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
|
||||
if (ret) {
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index dd033d0..c168690 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -123,6 +123,7 @@ struct BlockDriver {
|
||||
int (*bdrv_reopen_prepare)(BDRVReopenState *reopen_state,
|
||||
BlockReopenQueue *queue, Error **errp);
|
||||
void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
|
||||
+ void (*bdrv_reopen_commit_post)(BDRVReopenState *reopen_state);
|
||||
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
||||
void (*bdrv_join_options)(QDict *options, QDict *old_options);
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
67
SOURCES/kvm-block-Make-bdrv_get_cumulative_perm-public.patch
Normal file
67
SOURCES/kvm-block-Make-bdrv_get_cumulative_perm-public.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From 294ab4c4963295556d12ac15150b48c8536175a7 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:33 +0000
|
||||
Subject: [PATCH 13/20] block: Make bdrv_get_cumulative_perm() public
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-8-kwolf@redhat.com>
|
||||
Patchwork-id: 94287
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 07/13] block: Make bdrv_get_cumulative_perm() public
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200310113831.27293-2-kwolf@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit c7a0f2be8f95b220cdadbba9a9236eaf115951dc)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 6 ++----
|
||||
include/block/block_int.h | 3 +++
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 39e4647..354d388 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -1850,8 +1850,6 @@ static int bdrv_child_check_perm(BdrvChild *c, BlockReopenQueue *q,
|
||||
bool *tighten_restrictions, Error **errp);
|
||||
static void bdrv_child_abort_perm_update(BdrvChild *c);
|
||||
static void bdrv_child_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared);
|
||||
-static void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
|
||||
- uint64_t *shared_perm);
|
||||
|
||||
typedef struct BlockReopenQueueEntry {
|
||||
bool prepared;
|
||||
@@ -2075,8 +2073,8 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t cumulative_perms,
|
||||
}
|
||||
}
|
||||
|
||||
-static void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
|
||||
- uint64_t *shared_perm)
|
||||
+void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
|
||||
+ uint64_t *shared_perm)
|
||||
{
|
||||
BdrvChild *c;
|
||||
uint64_t cumulative_perms = 0;
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index c168690..96e327b 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -1228,6 +1228,9 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
||||
void *opaque, Error **errp);
|
||||
void bdrv_root_unref_child(BdrvChild *child);
|
||||
|
||||
+void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
|
||||
+ uint64_t *shared_perm);
|
||||
+
|
||||
/**
|
||||
* Sets a BdrvChild's permissions. Avoid if the parent is a BDS; use
|
||||
* bdrv_child_refresh_perms() instead and make the parent's
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,145 @@
|
||||
From 41d6c207c482093df8669f7cdcdb49bb25dba741 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Tue, 2 Jun 2020 02:34:12 +0100
|
||||
Subject: [PATCH 07/26] block: Make it easier to learn which BDS support
|
||||
bitmaps
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Eric Blake <eblake@redhat.com>
|
||||
Message-id: <20200602023420.2133649-5-eblake@redhat.com>
|
||||
Patchwork-id: 97071
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 04/12] block: Make it easier to learn which BDS support bitmaps
|
||||
Bugzilla: 1779893 1779904
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
|
||||
Upcoming patches will enhance bitmap support in qemu-img, but in doing
|
||||
so, it turns out to be nice to suppress output when persistent bitmaps
|
||||
make no sense (such as on a qcow2 v2 image). Add a hook to make this
|
||||
easier to query.
|
||||
|
||||
This patch adds a new callback .bdrv_supports_persistent_dirty_bitmap,
|
||||
rather than trying to shoehorn the answer in via existing callbacks.
|
||||
In particular, while it might have been possible to overload
|
||||
.bdrv_co_can_store_new_dirty_bitmap to special-case a NULL input to
|
||||
answer whether any persistent bitmaps are supported, that is at odds
|
||||
with whether a particular bitmap can be stored (for example, even on
|
||||
an image that supports persistent bitmaps but has currently filled up
|
||||
the maximum number of bitmaps, attempts to store another one should
|
||||
fail); and the new functionality doesn't require coroutine safety.
|
||||
Similarly, we could have added one more piece of information to
|
||||
.bdrv_get_info, but then again, most callers to that function tend to
|
||||
already discard extraneous information, and making it a catch-all
|
||||
rather than a series of dedicated scalar queries hasn't really
|
||||
simplified life.
|
||||
|
||||
In the future, when we improve the ability to look up bitmaps through
|
||||
a filter, we will probably also want to teach the block layer to
|
||||
automatically let filters pass this request on through.
|
||||
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Message-Id: <20200513011648.166876-4-eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
(cherry picked from commit ef893b5c84f3199d777e33966dc28839f71b1a5c)
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/dirty-bitmap.c | 9 +++++++++
|
||||
block/qcow2-bitmap.c | 7 +++++++
|
||||
block/qcow2.c | 2 ++
|
||||
block/qcow2.h | 1 +
|
||||
include/block/block_int.h | 1 +
|
||||
include/block/dirty-bitmap.h | 1 +
|
||||
6 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
|
||||
index 7039e82..2f96acc 100644
|
||||
--- a/block/dirty-bitmap.c
|
||||
+++ b/block/dirty-bitmap.c
|
||||
@@ -478,6 +478,15 @@ int bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
+bool
|
||||
+bdrv_supports_persistent_dirty_bitmap(BlockDriverState *bs)
|
||||
+{
|
||||
+ if (bs->drv && bs->drv->bdrv_supports_persistent_dirty_bitmap) {
|
||||
+ return bs->drv->bdrv_supports_persistent_dirty_bitmap(bs);
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static bool coroutine_fn
|
||||
bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
|
||||
uint32_t granularity, Error **errp)
|
||||
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
|
||||
index c6c8ebb..cbac905 100644
|
||||
--- a/block/qcow2-bitmap.c
|
||||
+++ b/block/qcow2-bitmap.c
|
||||
@@ -1759,3 +1759,10 @@ fail:
|
||||
name, bdrv_get_device_or_node_name(bs));
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+bool qcow2_supports_persistent_dirty_bitmap(BlockDriverState *bs)
|
||||
+{
|
||||
+ BDRVQcow2State *s = bs->opaque;
|
||||
+
|
||||
+ return s->qcow_version >= 3;
|
||||
+}
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index af0ad4a..36b0f7d 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -5551,6 +5551,8 @@ BlockDriver bdrv_qcow2 = {
|
||||
.bdrv_detach_aio_context = qcow2_detach_aio_context,
|
||||
.bdrv_attach_aio_context = qcow2_attach_aio_context,
|
||||
|
||||
+ .bdrv_supports_persistent_dirty_bitmap =
|
||||
+ qcow2_supports_persistent_dirty_bitmap,
|
||||
.bdrv_co_can_store_new_dirty_bitmap = qcow2_co_can_store_new_dirty_bitmap,
|
||||
.bdrv_co_remove_persistent_dirty_bitmap =
|
||||
qcow2_co_remove_persistent_dirty_bitmap,
|
||||
diff --git a/block/qcow2.h b/block/qcow2.h
|
||||
index 0942126..ceb1ceb 100644
|
||||
--- a/block/qcow2.h
|
||||
+++ b/block/qcow2.h
|
||||
@@ -767,6 +767,7 @@ bool qcow2_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
||||
int qcow2_co_remove_persistent_dirty_bitmap(BlockDriverState *bs,
|
||||
const char *name,
|
||||
Error **errp);
|
||||
+bool qcow2_supports_persistent_dirty_bitmap(BlockDriverState *bs);
|
||||
|
||||
ssize_t coroutine_fn
|
||||
qcow2_co_compress(BlockDriverState *bs, void *dest, size_t dest_size,
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index 562dca1..cc18e8d 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -568,6 +568,7 @@ struct BlockDriver {
|
||||
uint64_t parent_perm, uint64_t parent_shared,
|
||||
uint64_t *nperm, uint64_t *nshared);
|
||||
|
||||
+ bool (*bdrv_supports_persistent_dirty_bitmap)(BlockDriverState *bs);
|
||||
bool (*bdrv_co_can_store_new_dirty_bitmap)(BlockDriverState *bs,
|
||||
const char *name,
|
||||
uint32_t granularity,
|
||||
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
|
||||
index e2b20ec..f6e9a38 100644
|
||||
--- a/include/block/dirty-bitmap.h
|
||||
+++ b/include/block/dirty-bitmap.h
|
||||
@@ -16,6 +16,7 @@ typedef enum BitmapCheckFlags {
|
||||
|
||||
#define BDRV_BITMAP_MAX_NAME_SIZE 1023
|
||||
|
||||
+bool bdrv_supports_persistent_dirty_bitmap(BlockDriverState *bs);
|
||||
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
|
||||
uint32_t granularity,
|
||||
const char *name,
|
||||
--
|
||||
1.8.3.1
|
||||
|
117
SOURCES/kvm-block-Relax-restrictions-for-blockdev-snapshot.patch
Normal file
117
SOURCES/kvm-block-Relax-restrictions-for-blockdev-snapshot.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From 9ba321e18a357c1a3a238ceee301bbb174f96eee Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:34 +0000
|
||||
Subject: [PATCH 14/20] block: Relax restrictions for blockdev-snapshot
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-9-kwolf@redhat.com>
|
||||
Patchwork-id: 94285
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 08/13] block: Relax restrictions for blockdev-snapshot
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
blockdev-snapshot returned an error if the overlay was already in use,
|
||||
which it defined as having any BlockBackend parent. This is in fact both
|
||||
too strict (some parents can tolerate the change of visible data caused
|
||||
by attaching a backing file) and too loose (some non-BlockBackend
|
||||
parents may not be happy with it).
|
||||
|
||||
One important use case that is prevented by the too strict check is live
|
||||
storage migration with blockdev-mirror. Here, the target node is
|
||||
usually opened without a backing file so that the active layer is
|
||||
mirrored while its backing chain can be copied in the background.
|
||||
|
||||
The backing chain should be attached to the mirror target node when
|
||||
finalising the job, just before switching the users of the source node
|
||||
to the new copy (at which point the mirror job still has a reference to
|
||||
the node). drive-mirror did this automatically, but with blockdev-mirror
|
||||
this is the job of the QMP client, so it needs a way to do this.
|
||||
|
||||
blockdev-snapshot is the obvious way, so this patch makes it work in
|
||||
this scenario. The new condition is that no parent uses CONSISTENT_READ
|
||||
permissions. This will ensure that the operation will still be blocked
|
||||
when the node is attached to the guest device, so blockdev-snapshot
|
||||
remains safe.
|
||||
|
||||
(For the sake of completeness, x-blockdev-reopen can be used to achieve
|
||||
the same, however it is a big hammer, performs the graph change
|
||||
completely unchecked and is still experimental. So even with the option
|
||||
of using x-blockdev-reopen, there are reasons why blockdev-snapshot
|
||||
should be able to perform this operation.)
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-Id: <20200310113831.27293-3-kwolf@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Tested-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit d29d3d1f80b3947fb26e7139645c83de66d146a9)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 14 ++++++++------
|
||||
tests/qemu-iotests/085.out | 4 ++--
|
||||
2 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 4cd9a58..7918533 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1536,6 +1536,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
TransactionAction *action = common->action;
|
||||
AioContext *aio_context;
|
||||
AioContext *old_context;
|
||||
+ uint64_t perm, shared;
|
||||
int ret;
|
||||
|
||||
/* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar
|
||||
@@ -1656,16 +1657,17 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (bdrv_has_blk(state->new_bs)) {
|
||||
+ /*
|
||||
+ * Allow attaching a backing file to an overlay that's already in use only
|
||||
+ * if the parents don't assume that they are already seeing a valid image.
|
||||
+ * (Specifically, allow it as a mirror target, which is write-only access.)
|
||||
+ */
|
||||
+ bdrv_get_cumulative_perm(state->new_bs, &perm, &shared);
|
||||
+ if (perm & BLK_PERM_CONSISTENT_READ) {
|
||||
error_setg(errp, "The overlay is already in use");
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
|
||||
- errp)) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
if (state->new_bs->backing != NULL) {
|
||||
error_setg(errp, "The overlay already has a backing image");
|
||||
goto out;
|
||||
diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out
|
||||
index bb50227..487d920 100644
|
||||
--- a/tests/qemu-iotests/085.out
|
||||
+++ b/tests/qemu-iotests/085.out
|
||||
@@ -82,7 +82,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
|
||||
=== Invalid command - cannot create a snapshot using a file BDS ===
|
||||
|
||||
{ 'execute': 'blockdev-snapshot', 'arguments': { 'node':'virtio0', 'overlay':'file_12' } }
|
||||
-{"error": {"class": "GenericError", "desc": "The overlay does not support backing images"}}
|
||||
+{"error": {"class": "GenericError", "desc": "The overlay is already in use"}}
|
||||
|
||||
=== Invalid command - snapshot node used as active layer ===
|
||||
|
||||
@@ -96,7 +96,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
|
||||
=== Invalid command - snapshot node used as backing hd ===
|
||||
|
||||
{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_11' } }
|
||||
-{"error": {"class": "GenericError", "desc": "Node 'snap_11' is busy: node is used as backing hd of 'snap_12'"}}
|
||||
+{"error": {"class": "GenericError", "desc": "The overlay is already in use"}}
|
||||
|
||||
=== Invalid command - snapshot node has a backing image ===
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,57 @@
|
||||
From 371d312300251c0dc24522607b06b7e47e760b53 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:32 +0000
|
||||
Subject: [PATCH 12/20] block: Versioned x-blockdev-reopen API with feature
|
||||
flag
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-7-kwolf@redhat.com>
|
||||
Patchwork-id: 94283
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 06/13] block: Versioned x-blockdev-reopen API with feature flag
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
x-blockdev-reopen is still considered unstable upstream. libvirt needs
|
||||
(a small subset of) it for incremental backups, though.
|
||||
|
||||
Add a downstream-only feature flag that effectively makes this a
|
||||
versioned interface. As long as the feature is present, we promise that
|
||||
we won't change the interface incompatibly. Incompatible changes to the
|
||||
command will require us to drop the feature flag (and possibly introduce
|
||||
a new one if the new version is still not stable upstream).
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
qapi/block-core.json | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||
index 0cf68fe..a1e85b0 100644
|
||||
--- a/qapi/block-core.json
|
||||
+++ b/qapi/block-core.json
|
||||
@@ -4202,10 +4202,17 @@
|
||||
# image does not have a default backing file name as part of its
|
||||
# metadata.
|
||||
#
|
||||
+# Features:
|
||||
+# @__com.redhat_rhel-av-8_2_0-api: Versioning the downstream interface while
|
||||
+# it's still unstable upstream. As long as
|
||||
+# this flag is present, this command will not
|
||||
+# change incompatibly.
|
||||
+#
|
||||
# Since: 4.0
|
||||
##
|
||||
{ 'command': 'x-blockdev-reopen',
|
||||
- 'data': 'BlockdevOptions', 'boxed': true }
|
||||
+ 'data': 'BlockdevOptions', 'boxed': true,
|
||||
+ 'features': [ '__com.redhat_rhel-av-8_2_0-api' ] }
|
||||
|
||||
##
|
||||
# @blockdev-del:
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,308 @@
|
||||
From 67f36d057aa71ca56ebc17ef28a7cb70bac6c6b6 Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 5 May 2020 16:46:01 +0100
|
||||
Subject: [PATCH 01/12] block: always fill entire LUKS header space with zeros
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Message-id: <20200505164601.1059974-2-berrange@redhat.com>
|
||||
Patchwork-id: 96277
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] block: always fill entire LUKS header space with zeros
|
||||
Bugzilla: 1775462
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
When initializing the LUKS header the size with default encryption
|
||||
parameters will currently be 2068480 bytes. This is rounded up to
|
||||
a multiple of the cluster size, 2081792, with 64k sectors. If the
|
||||
end of the header is not the same as the end of the cluster we fill
|
||||
the extra space with zeros. This was forgetting that not even the
|
||||
space allocated for the header will be fully initialized, as we
|
||||
only write key material for the first key slot. The space left
|
||||
for the other 7 slots is never written to.
|
||||
|
||||
An optimization to the ref count checking code:
|
||||
|
||||
commit a5fff8d4b4d928311a5005efa12d0991fe3b66f9 (refs/bisect/bad)
|
||||
Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Date: Wed Feb 27 16:14:30 2019 +0300
|
||||
|
||||
qcow2-refcount: avoid eating RAM
|
||||
|
||||
made the assumption that every cluster which was allocated would
|
||||
have at least some data written to it. This was violated by way
|
||||
the LUKS header is only partially written, with much space simply
|
||||
reserved for future use.
|
||||
|
||||
Depending on the cluster size this problem was masked by the
|
||||
logic which wrote zeros between the end of the LUKS header and
|
||||
the end of the cluster.
|
||||
|
||||
$ qemu-img create --object secret,id=cluster_encrypt0,data=123456 \
|
||||
-f qcow2 -o cluster_size=2k,encrypt.iter-time=1,\
|
||||
encrypt.format=luks,encrypt.key-secret=cluster_encrypt0 \
|
||||
cluster_size_check.qcow2 100M
|
||||
Formatting 'cluster_size_check.qcow2', fmt=qcow2 size=104857600
|
||||
encrypt.format=luks encrypt.key-secret=cluster_encrypt0
|
||||
encrypt.iter-time=1 cluster_size=2048 lazy_refcounts=off refcount_bits=16
|
||||
|
||||
$ qemu-img check --object secret,id=cluster_encrypt0,data=redhat \
|
||||
'json:{"driver": "qcow2", "encrypt.format": "luks", \
|
||||
"encrypt.key-secret": "cluster_encrypt0", \
|
||||
"file.driver": "file", "file.filename": "cluster_size_check.qcow2"}'
|
||||
ERROR: counting reference for region exceeding the end of the file by one cluster or more: offset 0x2000 size 0x1f9000
|
||||
Leaked cluster 4 refcount=1 reference=0
|
||||
...snip...
|
||||
Leaked cluster 130 refcount=1 reference=0
|
||||
|
||||
1 errors were found on the image.
|
||||
Data may be corrupted, or further writes to the image may corrupt it.
|
||||
|
||||
127 leaked clusters were found on the image.
|
||||
This means waste of disk space, but no harm to data.
|
||||
Image end offset: 268288
|
||||
|
||||
The problem only exists when the disk image is entirely empty. Writing
|
||||
data to the disk image payload will solve the problem by causing the
|
||||
end of the file to be extended further.
|
||||
|
||||
The change fixes it by ensuring that the entire allocated LUKS header
|
||||
region is fully initialized with zeros. The qemu-img check will still
|
||||
fail for any pre-existing disk images created prior to this change,
|
||||
unless at least 1 byte of the payload is written to.
|
||||
|
||||
Fully writing zeros to the entire LUKS header is a good idea regardless
|
||||
as it ensures that space has been allocated on the host filesystem (or
|
||||
whatever block storage backend is used).
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Message-Id: <20200207135520.2669430-1-berrange@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 087ab8e775f48766068e65de1bc99d03b40d1670)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
|
||||
Conflicts:
|
||||
tests/qemu-iotests/group: no test 283 in downstream
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/qcow2.c | 11 ++++--
|
||||
tests/qemu-iotests/284 | 97 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/qemu-iotests/284.out | 62 +++++++++++++++++++++++++++++
|
||||
tests/qemu-iotests/group | 1 +
|
||||
4 files changed, 167 insertions(+), 4 deletions(-)
|
||||
create mode 100755 tests/qemu-iotests/284
|
||||
create mode 100644 tests/qemu-iotests/284.out
|
||||
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index 71067c6..af0ad4a 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -135,13 +135,16 @@ static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen,
|
||||
s->crypto_header.length = headerlen;
|
||||
s->crypto_header.offset = ret;
|
||||
|
||||
- /* Zero fill remaining space in cluster so it has predictable
|
||||
- * content in case of future spec changes */
|
||||
+ /*
|
||||
+ * Zero fill all space in cluster so it has predictable
|
||||
+ * content, as we may not initialize some regions of the
|
||||
+ * header (eg only 1 out of 8 key slots will be initialized)
|
||||
+ */
|
||||
clusterlen = size_to_clusters(s, headerlen) * s->cluster_size;
|
||||
assert(qcow2_pre_write_overlap_check(bs, 0, ret, clusterlen, false) == 0);
|
||||
ret = bdrv_pwrite_zeroes(bs->file,
|
||||
- ret + headerlen,
|
||||
- clusterlen - headerlen, 0);
|
||||
+ ret,
|
||||
+ clusterlen, 0);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not zero fill encryption header");
|
||||
return -1;
|
||||
diff --git a/tests/qemu-iotests/284 b/tests/qemu-iotests/284
|
||||
new file mode 100755
|
||||
index 0000000..071e89b
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/284
|
||||
@@ -0,0 +1,97 @@
|
||||
+#!/usr/bin/env bash
|
||||
+#
|
||||
+# Test ref count checks on encrypted images
|
||||
+#
|
||||
+# Copyright (C) 2019 Red Hat, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program 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 General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+#
|
||||
+
|
||||
+# creator
|
||||
+owner=berrange@redhat.com
|
||||
+
|
||||
+seq=`basename $0`
|
||||
+echo "QA output created by $seq"
|
||||
+
|
||||
+status=1 # failure is the default!
|
||||
+
|
||||
+_cleanup()
|
||||
+{
|
||||
+ _cleanup_test_img
|
||||
+}
|
||||
+trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
+
|
||||
+# get standard environment, filters and checks
|
||||
+. ./common.rc
|
||||
+. ./common.filter
|
||||
+
|
||||
+_supported_fmt qcow2
|
||||
+_supported_proto generic
|
||||
+_supported_os Linux
|
||||
+
|
||||
+
|
||||
+size=1M
|
||||
+
|
||||
+SECRET="secret,id=sec0,data=astrochicken"
|
||||
+
|
||||
+IMGSPEC="driver=$IMGFMT,file.filename=$TEST_IMG,encrypt.key-secret=sec0"
|
||||
+QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
|
||||
+
|
||||
+_run_test()
|
||||
+{
|
||||
+ IMGOPTSSYNTAX=true
|
||||
+ OLD_TEST_IMG="$TEST_IMG"
|
||||
+ TEST_IMG="driver=$IMGFMT,file.filename=$TEST_IMG,encrypt.key-secret=sec0"
|
||||
+ QEMU_IMG_EXTRA_ARGS="--image-opts --object $SECRET"
|
||||
+
|
||||
+ echo
|
||||
+ echo "== cluster size $csize"
|
||||
+ echo "== checking image refcounts =="
|
||||
+ _check_test_img
|
||||
+
|
||||
+ echo
|
||||
+ echo "== writing some data =="
|
||||
+ $QEMU_IO -c "write -P 0x9 0 1" $QEMU_IMG_EXTRA_ARGS $TEST_IMG | _filter_qemu_io | _filter_testdir
|
||||
+ echo
|
||||
+ echo "== rechecking image refcounts =="
|
||||
+ _check_test_img
|
||||
+
|
||||
+ echo
|
||||
+ echo "== writing some more data =="
|
||||
+ $QEMU_IO -c "write -P 0x9 $csize 1" $QEMU_IMG_EXTRA_ARGS $TEST_IMG | _filter_qemu_io | _filter_testdir
|
||||
+ echo
|
||||
+ echo "== rechecking image refcounts =="
|
||||
+ _check_test_img
|
||||
+
|
||||
+ TEST_IMG="$OLD_TEST_IMG"
|
||||
+ QEMU_IMG_EXTRA_ARGS=
|
||||
+ IMGOPTSSYNTAX=
|
||||
+}
|
||||
+
|
||||
+
|
||||
+echo
|
||||
+echo "testing LUKS qcow2 encryption"
|
||||
+echo
|
||||
+
|
||||
+for csize in 512 2048 32768
|
||||
+do
|
||||
+ _make_test_img --object $SECRET -o "encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,cluster_size=$csize" $size
|
||||
+ _run_test
|
||||
+ _cleanup_test_img
|
||||
+done
|
||||
+
|
||||
+# success, all done
|
||||
+echo "*** done"
|
||||
+rm -f $seq.full
|
||||
+status=0
|
||||
diff --git a/tests/qemu-iotests/284.out b/tests/qemu-iotests/284.out
|
||||
new file mode 100644
|
||||
index 0000000..48216f5
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/284.out
|
||||
@@ -0,0 +1,62 @@
|
||||
+QA output created by 284
|
||||
+
|
||||
+testing LUKS qcow2 encryption
|
||||
+
|
||||
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10
|
||||
+
|
||||
+== cluster size 512
|
||||
+== checking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some data ==
|
||||
+wrote 1/1 bytes at offset 0
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some more data ==
|
||||
+wrote 1/1 bytes at offset 512
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10
|
||||
+
|
||||
+== cluster size 2048
|
||||
+== checking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some data ==
|
||||
+wrote 1/1 bytes at offset 0
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some more data ==
|
||||
+wrote 1/1 bytes at offset 2048
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10
|
||||
+
|
||||
+== cluster size 32768
|
||||
+== checking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some data ==
|
||||
+wrote 1/1 bytes at offset 0
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+
|
||||
+== writing some more data ==
|
||||
+wrote 1/1 bytes at offset 32768
|
||||
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
+
|
||||
+== rechecking image refcounts ==
|
||||
+No errors were found on the image.
|
||||
+*** done
|
||||
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
||||
index e47cbfc..9c565cf 100644
|
||||
--- a/tests/qemu-iotests/group
|
||||
+++ b/tests/qemu-iotests/group
|
||||
@@ -289,3 +289,4 @@
|
||||
277 rw quick
|
||||
280 rw migration quick
|
||||
281 rw quick
|
||||
+284 rw
|
||||
--
|
||||
1.8.3.1
|
||||
|
294
SOURCES/kvm-block-backend-Add-flags-to-blk_truncate.patch
Normal file
294
SOURCES/kvm-block-backend-Add-flags-to-blk_truncate.patch
Normal file
@ -0,0 +1,294 @@
|
||||
From 07a93e74efa4861f54dd3d4bec01885f7af2fee3 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 17:01:32 +0200
|
||||
Subject: [PATCH 04/17] block-backend: Add flags to blk_truncate()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200608150140.38218-4-kwolf@redhat.com>
|
||||
Patchwork-id: 97450
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 03/11] block-backend: Add flags to blk_truncate()
|
||||
Bugzilla: 1780574
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
Now that node level interface bdrv_truncate() supports passing request
|
||||
flags to the block driver, expose this on the BlockBackend level, too.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200424125448.63318-4-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 8c6242b6f383e43fd11d2c50f8bcdd2bba1100fc)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 3 ++-
|
||||
block/block-backend.c | 4 ++--
|
||||
block/commit.c | 4 ++--
|
||||
block/crypto.c | 2 +-
|
||||
block/mirror.c | 2 +-
|
||||
block/qcow2.c | 4 ++--
|
||||
block/qed.c | 2 +-
|
||||
block/vdi.c | 2 +-
|
||||
block/vhdx.c | 4 ++--
|
||||
block/vmdk.c | 6 +++---
|
||||
block/vpc.c | 2 +-
|
||||
blockdev.c | 2 +-
|
||||
include/sysemu/block-backend.h | 2 +-
|
||||
qemu-img.c | 2 +-
|
||||
qemu-io-cmds.c | 2 +-
|
||||
15 files changed, 22 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index d6a05da..12c8941 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -547,7 +547,8 @@ static int64_t create_file_fallback_truncate(BlockBackend *blk,
|
||||
int64_t size;
|
||||
int ret;
|
||||
|
||||
- ret = blk_truncate(blk, minimum_size, false, PREALLOC_MODE_OFF, &local_err);
|
||||
+ ret = blk_truncate(blk, minimum_size, false, PREALLOC_MODE_OFF, 0,
|
||||
+ &local_err);
|
||||
if (ret < 0 && ret != -ENOTSUP) {
|
||||
error_propagate(errp, local_err);
|
||||
return ret;
|
||||
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||
index 8be2006..17ed6d8 100644
|
||||
--- a/block/block-backend.c
|
||||
+++ b/block/block-backend.c
|
||||
@@ -2137,14 +2137,14 @@ int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
|
||||
}
|
||||
|
||||
int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp)
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
if (!blk_is_available(blk)) {
|
||||
error_setg(errp, "No medium inserted");
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- return bdrv_truncate(blk->root, offset, exact, prealloc, 0, errp);
|
||||
+ return bdrv_truncate(blk->root, offset, exact, prealloc, flags, errp);
|
||||
}
|
||||
|
||||
int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
|
||||
diff --git a/block/commit.c b/block/commit.c
|
||||
index 23c90b3..075ebf8 100644
|
||||
--- a/block/commit.c
|
||||
+++ b/block/commit.c
|
||||
@@ -155,7 +155,7 @@ static int coroutine_fn commit_run(Job *job, Error **errp)
|
||||
}
|
||||
|
||||
if (base_len < len) {
|
||||
- ret = blk_truncate(s->base, len, false, PREALLOC_MODE_OFF, NULL);
|
||||
+ ret = blk_truncate(s->base, len, false, PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret) {
|
||||
goto out;
|
||||
}
|
||||
@@ -471,7 +471,7 @@ int bdrv_commit(BlockDriverState *bs)
|
||||
* grow the backing file image if possible. If not possible,
|
||||
* we must return an error */
|
||||
if (length > backing_length) {
|
||||
- ret = blk_truncate(backing, length, false, PREALLOC_MODE_OFF,
|
||||
+ ret = blk_truncate(backing, length, false, PREALLOC_MODE_OFF, 0,
|
||||
&local_err);
|
||||
if (ret < 0) {
|
||||
error_report_err(local_err);
|
||||
diff --git a/block/crypto.c b/block/crypto.c
|
||||
index fcb4a97..83a8fc0 100644
|
||||
--- a/block/crypto.c
|
||||
+++ b/block/crypto.c
|
||||
@@ -115,7 +115,7 @@ static ssize_t block_crypto_init_func(QCryptoBlock *block,
|
||||
* which will be used by the crypto header
|
||||
*/
|
||||
return blk_truncate(data->blk, data->size + headerlen, false,
|
||||
- data->prealloc, errp);
|
||||
+ data->prealloc, 0, errp);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/block/mirror.c b/block/mirror.c
|
||||
index 0d32fca..c8028cd 100644
|
||||
--- a/block/mirror.c
|
||||
+++ b/block/mirror.c
|
||||
@@ -886,7 +886,7 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
||||
if (s->base == blk_bs(s->target)) {
|
||||
if (s->bdev_length > target_length) {
|
||||
ret = blk_truncate(s->target, s->bdev_length, false,
|
||||
- PREALLOC_MODE_OFF, NULL);
|
||||
+ PREALLOC_MODE_OFF, 0, NULL);
|
||||
if (ret < 0) {
|
||||
goto immediate_exit;
|
||||
}
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index c0fdcb9..86aa74a 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -3497,7 +3497,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp)
|
||||
|
||||
/* Okay, now that we have a valid image, let's give it the right size */
|
||||
ret = blk_truncate(blk, qcow2_opts->size, false, qcow2_opts->preallocation,
|
||||
- errp);
|
||||
+ 0, errp);
|
||||
if (ret < 0) {
|
||||
error_prepend(errp, "Could not resize image: ");
|
||||
goto out;
|
||||
@@ -5347,7 +5347,7 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
|
||||
* Amending image options should ensure that the image has
|
||||
* exactly the given new values, so pass exact=true here.
|
||||
*/
|
||||
- ret = blk_truncate(blk, new_size, true, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, new_size, true, PREALLOC_MODE_OFF, 0, errp);
|
||||
blk_unref(blk);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
diff --git a/block/qed.c b/block/qed.c
|
||||
index fb6100b..b0fdb8f 100644
|
||||
--- a/block/qed.c
|
||||
+++ b/block/qed.c
|
||||
@@ -677,7 +677,7 @@ static int coroutine_fn bdrv_qed_co_create(BlockdevCreateOptions *opts,
|
||||
* The QED format associates file length with allocation status,
|
||||
* so a new file (which is empty) must have a length of 0.
|
||||
*/
|
||||
- ret = blk_truncate(blk, 0, true, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, 0, true, PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
diff --git a/block/vdi.c b/block/vdi.c
|
||||
index e1a11f2..0c7835a 100644
|
||||
--- a/block/vdi.c
|
||||
+++ b/block/vdi.c
|
||||
@@ -875,7 +875,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreateOptions *create_options,
|
||||
|
||||
if (image_type == VDI_TYPE_STATIC) {
|
||||
ret = blk_truncate(blk, offset + blocks * block_size, false,
|
||||
- PREALLOC_MODE_OFF, errp);
|
||||
+ PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
error_prepend(errp, "Failed to statically allocate file");
|
||||
goto exit;
|
||||
diff --git a/block/vhdx.c b/block/vhdx.c
|
||||
index 5dfbb20..21497f7 100644
|
||||
--- a/block/vhdx.c
|
||||
+++ b/block/vhdx.c
|
||||
@@ -1703,13 +1703,13 @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
|
||||
/* All zeroes, so we can just extend the file - the end of the BAT
|
||||
* is the furthest thing we have written yet */
|
||||
ret = blk_truncate(blk, data_file_offset, false, PREALLOC_MODE_OFF,
|
||||
- errp);
|
||||
+ 0, errp);
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
} else if (type == VHDX_TYPE_FIXED) {
|
||||
ret = blk_truncate(blk, data_file_offset + image_size, false,
|
||||
- PREALLOC_MODE_OFF, errp);
|
||||
+ PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
diff --git a/block/vmdk.c b/block/vmdk.c
|
||||
index 1bbf937..1bd3991 100644
|
||||
--- a/block/vmdk.c
|
||||
+++ b/block/vmdk.c
|
||||
@@ -2118,7 +2118,7 @@ static int vmdk_init_extent(BlockBackend *blk,
|
||||
int gd_buf_size;
|
||||
|
||||
if (flat) {
|
||||
- ret = blk_truncate(blk, filesize, false, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, filesize, false, PREALLOC_MODE_OFF, 0, errp);
|
||||
goto exit;
|
||||
}
|
||||
magic = cpu_to_be32(VMDK4_MAGIC);
|
||||
@@ -2182,7 +2182,7 @@ static int vmdk_init_extent(BlockBackend *blk,
|
||||
}
|
||||
|
||||
ret = blk_truncate(blk, le64_to_cpu(header.grain_offset) << 9, false,
|
||||
- PREALLOC_MODE_OFF, errp);
|
||||
+ PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
@@ -2523,7 +2523,7 @@ static int coroutine_fn vmdk_co_do_create(int64_t size,
|
||||
/* bdrv_pwrite write padding zeros to align to sector, we don't need that
|
||||
* for description file */
|
||||
if (desc_offset == 0) {
|
||||
- ret = blk_truncate(blk, desc_len, false, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, desc_len, false, PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
diff --git a/block/vpc.c b/block/vpc.c
|
||||
index 6df75e2..d5e7dc8 100644
|
||||
--- a/block/vpc.c
|
||||
+++ b/block/vpc.c
|
||||
@@ -898,7 +898,7 @@ static int create_fixed_disk(BlockBackend *blk, uint8_t *buf,
|
||||
/* Add footer to total size */
|
||||
total_size += HEADER_SIZE;
|
||||
|
||||
- ret = blk_truncate(blk, total_size, false, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, total_size, false, PREALLOC_MODE_OFF, 0, errp);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 5128c9b..6dde52a 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -3055,7 +3055,7 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
}
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
- ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
|
||||
+ ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
out:
|
||||
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
|
||||
index 9bbdbd6..34de7fa 100644
|
||||
--- a/include/sysemu/block-backend.h
|
||||
+++ b/include/sysemu/block-backend.h
|
||||
@@ -237,7 +237,7 @@ int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
||||
int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
|
||||
int bytes);
|
||||
int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
|
||||
- PreallocMode prealloc, Error **errp);
|
||||
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
|
||||
int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes);
|
||||
int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
|
||||
int64_t pos, int size);
|
||||
diff --git a/qemu-img.c b/qemu-img.c
|
||||
index 6dc881b..a27ad70 100644
|
||||
--- a/qemu-img.c
|
||||
+++ b/qemu-img.c
|
||||
@@ -3939,7 +3939,7 @@ static int img_resize(int argc, char **argv)
|
||||
* resizing, so pass @exact=true. It is of no use to report
|
||||
* success when the image has not actually been resized.
|
||||
*/
|
||||
- ret = blk_truncate(blk, total_size, true, prealloc, &err);
|
||||
+ ret = blk_truncate(blk, total_size, true, prealloc, 0, &err);
|
||||
if (!ret) {
|
||||
qprintf(quiet, "Image resized.\n");
|
||||
} else {
|
||||
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
|
||||
index 1b7e700..851f07e 100644
|
||||
--- a/qemu-io-cmds.c
|
||||
+++ b/qemu-io-cmds.c
|
||||
@@ -1715,7 +1715,7 @@ static int truncate_f(BlockBackend *blk, int argc, char **argv)
|
||||
* exact=true. It is better to err on the "emit more errors" side
|
||||
* than to be overly permissive.
|
||||
*/
|
||||
- ret = blk_truncate(blk, offset, true, PREALLOC_MODE_OFF, &local_err);
|
||||
+ ret = blk_truncate(blk, offset, true, PREALLOC_MODE_OFF, 0, &local_err);
|
||||
if (ret < 0) {
|
||||
error_report_err(local_err);
|
||||
return ret;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,158 @@
|
||||
From 6cc456c4c1e6557fdc7e138e8ef8171b71609222 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Wed, 8 Apr 2020 17:29:15 +0100
|
||||
Subject: [PATCH 4/6] block-backend: Reorder flush/pdiscard function
|
||||
definitions
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200408172917.18712-5-kwolf@redhat.com>
|
||||
Patchwork-id: 94598
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 4/6] block-backend: Reorder flush/pdiscard function definitions
|
||||
Bugzilla: 1817621
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
Move all variants of the flush/pdiscard functions to a single place and
|
||||
put the blk_co_*() version first because it is called by all other
|
||||
variants (and will become static in the next patch).
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200407121259.21350-2-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 564806c529d4e0acad209b1e5b864a8886092f1f)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/block-backend.c | 92 +++++++++++++++++++++++++--------------------------
|
||||
1 file changed, 46 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||
index 8b8f2a8..17b2e87 100644
|
||||
--- a/block/block-backend.c
|
||||
+++ b/block/block-backend.c
|
||||
@@ -1488,38 +1488,6 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t offset,
|
||||
blk_aio_write_entry, flags, cb, opaque);
|
||||
}
|
||||
|
||||
-static void blk_aio_flush_entry(void *opaque)
|
||||
-{
|
||||
- BlkAioEmAIOCB *acb = opaque;
|
||||
- BlkRwCo *rwco = &acb->rwco;
|
||||
-
|
||||
- rwco->ret = blk_co_flush(rwco->blk);
|
||||
- blk_aio_complete(acb);
|
||||
-}
|
||||
-
|
||||
-BlockAIOCB *blk_aio_flush(BlockBackend *blk,
|
||||
- BlockCompletionFunc *cb, void *opaque)
|
||||
-{
|
||||
- return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
|
||||
-}
|
||||
-
|
||||
-static void blk_aio_pdiscard_entry(void *opaque)
|
||||
-{
|
||||
- BlkAioEmAIOCB *acb = opaque;
|
||||
- BlkRwCo *rwco = &acb->rwco;
|
||||
-
|
||||
- rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
|
||||
- blk_aio_complete(acb);
|
||||
-}
|
||||
-
|
||||
-BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
|
||||
- int64_t offset, int bytes,
|
||||
- BlockCompletionFunc *cb, void *opaque)
|
||||
-{
|
||||
- return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_pdiscard_entry, 0,
|
||||
- cb, opaque);
|
||||
-}
|
||||
-
|
||||
void blk_aio_cancel(BlockAIOCB *acb)
|
||||
{
|
||||
bdrv_aio_cancel(acb);
|
||||
@@ -1586,6 +1554,37 @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
return bdrv_co_pdiscard(blk->root, offset, bytes);
|
||||
}
|
||||
|
||||
+static void blk_aio_pdiscard_entry(void *opaque)
|
||||
+{
|
||||
+ BlkAioEmAIOCB *acb = opaque;
|
||||
+ BlkRwCo *rwco = &acb->rwco;
|
||||
+
|
||||
+ rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, acb->bytes);
|
||||
+ blk_aio_complete(acb);
|
||||
+}
|
||||
+
|
||||
+BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
|
||||
+ int64_t offset, int bytes,
|
||||
+ BlockCompletionFunc *cb, void *opaque)
|
||||
+{
|
||||
+ return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_pdiscard_entry, 0,
|
||||
+ cb, opaque);
|
||||
+}
|
||||
+
|
||||
+static void blk_pdiscard_entry(void *opaque)
|
||||
+{
|
||||
+ BlkRwCo *rwco = opaque;
|
||||
+ QEMUIOVector *qiov = rwco->iobuf;
|
||||
+
|
||||
+ rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
|
||||
+ aio_wait_kick();
|
||||
+}
|
||||
+
|
||||
+int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
+{
|
||||
+ return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
|
||||
+}
|
||||
+
|
||||
int blk_co_flush(BlockBackend *blk)
|
||||
{
|
||||
blk_wait_while_drained(blk);
|
||||
@@ -1597,6 +1596,21 @@ int blk_co_flush(BlockBackend *blk)
|
||||
return bdrv_co_flush(blk_bs(blk));
|
||||
}
|
||||
|
||||
+static void blk_aio_flush_entry(void *opaque)
|
||||
+{
|
||||
+ BlkAioEmAIOCB *acb = opaque;
|
||||
+ BlkRwCo *rwco = &acb->rwco;
|
||||
+
|
||||
+ rwco->ret = blk_co_flush(rwco->blk);
|
||||
+ blk_aio_complete(acb);
|
||||
+}
|
||||
+
|
||||
+BlockAIOCB *blk_aio_flush(BlockBackend *blk,
|
||||
+ BlockCompletionFunc *cb, void *opaque)
|
||||
+{
|
||||
+ return blk_aio_prwv(blk, 0, 0, NULL, blk_aio_flush_entry, 0, cb, opaque);
|
||||
+}
|
||||
+
|
||||
static void blk_flush_entry(void *opaque)
|
||||
{
|
||||
BlkRwCo *rwco = opaque;
|
||||
@@ -2083,20 +2097,6 @@ int blk_truncate(BlockBackend *blk, int64_t offset, bool exact,
|
||||
return bdrv_truncate(blk->root, offset, exact, prealloc, errp);
|
||||
}
|
||||
|
||||
-static void blk_pdiscard_entry(void *opaque)
|
||||
-{
|
||||
- BlkRwCo *rwco = opaque;
|
||||
- QEMUIOVector *qiov = rwco->iobuf;
|
||||
-
|
||||
- rwco->ret = blk_co_pdiscard(rwco->blk, rwco->offset, qiov->size);
|
||||
- aio_wait_kick();
|
||||
-}
|
||||
-
|
||||
-int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
|
||||
-{
|
||||
- return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
|
||||
-}
|
||||
-
|
||||
int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
|
||||
int64_t pos, int size)
|
||||
{
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,130 @@
|
||||
From aefff389c4d11bd69180db7177135c4645a9b1bd Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:46 +0000
|
||||
Subject: [PATCH 13/18] block/backup-top: Don't acquire context while dropping
|
||||
top
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-7-slp@redhat.com>
|
||||
Patchwork-id: 93759
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 6/9] block/backup-top: Don't acquire context while dropping top
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
All paths that lead to bdrv_backup_top_drop(), except for the call
|
||||
from backup_clean(), imply that the BDS AioContext has already been
|
||||
acquired, so doing it there too can potentially lead to QEMU hanging
|
||||
on AIO_WAIT_WHILE().
|
||||
|
||||
An easy way to trigger this situation is by issuing a two actions
|
||||
transaction, with a proper and a bogus blockdev-backup, so the second
|
||||
one will trigger a rollback. This will trigger a hang with an stack
|
||||
trace like this one:
|
||||
|
||||
#0 0x00007fb680c75016 in __GI_ppoll (fds=0x55e74580f7c0, nfds=1, timeout=<optimized out>,
|
||||
timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
|
||||
#1 0x000055e743386e09 in ppoll (__ss=0x0, __timeout=0x0, __nfds=<optimized out>, __fds=<optimized out>)
|
||||
at /usr/include/bits/poll2.h:77
|
||||
#2 0x000055e743386e09 in qemu_poll_ns
|
||||
(fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at util/qemu-timer.c:336
|
||||
#3 0x000055e743388dc4 in aio_poll (ctx=0x55e7458925d0, blocking=blocking@entry=true)
|
||||
at util/aio-posix.c:669
|
||||
#4 0x000055e743305dea in bdrv_flush (bs=bs@entry=0x55e74593c0d0) at block/io.c:2878
|
||||
#5 0x000055e7432be58e in bdrv_close (bs=0x55e74593c0d0) at block.c:4017
|
||||
#6 0x000055e7432be58e in bdrv_delete (bs=<optimized out>) at block.c:4262
|
||||
#7 0x000055e7432be58e in bdrv_unref (bs=bs@entry=0x55e74593c0d0) at block.c:5644
|
||||
#8 0x000055e743316b9b in bdrv_backup_top_drop (bs=bs@entry=0x55e74593c0d0) at block/backup-top.c:273
|
||||
#9 0x000055e74331461f in backup_job_create
|
||||
(job_id=0x0, bs=bs@entry=0x55e7458d5820, target=target@entry=0x55e74589f640, speed=0, sync_mode=MIRROR_SYNC_MODE_FULL, sync_bitmap=sync_bitmap@entry=0x0, bitmap_mode=BITMAP_SYNC_MODE_ON_SUCCESS, compress=false, filter_node_name=0x0, on_source_error=BLOCKDEV_ON_ERROR_REPORT, on_target_error=BLOCKDEV_ON_ERROR_REPORT, creation_flags=0, cb=0x0, opaque=0x0, txn=0x0, errp=0x7ffddfd1efb0) at block/backup.c:478
|
||||
#10 0x000055e74315bc52 in do_backup_common
|
||||
(backup=backup@entry=0x55e746c066d0, bs=bs@entry=0x55e7458d5820, target_bs=target_bs@entry=0x55e74589f640, aio_context=aio_context@entry=0x55e7458a91e0, txn=txn@entry=0x0, errp=errp@entry=0x7ffddfd1efb0)
|
||||
at blockdev.c:3580
|
||||
#11 0x000055e74315c37c in do_blockdev_backup
|
||||
(backup=backup@entry=0x55e746c066d0, txn=0x0, errp=errp@entry=0x7ffddfd1efb0)
|
||||
at /usr/src/debug/qemu-kvm-4.2.0-2.module+el8.2.0+5135+ed3b2489.x86_64/./qapi/qapi-types-block-core.h:1492
|
||||
#12 0x000055e74315c449 in blockdev_backup_prepare (common=0x55e746a8de90, errp=0x7ffddfd1f018)
|
||||
at blockdev.c:1885
|
||||
#13 0x000055e743160152 in qmp_transaction
|
||||
(dev_list=<optimized out>, has_props=<optimized out>, props=0x55e7467fe2c0, errp=errp@entry=0x7ffddfd1f088) at blockdev.c:2340
|
||||
#14 0x000055e743287ff5 in qmp_marshal_transaction
|
||||
(args=<optimized out>, ret=<optimized out>, errp=0x7ffddfd1f0f8)
|
||||
at qapi/qapi-commands-transaction.c:44
|
||||
#15 0x000055e74333de6c in do_qmp_dispatch
|
||||
(errp=0x7ffddfd1f0f0, allow_oob=<optimized out>, request=<optimized out>, cmds=0x55e743c28d60 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#16 0x000055e74333de6c in qmp_dispatch
|
||||
(cmds=0x55e743c28d60 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>)
|
||||
at qapi/qmp-dispatch.c:175
|
||||
#17 0x000055e74325c061 in monitor_qmp_dispatch (mon=0x55e745908030, req=<optimized out>)
|
||||
at monitor/qmp.c:145
|
||||
#18 0x000055e74325c6fa in monitor_qmp_bh_dispatcher (data=<optimized out>) at monitor/qmp.c:234
|
||||
#19 0x000055e743385866 in aio_bh_call (bh=0x55e745807ae0) at util/async.c:117
|
||||
#20 0x000055e743385866 in aio_bh_poll (ctx=ctx@entry=0x55e7458067a0) at util/async.c:117
|
||||
#21 0x000055e743388c54 in aio_dispatch (ctx=0x55e7458067a0) at util/aio-posix.c:459
|
||||
#22 0x000055e743385742 in aio_ctx_dispatch
|
||||
(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#23 0x00007fb68543e67d in g_main_dispatch (context=0x55e745893a40) at gmain.c:3176
|
||||
#24 0x00007fb68543e67d in g_main_context_dispatch (context=context@entry=0x55e745893a40) at gmain.c:3829
|
||||
#25 0x000055e743387d08 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#26 0x000055e743387d08 in os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
|
||||
#27 0x000055e743387d08 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
|
||||
#28 0x000055e74316a3c1 in main_loop () at vl.c:1828
|
||||
#29 0x000055e743016a72 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
|
||||
at vl.c:4504
|
||||
|
||||
Fix this by not acquiring the AioContext there, and ensuring all paths
|
||||
leading to it have it already acquired (backup_clean()).
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1782111
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 0abf2581717a19d9749d5c2ff8acd0ac203452c2)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup-top.c | 5 -----
|
||||
block/backup.c | 3 +++
|
||||
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/block/backup-top.c b/block/backup-top.c
|
||||
index 818d3f2..b8d863f 100644
|
||||
--- a/block/backup-top.c
|
||||
+++ b/block/backup-top.c
|
||||
@@ -255,9 +255,6 @@ append_failed:
|
||||
void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
{
|
||||
BDRVBackupTopState *s = bs->opaque;
|
||||
- AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||
-
|
||||
- aio_context_acquire(aio_context);
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
@@ -271,6 +268,4 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
bdrv_unref(bs);
|
||||
-
|
||||
- aio_context_release(aio_context);
|
||||
}
|
||||
diff --git a/block/backup.c b/block/backup.c
|
||||
index cf62b1a..1383e21 100644
|
||||
--- a/block/backup.c
|
||||
+++ b/block/backup.c
|
||||
@@ -135,8 +135,11 @@ static void backup_abort(Job *job)
|
||||
static void backup_clean(Job *job)
|
||||
{
|
||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
|
||||
+ AioContext *aio_context = bdrv_get_aio_context(s->backup_top);
|
||||
|
||||
+ aio_context_acquire(aio_context);
|
||||
bdrv_backup_top_drop(s->backup_top);
|
||||
+ aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
void backup_do_checkpoint(BlockJob *job, Error **errp)
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,114 @@
|
||||
From 1e0582ad34e77a060e2067a35992979c9eae82c9 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:31 +0000
|
||||
Subject: [PATCH 11/20] block: bdrv_reopen() with backing file in different
|
||||
AioContext
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-6-kwolf@redhat.com>
|
||||
Patchwork-id: 94282
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 05/13] block: bdrv_reopen() with backing file in different AioContext
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
This patch allows bdrv_reopen() (and therefore the x-blockdev-reopen QMP
|
||||
command) to attach a node as the new backing file even if the node is in
|
||||
a different AioContext than the parent if one of both nodes can be moved
|
||||
to the AioContext of the other node.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Tested-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Message-Id: <20200306141413.30705-3-kwolf@redhat.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 1de6b45fb5c1489b450df7d1a4c692bba9678ce6)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 32 ++++++++++++++++++++++++++------
|
||||
tests/qemu-iotests/245 | 8 +++-----
|
||||
2 files changed, 29 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index a744bb5..39e4647 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -3749,6 +3749,29 @@ static void bdrv_reopen_perm(BlockReopenQueue *q, BlockDriverState *bs,
|
||||
*shared = cumulative_shared_perms;
|
||||
}
|
||||
|
||||
+static bool bdrv_reopen_can_attach(BlockDriverState *parent,
|
||||
+ BdrvChild *child,
|
||||
+ BlockDriverState *new_child,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ AioContext *parent_ctx = bdrv_get_aio_context(parent);
|
||||
+ AioContext *child_ctx = bdrv_get_aio_context(new_child);
|
||||
+ GSList *ignore;
|
||||
+ bool ret;
|
||||
+
|
||||
+ ignore = g_slist_prepend(NULL, child);
|
||||
+ ret = bdrv_can_set_aio_context(new_child, parent_ctx, &ignore, NULL);
|
||||
+ g_slist_free(ignore);
|
||||
+ if (ret) {
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ignore = g_slist_prepend(NULL, child);
|
||||
+ ret = bdrv_can_set_aio_context(parent, child_ctx, &ignore, errp);
|
||||
+ g_slist_free(ignore);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Take a BDRVReopenState and check if the value of 'backing' in the
|
||||
* reopen_state->options QDict is valid or not.
|
||||
@@ -3800,14 +3823,11 @@ static int bdrv_reopen_parse_backing(BDRVReopenState *reopen_state,
|
||||
}
|
||||
|
||||
/*
|
||||
- * TODO: before removing the x- prefix from x-blockdev-reopen we
|
||||
- * should move the new backing file into the right AioContext
|
||||
- * instead of returning an error.
|
||||
+ * Check AioContext compatibility so that the bdrv_set_backing_hd() call in
|
||||
+ * bdrv_reopen_commit() won't fail.
|
||||
*/
|
||||
if (new_backing_bs) {
|
||||
- if (bdrv_get_aio_context(new_backing_bs) != bdrv_get_aio_context(bs)) {
|
||||
- error_setg(errp, "Cannot use a new backing file "
|
||||
- "with a different AioContext");
|
||||
+ if (!bdrv_reopen_can_attach(bs, bs->backing, new_backing_bs, errp)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
|
||||
index f69c2fa..919131d 100644
|
||||
--- a/tests/qemu-iotests/245
|
||||
+++ b/tests/qemu-iotests/245
|
||||
@@ -1013,18 +1013,16 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
||||
# neither of them can switch to the other AioContext
|
||||
def test_iothreads_error(self):
|
||||
self.run_test_iothreads('iothread0', 'iothread1',
|
||||
- "Cannot use a new backing file with a different AioContext")
|
||||
+ "Cannot change iothread of active block backend")
|
||||
|
||||
def test_iothreads_compatible_users(self):
|
||||
self.run_test_iothreads('iothread0', 'iothread0')
|
||||
|
||||
def test_iothreads_switch_backing(self):
|
||||
- self.run_test_iothreads('iothread0', None,
|
||||
- "Cannot use a new backing file with a different AioContext")
|
||||
+ self.run_test_iothreads('iothread0', None)
|
||||
|
||||
def test_iothreads_switch_overlay(self):
|
||||
- self.run_test_iothreads(None, 'iothread0',
|
||||
- "Cannot use a new backing file with a different AioContext")
|
||||
+ self.run_test_iothreads(None, 'iothread0')
|
||||
|
||||
if __name__ == '__main__':
|
||||
iotests.main(supported_fmts=["qcow2"],
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,55 @@
|
||||
From 5e5ca17e1e09cfe9a780c556528bbde23c93fc4e Mon Sep 17 00:00:00 2001
|
||||
From: Richard Jones <rjones@redhat.com>
|
||||
Date: Thu, 28 May 2020 14:27:37 +0100
|
||||
Subject: [PATCH 03/26] block/curl: HTTP header field names are case
|
||||
insensitive
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Richard Jones <rjones@redhat.com>
|
||||
Message-id: <20200528142737.17318-3-rjones@redhat.com>
|
||||
Patchwork-id: 96895
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 2/2] block/curl: HTTP header field names are case insensitive
|
||||
Bugzilla: 1841038
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
From: David Edmondson <david.edmondson@oracle.com>
|
||||
|
||||
RFC 7230 section 3.2 indicates that HTTP header field names are case
|
||||
insensitive.
|
||||
|
||||
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
|
||||
Message-Id: <20200224101310.101169-3-david.edmondson@oracle.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 69032253c33ae1774233c63cedf36d32242a85fc)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/curl.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/block/curl.c b/block/curl.c
|
||||
index f9ffb7f..6e32590 100644
|
||||
--- a/block/curl.c
|
||||
+++ b/block/curl.c
|
||||
@@ -216,11 +216,12 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
||||
size_t realsize = size * nmemb;
|
||||
const char *header = (char *)ptr;
|
||||
const char *end = header + realsize;
|
||||
- const char *accept_ranges = "Accept-Ranges:";
|
||||
+ const char *accept_ranges = "accept-ranges:";
|
||||
const char *bytes = "bytes";
|
||||
|
||||
if (realsize >= strlen(accept_ranges)
|
||||
- && strncmp(header, accept_ranges, strlen(accept_ranges)) == 0) {
|
||||
+ && g_ascii_strncasecmp(header, accept_ranges,
|
||||
+ strlen(accept_ranges)) == 0) {
|
||||
|
||||
char *p = strchr(header, ':') + 1;
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,76 @@
|
||||
From e5ac775de83d3d22f13c74ab198780b8b579f684 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Jones <rjones@redhat.com>
|
||||
Date: Thu, 28 May 2020 14:27:36 +0100
|
||||
Subject: [PATCH 02/26] block/curl: HTTP header fields allow whitespace around
|
||||
values
|
||||
|
||||
RH-Author: Richard Jones <rjones@redhat.com>
|
||||
Message-id: <20200528142737.17318-2-rjones@redhat.com>
|
||||
Patchwork-id: 96894
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/2] block/curl: HTTP header fields allow whitespace around values
|
||||
Bugzilla: 1841038
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
|
||||
From: David Edmondson <david.edmondson@oracle.com>
|
||||
|
||||
RFC 7230 section 3.2 indicates that whitespace is permitted between
|
||||
the field name and field value and after the field value.
|
||||
|
||||
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
|
||||
Message-Id: <20200224101310.101169-2-david.edmondson@oracle.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 7788a319399f17476ff1dd43164c869e320820a2)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/curl.c | 31 +++++++++++++++++++++++++++----
|
||||
1 file changed, 27 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/block/curl.c b/block/curl.c
|
||||
index f862993..f9ffb7f 100644
|
||||
--- a/block/curl.c
|
||||
+++ b/block/curl.c
|
||||
@@ -214,11 +214,34 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
||||
{
|
||||
BDRVCURLState *s = opaque;
|
||||
size_t realsize = size * nmemb;
|
||||
- const char *accept_line = "Accept-Ranges: bytes";
|
||||
+ const char *header = (char *)ptr;
|
||||
+ const char *end = header + realsize;
|
||||
+ const char *accept_ranges = "Accept-Ranges:";
|
||||
+ const char *bytes = "bytes";
|
||||
|
||||
- if (realsize >= strlen(accept_line)
|
||||
- && strncmp((char *)ptr, accept_line, strlen(accept_line)) == 0) {
|
||||
- s->accept_range = true;
|
||||
+ if (realsize >= strlen(accept_ranges)
|
||||
+ && strncmp(header, accept_ranges, strlen(accept_ranges)) == 0) {
|
||||
+
|
||||
+ char *p = strchr(header, ':') + 1;
|
||||
+
|
||||
+ /* Skip whitespace between the header name and value. */
|
||||
+ while (p < end && *p && g_ascii_isspace(*p)) {
|
||||
+ p++;
|
||||
+ }
|
||||
+
|
||||
+ if (end - p >= strlen(bytes)
|
||||
+ && strncmp(p, bytes, strlen(bytes)) == 0) {
|
||||
+
|
||||
+ /* Check that there is nothing but whitespace after the value. */
|
||||
+ p += strlen(bytes);
|
||||
+ while (p < end && *p && g_ascii_isspace(*p)) {
|
||||
+ p++;
|
||||
+ }
|
||||
+
|
||||
+ if (p == end || !*p) {
|
||||
+ s->accept_range = true;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
return realsize;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,99 @@
|
||||
From 9581770f48911cbe68cfa1a7fa125df2a0a27d02 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Sun, 31 May 2020 16:40:33 +0100
|
||||
Subject: [PATCH 5/7] block: introducing 'bdrv_co_delete_file' interface
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200531164035.34188-2-mlevitsk@redhat.com>
|
||||
Patchwork-id: 97057
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/3] block: introducing 'bdrv_co_delete_file' interface
|
||||
Bugzilla: 1827630
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
|
||||
From: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
|
||||
Adding to Block Drivers the capability of being able to clean up
|
||||
its created files can be useful in certain situations. For the
|
||||
LUKS driver, for instance, a failure in one of its authentication
|
||||
steps can leave files in the host that weren't there before.
|
||||
|
||||
This patch adds the 'bdrv_co_delete_file' interface to block
|
||||
drivers and add it to the 'file' driver in file-posix.c. The
|
||||
implementation is given by 'raw_co_delete_file'.
|
||||
|
||||
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Message-Id: <20200130213907.2830642-2-danielhb413@gmail.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 9bffae14df879255329473a7bd578643af2d4c9c)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/file-posix.c | 23 +++++++++++++++++++++++
|
||||
include/block/block_int.h | 4 ++++
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index dd18d40..1609598 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -2388,6 +2388,28 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
return raw_co_create(&options, errp);
|
||||
}
|
||||
|
||||
+static int coroutine_fn raw_co_delete_file(BlockDriverState *bs,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ struct stat st;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!(stat(bs->filename, &st) == 0) || !S_ISREG(st.st_mode)) {
|
||||
+ error_setg_errno(errp, ENOENT, "%s is not a regular file",
|
||||
+ bs->filename);
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+
|
||||
+ ret = unlink(bs->filename);
|
||||
+ if (ret < 0) {
|
||||
+ ret = -errno;
|
||||
+ error_setg_errno(errp, -ret, "Error when deleting file %s",
|
||||
+ bs->filename);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Find allocation range in @bs around offset @start.
|
||||
* May change underlying file descriptor's file offset.
|
||||
@@ -3019,6 +3041,7 @@ BlockDriver bdrv_file = {
|
||||
.bdrv_co_block_status = raw_co_block_status,
|
||||
.bdrv_co_invalidate_cache = raw_co_invalidate_cache,
|
||||
.bdrv_co_pwrite_zeroes = raw_co_pwrite_zeroes,
|
||||
+ .bdrv_co_delete_file = raw_co_delete_file,
|
||||
|
||||
.bdrv_co_preadv = raw_co_preadv,
|
||||
.bdrv_co_pwritev = raw_co_pwritev,
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index 529f153..562dca1 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -316,6 +316,10 @@ struct BlockDriver {
|
||||
*/
|
||||
int coroutine_fn (*bdrv_co_flush)(BlockDriverState *bs);
|
||||
|
||||
+ /* Delete a created file. */
|
||||
+ int coroutine_fn (*bdrv_co_delete_file)(BlockDriverState *bs,
|
||||
+ Error **errp);
|
||||
+
|
||||
/*
|
||||
* Flushes all data that was already written to the OS all the way down to
|
||||
* the disk (for example file-posix.c calls fsync()).
|
||||
--
|
||||
1.8.3.1
|
||||
|
78
SOURCES/kvm-block-nbd-Fix-hang-in-.bdrv_close.patch
Normal file
78
SOURCES/kvm-block-nbd-Fix-hang-in-.bdrv_close.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From 4ef2c464a54b0b618d933641ac0a7012e629fed9 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 11 Mar 2020 10:51:42 +0000
|
||||
Subject: [PATCH 01/20] block/nbd: Fix hang in .bdrv_close()
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200311105147.13208-2-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94224
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 1/6] block/nbd: Fix hang in .bdrv_close()
|
||||
Bugzilla: 1640894
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
When nbd_close() is called from a coroutine, the connection_co never
|
||||
gets to run, and thus nbd_teardown_connection() hangs.
|
||||
|
||||
This is because aio_co_enter() only puts the connection_co into the main
|
||||
coroutine's wake-up queue, so this main coroutine needs to yield and
|
||||
wait for connection_co to terminate.
|
||||
|
||||
Suggested-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200122164532.178040-2-mreitz@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 78c81a3f108870d325b0a39d88711366afe6f703)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/nbd.c | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/block/nbd.c b/block/nbd.c
|
||||
index 5f18f78..a73f0d9 100644
|
||||
--- a/block/nbd.c
|
||||
+++ b/block/nbd.c
|
||||
@@ -70,6 +70,7 @@ typedef struct BDRVNBDState {
|
||||
CoMutex send_mutex;
|
||||
CoQueue free_sema;
|
||||
Coroutine *connection_co;
|
||||
+ Coroutine *teardown_co;
|
||||
QemuCoSleepState *connection_co_sleep_ns_state;
|
||||
bool drained;
|
||||
bool wait_drained_end;
|
||||
@@ -203,7 +204,15 @@ static void nbd_teardown_connection(BlockDriverState *bs)
|
||||
qemu_co_sleep_wake(s->connection_co_sleep_ns_state);
|
||||
}
|
||||
}
|
||||
- BDRV_POLL_WHILE(bs, s->connection_co);
|
||||
+ if (qemu_in_coroutine()) {
|
||||
+ s->teardown_co = qemu_coroutine_self();
|
||||
+ /* connection_co resumes us when it terminates */
|
||||
+ qemu_coroutine_yield();
|
||||
+ s->teardown_co = NULL;
|
||||
+ } else {
|
||||
+ BDRV_POLL_WHILE(bs, s->connection_co);
|
||||
+ }
|
||||
+ assert(!s->connection_co);
|
||||
}
|
||||
|
||||
static bool nbd_client_connecting(BDRVNBDState *s)
|
||||
@@ -395,6 +404,9 @@ static coroutine_fn void nbd_connection_entry(void *opaque)
|
||||
s->ioc = NULL;
|
||||
}
|
||||
|
||||
+ if (s->teardown_co) {
|
||||
+ aio_co_wake(s->teardown_co);
|
||||
+ }
|
||||
aio_wait_kick();
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,328 @@
|
||||
From 25c528b30f8774f33e957d14060805398da524d9 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Thu, 26 Mar 2020 20:23:06 +0000
|
||||
Subject: [PATCH 1/4] block: pass BlockDriver reference to the .bdrv_co_create
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200326202307.9264-2-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94447
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] block: pass BlockDriver reference to the .bdrv_co_create
|
||||
Bugzilla: 1816007
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
This will allow the reuse of a single generic .bdrv_co_create
|
||||
implementation for several drivers.
|
||||
No functional changes.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-Id: <20200326011218.29230-2-mlevitsk@redhat.com>
|
||||
Reviewed-by: Denis V. Lunev <den@openvz.org>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit b92902dfeaafbceaf744ab7473f2d070284f6172)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 3 ++-
|
||||
block/crypto.c | 3 ++-
|
||||
block/file-posix.c | 4 +++-
|
||||
block/file-win32.c | 4 +++-
|
||||
block/gluster.c | 3 ++-
|
||||
block/nfs.c | 4 +++-
|
||||
block/parallels.c | 3 ++-
|
||||
block/qcow.c | 3 ++-
|
||||
block/qcow2.c | 4 +++-
|
||||
block/qed.c | 3 ++-
|
||||
block/raw-format.c | 4 +++-
|
||||
block/rbd.c | 3 ++-
|
||||
block/sheepdog.c | 4 +++-
|
||||
block/ssh.c | 4 +++-
|
||||
block/vdi.c | 4 +++-
|
||||
block/vhdx.c | 3 ++-
|
||||
block/vmdk.c | 4 +++-
|
||||
block/vpc.c | 6 ++++--
|
||||
include/block/block_int.h | 3 ++-
|
||||
19 files changed, 49 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index ec29b1e..f9a1c5b 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -482,7 +482,8 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque)
|
||||
CreateCo *cco = opaque;
|
||||
assert(cco->drv);
|
||||
|
||||
- ret = cco->drv->bdrv_co_create_opts(cco->filename, cco->opts, &local_err);
|
||||
+ ret = cco->drv->bdrv_co_create_opts(cco->drv,
|
||||
+ cco->filename, cco->opts, &local_err);
|
||||
error_propagate(&cco->err, local_err);
|
||||
cco->ret = ret;
|
||||
}
|
||||
diff --git a/block/crypto.c b/block/crypto.c
|
||||
index 2482383..970d463 100644
|
||||
--- a/block/crypto.c
|
||||
+++ b/block/crypto.c
|
||||
@@ -539,7 +539,8 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
|
||||
+static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index fd29372..a2e0a74 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -2346,7 +2346,9 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions options;
|
||||
diff --git a/block/file-win32.c b/block/file-win32.c
|
||||
index 77e8ff7..1585983 100644
|
||||
--- a/block/file-win32.c
|
||||
+++ b/block/file-win32.c
|
||||
@@ -588,7 +588,9 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions options;
|
||||
diff --git a/block/gluster.c b/block/gluster.c
|
||||
index 4fa4a77..0aa1f2c 100644
|
||||
--- a/block/gluster.c
|
||||
+++ b/block/gluster.c
|
||||
@@ -1130,7 +1130,8 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn qemu_gluster_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn qemu_gluster_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/nfs.c b/block/nfs.c
|
||||
index 9a6311e..cc2413d 100644
|
||||
--- a/block/nfs.c
|
||||
+++ b/block/nfs.c
|
||||
@@ -662,7 +662,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts,
|
||||
+static int coroutine_fn nfs_file_co_create_opts(BlockDriver *drv,
|
||||
+ const char *url,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options;
|
||||
diff --git a/block/parallels.c b/block/parallels.c
|
||||
index 7a01997..6d4ed77 100644
|
||||
--- a/block/parallels.c
|
||||
+++ b/block/parallels.c
|
||||
@@ -609,7 +609,8 @@ exit:
|
||||
goto out;
|
||||
}
|
||||
|
||||
-static int coroutine_fn parallels_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn parallels_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/qcow.c b/block/qcow.c
|
||||
index fce8989..8973e4e 100644
|
||||
--- a/block/qcow.c
|
||||
+++ b/block/qcow.c
|
||||
@@ -934,7 +934,8 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn qcow_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn qcow_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts, Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index 83b1fc0..71067c6 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -3558,7 +3558,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
diff --git a/block/qed.c b/block/qed.c
|
||||
index d8c4e5f..1af9b3c 100644
|
||||
--- a/block/qed.c
|
||||
+++ b/block/qed.c
|
||||
@@ -720,7 +720,8 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn bdrv_qed_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/raw-format.c b/block/raw-format.c
|
||||
index 3a76ec7..93b25e1 100644
|
||||
--- a/block/raw-format.c
|
||||
+++ b/block/raw-format.c
|
||||
@@ -419,7 +419,9 @@ static int raw_has_zero_init_truncate(BlockDriverState *bs)
|
||||
return bdrv_has_zero_init_truncate(bs->file->bs);
|
||||
}
|
||||
|
||||
-static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
return bdrv_create_file(filename, opts, errp);
|
||||
diff --git a/block/rbd.c b/block/rbd.c
|
||||
index 027cbcc..8847259 100644
|
||||
--- a/block/rbd.c
|
||||
+++ b/block/rbd.c
|
||||
@@ -425,7 +425,8 @@ static int qemu_rbd_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||
return qemu_rbd_do_create(options, NULL, NULL, errp);
|
||||
}
|
||||
|
||||
-static int coroutine_fn qemu_rbd_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn qemu_rbd_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
||||
index cfa8433..a8a7e32 100644
|
||||
--- a/block/sheepdog.c
|
||||
+++ b/block/sheepdog.c
|
||||
@@ -2157,7 +2157,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn sd_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
diff --git a/block/ssh.c b/block/ssh.c
|
||||
index b4375cf..84e9282 100644
|
||||
--- a/block/ssh.c
|
||||
+++ b/block/ssh.c
|
||||
@@ -963,7 +963,9 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn ssh_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options;
|
||||
diff --git a/block/vdi.c b/block/vdi.c
|
||||
index 0142da7..e1a11f2 100644
|
||||
--- a/block/vdi.c
|
||||
+++ b/block/vdi.c
|
||||
@@ -896,7 +896,9 @@ static int coroutine_fn vdi_co_create(BlockdevCreateOptions *create_options,
|
||||
return vdi_co_do_create(create_options, DEFAULT_CLUSTER_SIZE, errp);
|
||||
}
|
||||
|
||||
-static int coroutine_fn vdi_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn vdi_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
QDict *qdict = NULL;
|
||||
diff --git a/block/vhdx.c b/block/vhdx.c
|
||||
index f02d261..33e57cd 100644
|
||||
--- a/block/vhdx.c
|
||||
+++ b/block/vhdx.c
|
||||
@@ -2046,7 +2046,8 @@ delete_and_exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn vhdx_co_create_opts(const char *filename,
|
||||
+static int coroutine_fn vhdx_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
diff --git a/block/vmdk.c b/block/vmdk.c
|
||||
index 20e909d..eb726f2 100644
|
||||
--- a/block/vmdk.c
|
||||
+++ b/block/vmdk.c
|
||||
@@ -2588,7 +2588,9 @@ exit:
|
||||
return blk;
|
||||
}
|
||||
|
||||
-static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
+static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
diff --git a/block/vpc.c b/block/vpc.c
|
||||
index a655502..6df75e2 100644
|
||||
--- a/block/vpc.c
|
||||
+++ b/block/vpc.c
|
||||
@@ -1089,8 +1089,10 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int coroutine_fn vpc_co_create_opts(const char *filename,
|
||||
- QemuOpts *opts, Error **errp)
|
||||
+static int coroutine_fn vpc_co_create_opts(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockdevCreateOptions *create_options = NULL;
|
||||
QDict *qdict;
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index 96e327b..7ff81be 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -136,7 +136,8 @@ struct BlockDriver {
|
||||
void (*bdrv_close)(BlockDriverState *bs);
|
||||
int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts,
|
||||
Error **errp);
|
||||
- int coroutine_fn (*bdrv_co_create_opts)(const char *filename,
|
||||
+ int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
QemuOpts *opts,
|
||||
Error **errp);
|
||||
int (*bdrv_make_empty)(BlockDriverState *bs);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,78 @@
|
||||
From ec5408763c49cd0b63ee324bdc38a429ed1adeee Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 12:34:29 +0000
|
||||
Subject: [PATCH 09/20] block/qcow2: Move bitmap reopen into
|
||||
bdrv_reopen_commit_post
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200313123439.10548-4-kwolf@redhat.com>
|
||||
Patchwork-id: 94280
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 03/13] block/qcow2: Move bitmap reopen into bdrv_reopen_commit_post
|
||||
Bugzilla: 1790482 1805143
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
|
||||
The bitmap code requires writing the 'file' child when the qcow2 driver
|
||||
is reopened in read-write mode.
|
||||
|
||||
If the 'file' child is being reopened due to a permissions change, the
|
||||
modification is commited yet when qcow2_reopen_commit is called. This
|
||||
means that any attempt to write the 'file' child will end with EBADFD
|
||||
as the original fd was already closed.
|
||||
|
||||
Moving bitmap reopening to the new callback which is called after
|
||||
permission modifications are commited fixes this as the file descriptor
|
||||
will be replaced with the correct one.
|
||||
|
||||
The above problem manifests itself when reopening 'qcow2' format layer
|
||||
which uses a 'file-posix' file child which was opened with the
|
||||
'auto-read-only' property set.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Message-Id: <db118dbafe1955afbc0a18d3dd220931074ce349.1582893284.git.pkrempa@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 65eb7c85a3e62529e2bad782e94d5a7b11dd5a92)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/qcow2.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/block/qcow2.c b/block/qcow2.c
|
||||
index 7c18721..83b1fc0 100644
|
||||
--- a/block/qcow2.c
|
||||
+++ b/block/qcow2.c
|
||||
@@ -1881,6 +1881,11 @@ fail:
|
||||
static void qcow2_reopen_commit(BDRVReopenState *state)
|
||||
{
|
||||
qcow2_update_options_commit(state->bs, state->opaque);
|
||||
+ g_free(state->opaque);
|
||||
+}
|
||||
+
|
||||
+static void qcow2_reopen_commit_post(BDRVReopenState *state)
|
||||
+{
|
||||
if (state->flags & BDRV_O_RDWR) {
|
||||
Error *local_err = NULL;
|
||||
|
||||
@@ -1895,7 +1900,6 @@ static void qcow2_reopen_commit(BDRVReopenState *state)
|
||||
bdrv_get_node_name(state->bs));
|
||||
}
|
||||
}
|
||||
- g_free(state->opaque);
|
||||
}
|
||||
|
||||
static void qcow2_reopen_abort(BDRVReopenState *state)
|
||||
@@ -5492,6 +5496,7 @@ BlockDriver bdrv_qcow2 = {
|
||||
.bdrv_close = qcow2_close,
|
||||
.bdrv_reopen_prepare = qcow2_reopen_prepare,
|
||||
.bdrv_reopen_commit = qcow2_reopen_commit,
|
||||
+ .bdrv_reopen_commit_post = qcow2_reopen_commit_post,
|
||||
.bdrv_reopen_abort = qcow2_reopen_abort,
|
||||
.bdrv_join_options = qcow2_join_options,
|
||||
.bdrv_child_perm = bdrv_format_default_perms,
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,296 @@
|
||||
From a1f7b929ae1fe6fa424c520c3a5eb497333b0fd9 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Thu, 26 Mar 2020 20:23:07 +0000
|
||||
Subject: [PATCH 2/4] block: trickle down the fallback image creation function
|
||||
use to the block drivers
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200326202307.9264-3-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94446
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/2] block: trickle down the fallback image creation function use to the block drivers
|
||||
Bugzilla: 1816007
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
Instead of checking the .bdrv_co_create_opts to see if we need the
|
||||
fallback, just implement the .bdrv_co_create_opts in the drivers that
|
||||
need it.
|
||||
|
||||
This way we don't break various places that need to know if the
|
||||
underlying protocol/format really supports image creation, and this way
|
||||
we still allow some drivers to not support image creation.
|
||||
|
||||
Fixes: fd17146cd93d1704cd96d7c2757b325fc7aac6fd
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1816007
|
||||
|
||||
Note that technically this driver reverts the image creation fallback
|
||||
for the vxhs driver since I don't have a means to test it, and IMHO it
|
||||
is better to leave it not supported as it was prior to generic image
|
||||
creation patches.
|
||||
|
||||
Also drop iscsi_create_opts which was left accidentally.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-Id: <20200326011218.29230-3-mlevitsk@redhat.com>
|
||||
Reviewed-by: Denis V. Lunev <den@openvz.org>
|
||||
[mreitz: Fixed alignment, and moved bdrv_co_create_opts_simple() and
|
||||
bdrv_create_opts_simple from block.h into block_int.h]
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 5a5e7f8cd86b7ced0732b1b6e28c82baa65b09c9)
|
||||
|
||||
Contextual conflicts in block.c and include/block/block_int.h
|
||||
|
||||
(conflict in block.c by default shows as functional but
|
||||
with --diff-algorithm=patience it becomes a contextual conflict)
|
||||
|
||||
...
|
||||
001/2:[----] [--] 'block: pass BlockDriver reference to the .bdrv_co_create'
|
||||
002/2:[0014] [FC] 'block: trickle down the fallback image creation function use to the block drivers'
|
||||
...
|
||||
002/2: 'meld <(git show 5a5e7f8^\!) <(git show 6d3bca5^\!)'
|
||||
|
||||
So now running:
|
||||
meld <(git show 5a5e7f8^\! --diff-algorithm=patience) <(git show 6d3bca5^\! --diff-algorithm=patience)
|
||||
|
||||
shows no contextual conflicts
|
||||
It is mostly due to missing commit f6dc1c31d3801dcbdf0c56574f9ff4f05180810c
|
||||
Thanks to Max Reitz for helping me with this.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 35 ++++++++++++++++++++---------------
|
||||
block/file-posix.c | 7 ++++++-
|
||||
block/iscsi.c | 16 ++++------------
|
||||
block/nbd.c | 6 ++++++
|
||||
block/nvme.c | 3 +++
|
||||
include/block/block.h | 1 +
|
||||
include/block/block_int.h | 11 +++++++++++
|
||||
7 files changed, 51 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index f9a1c5b..ba3b40d7 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -597,8 +597,15 @@ static int create_file_fallback_zero_first_sector(BlockBackend *blk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
|
||||
- QemuOpts *opts, Error **errp)
|
||||
+/**
|
||||
+ * Simple implementation of bdrv_co_create_opts for protocol drivers
|
||||
+ * which only support creation via opening a file
|
||||
+ * (usually existing raw storage device)
|
||||
+ */
|
||||
+int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockBackend *blk;
|
||||
QDict *options;
|
||||
@@ -662,11 +669,7 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
- if (drv->bdrv_co_create_opts) {
|
||||
- return bdrv_create(drv, filename, opts, errp);
|
||||
- } else {
|
||||
- return bdrv_create_file_fallback(filename, drv, opts, errp);
|
||||
- }
|
||||
+ return bdrv_create(drv, filename, opts, errp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1543,9 +1546,9 @@ QemuOptsList bdrv_runtime_opts = {
|
||||
},
|
||||
};
|
||||
|
||||
-static QemuOptsList fallback_create_opts = {
|
||||
- .name = "fallback-create-opts",
|
||||
- .head = QTAILQ_HEAD_INITIALIZER(fallback_create_opts.head),
|
||||
+QemuOptsList bdrv_create_opts_simple = {
|
||||
+ .name = "simple-create-opts",
|
||||
+ .head = QTAILQ_HEAD_INITIALIZER(bdrv_create_opts_simple.head),
|
||||
.desc = {
|
||||
{
|
||||
.name = BLOCK_OPT_SIZE,
|
||||
@@ -5910,13 +5913,15 @@ void bdrv_img_create(const char *filename, const char *fmt,
|
||||
return;
|
||||
}
|
||||
|
||||
- create_opts = qemu_opts_append(create_opts, drv->create_opts);
|
||||
- if (proto_drv->create_opts) {
|
||||
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
||||
- } else {
|
||||
- create_opts = qemu_opts_append(create_opts, &fallback_create_opts);
|
||||
+ if (!proto_drv->create_opts) {
|
||||
+ error_setg(errp, "Protocol driver '%s' does not support image creation",
|
||||
+ proto_drv->format_name);
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ create_opts = qemu_opts_append(create_opts, drv->create_opts);
|
||||
+ create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
||||
+
|
||||
/* Create parameter list with default values */
|
||||
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
|
||||
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort);
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index a2e0a74..dd18d40 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -3432,6 +3432,8 @@ static BlockDriver bdrv_host_device = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.mutable_opts = mutable_opts,
|
||||
.bdrv_co_invalidate_cache = raw_co_invalidate_cache,
|
||||
.bdrv_co_pwrite_zeroes = hdev_co_pwrite_zeroes,
|
||||
@@ -3558,10 +3560,11 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.mutable_opts = mutable_opts,
|
||||
.bdrv_co_invalidate_cache = raw_co_invalidate_cache,
|
||||
|
||||
-
|
||||
.bdrv_co_preadv = raw_co_preadv,
|
||||
.bdrv_co_pwritev = raw_co_pwritev,
|
||||
.bdrv_co_flush_to_disk = raw_co_flush_to_disk,
|
||||
@@ -3690,6 +3693,8 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.mutable_opts = mutable_opts,
|
||||
|
||||
.bdrv_co_preadv = raw_co_preadv,
|
||||
diff --git a/block/iscsi.c b/block/iscsi.c
|
||||
index b45da65..16b0716 100644
|
||||
--- a/block/iscsi.c
|
||||
+++ b/block/iscsi.c
|
||||
@@ -2399,18 +2399,6 @@ out_unlock:
|
||||
return r;
|
||||
}
|
||||
|
||||
-static QemuOptsList iscsi_create_opts = {
|
||||
- .name = "iscsi-create-opts",
|
||||
- .head = QTAILQ_HEAD_INITIALIZER(iscsi_create_opts.head),
|
||||
- .desc = {
|
||||
- {
|
||||
- .name = BLOCK_OPT_SIZE,
|
||||
- .type = QEMU_OPT_SIZE,
|
||||
- .help = "Virtual disk size"
|
||||
- },
|
||||
- { /* end of list */ }
|
||||
- }
|
||||
-};
|
||||
|
||||
static const char *const iscsi_strong_runtime_opts[] = {
|
||||
"transport",
|
||||
@@ -2434,6 +2422,8 @@ static BlockDriver bdrv_iscsi = {
|
||||
.bdrv_parse_filename = iscsi_parse_filename,
|
||||
.bdrv_file_open = iscsi_open,
|
||||
.bdrv_close = iscsi_close,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_reopen_prepare = iscsi_reopen_prepare,
|
||||
.bdrv_reopen_commit = iscsi_reopen_commit,
|
||||
.bdrv_co_invalidate_cache = iscsi_co_invalidate_cache,
|
||||
@@ -2471,6 +2461,8 @@ static BlockDriver bdrv_iser = {
|
||||
.bdrv_parse_filename = iscsi_parse_filename,
|
||||
.bdrv_file_open = iscsi_open,
|
||||
.bdrv_close = iscsi_close,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_reopen_prepare = iscsi_reopen_prepare,
|
||||
.bdrv_reopen_commit = iscsi_reopen_commit,
|
||||
.bdrv_co_invalidate_cache = iscsi_co_invalidate_cache,
|
||||
diff --git a/block/nbd.c b/block/nbd.c
|
||||
index a73f0d9..927915d 100644
|
||||
--- a/block/nbd.c
|
||||
+++ b/block/nbd.c
|
||||
@@ -2030,6 +2030,8 @@ static BlockDriver bdrv_nbd = {
|
||||
.protocol_name = "nbd",
|
||||
.instance_size = sizeof(BDRVNBDState),
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
@@ -2055,6 +2057,8 @@ static BlockDriver bdrv_nbd_tcp = {
|
||||
.protocol_name = "nbd+tcp",
|
||||
.instance_size = sizeof(BDRVNBDState),
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
@@ -2080,6 +2084,8 @@ static BlockDriver bdrv_nbd_unix = {
|
||||
.protocol_name = "nbd+unix",
|
||||
.instance_size = sizeof(BDRVNBDState),
|
||||
.bdrv_parse_filename = nbd_parse_filename,
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
.bdrv_file_open = nbd_open,
|
||||
.bdrv_reopen_prepare = nbd_client_reopen_prepare,
|
||||
.bdrv_co_preadv = nbd_client_co_preadv,
|
||||
diff --git a/block/nvme.c b/block/nvme.c
|
||||
index d41c4bd..7b7c0cc 100644
|
||||
--- a/block/nvme.c
|
||||
+++ b/block/nvme.c
|
||||
@@ -1333,6 +1333,9 @@ static BlockDriver bdrv_nvme = {
|
||||
.protocol_name = "nvme",
|
||||
.instance_size = sizeof(BDRVNVMeState),
|
||||
|
||||
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple,
|
||||
+ .create_opts = &bdrv_create_opts_simple,
|
||||
+
|
||||
.bdrv_parse_filename = nvme_parse_filename,
|
||||
.bdrv_file_open = nvme_file_open,
|
||||
.bdrv_close = nvme_close,
|
||||
diff --git a/include/block/block.h b/include/block/block.h
|
||||
index 1df9848..92685d2 100644
|
||||
--- a/include/block/block.h
|
||||
+++ b/include/block/block.h
|
||||
@@ -293,6 +293,7 @@ BlockDriver *bdrv_find_format(const char *format_name);
|
||||
int bdrv_create(BlockDriver *drv, const char* filename,
|
||||
QemuOpts *opts, Error **errp);
|
||||
int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp);
|
||||
+
|
||||
BlockDriverState *bdrv_new(void);
|
||||
void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top,
|
||||
Error **errp);
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index 7ff81be..529f153 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -1325,4 +1325,15 @@ int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset,
|
||||
|
||||
int refresh_total_sectors(BlockDriverState *bs, int64_t hint);
|
||||
|
||||
+/**
|
||||
+ * Simple implementation of bdrv_co_create_opts for protocol drivers
|
||||
+ * which only support creation via opening a file
|
||||
+ * (usually existing raw storage device)
|
||||
+ */
|
||||
+int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
|
||||
+ const char *filename,
|
||||
+ QemuOpts *opts,
|
||||
+ Error **errp);
|
||||
+extern QemuOptsList bdrv_create_opts_simple;
|
||||
+
|
||||
#endif /* BLOCK_INT_H */
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,94 @@
|
||||
From d84b9b93755ece6618ed98fa84386beeb1a0e40b Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 15:01:36 +0100
|
||||
Subject: [PATCH 08/17] block: truncate: Don't make backing file data visible
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200608150140.38218-8-kwolf@redhat.com>
|
||||
Patchwork-id: 97454
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 07/11] block: truncate: Don't make backing file data visible
|
||||
Bugzilla: 1780574
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
When extending the size of an image that has a backing file larger than
|
||||
its old size, make sure that the backing file data doesn't become
|
||||
visible in the guest, but the added area is properly zeroed out.
|
||||
|
||||
Consider the following scenario where the overlay is shorter than its
|
||||
backing file:
|
||||
|
||||
base.qcow2: AAAAAAAA
|
||||
overlay.qcow2: BBBB
|
||||
|
||||
When resizing (extending) overlay.qcow2, the new blocks should not stay
|
||||
unallocated and make the additional As from base.qcow2 visible like
|
||||
before this patch, but zeros should be read.
|
||||
|
||||
A similar case happens with the various variants of a commit job when an
|
||||
intermediate file is short (- for unallocated):
|
||||
|
||||
base.qcow2: A-A-AAAA
|
||||
mid.qcow2: BB-B
|
||||
top.qcow2: C--C--C-
|
||||
|
||||
After commit top.qcow2 to mid.qcow2, the following happens:
|
||||
|
||||
mid.qcow2: CB-C00C0 (correct result)
|
||||
mid.qcow2: CB-C--C- (before this fix)
|
||||
|
||||
Without the fix, blocks that previously read as zeros on top.qcow2
|
||||
suddenly turn into A.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Message-Id: <20200424125448.63318-8-kwolf@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 955c7d6687fefcd903900a1e597fcbc896c661cd)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/io.c | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/block/io.c b/block/io.c
|
||||
index 3235ce5..6c70b56 100644
|
||||
--- a/block/io.c
|
||||
+++ b/block/io.c
|
||||
@@ -3370,6 +3370,31 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * If the image has a backing file that is large enough that it would
|
||||
+ * provide data for the new area, we cannot leave it unallocated because
|
||||
+ * then the backing file content would become visible. Instead, zero-fill
|
||||
+ * the new area.
|
||||
+ *
|
||||
+ * Note that if the image has a backing file, but was opened without the
|
||||
+ * backing file, taking care of keeping things consistent with that backing
|
||||
+ * file is the user's responsibility.
|
||||
+ */
|
||||
+ if (new_bytes && bs->backing) {
|
||||
+ int64_t backing_len;
|
||||
+
|
||||
+ backing_len = bdrv_getlength(backing_bs(bs));
|
||||
+ if (backing_len < 0) {
|
||||
+ ret = backing_len;
|
||||
+ error_setg_errno(errp, -ret, "Could not get backing file size");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (backing_len > old_size) {
|
||||
+ flags |= BDRV_REQ_ZERO_WRITE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (drv->bdrv_co_truncate) {
|
||||
if (flags & ~bs->supported_truncate_flags) {
|
||||
error_setg(errp, "Block driver does not support requested flags");
|
||||
--
|
||||
1.8.3.1
|
||||
|
92
SOURCES/kvm-block.c-adding-bdrv_co_delete_file.patch
Normal file
92
SOURCES/kvm-block.c-adding-bdrv_co_delete_file.patch
Normal file
@ -0,0 +1,92 @@
|
||||
From 23b92512d7f11b3a38cf24a5c2fe7848f1e550e8 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Sun, 31 May 2020 16:40:34 +0100
|
||||
Subject: [PATCH 6/7] block.c: adding bdrv_co_delete_file
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200531164035.34188-3-mlevitsk@redhat.com>
|
||||
Patchwork-id: 97058
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 2/3] block.c: adding bdrv_co_delete_file
|
||||
Bugzilla: 1827630
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
|
||||
From: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
|
||||
Using the new 'bdrv_co_delete_file' interface, a pure co_routine function
|
||||
'bdrv_co_delete_file' inside block.c can can be used in a way similar of
|
||||
the existing bdrv_create_file to to clean up a created file.
|
||||
|
||||
We're creating a pure co_routine because the only caller of
|
||||
'bdrv_co_delete_file' will be already in co_routine context, thus there
|
||||
is no need to add all the machinery to check for qemu_in_coroutine() and
|
||||
create a separated co_routine to do the job.
|
||||
|
||||
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Message-Id: <20200130213907.2830642-3-danielhb413@gmail.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit e1d7f8bb1ec0c6911dcea81641ce6139dbded02d)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 26 ++++++++++++++++++++++++++
|
||||
include/block/block.h | 1 +
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index ba3b40d7..d6a05da 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -672,6 +672,32 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
|
||||
return bdrv_create(drv, filename, opts, errp);
|
||||
}
|
||||
|
||||
+int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs, Error **errp)
|
||||
+{
|
||||
+ Error *local_err = NULL;
|
||||
+ int ret;
|
||||
+
|
||||
+ assert(bs != NULL);
|
||||
+
|
||||
+ if (!bs->drv) {
|
||||
+ error_setg(errp, "Block node '%s' is not opened", bs->filename);
|
||||
+ return -ENOMEDIUM;
|
||||
+ }
|
||||
+
|
||||
+ if (!bs->drv->bdrv_co_delete_file) {
|
||||
+ error_setg(errp, "Driver '%s' does not support image deletion",
|
||||
+ bs->drv->format_name);
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
+
|
||||
+ ret = bs->drv->bdrv_co_delete_file(bs, &local_err);
|
||||
+ if (ret < 0) {
|
||||
+ error_propagate(errp, local_err);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Try to get @bs's logical and physical block size.
|
||||
* On success, store them in @bsz struct and return 0.
|
||||
diff --git a/include/block/block.h b/include/block/block.h
|
||||
index 92685d2..b2a3074 100644
|
||||
--- a/include/block/block.h
|
||||
+++ b/include/block/block.h
|
||||
@@ -373,6 +373,7 @@ bool bdrv_is_backing_chain_frozen(BlockDriverState *bs, BlockDriverState *base,
|
||||
int bdrv_freeze_backing_chain(BlockDriverState *bs, BlockDriverState *base,
|
||||
Error **errp);
|
||||
void bdrv_unfreeze_backing_chain(BlockDriverState *bs, BlockDriverState *base);
|
||||
+int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs, Error **errp);
|
||||
|
||||
|
||||
typedef struct BdrvCheckResult {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,176 @@
|
||||
From dc2654f2319ad6c379e0ba10be143726c6f0e9e0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:47 +0000
|
||||
Subject: [PATCH 14/18] blockdev: Acquire AioContext on dirty bitmap functions
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-8-slp@redhat.com>
|
||||
Patchwork-id: 93760
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 7/9] blockdev: Acquire AioContext on dirty bitmap functions
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Dirty map addition and removal functions are not acquiring to BDS
|
||||
AioContext, while they may call to code that expects it to be
|
||||
acquired.
|
||||
|
||||
This may trigger a crash with a stack trace like this one:
|
||||
|
||||
#0 0x00007f0ef146370f in __GI_raise (sig=sig@entry=6)
|
||||
at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
#1 0x00007f0ef144db25 in __GI_abort () at abort.c:79
|
||||
#2 0x0000565022294dce in error_exit
|
||||
(err=<optimized out>, msg=msg@entry=0x56502243a730 <__func__.16350> "qemu_mutex_unlock_impl") at util/qemu-thread-posix.c:36
|
||||
#3 0x00005650222950ba in qemu_mutex_unlock_impl
|
||||
(mutex=mutex@entry=0x5650244b0240, file=file@entry=0x565022439adf "util/async.c", line=line@entry=526) at util/qemu-thread-posix.c:108
|
||||
#4 0x0000565022290029 in aio_context_release
|
||||
(ctx=ctx@entry=0x5650244b01e0) at util/async.c:526
|
||||
#5 0x000056502221cd08 in bdrv_can_store_new_dirty_bitmap
|
||||
(bs=bs@entry=0x5650244dc820, name=name@entry=0x56502481d360 "bitmap1", granularity=granularity@entry=65536, errp=errp@entry=0x7fff22831718)
|
||||
at block/dirty-bitmap.c:542
|
||||
#6 0x000056502206ae53 in qmp_block_dirty_bitmap_add
|
||||
(errp=0x7fff22831718, disabled=false, has_disabled=<optimized out>, persistent=<optimized out>, has_persistent=true, granularity=65536, has_granularity=<optimized out>, name=0x56502481d360 "bitmap1", node=<optimized out>) at blockdev.c:2894
|
||||
#7 0x000056502206ae53 in qmp_block_dirty_bitmap_add
|
||||
(node=<optimized out>, name=0x56502481d360 "bitmap1", has_granularity=<optimized out>, granularity=<optimized out>, has_persistent=true, persistent=<optimized out>, has_disabled=false, disabled=false, errp=0x7fff22831718) at blockdev.c:2856
|
||||
#8 0x00005650221847a3 in qmp_marshal_block_dirty_bitmap_add
|
||||
(args=<optimized out>, ret=<optimized out>, errp=0x7fff22831798)
|
||||
at qapi/qapi-commands-block-core.c:651
|
||||
#9 0x0000565022247e6c in do_qmp_dispatch
|
||||
(errp=0x7fff22831790, allow_oob=<optimized out>, request=<optimized out>, cmds=0x565022b32d60 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#10 0x0000565022247e6c in qmp_dispatch
|
||||
(cmds=0x565022b32d60 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>) at qapi/qmp-dispatch.c:175
|
||||
#11 0x0000565022166061 in monitor_qmp_dispatch
|
||||
(mon=0x56502450faa0, req=<optimized out>) at monitor/qmp.c:145
|
||||
#12 0x00005650221666fa in monitor_qmp_bh_dispatcher
|
||||
(data=<optimized out>) at monitor/qmp.c:234
|
||||
#13 0x000056502228f866 in aio_bh_call (bh=0x56502440eae0)
|
||||
at util/async.c:117
|
||||
#14 0x000056502228f866 in aio_bh_poll (ctx=ctx@entry=0x56502440d7a0)
|
||||
at util/async.c:117
|
||||
#15 0x0000565022292c54 in aio_dispatch (ctx=0x56502440d7a0)
|
||||
at util/aio-posix.c:459
|
||||
#16 0x000056502228f742 in aio_ctx_dispatch
|
||||
(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#17 0x00007f0ef5ce667d in g_main_dispatch (context=0x56502449aa40)
|
||||
at gmain.c:3176
|
||||
#18 0x00007f0ef5ce667d in g_main_context_dispatch
|
||||
(context=context@entry=0x56502449aa40) at gmain.c:3829
|
||||
#19 0x0000565022291d08 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#20 0x0000565022291d08 in os_host_main_loop_wait
|
||||
(timeout=<optimized out>) at util/main-loop.c:242
|
||||
#21 0x0000565022291d08 in main_loop_wait (nonblocking=<optimized out>)
|
||||
at util/main-loop.c:518
|
||||
#22 0x00005650220743c1 in main_loop () at vl.c:1828
|
||||
#23 0x0000565021f20a72 in main
|
||||
(argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
|
||||
at vl.c:4504
|
||||
|
||||
Fix this by acquiring the AioContext at qmp_block_dirty_bitmap_add()
|
||||
and qmp_block_dirty_bitmap_add().
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1782175
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 91005a495e228ebd7e5e173cd18f952450eef82d)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 22 ++++++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 1dacbc2..d4ef6cd 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -2984,6 +2984,7 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
|
||||
if (!name || name[0] == '\0') {
|
||||
error_setg(errp, "Bitmap name cannot be empty");
|
||||
@@ -2995,11 +2996,14 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
return;
|
||||
}
|
||||
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (has_granularity) {
|
||||
if (granularity < 512 || !is_power_of_2(granularity)) {
|
||||
error_setg(errp, "Granularity must be power of 2 "
|
||||
"and at least 512");
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
} else {
|
||||
/* Default to cluster size, if available: */
|
||||
@@ -3017,12 +3021,12 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
if (persistent &&
|
||||
!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
|
||||
{
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
|
||||
if (bitmap == NULL) {
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
@@ -3030,6 +3034,9 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
}
|
||||
|
||||
bdrv_dirty_bitmap_set_persistence(bitmap, persistent);
|
||||
+
|
||||
+out:
|
||||
+ aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
@@ -3038,21 +3045,27 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
|
||||
bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
if (!bitmap || !bs) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO,
|
||||
errp)) {
|
||||
+ aio_context_release(aio_context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bdrv_dirty_bitmap_get_persistence(bitmap) &&
|
||||
bdrv_remove_persistent_dirty_bitmap(bs, name, errp) < 0)
|
||||
{
|
||||
- return NULL;
|
||||
+ aio_context_release(aio_context);
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
if (release) {
|
||||
@@ -3063,6 +3076,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
*bitmap_bs = bs;
|
||||
}
|
||||
|
||||
+ aio_context_release(aio_context);
|
||||
return release ? NULL : bitmap;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,179 @@
|
||||
From 0c8ba0a96a7d0cbf371f1a5fbee543e8b2cb2595 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Tue, 2 Jun 2020 02:34:13 +0100
|
||||
Subject: [PATCH 08/26] blockdev: Promote several bitmap functions to
|
||||
non-static
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Eric Blake <eblake@redhat.com>
|
||||
Message-id: <20200602023420.2133649-6-eblake@redhat.com>
|
||||
Patchwork-id: 97077
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 05/12] blockdev: Promote several bitmap functions to non-static
|
||||
Bugzilla: 1779893 1779904
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
|
||||
The next patch will split blockdev.c, which will require accessing
|
||||
some previously-static functions from more than one .c file. But part
|
||||
of promoting a function to public is picking a naming scheme that does
|
||||
not reek of exposing too many internals (two of the three functions
|
||||
were named starting with 'do_'). To make future code motion easier,
|
||||
perform the function rename and non-static promotion into its own
|
||||
patch.
|
||||
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200513011648.166876-5-eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
(cherry picked from commit c6996cf9a6c759c29919642be9a73ac64b38301b)
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 47 +++++++++++++++++++----------------------------
|
||||
include/block/block_int.h | 12 ++++++++++++
|
||||
2 files changed, 31 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 86eb115..3958058 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1262,10 +1262,10 @@ out_aio_context:
|
||||
*
|
||||
* @return: A bitmap object on success, or NULL on failure.
|
||||
*/
|
||||
-static BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
||||
- const char *name,
|
||||
- BlockDriverState **pbs,
|
||||
- Error **errp)
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
||||
+ const char *name,
|
||||
+ BlockDriverState **pbs,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
@@ -2241,11 +2241,6 @@ static void block_dirty_bitmap_disable_abort(BlkActionState *common)
|
||||
}
|
||||
}
|
||||
|
||||
-static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
||||
- const char *node, const char *target,
|
||||
- BlockDirtyBitmapMergeSourceList *bitmaps,
|
||||
- HBitmap **backup, Error **errp);
|
||||
-
|
||||
static void block_dirty_bitmap_merge_prepare(BlkActionState *common,
|
||||
Error **errp)
|
||||
{
|
||||
@@ -2259,15 +2254,11 @@ static void block_dirty_bitmap_merge_prepare(BlkActionState *common,
|
||||
|
||||
action = common->action->u.block_dirty_bitmap_merge.data;
|
||||
|
||||
- state->bitmap = do_block_dirty_bitmap_merge(action->node, action->target,
|
||||
- action->bitmaps, &state->backup,
|
||||
- errp);
|
||||
+ state->bitmap = block_dirty_bitmap_merge(action->node, action->target,
|
||||
+ action->bitmaps, &state->backup,
|
||||
+ errp);
|
||||
}
|
||||
|
||||
-static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
- const char *node, const char *name, bool release,
|
||||
- BlockDriverState **bitmap_bs, Error **errp);
|
||||
-
|
||||
static void block_dirty_bitmap_remove_prepare(BlkActionState *common,
|
||||
Error **errp)
|
||||
{
|
||||
@@ -2281,8 +2272,8 @@ static void block_dirty_bitmap_remove_prepare(BlkActionState *common,
|
||||
|
||||
action = common->action->u.block_dirty_bitmap_remove.data;
|
||||
|
||||
- state->bitmap = do_block_dirty_bitmap_remove(action->node, action->name,
|
||||
- false, &state->bs, errp);
|
||||
+ state->bitmap = block_dirty_bitmap_remove(action->node, action->name,
|
||||
+ false, &state->bs, errp);
|
||||
if (state->bitmap) {
|
||||
bdrv_dirty_bitmap_skip_store(state->bitmap, true);
|
||||
bdrv_dirty_bitmap_set_busy(state->bitmap, true);
|
||||
@@ -3046,9 +3037,10 @@ out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
-static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
- const char *node, const char *name, bool release,
|
||||
- BlockDriverState **bitmap_bs, Error **errp)
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
+ bool release,
|
||||
+ BlockDriverState **bitmap_bs,
|
||||
+ Error **errp)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
@@ -3090,7 +3082,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
Error **errp)
|
||||
{
|
||||
- do_block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
||||
+ block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3151,10 +3143,9 @@ void qmp_block_dirty_bitmap_disable(const char *node, const char *name,
|
||||
bdrv_disable_dirty_bitmap(bitmap);
|
||||
}
|
||||
|
||||
-static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
||||
- const char *node, const char *target,
|
||||
- BlockDirtyBitmapMergeSourceList *bitmaps,
|
||||
- HBitmap **backup, Error **errp)
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
+ BlockDirtyBitmapMergeSourceList *bms,
|
||||
+ HBitmap **backup, Error **errp)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *dst, *src, *anon;
|
||||
@@ -3172,7 +3163,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- for (lst = bitmaps; lst; lst = lst->next) {
|
||||
+ for (lst = bms; lst; lst = lst->next) {
|
||||
switch (lst->value->type) {
|
||||
const char *name, *node;
|
||||
case QTYPE_QSTRING:
|
||||
@@ -3217,7 +3208,7 @@ void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
BlockDirtyBitmapMergeSourceList *bitmaps,
|
||||
Error **errp)
|
||||
{
|
||||
- do_block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
||||
+ block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
||||
}
|
||||
|
||||
BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
|
||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
||||
index cc18e8d..876a83d 100644
|
||||
--- a/include/block/block_int.h
|
||||
+++ b/include/block/block_int.h
|
||||
@@ -1341,4 +1341,16 @@ int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
|
||||
Error **errp);
|
||||
extern QemuOptsList bdrv_create_opts_simple;
|
||||
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
||||
+ const char *name,
|
||||
+ BlockDriverState **pbs,
|
||||
+ Error **errp);
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
+ BlockDirtyBitmapMergeSourceList *bms,
|
||||
+ HBitmap **backup, Error **errp);
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
+ bool release,
|
||||
+ BlockDriverState **bitmap_bs,
|
||||
+ Error **errp);
|
||||
+
|
||||
#endif /* BLOCK_INT_H */
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,107 @@
|
||||
From 24e5eca4218b294bd013e2d85a38345045506bec Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:48 +0000
|
||||
Subject: [PATCH 15/18] blockdev: Return bs to the proper context on snapshot
|
||||
abort
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-9-slp@redhat.com>
|
||||
Patchwork-id: 93761
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 8/9] blockdev: Return bs to the proper context on snapshot abort
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
external_snapshot_abort() calls to bdrv_set_backing_hd(), which
|
||||
returns state->old_bs to the main AioContext, as it's intended to be
|
||||
used then the BDS is going to be released. As that's not the case when
|
||||
aborting an external snapshot, return it to the AioContext it was
|
||||
before the call.
|
||||
|
||||
This issue can be triggered by issuing a transaction with two actions,
|
||||
a proper blockdev-snapshot-sync and a bogus one, so the second will
|
||||
trigger a transaction abort. This results in a crash with an stack
|
||||
trace like this one:
|
||||
|
||||
#0 0x00007fa1048b28df in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
#1 0x00007fa10489ccf5 in __GI_abort () at abort.c:79
|
||||
#2 0x00007fa10489cbc9 in __assert_fail_base
|
||||
(fmt=0x7fa104a03300 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=0x557224014d30 "block.c", line=2240, function=<optimized out>) at assert.c:92
|
||||
#3 0x00007fa1048aae96 in __GI___assert_fail
|
||||
(assertion=assertion@entry=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=file@entry=0x557224014d30 "block.c", line=line@entry=2240, function=function@entry=0x5572240b5d60 <__PRETTY_FUNCTION__.31620> "bdrv_replace_child_noperm") at assert.c:101
|
||||
#4 0x0000557223e631f8 in bdrv_replace_child_noperm (child=0x557225b9c980, new_bs=new_bs@entry=0x557225c42e40) at block.c:2240
|
||||
#5 0x0000557223e68be7 in bdrv_replace_node (from=0x557226951a60, to=0x557225c42e40, errp=0x5572247d6138 <error_abort>) at block.c:4196
|
||||
#6 0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1731
|
||||
#7 0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1717
|
||||
#8 0x0000557223d09013 in qmp_transaction (dev_list=<optimized out>, has_props=<optimized out>, props=0x557225cc7d70, errp=errp@entry=0x7ffe704c0c98) at blockdev.c:2360
|
||||
#9 0x0000557223e32085 in qmp_marshal_transaction (args=<optimized out>, ret=<optimized out>, errp=0x7ffe704c0d08) at qapi/qapi-commands-transaction.c:44
|
||||
#10 0x0000557223ee798c in do_qmp_dispatch (errp=0x7ffe704c0d00, allow_oob=<optimized out>, request=<optimized out>, cmds=0x5572247d3cc0 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#11 0x0000557223ee798c in qmp_dispatch (cmds=0x5572247d3cc0 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>) at qapi/qmp-dispatch.c:175
|
||||
#12 0x0000557223e06141 in monitor_qmp_dispatch (mon=0x557225c69ff0, req=<optimized out>) at monitor/qmp.c:120
|
||||
#13 0x0000557223e0678a in monitor_qmp_bh_dispatcher (data=<optimized out>) at monitor/qmp.c:209
|
||||
#14 0x0000557223f2f366 in aio_bh_call (bh=0x557225b9dc60) at util/async.c:117
|
||||
#15 0x0000557223f2f366 in aio_bh_poll (ctx=ctx@entry=0x557225b9c840) at util/async.c:117
|
||||
#16 0x0000557223f32754 in aio_dispatch (ctx=0x557225b9c840) at util/aio-posix.c:459
|
||||
#17 0x0000557223f2f242 in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#18 0x00007fa10913467d in g_main_dispatch (context=0x557225c28e80) at gmain.c:3176
|
||||
#19 0x00007fa10913467d in g_main_context_dispatch (context=context@entry=0x557225c28e80) at gmain.c:3829
|
||||
#20 0x0000557223f31808 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#21 0x0000557223f31808 in os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
|
||||
#22 0x0000557223f31808 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
|
||||
#23 0x0000557223d13201 in main_loop () at vl.c:1828
|
||||
#24 0x0000557223bbfb82 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4504
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1779036
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 377410f6fb4f6b0d26d4a028c20766fae05de17e)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index d4ef6cd..4cd9a58 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1731,6 +1731,8 @@ static void external_snapshot_abort(BlkActionState *common)
|
||||
if (state->new_bs) {
|
||||
if (state->overlay_appended) {
|
||||
AioContext *aio_context;
|
||||
+ AioContext *tmp_context;
|
||||
+ int ret;
|
||||
|
||||
aio_context = bdrv_get_aio_context(state->old_bs);
|
||||
aio_context_acquire(aio_context);
|
||||
@@ -1738,6 +1740,25 @@ static void external_snapshot_abort(BlkActionState *common)
|
||||
bdrv_ref(state->old_bs); /* we can't let bdrv_set_backind_hd()
|
||||
close state->old_bs; we need it */
|
||||
bdrv_set_backing_hd(state->new_bs, NULL, &error_abort);
|
||||
+
|
||||
+ /*
|
||||
+ * The call to bdrv_set_backing_hd() above returns state->old_bs to
|
||||
+ * the main AioContext. As we're still going to be using it, return
|
||||
+ * it to the AioContext it was before.
|
||||
+ */
|
||||
+ tmp_context = bdrv_get_aio_context(state->old_bs);
|
||||
+ if (aio_context != tmp_context) {
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(tmp_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(state->old_bs,
|
||||
+ aio_context, NULL);
|
||||
+ assert(ret == 0);
|
||||
+
|
||||
+ aio_context_release(tmp_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+ }
|
||||
+
|
||||
bdrv_replace_node(state->new_bs, state->old_bs, &error_abort);
|
||||
bdrv_unref(state->old_bs); /* bdrv_replace_node() ref'ed old_bs */
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,720 @@
|
||||
From 2afa718d59ef86879a9e34b4601a1f2658afa9ba Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Tue, 2 Jun 2020 02:34:14 +0100
|
||||
Subject: [PATCH 09/26] blockdev: Split off basic bitmap operations for
|
||||
qemu-img
|
||||
|
||||
RH-Author: Eric Blake <eblake@redhat.com>
|
||||
Message-id: <20200602023420.2133649-7-eblake@redhat.com>
|
||||
Patchwork-id: 97073
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 06/12] blockdev: Split off basic bitmap operations for qemu-img
|
||||
Bugzilla: 1779893 1779904
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
|
||||
Upcoming patches want to add some basic bitmap manipulation abilities
|
||||
to qemu-img. But blockdev.o is too heavyweight to link into qemu-img
|
||||
(among other things, it would drag in block jobs and transaction
|
||||
support - qemu-img does offline manipulation, where atomicity is less
|
||||
important because there are no concurrent modifications to compete
|
||||
with), so it's time to split off the bare bones of what we will need
|
||||
into a new file block/monitor/bitmap-qmp-cmds.o.
|
||||
|
||||
This is sufficient to expose 6 QMP commands for use by qemu-img (add,
|
||||
remove, clear, enable, disable, merge), as well as move the three
|
||||
helper functions touched in the previous patch. Regarding
|
||||
MAINTAINERS, the new file is automatically part of block core, but
|
||||
also makes sense as related to other dirty bitmap files.
|
||||
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200513011648.166876-6-eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
(cherry picked from commit bb4e58c6137e80129b955789dd4b66c1504f20dc)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
|
||||
Conflicts:
|
||||
Makefile.objs - comment context
|
||||
block/monitor/Makefile.objs - context: a2dde2f2 not backported
|
||||
blockdev.c - context
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
Makefile.objs | 3 +-
|
||||
block/monitor/Makefile.objs | 1 +
|
||||
block/monitor/bitmap-qmp-cmds.c | 321 ++++++++++++++++++++++++++++++++++++++++
|
||||
blockdev.c | 284 -----------------------------------
|
||||
5 files changed, 324 insertions(+), 286 deletions(-)
|
||||
create mode 100644 block/monitor/Makefile.objs
|
||||
create mode 100644 block/monitor/bitmap-qmp-cmds.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 3a81ac9..49d5d44 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -1875,6 +1875,7 @@ L: qemu-block@nongnu.org
|
||||
S: Supported
|
||||
F: include/qemu/hbitmap.h
|
||||
F: include/block/dirty-bitmap.h
|
||||
+F: block/monitor/bitmap-qmp-cmds.c
|
||||
F: block/dirty-bitmap.c
|
||||
F: block/qcow2-bitmap.c
|
||||
F: migration/block-dirty-bitmap.c
|
||||
diff --git a/Makefile.objs b/Makefile.objs
|
||||
index 1a8f288..7404ef0 100644
|
||||
--- a/Makefile.objs
|
||||
+++ b/Makefile.objs
|
||||
@@ -13,9 +13,8 @@ authz-obj-y = authz/
|
||||
#######################################################################
|
||||
# block-obj-y is code used by both qemu system emulation and qemu-img
|
||||
|
||||
-block-obj-y = nbd/
|
||||
+block-obj-y = block/ block/monitor/ nbd/ scsi/
|
||||
block-obj-y += block.o blockjob.o job.o
|
||||
-block-obj-y += block/ scsi/
|
||||
block-obj-y += qemu-io-cmds.o
|
||||
block-obj-$(CONFIG_REPLICATION) += replication.o
|
||||
|
||||
diff --git a/block/monitor/Makefile.objs b/block/monitor/Makefile.objs
|
||||
new file mode 100644
|
||||
index 0000000..f0c7642
|
||||
--- /dev/null
|
||||
+++ b/block/monitor/Makefile.objs
|
||||
@@ -0,0 +1 @@
|
||||
+block-obj-y += bitmap-qmp-cmds.o
|
||||
diff --git a/block/monitor/bitmap-qmp-cmds.c b/block/monitor/bitmap-qmp-cmds.c
|
||||
new file mode 100644
|
||||
index 0000000..9f11dee
|
||||
--- /dev/null
|
||||
+++ b/block/monitor/bitmap-qmp-cmds.c
|
||||
@@ -0,0 +1,321 @@
|
||||
+/*
|
||||
+ * QEMU block dirty bitmap QMP commands
|
||||
+ *
|
||||
+ * Copyright (c) 2003-2008 Fabrice Bellard
|
||||
+ *
|
||||
+ * This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
+ * later. See the COPYING file in the top-level directory.
|
||||
+ *
|
||||
+ * This file incorporates work covered by the following copyright and
|
||||
+ * permission notice:
|
||||
+ *
|
||||
+ * Copyright (c) 2003-2008 Fabrice Bellard
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the "Software"), to deal
|
||||
+ * in the Software without restriction, including without limitation the rights
|
||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
+ * copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
+ * THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#include "qemu/osdep.h"
|
||||
+
|
||||
+#include "block/block_int.h"
|
||||
+#include "qapi/qapi-commands-block.h"
|
||||
+#include "qapi/error.h"
|
||||
+
|
||||
+/**
|
||||
+ * block_dirty_bitmap_lookup:
|
||||
+ * Return a dirty bitmap (if present), after validating
|
||||
+ * the node reference and bitmap names.
|
||||
+ *
|
||||
+ * @node: The name of the BDS node to search for bitmaps
|
||||
+ * @name: The name of the bitmap to search for
|
||||
+ * @pbs: Output pointer for BDS lookup, if desired. Can be NULL.
|
||||
+ * @errp: Output pointer for error information. Can be NULL.
|
||||
+ *
|
||||
+ * @return: A bitmap object on success, or NULL on failure.
|
||||
+ */
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
||||
+ const char *name,
|
||||
+ BlockDriverState **pbs,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+
|
||||
+ if (!node) {
|
||||
+ error_setg(errp, "Node cannot be NULL");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (!name) {
|
||||
+ error_setg(errp, "Bitmap name cannot be NULL");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ bs = bdrv_lookup_bs(node, node, NULL);
|
||||
+ if (!bs) {
|
||||
+ error_setg(errp, "Node '%s' not found", node);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ bitmap = bdrv_find_dirty_bitmap(bs, name);
|
||||
+ if (!bitmap) {
|
||||
+ error_setg(errp, "Dirty bitmap '%s' not found", name);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (pbs) {
|
||||
+ *pbs = bs;
|
||||
+ }
|
||||
+
|
||||
+ return bitmap;
|
||||
+}
|
||||
+
|
||||
+void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
+ bool has_granularity, uint32_t granularity,
|
||||
+ bool has_persistent, bool persistent,
|
||||
+ bool has_disabled, bool disabled,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
+
|
||||
+ if (!name || name[0] == '\0') {
|
||||
+ error_setg(errp, "Bitmap name cannot be empty");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bs = bdrv_lookup_bs(node, node, errp);
|
||||
+ if (!bs) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
+ if (has_granularity) {
|
||||
+ if (granularity < 512 || !is_power_of_2(granularity)) {
|
||||
+ error_setg(errp, "Granularity must be power of 2 "
|
||||
+ "and at least 512");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Default to cluster size, if available: */
|
||||
+ granularity = bdrv_get_default_bitmap_granularity(bs);
|
||||
+ }
|
||||
+
|
||||
+ if (!has_persistent) {
|
||||
+ persistent = false;
|
||||
+ }
|
||||
+
|
||||
+ if (!has_disabled) {
|
||||
+ disabled = false;
|
||||
+ }
|
||||
+
|
||||
+ if (persistent &&
|
||||
+ !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
|
||||
+ {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
|
||||
+ if (bitmap == NULL) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (disabled) {
|
||||
+ bdrv_disable_dirty_bitmap(bitmap);
|
||||
+ }
|
||||
+
|
||||
+ bdrv_dirty_bitmap_set_persistence(bitmap, persistent);
|
||||
+
|
||||
+out:
|
||||
+ aio_context_release(aio_context);
|
||||
+}
|
||||
+
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
+ bool release,
|
||||
+ BlockDriverState **bitmap_bs,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
+
|
||||
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
+ if (!bitmap || !bs) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO,
|
||||
+ errp)) {
|
||||
+ aio_context_release(aio_context);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (bdrv_dirty_bitmap_get_persistence(bitmap) &&
|
||||
+ bdrv_remove_persistent_dirty_bitmap(bs, name, errp) < 0)
|
||||
+ {
|
||||
+ aio_context_release(aio_context);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (release) {
|
||||
+ bdrv_release_dirty_bitmap(bitmap);
|
||||
+ }
|
||||
+
|
||||
+ if (bitmap_bs) {
|
||||
+ *bitmap_bs = bs;
|
||||
+ }
|
||||
+
|
||||
+ aio_context_release(aio_context);
|
||||
+ return release ? NULL : bitmap;
|
||||
+}
|
||||
+
|
||||
+void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Completely clear a bitmap, for the purposes of synchronizing a bitmap
|
||||
+ * immediately after a full backup operation.
|
||||
+ */
|
||||
+void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+ BlockDriverState *bs;
|
||||
+
|
||||
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
+ if (!bitmap || !bs) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, errp)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bdrv_clear_dirty_bitmap(bitmap, NULL);
|
||||
+}
|
||||
+
|
||||
+void qmp_block_dirty_bitmap_enable(const char *node, const char *name,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+
|
||||
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
+ if (!bitmap) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bdrv_enable_dirty_bitmap(bitmap);
|
||||
+}
|
||||
+
|
||||
+void qmp_block_dirty_bitmap_disable(const char *node, const char *name,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *bitmap;
|
||||
+
|
||||
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
+ if (!bitmap) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bdrv_disable_dirty_bitmap(bitmap);
|
||||
+}
|
||||
+
|
||||
+BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
+ BlockDirtyBitmapMergeSourceList *bms,
|
||||
+ HBitmap **backup, Error **errp)
|
||||
+{
|
||||
+ BlockDriverState *bs;
|
||||
+ BdrvDirtyBitmap *dst, *src, *anon;
|
||||
+ BlockDirtyBitmapMergeSourceList *lst;
|
||||
+ Error *local_err = NULL;
|
||||
+
|
||||
+ dst = block_dirty_bitmap_lookup(node, target, &bs, errp);
|
||||
+ if (!dst) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ anon = bdrv_create_dirty_bitmap(bs, bdrv_dirty_bitmap_granularity(dst),
|
||||
+ NULL, errp);
|
||||
+ if (!anon) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (lst = bms; lst; lst = lst->next) {
|
||||
+ switch (lst->value->type) {
|
||||
+ const char *name, *node;
|
||||
+ case QTYPE_QSTRING:
|
||||
+ name = lst->value->u.local;
|
||||
+ src = bdrv_find_dirty_bitmap(bs, name);
|
||||
+ if (!src) {
|
||||
+ error_setg(errp, "Dirty bitmap '%s' not found", name);
|
||||
+ dst = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ break;
|
||||
+ case QTYPE_QDICT:
|
||||
+ node = lst->value->u.external.node;
|
||||
+ name = lst->value->u.external.name;
|
||||
+ src = block_dirty_bitmap_lookup(node, name, NULL, errp);
|
||||
+ if (!src) {
|
||||
+ dst = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ abort();
|
||||
+ }
|
||||
+
|
||||
+ bdrv_merge_dirty_bitmap(anon, src, NULL, &local_err);
|
||||
+ if (local_err) {
|
||||
+ error_propagate(errp, local_err);
|
||||
+ dst = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Merge into dst; dst is unchanged on failure. */
|
||||
+ bdrv_merge_dirty_bitmap(dst, anon, backup, errp);
|
||||
+
|
||||
+ out:
|
||||
+ bdrv_release_dirty_bitmap(anon);
|
||||
+ return dst;
|
||||
+}
|
||||
+
|
||||
+void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
+ BlockDirtyBitmapMergeSourceList *bitmaps,
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
||||
+}
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 3958058..5128c9b 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1250,53 +1250,6 @@ out_aio_context:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * block_dirty_bitmap_lookup:
|
||||
- * Return a dirty bitmap (if present), after validating
|
||||
- * the node reference and bitmap names.
|
||||
- *
|
||||
- * @node: The name of the BDS node to search for bitmaps
|
||||
- * @name: The name of the bitmap to search for
|
||||
- * @pbs: Output pointer for BDS lookup, if desired. Can be NULL.
|
||||
- * @errp: Output pointer for error information. Can be NULL.
|
||||
- *
|
||||
- * @return: A bitmap object on success, or NULL on failure.
|
||||
- */
|
||||
-BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
||||
- const char *name,
|
||||
- BlockDriverState **pbs,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
-
|
||||
- if (!node) {
|
||||
- error_setg(errp, "Node cannot be NULL");
|
||||
- return NULL;
|
||||
- }
|
||||
- if (!name) {
|
||||
- error_setg(errp, "Bitmap name cannot be NULL");
|
||||
- return NULL;
|
||||
- }
|
||||
- bs = bdrv_lookup_bs(node, node, NULL);
|
||||
- if (!bs) {
|
||||
- error_setg(errp, "Node '%s' not found", node);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- bitmap = bdrv_find_dirty_bitmap(bs, name);
|
||||
- if (!bitmap) {
|
||||
- error_setg(errp, "Dirty bitmap '%s' not found", name);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (pbs) {
|
||||
- *pbs = bs;
|
||||
- }
|
||||
-
|
||||
- return bitmap;
|
||||
-}
|
||||
-
|
||||
/* New and old BlockDriverState structs for atomic group operations */
|
||||
|
||||
typedef struct BlkActionState BlkActionState;
|
||||
@@ -2974,243 +2927,6 @@ out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
-void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
- bool has_granularity, uint32_t granularity,
|
||||
- bool has_persistent, bool persistent,
|
||||
- bool has_disabled, bool disabled,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
- AioContext *aio_context;
|
||||
-
|
||||
- if (!name || name[0] == '\0') {
|
||||
- error_setg(errp, "Bitmap name cannot be empty");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- bs = bdrv_lookup_bs(node, node, errp);
|
||||
- if (!bs) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- if (has_granularity) {
|
||||
- if (granularity < 512 || !is_power_of_2(granularity)) {
|
||||
- error_setg(errp, "Granularity must be power of 2 "
|
||||
- "and at least 512");
|
||||
- goto out;
|
||||
- }
|
||||
- } else {
|
||||
- /* Default to cluster size, if available: */
|
||||
- granularity = bdrv_get_default_bitmap_granularity(bs);
|
||||
- }
|
||||
-
|
||||
- if (!has_persistent) {
|
||||
- persistent = false;
|
||||
- }
|
||||
-
|
||||
- if (!has_disabled) {
|
||||
- disabled = false;
|
||||
- }
|
||||
-
|
||||
- if (persistent &&
|
||||
- !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
|
||||
- {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
|
||||
- if (bitmap == NULL) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (disabled) {
|
||||
- bdrv_disable_dirty_bitmap(bitmap);
|
||||
- }
|
||||
-
|
||||
- bdrv_dirty_bitmap_set_persistence(bitmap, persistent);
|
||||
-
|
||||
-out:
|
||||
- aio_context_release(aio_context);
|
||||
-}
|
||||
-
|
||||
-BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
- bool release,
|
||||
- BlockDriverState **bitmap_bs,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
- AioContext *aio_context;
|
||||
-
|
||||
- bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
- if (!bitmap || !bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO,
|
||||
- errp)) {
|
||||
- aio_context_release(aio_context);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (bdrv_dirty_bitmap_get_persistence(bitmap) &&
|
||||
- bdrv_remove_persistent_dirty_bitmap(bs, name, errp) < 0)
|
||||
- {
|
||||
- aio_context_release(aio_context);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (release) {
|
||||
- bdrv_release_dirty_bitmap(bitmap);
|
||||
- }
|
||||
-
|
||||
- if (bitmap_bs) {
|
||||
- *bitmap_bs = bs;
|
||||
- }
|
||||
-
|
||||
- aio_context_release(aio_context);
|
||||
- return release ? NULL : bitmap;
|
||||
-}
|
||||
-
|
||||
-void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
|
||||
- Error **errp)
|
||||
-{
|
||||
- block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
- * Completely clear a bitmap, for the purposes of synchronizing a bitmap
|
||||
- * immediately after a full backup operation.
|
||||
- */
|
||||
-void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
- BlockDriverState *bs;
|
||||
-
|
||||
- bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
- if (!bitmap || !bs) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, errp)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- bdrv_clear_dirty_bitmap(bitmap, NULL);
|
||||
-}
|
||||
-
|
||||
-void qmp_block_dirty_bitmap_enable(const char *node, const char *name,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
-
|
||||
- bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
- if (!bitmap) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- bdrv_enable_dirty_bitmap(bitmap);
|
||||
-}
|
||||
-
|
||||
-void qmp_block_dirty_bitmap_disable(const char *node, const char *name,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *bitmap;
|
||||
-
|
||||
- bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
- if (!bitmap) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- bdrv_disable_dirty_bitmap(bitmap);
|
||||
-}
|
||||
-
|
||||
-BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
- BlockDirtyBitmapMergeSourceList *bms,
|
||||
- HBitmap **backup, Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BdrvDirtyBitmap *dst, *src, *anon;
|
||||
- BlockDirtyBitmapMergeSourceList *lst;
|
||||
- Error *local_err = NULL;
|
||||
-
|
||||
- dst = block_dirty_bitmap_lookup(node, target, &bs, errp);
|
||||
- if (!dst) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- anon = bdrv_create_dirty_bitmap(bs, bdrv_dirty_bitmap_granularity(dst),
|
||||
- NULL, errp);
|
||||
- if (!anon) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- for (lst = bms; lst; lst = lst->next) {
|
||||
- switch (lst->value->type) {
|
||||
- const char *name, *node;
|
||||
- case QTYPE_QSTRING:
|
||||
- name = lst->value->u.local;
|
||||
- src = bdrv_find_dirty_bitmap(bs, name);
|
||||
- if (!src) {
|
||||
- error_setg(errp, "Dirty bitmap '%s' not found", name);
|
||||
- dst = NULL;
|
||||
- goto out;
|
||||
- }
|
||||
- break;
|
||||
- case QTYPE_QDICT:
|
||||
- node = lst->value->u.external.node;
|
||||
- name = lst->value->u.external.name;
|
||||
- src = block_dirty_bitmap_lookup(node, name, NULL, errp);
|
||||
- if (!src) {
|
||||
- dst = NULL;
|
||||
- goto out;
|
||||
- }
|
||||
- break;
|
||||
- default:
|
||||
- abort();
|
||||
- }
|
||||
-
|
||||
- bdrv_merge_dirty_bitmap(anon, src, NULL, &local_err);
|
||||
- if (local_err) {
|
||||
- error_propagate(errp, local_err);
|
||||
- dst = NULL;
|
||||
- goto out;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Merge into dst; dst is unchanged on failure. */
|
||||
- bdrv_merge_dirty_bitmap(dst, anon, backup, errp);
|
||||
-
|
||||
- out:
|
||||
- bdrv_release_dirty_bitmap(anon);
|
||||
- return dst;
|
||||
-}
|
||||
-
|
||||
-void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
|
||||
- BlockDirtyBitmapMergeSourceList *bitmaps,
|
||||
- Error **errp)
|
||||
-{
|
||||
- block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
||||
-}
|
||||
-
|
||||
BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
|
||||
const char *name,
|
||||
Error **errp)
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,62 @@
|
||||
From d56b53cd75c4146eae7a06d1cc30ab823a9bde93 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:41 +0000
|
||||
Subject: [PATCH 08/18] blockdev: fix coding style issues in
|
||||
drive_backup_prepare
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-2-slp@redhat.com>
|
||||
Patchwork-id: 93754
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 1/9] blockdev: fix coding style issues in drive_backup_prepare
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Fix a couple of minor coding style issues in drive_backup_prepare.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 471ded690e19689018535e3f48480507ed073e22)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 8e029e9..553e315 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -3620,7 +3620,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
|
||||
if (!backup->has_format) {
|
||||
backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
- NULL : (char*) bs->drv->format_name;
|
||||
+ NULL : (char *) bs->drv->format_name;
|
||||
}
|
||||
|
||||
/* Early check to avoid creating target */
|
||||
@@ -3630,8 +3630,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
|
||||
flags = bs->open_flags | BDRV_O_RDWR;
|
||||
|
||||
- /* See if we have a backing HD we can use to create our new image
|
||||
- * on top of. */
|
||||
+ /*
|
||||
+ * See if we have a backing HD we can use to create our new image
|
||||
+ * on top of.
|
||||
+ */
|
||||
if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
source = backing_bs(bs);
|
||||
if (!source) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,204 @@
|
||||
From da4ee4c0d56200042cb86f8ccd2777009bd82df3 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:44 +0000
|
||||
Subject: [PATCH 11/18] blockdev: honor bdrv_try_set_aio_context() context
|
||||
requirements
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-5-slp@redhat.com>
|
||||
Patchwork-id: 93758
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 4/9] blockdev: honor bdrv_try_set_aio_context() context requirements
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
bdrv_try_set_aio_context() requires that the old context is held, and
|
||||
the new context is not held. Fix all the occurrences where it's not
|
||||
done this way.
|
||||
|
||||
Suggested-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 3ea67e08832775a28d0bd2795f01bc77e7ea1512)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 60 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 152a0f7..1dacbc2 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1535,6 +1535,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
DO_UPCAST(ExternalSnapshotState, common, common);
|
||||
TransactionAction *action = common->action;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
int ret;
|
||||
|
||||
/* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar
|
||||
@@ -1675,7 +1676,16 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(state->new_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
ret = bdrv_try_set_aio_context(state->new_bs, aio_context, errp);
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -1775,11 +1785,13 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
BlockDriverState *target_bs;
|
||||
BlockDriverState *source = NULL;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
QDict *options;
|
||||
Error *local_err = NULL;
|
||||
int flags;
|
||||
int64_t size;
|
||||
bool set_backing_hd = false;
|
||||
+ int ret;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
|
||||
backup = common->action->u.drive_backup.data;
|
||||
@@ -1868,6 +1880,21 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+ if (ret < 0) {
|
||||
+ bdrv_unref(target_bs);
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (set_backing_hd) {
|
||||
bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
if (local_err) {
|
||||
@@ -1947,6 +1974,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
+ int ret;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
|
||||
backup = common->action->u.blockdev_backup.data;
|
||||
@@ -1961,7 +1990,18 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+ if (ret < 0) {
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
aio_context_acquire(aio_context);
|
||||
state->bs = bs;
|
||||
|
||||
@@ -3562,7 +3602,6 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
BlockJob *job = NULL;
|
||||
BdrvDirtyBitmap *bmap = NULL;
|
||||
int job_flags = JOB_DEFAULT;
|
||||
- int ret;
|
||||
|
||||
if (!backup->has_speed) {
|
||||
backup->speed = 0;
|
||||
@@ -3586,11 +3625,6 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
backup->compress = false;
|
||||
}
|
||||
|
||||
- ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
- if (ret < 0) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
if ((backup->sync == MIRROR_SYNC_MODE_BITMAP) ||
|
||||
(backup->sync == MIRROR_SYNC_MODE_INCREMENTAL)) {
|
||||
/* done before desugaring 'incremental' to print the right message */
|
||||
@@ -3825,6 +3859,7 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *source, *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
BlockMirrorBackingMode backing_mode;
|
||||
Error *local_err = NULL;
|
||||
QDict *options = NULL;
|
||||
@@ -3937,12 +3972,22 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
||||
(arg->mode == NEW_IMAGE_MODE_EXISTING ||
|
||||
!bdrv_has_zero_init(target_bs)));
|
||||
|
||||
+
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
if (ret < 0) {
|
||||
bdrv_unref(target_bs);
|
||||
- goto out;
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
|
||||
arg->has_replaces, arg->replaces, arg->sync,
|
||||
backing_mode, zero_target,
|
||||
@@ -3984,6 +4029,7 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;
|
||||
Error *local_err = NULL;
|
||||
bool zero_target;
|
||||
@@ -4001,10 +4047,16 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||
|
||||
zero_target = (sync == MIRROR_SYNC_MODE_FULL);
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
|
||||
ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,144 @@
|
||||
From 959955217f745f1ee6cbea97314efe69f2d7dc08 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:43 +0000
|
||||
Subject: [PATCH 10/18] blockdev: unify qmp_blockdev_backup and blockdev-backup
|
||||
transaction paths
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-4-slp@redhat.com>
|
||||
Patchwork-id: 93756
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 3/9] blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly
|
||||
different path than when it's issued from a transaction. In the code,
|
||||
this is manifested as some redundancy between do_blockdev_backup() and
|
||||
blockdev_backup_prepare().
|
||||
|
||||
This change unifies both paths, merging do_blockdev_backup() and
|
||||
blockdev_backup_prepare(), and changing qmp_blockdev_backup() to
|
||||
create a transaction instead of calling do_backup_common() direcly.
|
||||
|
||||
As a side-effect, now qmp_blockdev_backup() is executed inside a
|
||||
drained section, as it happens when creating a blockdev-backup
|
||||
transaction. This change is visible from the user's perspective, as
|
||||
the job gets paused and immediately resumed before starting the actual
|
||||
work.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 5b7bfe515ecbd584b40ff6e41d2fd8b37c7d5139)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 60 +++++++++++++-----------------------------------------------
|
||||
1 file changed, 13 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 5e85fc0..152a0f7 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1940,16 +1940,13 @@ typedef struct BlockdevBackupState {
|
||||
BlockJob *job;
|
||||
} BlockdevBackupState;
|
||||
|
||||
-static BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
|
||||
- Error **errp);
|
||||
-
|
||||
static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
{
|
||||
BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);
|
||||
BlockdevBackup *backup;
|
||||
- BlockDriverState *bs, *target;
|
||||
+ BlockDriverState *bs;
|
||||
+ BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
- Error *local_err = NULL;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
|
||||
backup = common->action->u.blockdev_backup.data;
|
||||
@@ -1959,8 +1956,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
- target = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
- if (!target) {
|
||||
+ target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
+ if (!target_bs) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1971,13 +1968,10 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
/* Paired with .clean() */
|
||||
bdrv_drained_begin(state->bs);
|
||||
|
||||
- state->job = do_blockdev_backup(backup, common->block_job_txn, &local_err);
|
||||
- if (local_err) {
|
||||
- error_propagate(errp, local_err);
|
||||
- goto out;
|
||||
- }
|
||||
+ state->job = do_backup_common(qapi_BlockdevBackup_base(backup),
|
||||
+ bs, target_bs, aio_context,
|
||||
+ common->block_job_txn, errp);
|
||||
|
||||
-out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
@@ -3695,41 +3689,13 @@ XDbgBlockGraph *qmp_x_debug_query_block_graph(Error **errp)
|
||||
return bdrv_get_xdbg_block_graph(errp);
|
||||
}
|
||||
|
||||
-BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
|
||||
- Error **errp)
|
||||
+void qmp_blockdev_backup(BlockdevBackup *backup, Error **errp)
|
||||
{
|
||||
- BlockDriverState *bs;
|
||||
- BlockDriverState *target_bs;
|
||||
- AioContext *aio_context;
|
||||
- BlockJob *job;
|
||||
-
|
||||
- bs = bdrv_lookup_bs(backup->device, backup->device, errp);
|
||||
- if (!bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
- if (!target_bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- job = do_backup_common(qapi_BlockdevBackup_base(backup),
|
||||
- bs, target_bs, aio_context, txn, errp);
|
||||
-
|
||||
- aio_context_release(aio_context);
|
||||
- return job;
|
||||
-}
|
||||
-
|
||||
-void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp)
|
||||
-{
|
||||
- BlockJob *job;
|
||||
- job = do_blockdev_backup(arg, NULL, errp);
|
||||
- if (job) {
|
||||
- job_start(&job->job);
|
||||
- }
|
||||
+ TransactionAction action = {
|
||||
+ .type = TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP,
|
||||
+ .u.blockdev_backup.data = backup,
|
||||
+ };
|
||||
+ blockdev_do_action(&action, errp);
|
||||
}
|
||||
|
||||
/* Parameter check and block job starting for drive mirroring.
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,419 @@
|
||||
From 4a03ab2a6cc4974d8d43240d1297b09160818af3 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:42 +0000
|
||||
Subject: [PATCH 09/18] blockdev: unify qmp_drive_backup and drive-backup
|
||||
transaction paths
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-3-slp@redhat.com>
|
||||
Patchwork-id: 93755
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 2/9] blockdev: unify qmp_drive_backup and drive-backup transaction paths
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Issuing a drive-backup from qmp_drive_backup takes a slightly
|
||||
different path than when it's issued from a transaction. In the code,
|
||||
this is manifested as some redundancy between do_drive_backup() and
|
||||
drive_backup_prepare().
|
||||
|
||||
This change unifies both paths, merging do_drive_backup() and
|
||||
drive_backup_prepare(), and changing qmp_drive_backup() to create a
|
||||
transaction instead of calling do_backup_common() direcly.
|
||||
|
||||
As a side-effect, now qmp_drive_backup() is executed inside a drained
|
||||
section, as it happens when creating a drive-backup transaction. This
|
||||
change is visible from the user's perspective, as the job gets paused
|
||||
and immediately resumed before starting the actual work.
|
||||
|
||||
Also fix tests 141, 185 and 219 to cope with the extra
|
||||
JOB_STATUS_CHANGE lines.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 2288ccfac96281c316db942d10e3f921c1373064)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 224 ++++++++++++++++++++-------------------------
|
||||
tests/qemu-iotests/141.out | 2 +
|
||||
tests/qemu-iotests/185.out | 2 +
|
||||
tests/qemu-iotests/219 | 7 +-
|
||||
tests/qemu-iotests/219.out | 8 ++
|
||||
5 files changed, 117 insertions(+), 126 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 553e315..5e85fc0 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1761,39 +1761,128 @@ typedef struct DriveBackupState {
|
||||
BlockJob *job;
|
||||
} DriveBackupState;
|
||||
|
||||
-static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
- Error **errp);
|
||||
+static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
+ BlockDriverState *bs,
|
||||
+ BlockDriverState *target_bs,
|
||||
+ AioContext *aio_context,
|
||||
+ JobTxn *txn, Error **errp);
|
||||
|
||||
static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
{
|
||||
DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
|
||||
- BlockDriverState *bs;
|
||||
DriveBackup *backup;
|
||||
+ BlockDriverState *bs;
|
||||
+ BlockDriverState *target_bs;
|
||||
+ BlockDriverState *source = NULL;
|
||||
AioContext *aio_context;
|
||||
+ QDict *options;
|
||||
Error *local_err = NULL;
|
||||
+ int flags;
|
||||
+ int64_t size;
|
||||
+ bool set_backing_hd = false;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
|
||||
backup = common->action->u.drive_backup.data;
|
||||
|
||||
+ if (!backup->has_mode) {
|
||||
+ backup->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
|
||||
+ }
|
||||
+
|
||||
bs = bdrv_lookup_bs(backup->device, backup->device, errp);
|
||||
if (!bs) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (!bs->drv) {
|
||||
+ error_setg(errp, "Device has no medium");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
/* Paired with .clean() */
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
- state->bs = bs;
|
||||
+ if (!backup->has_format) {
|
||||
+ backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
+ NULL : (char *) bs->drv->format_name;
|
||||
+ }
|
||||
+
|
||||
+ /* Early check to avoid creating target */
|
||||
+ if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ flags = bs->open_flags | BDRV_O_RDWR;
|
||||
+
|
||||
+ /*
|
||||
+ * See if we have a backing HD we can use to create our new image
|
||||
+ * on top of.
|
||||
+ */
|
||||
+ if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
+ source = backing_bs(bs);
|
||||
+ if (!source) {
|
||||
+ backup->sync = MIRROR_SYNC_MODE_FULL;
|
||||
+ }
|
||||
+ }
|
||||
+ if (backup->sync == MIRROR_SYNC_MODE_NONE) {
|
||||
+ source = bs;
|
||||
+ flags |= BDRV_O_NO_BACKING;
|
||||
+ set_backing_hd = true;
|
||||
+ }
|
||||
+
|
||||
+ size = bdrv_getlength(bs);
|
||||
+ if (size < 0) {
|
||||
+ error_setg_errno(errp, -size, "bdrv_getlength failed");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (backup->mode != NEW_IMAGE_MODE_EXISTING) {
|
||||
+ assert(backup->format);
|
||||
+ if (source) {
|
||||
+ bdrv_refresh_filename(source);
|
||||
+ bdrv_img_create(backup->target, backup->format, source->filename,
|
||||
+ source->drv->format_name, NULL,
|
||||
+ size, flags, false, &local_err);
|
||||
+ } else {
|
||||
+ bdrv_img_create(backup->target, backup->format, NULL, NULL, NULL,
|
||||
+ size, flags, false, &local_err);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- state->job = do_drive_backup(backup, common->block_job_txn, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ options = qdict_new();
|
||||
+ qdict_put_str(options, "discard", "unmap");
|
||||
+ qdict_put_str(options, "detect-zeroes", "unmap");
|
||||
+ if (backup->format) {
|
||||
+ qdict_put_str(options, "driver", backup->format);
|
||||
+ }
|
||||
+
|
||||
+ target_bs = bdrv_open(backup->target, NULL, options, flags, errp);
|
||||
+ if (!target_bs) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (set_backing_hd) {
|
||||
+ bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
+ if (local_err) {
|
||||
+ goto unref;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ state->bs = bs;
|
||||
+
|
||||
+ state->job = do_backup_common(qapi_DriveBackup_base(backup),
|
||||
+ bs, target_bs, aio_context,
|
||||
+ common->block_job_txn, errp);
|
||||
+
|
||||
+unref:
|
||||
+ bdrv_unref(target_bs);
|
||||
out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
@@ -3587,126 +3676,13 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
return job;
|
||||
}
|
||||
|
||||
-static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BlockDriverState *target_bs;
|
||||
- BlockDriverState *source = NULL;
|
||||
- BlockJob *job = NULL;
|
||||
- AioContext *aio_context;
|
||||
- QDict *options;
|
||||
- Error *local_err = NULL;
|
||||
- int flags;
|
||||
- int64_t size;
|
||||
- bool set_backing_hd = false;
|
||||
-
|
||||
- if (!backup->has_mode) {
|
||||
- backup->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
|
||||
- }
|
||||
-
|
||||
- bs = bdrv_lookup_bs(backup->device, backup->device, errp);
|
||||
- if (!bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (!bs->drv) {
|
||||
- error_setg(errp, "Device has no medium");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- if (!backup->has_format) {
|
||||
- backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
- NULL : (char *) bs->drv->format_name;
|
||||
- }
|
||||
-
|
||||
- /* Early check to avoid creating target */
|
||||
- if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- flags = bs->open_flags | BDRV_O_RDWR;
|
||||
-
|
||||
- /*
|
||||
- * See if we have a backing HD we can use to create our new image
|
||||
- * on top of.
|
||||
- */
|
||||
- if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
- source = backing_bs(bs);
|
||||
- if (!source) {
|
||||
- backup->sync = MIRROR_SYNC_MODE_FULL;
|
||||
- }
|
||||
- }
|
||||
- if (backup->sync == MIRROR_SYNC_MODE_NONE) {
|
||||
- source = bs;
|
||||
- flags |= BDRV_O_NO_BACKING;
|
||||
- set_backing_hd = true;
|
||||
- }
|
||||
-
|
||||
- size = bdrv_getlength(bs);
|
||||
- if (size < 0) {
|
||||
- error_setg_errno(errp, -size, "bdrv_getlength failed");
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (backup->mode != NEW_IMAGE_MODE_EXISTING) {
|
||||
- assert(backup->format);
|
||||
- if (source) {
|
||||
- bdrv_refresh_filename(source);
|
||||
- bdrv_img_create(backup->target, backup->format, source->filename,
|
||||
- source->drv->format_name, NULL,
|
||||
- size, flags, false, &local_err);
|
||||
- } else {
|
||||
- bdrv_img_create(backup->target, backup->format, NULL, NULL, NULL,
|
||||
- size, flags, false, &local_err);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (local_err) {
|
||||
- error_propagate(errp, local_err);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- options = qdict_new();
|
||||
- qdict_put_str(options, "discard", "unmap");
|
||||
- qdict_put_str(options, "detect-zeroes", "unmap");
|
||||
- if (backup->format) {
|
||||
- qdict_put_str(options, "driver", backup->format);
|
||||
- }
|
||||
-
|
||||
- target_bs = bdrv_open(backup->target, NULL, options, flags, errp);
|
||||
- if (!target_bs) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (set_backing_hd) {
|
||||
- bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
- if (local_err) {
|
||||
- goto unref;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- job = do_backup_common(qapi_DriveBackup_base(backup),
|
||||
- bs, target_bs, aio_context, txn, errp);
|
||||
-
|
||||
-unref:
|
||||
- bdrv_unref(target_bs);
|
||||
-out:
|
||||
- aio_context_release(aio_context);
|
||||
- return job;
|
||||
-}
|
||||
-
|
||||
-void qmp_drive_backup(DriveBackup *arg, Error **errp)
|
||||
+void qmp_drive_backup(DriveBackup *backup, Error **errp)
|
||||
{
|
||||
-
|
||||
- BlockJob *job;
|
||||
- job = do_drive_backup(arg, NULL, errp);
|
||||
- if (job) {
|
||||
- job_start(&job->job);
|
||||
- }
|
||||
+ TransactionAction action = {
|
||||
+ .type = TRANSACTION_ACTION_KIND_DRIVE_BACKUP,
|
||||
+ .u.drive_backup.data = backup,
|
||||
+ };
|
||||
+ blockdev_do_action(&action, errp);
|
||||
}
|
||||
|
||||
BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
|
||||
diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out
|
||||
index 3645675..263b680 100644
|
||||
--- a/tests/qemu-iotests/141.out
|
||||
+++ b/tests/qemu-iotests/141.out
|
||||
@@ -13,6 +13,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/m.
|
||||
Formatting 'TEST_DIR/o.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "job0"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
|
||||
{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}}
|
||||
{"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: node is used as backing hd of 'NODE_NAME'"}}
|
||||
{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}}
|
||||
diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out
|
||||
index 8379ac5..9a3b657 100644
|
||||
--- a/tests/qemu-iotests/185.out
|
||||
+++ b/tests/qemu-iotests/185.out
|
||||
@@ -65,6 +65,8 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
|
||||
Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "disk"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
|
||||
{"return": {}}
|
||||
{ 'execute': 'quit' }
|
||||
{"return": {}}
|
||||
diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219
|
||||
index e0c5166..655f54d 100755
|
||||
--- a/tests/qemu-iotests/219
|
||||
+++ b/tests/qemu-iotests/219
|
||||
@@ -63,7 +63,7 @@ def test_pause_resume(vm):
|
||||
# logged immediately
|
||||
iotests.log(vm.qmp('query-jobs'))
|
||||
|
||||
-def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
||||
+def test_job_lifecycle(vm, job, job_args, has_ready=False, is_mirror=False):
|
||||
global img_size
|
||||
|
||||
iotests.log('')
|
||||
@@ -135,6 +135,9 @@ def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
||||
iotests.log('Waiting for PENDING state...')
|
||||
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
+ if is_mirror:
|
||||
+ iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
+ iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
|
||||
if not job_args.get('auto-finalize', True):
|
||||
# PENDING state:
|
||||
@@ -218,7 +221,7 @@ with iotests.FilePath('disk.img') as disk_path, \
|
||||
|
||||
for auto_finalize in [True, False]:
|
||||
for auto_dismiss in [True, False]:
|
||||
- test_job_lifecycle(vm, 'drive-backup', job_args={
|
||||
+ test_job_lifecycle(vm, 'drive-backup', is_mirror=True, job_args={
|
||||
'device': 'drive0-node',
|
||||
'target': copy_path,
|
||||
'sync': 'full',
|
||||
diff --git a/tests/qemu-iotests/219.out b/tests/qemu-iotests/219.out
|
||||
index 8ebd3fe..0ea5d0b 100644
|
||||
--- a/tests/qemu-iotests/219.out
|
||||
+++ b/tests/qemu-iotests/219.out
|
||||
@@ -135,6 +135,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "concluded"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
@@ -186,6 +188,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "concluded"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
@@ -245,6 +249,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"return": [{"current-progress": 4194304, "id": "job0", "status": "pending", "total-progress": 4194304, "type": "backup"}]}
|
||||
@@ -304,6 +310,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"return": [{"current-progress": 4194304, "id": "job0", "status": "pending", "total-progress": 4194304, "type": "backup"}]}
|
||||
--
|
||||
1.8.3.1
|
||||
|
137
SOURCES/kvm-build-rename-CONFIG_LIBCAP-to-CONFIG_LIBCAP_NG.patch
Normal file
137
SOURCES/kvm-build-rename-CONFIG_LIBCAP-to-CONFIG_LIBCAP_NG.patch
Normal file
@ -0,0 +1,137 @@
|
||||
From f756c1c4590a37c533ec0429644a7034ba35dada Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Mon, 27 Jan 2020 19:00:38 +0100
|
||||
Subject: [PATCH 007/116] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20200127190227.40942-4-dgilbert@redhat.com>
|
||||
Patchwork-id: 93459
|
||||
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 003/112] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG
|
||||
Bugzilla: 1694164
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
Since we are actually testing for the newer capng library, rename the
|
||||
symbol to match.
|
||||
|
||||
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit a358bca24026a377e0804e137a4499e4e041918d)
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
configure | 2 +-
|
||||
qemu-bridge-helper.c | 6 +++---
|
||||
scsi/qemu-pr-helper.c | 12 ++++++------
|
||||
3 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 16564f8..7831618 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -6760,7 +6760,7 @@ if test "$l2tpv3" = "yes" ; then
|
||||
echo "CONFIG_L2TPV3=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$cap_ng" = "yes" ; then
|
||||
- echo "CONFIG_LIBCAP=y" >> $config_host_mak
|
||||
+ echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
|
||||
fi
|
||||
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
|
||||
for drv in $audio_drv_list; do
|
||||
diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
|
||||
index 3d50ec0..88b2674 100644
|
||||
--- a/qemu-bridge-helper.c
|
||||
+++ b/qemu-bridge-helper.c
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#include "net/tap-linux.h"
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
#include <cap-ng.h>
|
||||
#endif
|
||||
|
||||
@@ -207,7 +207,7 @@ static int send_fd(int c, int fd)
|
||||
return sendmsg(c, &msg, 0);
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
static int drop_privileges(void)
|
||||
{
|
||||
/* clear all capabilities */
|
||||
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
|
||||
int access_allowed, access_denied;
|
||||
int ret = EXIT_SUCCESS;
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
/* if we're run from an suid binary, immediately drop privileges preserving
|
||||
* cap_net_admin */
|
||||
if (geteuid() == 0 && getuid() != geteuid()) {
|
||||
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
|
||||
index debb18f..0659cee 100644
|
||||
--- a/scsi/qemu-pr-helper.c
|
||||
+++ b/scsi/qemu-pr-helper.c
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <linux/dm-ioctl.h>
|
||||
#include <scsi/sg.h>
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
#include <cap-ng.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
@@ -70,7 +70,7 @@ static int num_active_sockets = 1;
|
||||
static int noisy;
|
||||
static int verbose;
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
static int uid = -1;
|
||||
static int gid = -1;
|
||||
#endif
|
||||
@@ -97,7 +97,7 @@ static void usage(const char *name)
|
||||
" (default '%s')\n"
|
||||
" -T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
|
||||
" specify tracing options\n"
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
" -u, --user=USER user to drop privileges to\n"
|
||||
" -g, --group=GROUP group to drop privileges to\n"
|
||||
#endif
|
||||
@@ -827,7 +827,7 @@ static void close_server_socket(void)
|
||||
num_active_sockets--;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
static int drop_privileges(void)
|
||||
{
|
||||
/* clear all capabilities */
|
||||
@@ -920,7 +920,7 @@ int main(int argc, char **argv)
|
||||
pidfile = g_strdup(optarg);
|
||||
pidfile_specified = true;
|
||||
break;
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
case 'u': {
|
||||
unsigned long res;
|
||||
struct passwd *userinfo = getpwnam(optarg);
|
||||
@@ -1056,7 +1056,7 @@ int main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_LIBCAP
|
||||
+#ifdef CONFIG_LIBCAP_NG
|
||||
if (drop_privileges() < 0) {
|
||||
error_report("Failed to drop privileges: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
--
|
||||
1.8.3.1
|
||||
|
2463
SOURCES/kvm-build-sys-do-not-make-qemu-ga-link-with-pixman.patch
Normal file
2463
SOURCES/kvm-build-sys-do-not-make-qemu-ga-link-with-pixman.patch
Normal file
File diff suppressed because it is too large
Load Diff
50
SOURCES/kvm-compat-disable-edid-for-virtio-gpu-ccw.patch
Normal file
50
SOURCES/kvm-compat-disable-edid-for-virtio-gpu-ccw.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 8f9f4d8d52ebb7878543ac0b84cc372477041e33 Mon Sep 17 00:00:00 2001
|
||||
From: Cornelia Huck <cohuck@redhat.com>
|
||||
Date: Wed, 1 Apr 2020 16:13:50 -0400
|
||||
Subject: [PATCH 2/2] compat: disable 'edid' for virtio-gpu-ccw
|
||||
|
||||
RH-Author: Cornelia Huck <cohuck@redhat.com>
|
||||
Message-id: <20200401161350.20462-1-cohuck@redhat.com>
|
||||
Patchwork-id: 94523
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2] compat: disable 'edid' for virtio-gpu-ccw
|
||||
Bugzilla: 1816793
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
||||
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1816793
|
||||
Branch: rhel-av-8.2.1
|
||||
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=27629804
|
||||
Upstream: downstream only
|
||||
Tested: verified that for a virtio-gpu-ccw device 'edid' is false with
|
||||
a s390-ccw-virtio-rhel7.6.0 machine and true with a
|
||||
s390-ccw-virtio-rhel8.2.0 (s390x does not have the 8.0 or 8.1
|
||||
machine types)
|
||||
|
||||
hw_compat_rhel_8_0 copied the original upstream version of
|
||||
disabling 'edid' for virtio-gpu-pci only (not following later
|
||||
changes). Switch it to virtio-gpu-device, following upstream
|
||||
02501fc39381 ("compat: disable edid on correct virtio-gpu device").
|
||||
|
||||
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
|
||||
---
|
||||
hw/core/machine.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
||||
index e0e0eec8bf..5a025d1af2 100644
|
||||
--- a/hw/core/machine.c
|
||||
+++ b/hw/core/machine.c
|
||||
@@ -72,7 +72,7 @@ GlobalProperty hw_compat_rhel_8_0[] = {
|
||||
/* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
{ "virtio-vga", "edid", "false" },
|
||||
/* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
- { "virtio-gpu-pci", "edid", "false" },
|
||||
+ { "virtio-gpu-device", "edid", "false" },
|
||||
/* hw_compat_rhel_8_0 from hw_compat_4_0 */
|
||||
{ "virtio-device", "use-started", "false" },
|
||||
/* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */
|
||||
--
|
||||
2.18.2
|
||||
|
39
SOURCES/kvm-config-enable-VFIO_CCW.patch
Normal file
39
SOURCES/kvm-config-enable-VFIO_CCW.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From f3e80771c921560a58c30020781fa01a54be8eb0 Mon Sep 17 00:00:00 2001
|
||||
From: Cornelia Huck <cohuck@redhat.com>
|
||||
Date: Tue, 23 Jun 2020 09:25:43 -0400
|
||||
Subject: [PATCH 09/12] config: enable VFIO_CCW
|
||||
|
||||
RH-Author: Cornelia Huck <cohuck@redhat.com>
|
||||
Message-id: <20200623092543.358315-10-cohuck@redhat.com>
|
||||
Patchwork-id: 97699
|
||||
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 9/9] config: enable VFIO_CCW
|
||||
Bugzilla: 1660916
|
||||
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
|
||||
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
||||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||||
|
||||
Enable vfio-ccw in RHEL builds.
|
||||
|
||||
Upstream: n/a
|
||||
|
||||
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
default-configs/s390x-rh-devices.mak | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/default-configs/s390x-rh-devices.mak b/default-configs/s390x-rh-devices.mak
|
||||
index c3c73fe752..08a15f3e01 100644
|
||||
--- a/default-configs/s390x-rh-devices.mak
|
||||
+++ b/default-configs/s390x-rh-devices.mak
|
||||
@@ -9,6 +9,7 @@ CONFIG_SCSI=y
|
||||
CONFIG_TERMINAL3270=y
|
||||
CONFIG_VFIO=y
|
||||
CONFIG_VFIO_AP=y
|
||||
+CONFIG_VFIO_CCW=y
|
||||
CONFIG_VFIO_PCI=y
|
||||
CONFIG_VHOST_USER=y
|
||||
CONFIG_VIRTIO_CCW=y
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,134 @@
|
||||
From 548de8acbf0137b6e49a14b63682badfff037d23 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Mon, 27 Jan 2020 19:01:44 +0100
|
||||
Subject: [PATCH 073/116] contrib/libvhost-user: Protect slave fd with mutex
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20200127190227.40942-70-dgilbert@redhat.com>
|
||||
Patchwork-id: 93523
|
||||
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 069/112] contrib/libvhost-user: Protect slave fd with mutex
|
||||
Bugzilla: 1694164
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
|
||||
In future patches we'll be performing commands on the slave-fd driven
|
||||
by commands on queues, since those queues will be driven by individual
|
||||
threads we need to make sure they don't attempt to use the slave-fd
|
||||
for multiple commands in parallel.
|
||||
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
(cherry picked from commit c25c02b9e6a196be87a818f459c426556b24770d)
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++++++++++----
|
||||
contrib/libvhost-user/libvhost-user.h | 3 +++
|
||||
2 files changed, 23 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
|
||||
index ec27b78..63e4106 100644
|
||||
--- a/contrib/libvhost-user/libvhost-user.c
|
||||
+++ b/contrib/libvhost-user/libvhost-user.c
|
||||
@@ -392,26 +392,37 @@ vu_send_reply(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)
|
||||
return vu_message_write(dev, conn_fd, vmsg);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Processes a reply on the slave channel.
|
||||
+ * Entered with slave_mutex held and releases it before exit.
|
||||
+ * Returns true on success.
|
||||
+ */
|
||||
static bool
|
||||
vu_process_message_reply(VuDev *dev, const VhostUserMsg *vmsg)
|
||||
{
|
||||
VhostUserMsg msg_reply;
|
||||
+ bool result = false;
|
||||
|
||||
if ((vmsg->flags & VHOST_USER_NEED_REPLY_MASK) == 0) {
|
||||
- return true;
|
||||
+ result = true;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (!vu_message_read(dev, dev->slave_fd, &msg_reply)) {
|
||||
- return false;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (msg_reply.request != vmsg->request) {
|
||||
DPRINT("Received unexpected msg type. Expected %d received %d",
|
||||
vmsg->request, msg_reply.request);
|
||||
- return false;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
- return msg_reply.payload.u64 == 0;
|
||||
+ result = msg_reply.payload.u64 == 0;
|
||||
+
|
||||
+out:
|
||||
+ pthread_mutex_unlock(&dev->slave_mutex);
|
||||
+ return result;
|
||||
}
|
||||
|
||||
/* Kick the log_call_fd if required. */
|
||||
@@ -1105,10 +1116,13 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
|
||||
return false;
|
||||
}
|
||||
|
||||
+ pthread_mutex_lock(&dev->slave_mutex);
|
||||
if (!vu_message_write(dev, dev->slave_fd, &vmsg)) {
|
||||
+ pthread_mutex_unlock(&dev->slave_mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
+ /* Also unlocks the slave_mutex */
|
||||
return vu_process_message_reply(dev, &vmsg);
|
||||
}
|
||||
|
||||
@@ -1628,6 +1642,7 @@ vu_deinit(VuDev *dev)
|
||||
close(dev->slave_fd);
|
||||
dev->slave_fd = -1;
|
||||
}
|
||||
+ pthread_mutex_destroy(&dev->slave_mutex);
|
||||
|
||||
if (dev->sock != -1) {
|
||||
close(dev->sock);
|
||||
@@ -1663,6 +1678,7 @@ vu_init(VuDev *dev,
|
||||
dev->remove_watch = remove_watch;
|
||||
dev->iface = iface;
|
||||
dev->log_call_fd = -1;
|
||||
+ pthread_mutex_init(&dev->slave_mutex, NULL);
|
||||
dev->slave_fd = -1;
|
||||
dev->max_queues = max_queues;
|
||||
|
||||
diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/libvhost-user.h
|
||||
index 46b6007..1844b6f 100644
|
||||
--- a/contrib/libvhost-user/libvhost-user.h
|
||||
+++ b/contrib/libvhost-user/libvhost-user.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/poll.h>
|
||||
#include <linux/vhost.h>
|
||||
+#include <pthread.h>
|
||||
#include "standard-headers/linux/virtio_ring.h"
|
||||
|
||||
/* Based on qemu/hw/virtio/vhost-user.c */
|
||||
@@ -355,6 +356,8 @@ struct VuDev {
|
||||
VuVirtq *vq;
|
||||
VuDevInflightInfo inflight_info;
|
||||
int log_call_fd;
|
||||
+ /* Must be held while using slave_fd */
|
||||
+ pthread_mutex_t slave_mutex;
|
||||
int slave_fd;
|
||||
uint64_t log_size;
|
||||
uint8_t *log_table;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 043decff5812c1f46ed44dd0f82099e3b8bb6a28 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Sun, 31 May 2020 16:40:35 +0100
|
||||
Subject: [PATCH 7/7] crypto.c: cleanup created file when
|
||||
block_crypto_co_create_opts_luks fails
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200531164035.34188-4-mlevitsk@redhat.com>
|
||||
Patchwork-id: 97060
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 3/3] crypto.c: cleanup created file when block_crypto_co_create_opts_luks fails
|
||||
Bugzilla: 1827630
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
|
||||
From: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
|
||||
When using a non-UTF8 secret to create a volume using qemu-img, the
|
||||
following error happens:
|
||||
|
||||
$ qemu-img create -f luks --object secret,id=vol_1_encrypt0,file=vol_resize_pool.vol_1.secret.qzVQrI -o key-secret=vol_1_encrypt0 /var/tmp/pool_target/vol_1 10240K
|
||||
|
||||
Formatting '/var/tmp/pool_target/vol_1', fmt=luks size=10485760 key-secret=vol_1_encrypt0
|
||||
qemu-img: /var/tmp/pool_target/vol_1: Data from secret vol_1_encrypt0 is not valid UTF-8
|
||||
|
||||
However, the created file '/var/tmp/pool_target/vol_1' is left behind in the
|
||||
file system after the failure. This behavior can be observed when creating
|
||||
the volume using Libvirt, via 'virsh vol-create', and then getting "volume
|
||||
target path already exist" errors when trying to re-create the volume.
|
||||
|
||||
The volume file is created inside block_crypto_co_create_opts_luks(), in
|
||||
block/crypto.c. If the bdrv_create_file() call is successful but any
|
||||
succeeding step fails*, the existing 'fail' label does not take into
|
||||
account the created file, leaving it behind.
|
||||
|
||||
This patch changes block_crypto_co_create_opts_luks() to delete
|
||||
'filename' in case of failure. A failure in this point means that
|
||||
the volume is now truncated/corrupted, so even if 'filename' was an
|
||||
existing volume before calling qemu-img, it is now unusable. Deleting
|
||||
the file it is not much worse than leaving it in the filesystem in
|
||||
this scenario, and we don't have to deal with checking the file
|
||||
pre-existence in the code.
|
||||
|
||||
* in our case, block_crypto_co_create_generic calls qcrypto_block_create,
|
||||
which calls qcrypto_block_luks_create, and this function fails when
|
||||
calling qcrypto_secret_lookup_as_utf8.
|
||||
|
||||
Reported-by: Srikanth Aithal <bssrikanth@in.ibm.com>
|
||||
Suggested-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Message-Id: <20200130213907.2830642-4-danielhb413@gmail.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 1bba30da24e1124ceeb0693c81382a0d77e20ca5)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/crypto.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/block/crypto.c b/block/crypto.c
|
||||
index 970d463..5e3b15c 100644
|
||||
--- a/block/crypto.c
|
||||
+++ b/block/crypto.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
+#include "qemu/cutils.h"
|
||||
#include "crypto.h"
|
||||
|
||||
typedef struct BlockCrypto BlockCrypto;
|
||||
@@ -597,6 +598,23 @@ static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv,
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
+ /*
|
||||
+ * If an error occurred, delete 'filename'. Even if the file existed
|
||||
+ * beforehand, it has been truncated and corrupted in the process.
|
||||
+ */
|
||||
+ if (ret && bs) {
|
||||
+ Error *local_delete_err = NULL;
|
||||
+ int r_del = bdrv_co_delete_file(bs, &local_delete_err);
|
||||
+ /*
|
||||
+ * ENOTSUP will happen if the block driver doesn't support
|
||||
+ * the 'bdrv_co_delete_file' interface. This is a predictable
|
||||
+ * scenario and shouldn't be reported back to the user.
|
||||
+ */
|
||||
+ if ((r_del < 0) && (r_del != -ENOTSUP)) {
|
||||
+ error_report_err(local_delete_err);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
bdrv_unref(bs);
|
||||
qapi_free_QCryptoBlockCreateOptions(create_opts);
|
||||
qobject_unref(cryptoopts);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From f01178897c8f5ff98692a22059dd65e35677eaa3 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jones <drjones@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 17:33:58 +0000
|
||||
Subject: [PATCH 18/18] docs/arm-cpu-features: Make kvm-no-adjvtime comment
|
||||
clearer
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: <20200210173358.16896-3-drjones@redhat.com>
|
||||
Patchwork-id: 93772
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/2] docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
|
||||
Bugzilla: 1801320
|
||||
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
|
||||
RH-Acked-by: Gavin Shan <gshan@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1801320
|
||||
|
||||
Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Date: Fri, 07 Feb 2020 14:04:28 +0000
|
||||
|
||||
docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
|
||||
|
||||
The bold text sounds like 'knock knock'. Only bolding the
|
||||
second 'not' makes it easier to read.
|
||||
|
||||
Fixes: dea101a1ae
|
||||
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Reviewed-by: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: 20200206225148.23923-1-philmd@redhat.com
|
||||
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
|
||||
(cherry picked from commit fa3236a970b6ea5be3fa3ad258f1a75920ca1ebb)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
docs/arm-cpu-features.rst | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/arm-cpu-features.rst b/docs/arm-cpu-features.rst
|
||||
index 45d1eb6..48d5054 100644
|
||||
--- a/docs/arm-cpu-features.rst
|
||||
+++ b/docs/arm-cpu-features.rst
|
||||
@@ -185,7 +185,7 @@ the list of KVM VCPU features and their descriptions.
|
||||
|
||||
kvm-no-adjvtime By default kvm-no-adjvtime is disabled. This
|
||||
means that by default the virtual time
|
||||
- adjustment is enabled (vtime is *not not*
|
||||
+ adjustment is enabled (vtime is not *not*
|
||||
adjusted).
|
||||
|
||||
When virtual time adjustment is enabled each
|
||||
--
|
||||
1.8.3.1
|
||||
|
72
SOURCES/kvm-enable-ramfb.patch
Normal file
72
SOURCES/kvm-enable-ramfb.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From 441128e2f13a56d4949b70971edd2f6902772959 Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Wed, 3 Jun 2020 15:15:56 +0100
|
||||
Subject: [PATCH 01/17] enable ramfb
|
||||
|
||||
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Message-id: <20200603151556.1195-2-kraxel@redhat.com>
|
||||
Patchwork-id: 97097
|
||||
O-Subject: [RHEL-AV-8.2.0.z qemu-kvm PATCH 1/1] enable ramfb
|
||||
Bugzilla: 1841068
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
---
|
||||
hw/vfio/pci.c | 5 -----
|
||||
hw/display/Makefile.objs | 5 ++---
|
||||
2 files changed, 2 insertions(+), 8 deletions(-)
|
||||
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/display/Makefile.objs | 5 ++---
|
||||
hw/vfio/pci.c | 5 -----
|
||||
2 files changed, 2 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
|
||||
index 3d0cda1..f2182e3 100644
|
||||
--- a/hw/display/Makefile.objs
|
||||
+++ b/hw/display/Makefile.objs
|
||||
@@ -1,9 +1,8 @@
|
||||
common-obj-$(CONFIG_DDC) += i2c-ddc.o
|
||||
common-obj-$(CONFIG_EDID) += edid-generate.o edid-region.o
|
||||
|
||||
-# Disabled for Red Hat Enterprise Linux
|
||||
-#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
|
||||
-#common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
|
||||
+common-obj-$(CONFIG_FW_CFG_DMA) += ramfb.o
|
||||
+common-obj-$(CONFIG_FW_CFG_DMA) += ramfb-standalone.o
|
||||
|
||||
common-obj-$(CONFIG_ADS7846) += ads7846.o
|
||||
common-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
|
||||
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
||||
index d717520..f191904 100644
|
||||
--- a/hw/vfio/pci.c
|
||||
+++ b/hw/vfio/pci.c
|
||||
@@ -3249,7 +3249,6 @@ static const TypeInfo vfio_pci_dev_info = {
|
||||
},
|
||||
};
|
||||
|
||||
-#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
static Property vfio_pci_dev_nohotplug_properties[] = {
|
||||
DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
@@ -3269,15 +3268,11 @@ static const TypeInfo vfio_pci_nohotplug_dev_info = {
|
||||
.instance_size = sizeof(VFIOPCIDevice),
|
||||
.class_init = vfio_pci_nohotplug_dev_class_init,
|
||||
};
|
||||
-#endif
|
||||
|
||||
static void register_vfio_pci_dev_type(void)
|
||||
{
|
||||
type_register_static(&vfio_pci_dev_info);
|
||||
-
|
||||
-#if 0 /* Disabled for Red Hat Enterprise Linux */
|
||||
type_register_static(&vfio_pci_nohotplug_dev_info);
|
||||
-#endif
|
||||
}
|
||||
|
||||
type_init(register_vfio_pci_dev_type)
|
||||
--
|
||||
1.8.3.1
|
||||
|
156
SOURCES/kvm-error-Document-Error-API-usage-rules.patch
Normal file
156
SOURCES/kvm-error-Document-Error-API-usage-rules.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From d931195ef5cccd6a4e6fceeba37809b1712c97ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 07:40:55 -0500
|
||||
Subject: [PATCH 04/10] error: Document Error API usage rules
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: <20210108074101.290008-5-marcandre.lureau@redhat.com>
|
||||
Patchwork-id: 100523
|
||||
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 04/10] error: Document Error API usage rules
|
||||
Bugzilla: 1913818
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
From: Markus Armbruster <armbru@redhat.com>
|
||||
|
||||
This merely codifies existing practice, with one exception: the rule
|
||||
advising against returning void, where existing practice is mixed.
|
||||
|
||||
When the Error API was created, we adopted the (unwritten) rule to
|
||||
return void when the function returns no useful value on success,
|
||||
unlike GError, which recommends to return true on success and false on
|
||||
error then.
|
||||
|
||||
When a function returns a distinct error value, say false, a checked
|
||||
call that passes the error up looks like
|
||||
|
||||
if (!frobnicate(..., errp)) {
|
||||
handle the error...
|
||||
}
|
||||
|
||||
When it returns void, we need
|
||||
|
||||
Error *err = NULL;
|
||||
|
||||
frobnicate(..., &err);
|
||||
if (err) {
|
||||
handle the error...
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
Not only is this more verbose, it also creates an Error object even
|
||||
when @errp is null, &error_abort or &error_fatal.
|
||||
|
||||
People got tired of the additional boilerplate, and started to ignore
|
||||
the unwritten rule. The result is confusion among developers about
|
||||
the preferred usage.
|
||||
|
||||
Make the rule advising against returning void official by putting it
|
||||
in writing. This will hopefully reduce confusion.
|
||||
|
||||
Update the examples accordingly.
|
||||
|
||||
The remainder of this series will update a substantial amount of code
|
||||
to honor the rule.
|
||||
|
||||
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Greg Kurz <groug@kaod.org>
|
||||
Message-Id: <20200707160613.848843-4-armbru@redhat.com>
|
||||
|
||||
(cherry picked from commit e3fe3988d7851cac30abffae06d2f555ff7bee62)
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
include/qapi/error.h | 52 +++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/qapi/error.h b/include/qapi/error.h
|
||||
index 3351fe76368..08d48e74836 100644
|
||||
--- a/include/qapi/error.h
|
||||
+++ b/include/qapi/error.h
|
||||
@@ -15,6 +15,33 @@
|
||||
/*
|
||||
* Error reporting system loosely patterned after Glib's GError.
|
||||
*
|
||||
+ * = Rules =
|
||||
+ *
|
||||
+ * - Functions that use Error to report errors have an Error **errp
|
||||
+ * parameter. It should be the last parameter, except for functions
|
||||
+ * taking variable arguments.
|
||||
+ *
|
||||
+ * - You may pass NULL to not receive the error, &error_abort to abort
|
||||
+ * on error, &error_fatal to exit(1) on error, or a pointer to a
|
||||
+ * variable containing NULL to receive the error.
|
||||
+ *
|
||||
+ * - Separation of concerns: the function is responsible for detecting
|
||||
+ * errors and failing cleanly; handling the error is its caller's
|
||||
+ * job. Since the value of @errp is about handling the error, the
|
||||
+ * function should not examine it.
|
||||
+ *
|
||||
+ * - On success, the function should not touch *errp. On failure, it
|
||||
+ * should set a new error, e.g. with error_setg(errp, ...), or
|
||||
+ * propagate an existing one, e.g. with error_propagate(errp, ...).
|
||||
+ *
|
||||
+ * - Whenever practical, also return a value that indicates success /
|
||||
+ * failure. This can make the error checking more concise, and can
|
||||
+ * avoid useless error object creation and destruction. Note that
|
||||
+ * we still have many functions returning void. We recommend
|
||||
+ * • bool-valued functions return true on success / false on failure,
|
||||
+ * • pointer-valued functions return non-null / null pointer, and
|
||||
+ * • integer-valued functions return non-negative / negative.
|
||||
+ *
|
||||
* = Creating errors =
|
||||
*
|
||||
* Create an error:
|
||||
@@ -95,14 +122,13 @@
|
||||
* Create a new error and pass it to the caller:
|
||||
* error_setg(errp, "situation normal, all fouled up");
|
||||
*
|
||||
- * Call a function and receive an error from it:
|
||||
- * Error *err = NULL;
|
||||
- * foo(arg, &err);
|
||||
- * if (err) {
|
||||
+ * Call a function, receive an error from it, and pass it to the caller
|
||||
+ * - when the function returns a value that indicates failure, say
|
||||
+ * false:
|
||||
+ * if (!foo(arg, errp)) {
|
||||
* handle the error...
|
||||
* }
|
||||
- *
|
||||
- * Receive an error and pass it on to the caller:
|
||||
+ * - when it does not, say because it is a void function:
|
||||
* Error *err = NULL;
|
||||
* foo(arg, &err);
|
||||
* if (err) {
|
||||
@@ -120,6 +146,20 @@
|
||||
* foo(arg, errp);
|
||||
* for readability.
|
||||
*
|
||||
+ * Receive an error, and handle it locally
|
||||
+ * - when the function returns a value that indicates failure, say
|
||||
+ * false:
|
||||
+ * Error *err = NULL;
|
||||
+ * if (!foo(arg, &err)) {
|
||||
+ * handle the error...
|
||||
+ * }
|
||||
+ * - when it does not, say because it is a void function:
|
||||
+ * Error *err = NULL;
|
||||
+ * foo(arg, &err);
|
||||
+ * if (err) {
|
||||
+ * handle the error...
|
||||
+ * }
|
||||
+ *
|
||||
* Receive and accumulate multiple errors (first one wins):
|
||||
* Error *err = NULL, *local_err = NULL;
|
||||
* foo(arg, &err);
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,87 @@
|
||||
From 393a5e9b24947f90cd116c4fb1b2ff4ee200f0df Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 07:40:53 -0500
|
||||
Subject: [PATCH 02/10] error: Fix examples in error.h's big comment
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: <20210108074101.290008-3-marcandre.lureau@redhat.com>
|
||||
Patchwork-id: 100521
|
||||
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 02/10] error: Fix examples in error.h's big comment
|
||||
Bugzilla: 1913818
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
From: Markus Armbruster <armbru@redhat.com>
|
||||
|
||||
Mark a bad example more clearly. Fix the error_propagate_prepend()
|
||||
example. Add a missing declaration and a second error pileup example.
|
||||
|
||||
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Greg Kurz <groug@kaod.org>
|
||||
Message-Id: <20200707160613.848843-2-armbru@redhat.com>
|
||||
|
||||
(cherry picked from commit 47ff5ac81e8bb3096500de7b132051691d533d36)
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
include/qapi/error.h | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/qapi/error.h b/include/qapi/error.h
|
||||
index 3f95141a01a..83c38f9a188 100644
|
||||
--- a/include/qapi/error.h
|
||||
+++ b/include/qapi/error.h
|
||||
@@ -24,7 +24,7 @@
|
||||
* "charm, top, bottom.\n");
|
||||
*
|
||||
* Do *not* contract this to
|
||||
- * error_setg(&err, "invalid quark\n"
|
||||
+ * error_setg(&err, "invalid quark\n" // WRONG!
|
||||
* "Valid quarks are up, down, strange, charm, top, bottom.");
|
||||
*
|
||||
* Report an error to the current monitor if we have one, else stderr:
|
||||
@@ -52,7 +52,8 @@
|
||||
* where Error **errp is a parameter, by convention the last one.
|
||||
*
|
||||
* Pass an existing error to the caller with the message modified:
|
||||
- * error_propagate_prepend(errp, err);
|
||||
+ * error_propagate_prepend(errp, err,
|
||||
+ * "Could not frobnicate '%s': ", name);
|
||||
*
|
||||
* Avoid
|
||||
* error_propagate(errp, err);
|
||||
@@ -108,12 +109,23 @@
|
||||
* }
|
||||
*
|
||||
* Do *not* "optimize" this to
|
||||
+ * Error *err = NULL;
|
||||
* foo(arg, &err);
|
||||
* bar(arg, &err); // WRONG!
|
||||
* if (err) {
|
||||
* handle the error...
|
||||
* }
|
||||
* because this may pass a non-null err to bar().
|
||||
+ *
|
||||
+ * Likewise, do *not*
|
||||
+ * Error *err = NULL;
|
||||
+ * if (cond1) {
|
||||
+ * error_setg(&err, ...);
|
||||
+ * }
|
||||
+ * if (cond2) {
|
||||
+ * error_setg(&err, ...); // WRONG!
|
||||
+ * }
|
||||
+ * because this may pass a non-null err to error_setg().
|
||||
*/
|
||||
|
||||
#ifndef ERROR_H
|
||||
--
|
||||
2.27.0
|
||||
|
148
SOURCES/kvm-error-Improve-error.h-s-big-comment.patch
Normal file
148
SOURCES/kvm-error-Improve-error.h-s-big-comment.patch
Normal file
@ -0,0 +1,148 @@
|
||||
From b41fc6d57fae80ac2a431bca22862985f003fe88 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 07:40:54 -0500
|
||||
Subject: [PATCH 03/10] error: Improve error.h's big comment
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: <20210108074101.290008-4-marcandre.lureau@redhat.com>
|
||||
Patchwork-id: 100522
|
||||
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 03/10] error: Improve error.h's big comment
|
||||
Bugzilla: 1913818
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
From: Markus Armbruster <armbru@redhat.com>
|
||||
|
||||
Add headlines to the big comment.
|
||||
|
||||
Explain examples for NULL, &error_abort and &error_fatal argument
|
||||
better.
|
||||
|
||||
Tweak rationale for error_propagate_prepend().
|
||||
|
||||
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
||||
Message-Id: <20200707160613.848843-3-armbru@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Greg Kurz <groug@kaod.org>
|
||||
|
||||
(cherry picked from commit 9aac7d486cc792191c25c30851f501624b0c2751)
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
include/qapi/error.h | 51 +++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 36 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/include/qapi/error.h b/include/qapi/error.h
|
||||
index 83c38f9a188..3351fe76368 100644
|
||||
--- a/include/qapi/error.h
|
||||
+++ b/include/qapi/error.h
|
||||
@@ -15,6 +15,8 @@
|
||||
/*
|
||||
* Error reporting system loosely patterned after Glib's GError.
|
||||
*
|
||||
+ * = Creating errors =
|
||||
+ *
|
||||
* Create an error:
|
||||
* error_setg(&err, "situation normal, all fouled up");
|
||||
*
|
||||
@@ -27,6 +29,8 @@
|
||||
* error_setg(&err, "invalid quark\n" // WRONG!
|
||||
* "Valid quarks are up, down, strange, charm, top, bottom.");
|
||||
*
|
||||
+ * = Reporting and destroying errors =
|
||||
+ *
|
||||
* Report an error to the current monitor if we have one, else stderr:
|
||||
* error_report_err(err);
|
||||
* This frees the error object.
|
||||
@@ -40,6 +44,30 @@
|
||||
* error_free(err);
|
||||
* Note that this loses hints added with error_append_hint().
|
||||
*
|
||||
+ * Call a function ignoring errors:
|
||||
+ * foo(arg, NULL);
|
||||
+ * This is more concise than
|
||||
+ * Error *err = NULL;
|
||||
+ * foo(arg, &err);
|
||||
+ * error_free(err); // don't do this
|
||||
+ *
|
||||
+ * Call a function aborting on errors:
|
||||
+ * foo(arg, &error_abort);
|
||||
+ * This is more concise and fails more nicely than
|
||||
+ * Error *err = NULL;
|
||||
+ * foo(arg, &err);
|
||||
+ * assert(!err); // don't do this
|
||||
+ *
|
||||
+ * Call a function treating errors as fatal:
|
||||
+ * foo(arg, &error_fatal);
|
||||
+ * This is more concise than
|
||||
+ * Error *err = NULL;
|
||||
+ * foo(arg, &err);
|
||||
+ * if (err) { // don't do this
|
||||
+ * error_report_err(err);
|
||||
+ * exit(1);
|
||||
+ * }
|
||||
+ *
|
||||
* Handle an error without reporting it (just for completeness):
|
||||
* error_free(err);
|
||||
*
|
||||
@@ -47,6 +75,11 @@
|
||||
* reporting it (primarily useful in testsuites):
|
||||
* error_free_or_abort(&err);
|
||||
*
|
||||
+ * = Passing errors around =
|
||||
+ *
|
||||
+ * Errors get passed to the caller through the conventional @errp
|
||||
+ * parameter.
|
||||
+ *
|
||||
* Pass an existing error to the caller:
|
||||
* error_propagate(errp, err);
|
||||
* where Error **errp is a parameter, by convention the last one.
|
||||
@@ -54,11 +87,10 @@
|
||||
* Pass an existing error to the caller with the message modified:
|
||||
* error_propagate_prepend(errp, err,
|
||||
* "Could not frobnicate '%s': ", name);
|
||||
- *
|
||||
- * Avoid
|
||||
- * error_propagate(errp, err);
|
||||
+ * This is more concise than
|
||||
+ * error_propagate(errp, err); // don't do this
|
||||
* error_prepend(errp, "Could not frobnicate '%s': ", name);
|
||||
- * because this fails to prepend when @errp is &error_fatal.
|
||||
+ * and works even when @errp is &error_fatal.
|
||||
*
|
||||
* Create a new error and pass it to the caller:
|
||||
* error_setg(errp, "situation normal, all fouled up");
|
||||
@@ -70,15 +102,6 @@
|
||||
* handle the error...
|
||||
* }
|
||||
*
|
||||
- * Call a function ignoring errors:
|
||||
- * foo(arg, NULL);
|
||||
- *
|
||||
- * Call a function aborting on errors:
|
||||
- * foo(arg, &error_abort);
|
||||
- *
|
||||
- * Call a function treating errors as fatal:
|
||||
- * foo(arg, &error_fatal);
|
||||
- *
|
||||
* Receive an error and pass it on to the caller:
|
||||
* Error *err = NULL;
|
||||
* foo(arg, &err);
|
||||
@@ -86,8 +109,6 @@
|
||||
* handle the error...
|
||||
* error_propagate(errp, err);
|
||||
* }
|
||||
- * where Error **errp is a parameter, by convention the last one.
|
||||
- *
|
||||
* Do *not* "optimize" this to
|
||||
* foo(arg, errp);
|
||||
* if (*errp) { // WRONG!
|
||||
--
|
||||
2.27.0
|
||||
|
307
SOURCES/kvm-error-New-macro-ERRP_GUARD.patch
Normal file
307
SOURCES/kvm-error-New-macro-ERRP_GUARD.patch
Normal file
@ -0,0 +1,307 @@
|
||||
From f6ac3d6bab961c31060d722af23beeb50ce5bdde Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
||||
Date: Fri, 8 Jan 2021 07:40:56 -0500
|
||||
Subject: [PATCH 05/10] error: New macro ERRP_GUARD()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-id: <20210108074101.290008-6-marcandre.lureau@redhat.com>
|
||||
Patchwork-id: 100524
|
||||
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 05/10] error: New macro ERRP_GUARD()
|
||||
Bugzilla: 1913818
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
|
||||
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
|
||||
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
|
||||
Introduce a new ERRP_GUARD() macro, to be used at start of functions
|
||||
with an errp OUT parameter.
|
||||
|
||||
It has three goals:
|
||||
|
||||
1. Fix issue with error_fatal and error_prepend/error_append_hint: the
|
||||
user can't see this additional information, because exit() happens in
|
||||
error_setg earlier than information is added. [Reported by Greg Kurz]
|
||||
|
||||
2. Fix issue with error_abort and error_propagate: when we wrap
|
||||
error_abort by local_err+error_propagate, the resulting coredump will
|
||||
refer to error_propagate and not to the place where error happened.
|
||||
(the macro itself doesn't fix the issue, but it allows us to [3.] drop
|
||||
the local_err+error_propagate pattern, which will definitely fix the
|
||||
issue) [Reported by Kevin Wolf]
|
||||
|
||||
3. Drop local_err+error_propagate pattern, which is used to workaround
|
||||
void functions with errp parameter, when caller wants to know resulting
|
||||
status. (Note: actually these functions could be merely updated to
|
||||
return int error code).
|
||||
|
||||
To achieve these goals, later patches will add invocations
|
||||
of this macro at the start of functions with either use
|
||||
error_prepend/error_append_hint (solving 1) or which use
|
||||
local_err+error_propagate to check errors, switching those
|
||||
functions to use *errp instead (solving 2 and 3).
|
||||
|
||||
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Paul Durrant <paul@xen.org>
|
||||
Reviewed-by: Greg Kurz <groug@kaod.org>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
[Merge comments properly with recent commit "error: Document Error API
|
||||
usage rules", and edit for clarity. Put ERRP_AUTO_PROPAGATE() before
|
||||
its helpers, and touch up style. Tweak commit message.]
|
||||
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
||||
Message-Id: <20200707165037.1026246-2-armbru@redhat.com>
|
||||
|
||||
(cherry picked from commit ae7c80a7bd73685437bf6ba9d7c26098351f4166)
|
||||
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
include/qapi/error.h | 158 +++++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 139 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/include/qapi/error.h b/include/qapi/error.h
|
||||
index 08d48e74836..e658790acfc 100644
|
||||
--- a/include/qapi/error.h
|
||||
+++ b/include/qapi/error.h
|
||||
@@ -30,6 +30,10 @@
|
||||
* job. Since the value of @errp is about handling the error, the
|
||||
* function should not examine it.
|
||||
*
|
||||
+ * - The function may pass @errp to functions it calls to pass on
|
||||
+ * their errors to its caller. If it dereferences @errp to check
|
||||
+ * for errors, it must use ERRP_GUARD().
|
||||
+ *
|
||||
* - On success, the function should not touch *errp. On failure, it
|
||||
* should set a new error, e.g. with error_setg(errp, ...), or
|
||||
* propagate an existing one, e.g. with error_propagate(errp, ...).
|
||||
@@ -45,15 +49,17 @@
|
||||
* = Creating errors =
|
||||
*
|
||||
* Create an error:
|
||||
- * error_setg(&err, "situation normal, all fouled up");
|
||||
+ * error_setg(errp, "situation normal, all fouled up");
|
||||
+ * where @errp points to the location to receive the error.
|
||||
*
|
||||
* Create an error and add additional explanation:
|
||||
- * error_setg(&err, "invalid quark");
|
||||
- * error_append_hint(&err, "Valid quarks are up, down, strange, "
|
||||
+ * error_setg(errp, "invalid quark");
|
||||
+ * error_append_hint(errp, "Valid quarks are up, down, strange, "
|
||||
* "charm, top, bottom.\n");
|
||||
+ * This may require use of ERRP_GUARD(); more on that below.
|
||||
*
|
||||
* Do *not* contract this to
|
||||
- * error_setg(&err, "invalid quark\n" // WRONG!
|
||||
+ * error_setg(errp, "invalid quark\n" // WRONG!
|
||||
* "Valid quarks are up, down, strange, charm, top, bottom.");
|
||||
*
|
||||
* = Reporting and destroying errors =
|
||||
@@ -107,18 +113,6 @@
|
||||
* Errors get passed to the caller through the conventional @errp
|
||||
* parameter.
|
||||
*
|
||||
- * Pass an existing error to the caller:
|
||||
- * error_propagate(errp, err);
|
||||
- * where Error **errp is a parameter, by convention the last one.
|
||||
- *
|
||||
- * Pass an existing error to the caller with the message modified:
|
||||
- * error_propagate_prepend(errp, err,
|
||||
- * "Could not frobnicate '%s': ", name);
|
||||
- * This is more concise than
|
||||
- * error_propagate(errp, err); // don't do this
|
||||
- * error_prepend(errp, "Could not frobnicate '%s': ", name);
|
||||
- * and works even when @errp is &error_fatal.
|
||||
- *
|
||||
* Create a new error and pass it to the caller:
|
||||
* error_setg(errp, "situation normal, all fouled up");
|
||||
*
|
||||
@@ -129,18 +123,26 @@
|
||||
* handle the error...
|
||||
* }
|
||||
* - when it does not, say because it is a void function:
|
||||
+ * ERRP_GUARD();
|
||||
+ * foo(arg, errp);
|
||||
+ * if (*errp) {
|
||||
+ * handle the error...
|
||||
+ * }
|
||||
+ * More on ERRP_GUARD() below.
|
||||
+ *
|
||||
+ * Code predating ERRP_GUARD() still exists, and looks like this:
|
||||
* Error *err = NULL;
|
||||
* foo(arg, &err);
|
||||
* if (err) {
|
||||
* handle the error...
|
||||
- * error_propagate(errp, err);
|
||||
+ * error_propagate(errp, err); // deprecated
|
||||
* }
|
||||
- * Do *not* "optimize" this to
|
||||
+ * Avoid in new code. Do *not* "optimize" it to
|
||||
* foo(arg, errp);
|
||||
* if (*errp) { // WRONG!
|
||||
* handle the error...
|
||||
* }
|
||||
- * because errp may be NULL!
|
||||
+ * because errp may be NULL without the ERRP_GUARD() guard.
|
||||
*
|
||||
* But when all you do with the error is pass it on, please use
|
||||
* foo(arg, errp);
|
||||
@@ -160,6 +162,19 @@
|
||||
* handle the error...
|
||||
* }
|
||||
*
|
||||
+ * Pass an existing error to the caller:
|
||||
+ * error_propagate(errp, err);
|
||||
+ * This is rarely needed. When @err is a local variable, use of
|
||||
+ * ERRP_GUARD() commonly results in more readable code.
|
||||
+ *
|
||||
+ * Pass an existing error to the caller with the message modified:
|
||||
+ * error_propagate_prepend(errp, err,
|
||||
+ * "Could not frobnicate '%s': ", name);
|
||||
+ * This is more concise than
|
||||
+ * error_propagate(errp, err); // don't do this
|
||||
+ * error_prepend(errp, "Could not frobnicate '%s': ", name);
|
||||
+ * and works even when @errp is &error_fatal.
|
||||
+ *
|
||||
* Receive and accumulate multiple errors (first one wins):
|
||||
* Error *err = NULL, *local_err = NULL;
|
||||
* foo(arg, &err);
|
||||
@@ -187,6 +202,69 @@
|
||||
* error_setg(&err, ...); // WRONG!
|
||||
* }
|
||||
* because this may pass a non-null err to error_setg().
|
||||
+ *
|
||||
+ * = Why, when and how to use ERRP_GUARD() =
|
||||
+ *
|
||||
+ * Without ERRP_GUARD(), use of the @errp parameter is restricted:
|
||||
+ * - It must not be dereferenced, because it may be null.
|
||||
+ * - It should not be passed to error_prepend() or
|
||||
+ * error_append_hint(), because that doesn't work with &error_fatal.
|
||||
+ * ERRP_GUARD() lifts these restrictions.
|
||||
+ *
|
||||
+ * To use ERRP_GUARD(), add it right at the beginning of the function.
|
||||
+ * @errp can then be used without worrying about the argument being
|
||||
+ * NULL or &error_fatal.
|
||||
+ *
|
||||
+ * Using it when it's not needed is safe, but please avoid cluttering
|
||||
+ * the source with useless code.
|
||||
+ *
|
||||
+ * = Converting to ERRP_GUARD() =
|
||||
+ *
|
||||
+ * To convert a function to use ERRP_GUARD():
|
||||
+ *
|
||||
+ * 0. If the Error ** parameter is not named @errp, rename it to
|
||||
+ * @errp.
|
||||
+ *
|
||||
+ * 1. Add an ERRP_GUARD() invocation, by convention right at the
|
||||
+ * beginning of the function. This makes @errp safe to use.
|
||||
+ *
|
||||
+ * 2. Replace &err by errp, and err by *errp. Delete local variable
|
||||
+ * @err.
|
||||
+ *
|
||||
+ * 3. Delete error_propagate(errp, *errp), replace
|
||||
+ * error_propagate_prepend(errp, *errp, ...) by error_prepend(errp, ...)
|
||||
+ *
|
||||
+ * 4. Ensure @errp is valid at return: when you destroy *errp, set
|
||||
+ * errp = NULL.
|
||||
+ *
|
||||
+ * Example:
|
||||
+ *
|
||||
+ * bool fn(..., Error **errp)
|
||||
+ * {
|
||||
+ * Error *err = NULL;
|
||||
+ *
|
||||
+ * foo(arg, &err);
|
||||
+ * if (err) {
|
||||
+ * handle the error...
|
||||
+ * error_propagate(errp, err);
|
||||
+ * return false;
|
||||
+ * }
|
||||
+ * ...
|
||||
+ * }
|
||||
+ *
|
||||
+ * becomes
|
||||
+ *
|
||||
+ * bool fn(..., Error **errp)
|
||||
+ * {
|
||||
+ * ERRP_GUARD();
|
||||
+ *
|
||||
+ * foo(arg, errp);
|
||||
+ * if (*errp) {
|
||||
+ * handle the error...
|
||||
+ * return false;
|
||||
+ * }
|
||||
+ * ...
|
||||
+ * }
|
||||
*/
|
||||
|
||||
#ifndef ERROR_H
|
||||
@@ -287,6 +365,7 @@ void error_setg_win32_internal(Error **errp,
|
||||
* the error object.
|
||||
* Else, move the error object from @local_err to *@dst_errp.
|
||||
* On return, @local_err is invalid.
|
||||
+ * Please use ERRP_GUARD() instead when possible.
|
||||
* Please don't error_propagate(&error_fatal, ...), use
|
||||
* error_report_err() and exit(), because that's more obvious.
|
||||
*/
|
||||
@@ -298,6 +377,7 @@ void error_propagate(Error **dst_errp, Error *local_err);
|
||||
* Behaves like
|
||||
* error_prepend(&local_err, fmt, ...);
|
||||
* error_propagate(dst_errp, local_err);
|
||||
+ * Please use ERRP_GUARD() and error_prepend() instead when possible.
|
||||
*/
|
||||
void error_propagate_prepend(Error **dst_errp, Error *local_err,
|
||||
const char *fmt, ...);
|
||||
@@ -395,6 +475,46 @@ void error_set_internal(Error **errp,
|
||||
ErrorClass err_class, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(6, 7);
|
||||
|
||||
+/*
|
||||
+ * Make @errp parameter easier to use regardless of argument value
|
||||
+ *
|
||||
+ * This macro is for use right at the beginning of a function that
|
||||
+ * takes an Error **errp parameter to pass errors to its caller. The
|
||||
+ * parameter must be named @errp.
|
||||
+ *
|
||||
+ * It must be used when the function dereferences @errp or passes
|
||||
+ * @errp to error_prepend(), error_vprepend(), or error_append_hint().
|
||||
+ * It is safe to use even when it's not needed, but please avoid
|
||||
+ * cluttering the source with useless code.
|
||||
+ *
|
||||
+ * If @errp is NULL or &error_fatal, rewrite it to point to a local
|
||||
+ * Error variable, which will be automatically propagated to the
|
||||
+ * original @errp on function exit.
|
||||
+ *
|
||||
+ * Note: &error_abort is not rewritten, because that would move the
|
||||
+ * abort from the place where the error is created to the place where
|
||||
+ * it's propagated.
|
||||
+ */
|
||||
+#define ERRP_GUARD() \
|
||||
+ g_auto(ErrorPropagator) _auto_errp_prop = {.errp = errp}; \
|
||||
+ do { \
|
||||
+ if (!errp || errp == &error_fatal) { \
|
||||
+ errp = &_auto_errp_prop.local_err; \
|
||||
+ } \
|
||||
+ } while (0)
|
||||
+
|
||||
+typedef struct ErrorPropagator {
|
||||
+ Error *local_err;
|
||||
+ Error **errp;
|
||||
+} ErrorPropagator;
|
||||
+
|
||||
+static inline void error_propagator_cleanup(ErrorPropagator *prop)
|
||||
+{
|
||||
+ error_propagate(prop->errp, prop->local_err);
|
||||
+}
|
||||
+
|
||||
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(ErrorPropagator, error_propagator_cleanup);
|
||||
+
|
||||
/*
|
||||
* Special error destination to abort on error.
|
||||
* See error_setg() and error_propagate() for details.
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,85 @@
|
||||
From 5770fe43fe1e15e6f53cfd3705605e8645b95a98 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
Date: Fri, 13 Mar 2020 17:17:08 +0000
|
||||
Subject: [PATCH 20/20] exec/rom_reset: Free rom data during inmigrate skip
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Message-id: <20200313171708.242774-1-dgilbert@redhat.com>
|
||||
Patchwork-id: 94292
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/1] exec/rom_reset: Free rom data during inmigrate skip
|
||||
Bugzilla: 1809380
|
||||
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
||||
|
||||
bz: https://bugzilla.redhat.com/show_bug.cgi?id=1809380
|
||||
brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=27249921
|
||||
branch: rhel-av-8.2.0
|
||||
upstream: Posted and with review-by, not merged yet
|
||||
|
||||
Commit 355477f8c73e9 skips rom reset when we're an incoming migration
|
||||
so as not to overwrite shared ram in the ignore-shared migration
|
||||
optimisation.
|
||||
However, it's got an unexpected side effect that because it skips
|
||||
freeing the ROM data, when rom_reset gets called later on, after
|
||||
migration (e.g. during a reboot), the ROM does get reset to the original
|
||||
file contents. Because of seabios/x86's weird reboot process
|
||||
this confuses a reboot into hanging after a migration.
|
||||
|
||||
Fixes: 355477f8c73e9 ("migration: do not rom_reset() during incoming migration")
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1809380
|
||||
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/core/loader.c | 25 ++++++++++++++++---------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/hw/core/loader.c b/hw/core/loader.c
|
||||
index 5099f27..375b29b 100644
|
||||
--- a/hw/core/loader.c
|
||||
+++ b/hw/core/loader.c
|
||||
@@ -1118,19 +1118,26 @@ static void rom_reset(void *unused)
|
||||
{
|
||||
Rom *rom;
|
||||
|
||||
- /*
|
||||
- * We don't need to fill in the RAM with ROM data because we'll fill
|
||||
- * the data in during the next incoming migration in all cases. Note
|
||||
- * that some of those RAMs can actually be modified by the guest on ARM
|
||||
- * so this is probably the only right thing to do here.
|
||||
- */
|
||||
- if (runstate_check(RUN_STATE_INMIGRATE))
|
||||
- return;
|
||||
-
|
||||
QTAILQ_FOREACH(rom, &roms, next) {
|
||||
if (rom->fw_file) {
|
||||
continue;
|
||||
}
|
||||
+ /*
|
||||
+ * We don't need to fill in the RAM with ROM data because we'll fill
|
||||
+ * the data in during the next incoming migration in all cases. Note
|
||||
+ * that some of those RAMs can actually be modified by the guest.
|
||||
+ */
|
||||
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
|
||||
+ if (rom->data && rom->isrom) {
|
||||
+ /*
|
||||
+ * Free it so that a rom_reset after migration doesn't
|
||||
+ * overwrite a potentially modified 'rom'.
|
||||
+ */
|
||||
+ rom_free_data(rom);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if (rom->data == NULL) {
|
||||
continue;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
131
SOURCES/kvm-file-posix-Drop-hdev_co_create_opts.patch
Normal file
131
SOURCES/kvm-file-posix-Drop-hdev_co_create_opts.patch
Normal file
@ -0,0 +1,131 @@
|
||||
From 3d3509c010129bd15eb1f5ec1a7b9eedcdbf23f6 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 11 Mar 2020 10:51:44 +0000
|
||||
Subject: [PATCH 03/20] file-posix: Drop hdev_co_create_opts()
|
||||
|
||||
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-id: <20200311105147.13208-4-mlevitsk@redhat.com>
|
||||
Patchwork-id: 94225
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 3/6] file-posix: Drop hdev_co_create_opts()
|
||||
Bugzilla: 1640894
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
The generic fallback implementation effectively does the same.
|
||||
|
||||
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200122164532.178040-4-mreitz@redhat.com>
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 87ca3b8fa615b278b33cabf9ed22b3f44b5214ba)
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/file-posix.c | 67 ------------------------------------------------------
|
||||
1 file changed, 67 deletions(-)
|
||||
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index 1b805bd..fd29372 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -3418,67 +3418,6 @@ static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs,
|
||||
return raw_do_pwrite_zeroes(bs, offset, bytes, flags, true);
|
||||
}
|
||||
|
||||
-static int coroutine_fn hdev_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
- Error **errp)
|
||||
-{
|
||||
- int fd;
|
||||
- int ret = 0;
|
||||
- struct stat stat_buf;
|
||||
- int64_t total_size = 0;
|
||||
- bool has_prefix;
|
||||
-
|
||||
- /* This function is used by both protocol block drivers and therefore either
|
||||
- * of these prefixes may be given.
|
||||
- * The return value has to be stored somewhere, otherwise this is an error
|
||||
- * due to -Werror=unused-value. */
|
||||
- has_prefix =
|
||||
- strstart(filename, "host_device:", &filename) ||
|
||||
- strstart(filename, "host_cdrom:" , &filename);
|
||||
-
|
||||
- (void)has_prefix;
|
||||
-
|
||||
- ret = raw_normalize_devicepath(&filename, errp);
|
||||
- if (ret < 0) {
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- /* Read out options */
|
||||
- total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
|
||||
- BDRV_SECTOR_SIZE);
|
||||
-
|
||||
- fd = qemu_open(filename, O_WRONLY | O_BINARY);
|
||||
- if (fd < 0) {
|
||||
- ret = -errno;
|
||||
- error_setg_errno(errp, -ret, "Could not open device");
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- if (fstat(fd, &stat_buf) < 0) {
|
||||
- ret = -errno;
|
||||
- error_setg_errno(errp, -ret, "Could not stat device");
|
||||
- } else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode)) {
|
||||
- error_setg(errp,
|
||||
- "The given file is neither a block nor a character device");
|
||||
- ret = -ENODEV;
|
||||
- } else if (lseek(fd, 0, SEEK_END) < total_size) {
|
||||
- error_setg(errp, "Device is too small");
|
||||
- ret = -ENOSPC;
|
||||
- }
|
||||
-
|
||||
- if (!ret && total_size) {
|
||||
- uint8_t buf[BDRV_SECTOR_SIZE] = { 0 };
|
||||
- int64_t zero_size = MIN(BDRV_SECTOR_SIZE, total_size);
|
||||
- if (lseek(fd, 0, SEEK_SET) == -1) {
|
||||
- ret = -errno;
|
||||
- } else {
|
||||
- ret = qemu_write_full(fd, buf, zero_size);
|
||||
- ret = ret == zero_size ? 0 : -errno;
|
||||
- }
|
||||
- }
|
||||
- qemu_close(fd);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
static BlockDriver bdrv_host_device = {
|
||||
.format_name = "host_device",
|
||||
.protocol_name = "host_device",
|
||||
@@ -3491,8 +3430,6 @@ static BlockDriver bdrv_host_device = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
- .bdrv_co_create_opts = hdev_co_create_opts,
|
||||
- .create_opts = &raw_create_opts,
|
||||
.mutable_opts = mutable_opts,
|
||||
.bdrv_co_invalidate_cache = raw_co_invalidate_cache,
|
||||
.bdrv_co_pwrite_zeroes = hdev_co_pwrite_zeroes,
|
||||
@@ -3619,8 +3556,6 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
- .bdrv_co_create_opts = hdev_co_create_opts,
|
||||
- .create_opts = &raw_create_opts,
|
||||
.mutable_opts = mutable_opts,
|
||||
.bdrv_co_invalidate_cache = raw_co_invalidate_cache,
|
||||
|
||||
@@ -3753,8 +3688,6 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
- .bdrv_co_create_opts = hdev_co_create_opts,
|
||||
- .create_opts = &raw_create_opts,
|
||||
.mutable_opts = mutable_opts,
|
||||
|
||||
.bdrv_co_preadv = raw_co_preadv,
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 55bfda3a0e077b822f57e8ed901f0cee848bc471 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 15:01:35 +0100
|
||||
Subject: [PATCH 07/17] file-posix: Support BDRV_REQ_ZERO_WRITE for truncate
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200608150140.38218-7-kwolf@redhat.com>
|
||||
Patchwork-id: 97452
|
||||
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 06/11] file-posix: Support BDRV_REQ_ZERO_WRITE for truncate
|
||||
Bugzilla: 1780574
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
For regular files, we always get BDRV_REQ_ZERO_WRITE behaviour from the
|
||||
OS, so we can advertise the flag and just ignore it.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-Id: <20200424125448.63318-7-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 2f0c6e7a650de133eccd94e9bb6cf7b2070f07f1)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/file-posix.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index 7551e8d..adafbfa 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -674,6 +674,10 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
||||
#endif
|
||||
|
||||
bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
|
||||
+ if (S_ISREG(st.st_mode)) {
|
||||
+ /* When extending regular files, we get zeros from the OS */
|
||||
+ bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
|
||||
+ }
|
||||
ret = 0;
|
||||
fail:
|
||||
if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,275 @@
|
||||
From a0816e4374759048cb24b9b3549a093a2ccb6240 Mon Sep 17 00:00:00 2001
|
||||
From: "plai@redhat.com" <plai@redhat.com>
|
||||
Date: Thu, 21 May 2020 23:56:50 +0100
|
||||
Subject: [PATCH 07/12] hmat acpi: Build Memory Proximity Domain Attributes
|
||||
Structure(s)
|
||||
|
||||
RH-Author: plai@redhat.com
|
||||
Message-id: <20200521235655.27141-7-plai@redhat.com>
|
||||
Patchwork-id: 96734
|
||||
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 06/11] hmat acpi: Build Memory Proximity Domain Attributes Structure(s)
|
||||
Bugzilla: 1600217
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
|
||||
From: Liu Jingqi <jingqi.liu@intel.com>
|
||||
|
||||
HMAT is defined in ACPI 6.3: 5.2.27 Heterogeneous Memory Attribute Table
|
||||
(HMAT). The specification references below link:
|
||||
http://www.uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
|
||||
|
||||
It describes the memory attributes, such as memory side cache
|
||||
attributes and bandwidth and latency details, related to the
|
||||
Memory Proximity Domain. The software is
|
||||
expected to use this information as hint for optimization.
|
||||
|
||||
This structure describes Memory Proximity Domain Attributes by memory
|
||||
subsystem and its associativity with processor proximity domain as well as
|
||||
hint for memory usage.
|
||||
|
||||
In the linux kernel, the codes in drivers/acpi/hmat/hmat.c parse and report
|
||||
the platform's HMAT tables.
|
||||
|
||||
Acked-by: Markus Armbruster <armbru@redhat.com>
|
||||
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
||||
Reviewed-by: Daniel Black <daniel@linux.ibm.com>
|
||||
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
||||
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
|
||||
Signed-off-by: Tao Xu <tao3.xu@intel.com>
|
||||
Message-Id: <20191213011929.2520-5-tao3.xu@intel.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit e6f123c3b81241be33f1b763d0ff8b36d1ae9c1e)
|
||||
Signed-off-by: Paul Lai <plai@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/acpi/Kconfig | 7 ++--
|
||||
hw/acpi/Makefile.objs | 1 +
|
||||
hw/acpi/hmat.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
hw/acpi/hmat.h | 42 ++++++++++++++++++++++
|
||||
hw/i386/acpi-build.c | 5 +++
|
||||
5 files changed, 152 insertions(+), 2 deletions(-)
|
||||
create mode 100644 hw/acpi/hmat.c
|
||||
create mode 100644 hw/acpi/hmat.h
|
||||
|
||||
diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
|
||||
index 12e3f1e..54209c6 100644
|
||||
--- a/hw/acpi/Kconfig
|
||||
+++ b/hw/acpi/Kconfig
|
||||
@@ -7,6 +7,7 @@ config ACPI_X86
|
||||
select ACPI_NVDIMM
|
||||
select ACPI_CPU_HOTPLUG
|
||||
select ACPI_MEMORY_HOTPLUG
|
||||
+ select ACPI_HMAT
|
||||
|
||||
config ACPI_X86_ICH
|
||||
bool
|
||||
@@ -23,6 +24,10 @@ config ACPI_NVDIMM
|
||||
bool
|
||||
depends on ACPI
|
||||
|
||||
+config ACPI_HMAT
|
||||
+ bool
|
||||
+ depends on ACPI
|
||||
+
|
||||
config ACPI_PCI
|
||||
bool
|
||||
depends on ACPI && PCI
|
||||
@@ -33,5 +38,3 @@ config ACPI_VMGENID
|
||||
depends on PC
|
||||
|
||||
config ACPI_HW_REDUCED
|
||||
- bool
|
||||
- depends on ACPI
|
||||
diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
|
||||
index 655a9c1..517bd88 100644
|
||||
--- a/hw/acpi/Makefile.objs
|
||||
+++ b/hw/acpi/Makefile.objs
|
||||
@@ -7,6 +7,7 @@ common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
|
||||
common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
|
||||
common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o
|
||||
common-obj-$(CONFIG_ACPI_HW_REDUCED) += generic_event_device.o
|
||||
+common-obj-$(CONFIG_ACPI_HMAT) += hmat.o
|
||||
common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o
|
||||
|
||||
common-obj-y += acpi_interface.o
|
||||
diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c
|
||||
new file mode 100644
|
||||
index 0000000..9ff7930
|
||||
--- /dev/null
|
||||
+++ b/hw/acpi/hmat.c
|
||||
@@ -0,0 +1,99 @@
|
||||
+/*
|
||||
+ * HMAT ACPI Implementation
|
||||
+ *
|
||||
+ * Copyright(C) 2019 Intel Corporation.
|
||||
+ *
|
||||
+ * Author:
|
||||
+ * Liu jingqi <jingqi.liu@linux.intel.com>
|
||||
+ * Tao Xu <tao3.xu@intel.com>
|
||||
+ *
|
||||
+ * HMAT is defined in ACPI 6.3: 5.2.27 Heterogeneous Memory Attribute Table
|
||||
+ * (HMAT)
|
||||
+ *
|
||||
+ * 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 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 "qemu/osdep.h"
|
||||
+#include "sysemu/numa.h"
|
||||
+#include "hw/acpi/hmat.h"
|
||||
+
|
||||
+/*
|
||||
+ * ACPI 6.3:
|
||||
+ * 5.2.27.3 Memory Proximity Domain Attributes Structure: Table 5-145
|
||||
+ */
|
||||
+static void build_hmat_mpda(GArray *table_data, uint16_t flags,
|
||||
+ uint32_t initiator, uint32_t mem_node)
|
||||
+{
|
||||
+
|
||||
+ /* Memory Proximity Domain Attributes Structure */
|
||||
+ /* Type */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Length */
|
||||
+ build_append_int_noprefix(table_data, 40, 4);
|
||||
+ /* Flags */
|
||||
+ build_append_int_noprefix(table_data, flags, 2);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Proximity Domain for the Attached Initiator */
|
||||
+ build_append_int_noprefix(table_data, initiator, 4);
|
||||
+ /* Proximity Domain for the Memory */
|
||||
+ build_append_int_noprefix(table_data, mem_node, 4);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 4);
|
||||
+ /*
|
||||
+ * Reserved:
|
||||
+ * Previously defined as the Start Address of the System Physical
|
||||
+ * Address Range. Deprecated since ACPI Spec 6.3.
|
||||
+ */
|
||||
+ build_append_int_noprefix(table_data, 0, 8);
|
||||
+ /*
|
||||
+ * Reserved:
|
||||
+ * Previously defined as the Range Length of the region in bytes.
|
||||
+ * Deprecated since ACPI Spec 6.3.
|
||||
+ */
|
||||
+ build_append_int_noprefix(table_data, 0, 8);
|
||||
+}
|
||||
+
|
||||
+/* Build HMAT sub table structures */
|
||||
+static void hmat_build_table_structs(GArray *table_data, NumaState *numa_state)
|
||||
+{
|
||||
+ uint16_t flags;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < numa_state->num_nodes; i++) {
|
||||
+ flags = 0;
|
||||
+
|
||||
+ if (numa_state->nodes[i].initiator < MAX_NODES) {
|
||||
+ flags |= HMAT_PROXIMITY_INITIATOR_VALID;
|
||||
+ }
|
||||
+
|
||||
+ build_hmat_mpda(table_data, flags, numa_state->nodes[i].initiator, i);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void build_hmat(GArray *table_data, BIOSLinker *linker, NumaState *numa_state)
|
||||
+{
|
||||
+ int hmat_start = table_data->len;
|
||||
+
|
||||
+ /* reserve space for HMAT header */
|
||||
+ acpi_data_push(table_data, 40);
|
||||
+
|
||||
+ hmat_build_table_structs(table_data, numa_state);
|
||||
+
|
||||
+ build_header(linker, table_data,
|
||||
+ (void *)(table_data->data + hmat_start),
|
||||
+ "HMAT", table_data->len - hmat_start, 2, NULL, NULL);
|
||||
+}
|
||||
diff --git a/hw/acpi/hmat.h b/hw/acpi/hmat.h
|
||||
new file mode 100644
|
||||
index 0000000..437dbc6
|
||||
--- /dev/null
|
||||
+++ b/hw/acpi/hmat.h
|
||||
@@ -0,0 +1,42 @@
|
||||
+/*
|
||||
+ * HMAT ACPI Implementation Header
|
||||
+ *
|
||||
+ * Copyright(C) 2019 Intel Corporation.
|
||||
+ *
|
||||
+ * Author:
|
||||
+ * Liu jingqi <jingqi.liu@linux.intel.com>
|
||||
+ * Tao Xu <tao3.xu@intel.com>
|
||||
+ *
|
||||
+ * HMAT is defined in ACPI 6.3: 5.2.27 Heterogeneous Memory Attribute Table
|
||||
+ * (HMAT)
|
||||
+ *
|
||||
+ * 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 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/>
|
||||
+ */
|
||||
+
|
||||
+#ifndef HMAT_H
|
||||
+#define HMAT_H
|
||||
+
|
||||
+#include "hw/acpi/aml-build.h"
|
||||
+
|
||||
+/*
|
||||
+ * ACPI 6.3: 5.2.27.3 Memory Proximity Domain Attributes Structure,
|
||||
+ * Table 5-145, Field "flag", Bit [0]: set to 1 to indicate that data in
|
||||
+ * the Proximity Domain for the Attached Initiator field is valid.
|
||||
+ * Other bits reserved.
|
||||
+ */
|
||||
+#define HMAT_PROXIMITY_INITIATOR_VALID 0x1
|
||||
+
|
||||
+void build_hmat(GArray *table_data, BIOSLinker *linker, NumaState *numa_state);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
|
||||
index 6400189..b1f8c55 100644
|
||||
--- a/hw/i386/acpi-build.c
|
||||
+++ b/hw/i386/acpi-build.c
|
||||
@@ -67,6 +67,7 @@
|
||||
#include "hw/i386/intel_iommu.h"
|
||||
|
||||
#include "hw/acpi/ipmi.h"
|
||||
+#include "hw/acpi/hmat.h"
|
||||
|
||||
/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
|
||||
* -M pc-i440fx-2.0. Even if the actual amount of AML generated grows
|
||||
@@ -2837,6 +2838,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_slit(tables_blob, tables->linker, machine);
|
||||
}
|
||||
+ if (machine->numa_state->hmat_enabled) {
|
||||
+ acpi_add_table(table_offsets, tables_blob);
|
||||
+ build_hmat(tables_blob, tables->linker, machine->numa_state);
|
||||
+ }
|
||||
}
|
||||
if (acpi_get_mcfg(&mcfg)) {
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,137 @@
|
||||
From d00453667cb972dc2fe1242081d3b39313a6a925 Mon Sep 17 00:00:00 2001
|
||||
From: "plai@redhat.com" <plai@redhat.com>
|
||||
Date: Thu, 21 May 2020 23:56:52 +0100
|
||||
Subject: [PATCH 09/12] hmat acpi: Build Memory Side Cache Information
|
||||
Structure(s)
|
||||
|
||||
RH-Author: plai@redhat.com
|
||||
Message-id: <20200521235655.27141-9-plai@redhat.com>
|
||||
Patchwork-id: 96741
|
||||
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 08/11] hmat acpi: Build Memory Side Cache Information Structure(s)
|
||||
Bugzilla: 1600217
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
|
||||
From: Liu Jingqi <jingqi.liu@intel.com>
|
||||
|
||||
This structure describes memory side cache information for memory
|
||||
proximity domains if the memory side cache is present and the
|
||||
physical device forms the memory side cache.
|
||||
The software could use this information to effectively place
|
||||
the data in memory to maximize the performance of the system
|
||||
memory that use the memory side cache.
|
||||
|
||||
Acked-by: Markus Armbruster <armbru@redhat.com>
|
||||
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
||||
Reviewed-by: Daniel Black <daniel@linux.ibm.com>
|
||||
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
||||
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
|
||||
Signed-off-by: Tao Xu <tao3.xu@intel.com>
|
||||
Message-Id: <20191213011929.2520-7-tao3.xu@intel.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit a9c2b841af002db6e21e1297c9026b63fc22c875)
|
||||
Signed-off-by: Paul Lai <plai@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/acpi/hmat.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 68 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c
|
||||
index 4635d45..7c24bb5 100644
|
||||
--- a/hw/acpi/hmat.c
|
||||
+++ b/hw/acpi/hmat.c
|
||||
@@ -143,14 +143,62 @@ static void build_hmat_lb(GArray *table_data, HMAT_LB_Info *hmat_lb,
|
||||
g_free(entry_list);
|
||||
}
|
||||
|
||||
+/* ACPI 6.3: 5.2.27.5 Memory Side Cache Information Structure: Table 5-147 */
|
||||
+static void build_hmat_cache(GArray *table_data, uint8_t total_levels,
|
||||
+ NumaHmatCacheOptions *hmat_cache)
|
||||
+{
|
||||
+ /*
|
||||
+ * Cache Attributes: Bits [3:0] – Total Cache Levels
|
||||
+ * for this Memory Proximity Domain
|
||||
+ */
|
||||
+ uint32_t cache_attr = total_levels;
|
||||
+
|
||||
+ /* Bits [7:4] : Cache Level described in this structure */
|
||||
+ cache_attr |= (uint32_t) hmat_cache->level << 4;
|
||||
+
|
||||
+ /* Bits [11:8] - Cache Associativity */
|
||||
+ cache_attr |= (uint32_t) hmat_cache->associativity << 8;
|
||||
+
|
||||
+ /* Bits [15:12] - Write Policy */
|
||||
+ cache_attr |= (uint32_t) hmat_cache->policy << 12;
|
||||
+
|
||||
+ /* Bits [31:16] - Cache Line size in bytes */
|
||||
+ cache_attr |= (uint32_t) hmat_cache->line << 16;
|
||||
+
|
||||
+ /* Type */
|
||||
+ build_append_int_noprefix(table_data, 2, 2);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Length */
|
||||
+ build_append_int_noprefix(table_data, 32, 4);
|
||||
+ /* Proximity Domain for the Memory */
|
||||
+ build_append_int_noprefix(table_data, hmat_cache->node_id, 4);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 4);
|
||||
+ /* Memory Side Cache Size */
|
||||
+ build_append_int_noprefix(table_data, hmat_cache->size, 8);
|
||||
+ /* Cache Attributes */
|
||||
+ build_append_int_noprefix(table_data, cache_attr, 4);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /*
|
||||
+ * Number of SMBIOS handles (n)
|
||||
+ * Linux kernel uses Memory Side Cache Information Structure
|
||||
+ * without SMBIOS entries for now, so set Number of SMBIOS handles
|
||||
+ * as 0.
|
||||
+ */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+}
|
||||
+
|
||||
/* Build HMAT sub table structures */
|
||||
static void hmat_build_table_structs(GArray *table_data, NumaState *numa_state)
|
||||
{
|
||||
uint16_t flags;
|
||||
uint32_t num_initiator = 0;
|
||||
uint32_t initiator_list[MAX_NODES];
|
||||
- int i, hierarchy, type;
|
||||
+ int i, hierarchy, type, cache_level, total_levels;
|
||||
HMAT_LB_Info *hmat_lb;
|
||||
+ NumaHmatCacheOptions *hmat_cache;
|
||||
|
||||
for (i = 0; i < numa_state->num_nodes; i++) {
|
||||
flags = 0;
|
||||
@@ -184,6 +232,25 @@ static void hmat_build_table_structs(GArray *table_data, NumaState *numa_state)
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * ACPI 6.3: 5.2.27.5 Memory Side Cache Information Structure:
|
||||
+ * Table 5-147
|
||||
+ */
|
||||
+ for (i = 0; i < numa_state->num_nodes; i++) {
|
||||
+ total_levels = 0;
|
||||
+ for (cache_level = 1; cache_level < HMAT_LB_LEVELS; cache_level++) {
|
||||
+ if (numa_state->hmat_cache[i][cache_level]) {
|
||||
+ total_levels++;
|
||||
+ }
|
||||
+ }
|
||||
+ for (cache_level = 0; cache_level <= total_levels; cache_level++) {
|
||||
+ hmat_cache = numa_state->hmat_cache[i][cache_level];
|
||||
+ if (hmat_cache) {
|
||||
+ build_hmat_cache(table_data, total_levels, hmat_cache);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void build_hmat(GArray *table_data, BIOSLinker *linker, NumaState *numa_state)
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,173 @@
|
||||
From f55b8b251c323856087baf2380d93fbf2da15db7 Mon Sep 17 00:00:00 2001
|
||||
From: "plai@redhat.com" <plai@redhat.com>
|
||||
Date: Thu, 21 May 2020 23:56:51 +0100
|
||||
Subject: [PATCH 08/12] hmat acpi: Build System Locality Latency and Bandwidth
|
||||
Information Structure(s)
|
||||
|
||||
RH-Author: plai@redhat.com
|
||||
Message-id: <20200521235655.27141-8-plai@redhat.com>
|
||||
Patchwork-id: 96733
|
||||
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 07/11] hmat acpi: Build System Locality Latency and Bandwidth Information Structure(s)
|
||||
Bugzilla: 1600217
|
||||
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
|
||||
From: Liu Jingqi <jingqi.liu@intel.com>
|
||||
|
||||
This structure describes the memory access latency and bandwidth
|
||||
information from various memory access initiator proximity domains.
|
||||
The latency and bandwidth numbers represented in this structure
|
||||
correspond to rated latency and bandwidth for the platform.
|
||||
The software could use this information as hint for optimization.
|
||||
|
||||
Acked-by: Markus Armbruster <armbru@redhat.com>
|
||||
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
||||
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
|
||||
Signed-off-by: Tao Xu <tao3.xu@intel.com>
|
||||
Message-Id: <20191213011929.2520-6-tao3.xu@intel.com>
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
(cherry picked from commit 4586a2cb833f80b19c80ebe364a005ac2fa0974a)
|
||||
Signed-off-by: Paul Lai <plai@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/acpi/hmat.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 103 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c
|
||||
index 9ff7930..4635d45 100644
|
||||
--- a/hw/acpi/hmat.c
|
||||
+++ b/hw/acpi/hmat.c
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
+#include "qemu/units.h"
|
||||
#include "sysemu/numa.h"
|
||||
#include "hw/acpi/hmat.h"
|
||||
|
||||
@@ -67,11 +68,89 @@ static void build_hmat_mpda(GArray *table_data, uint16_t flags,
|
||||
build_append_int_noprefix(table_data, 0, 8);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * ACPI 6.3: 5.2.27.4 System Locality Latency and Bandwidth Information
|
||||
+ * Structure: Table 5-146
|
||||
+ */
|
||||
+static void build_hmat_lb(GArray *table_data, HMAT_LB_Info *hmat_lb,
|
||||
+ uint32_t num_initiator, uint32_t num_target,
|
||||
+ uint32_t *initiator_list)
|
||||
+{
|
||||
+ int i, index;
|
||||
+ HMAT_LB_Data *lb_data;
|
||||
+ uint16_t *entry_list;
|
||||
+ uint32_t base;
|
||||
+ /* Length in bytes for entire structure */
|
||||
+ uint32_t lb_length
|
||||
+ = 32 /* Table length upto and including Entry Base Unit */
|
||||
+ + 4 * num_initiator /* Initiator Proximity Domain List */
|
||||
+ + 4 * num_target /* Target Proximity Domain List */
|
||||
+ + 2 * num_initiator * num_target; /* Latency or Bandwidth Entries */
|
||||
+
|
||||
+ /* Type */
|
||||
+ build_append_int_noprefix(table_data, 1, 2);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Length */
|
||||
+ build_append_int_noprefix(table_data, lb_length, 4);
|
||||
+ /* Flags: Bits [3:0] Memory Hierarchy, Bits[7:4] Reserved */
|
||||
+ assert(!(hmat_lb->hierarchy >> 4));
|
||||
+ build_append_int_noprefix(table_data, hmat_lb->hierarchy, 1);
|
||||
+ /* Data Type */
|
||||
+ build_append_int_noprefix(table_data, hmat_lb->data_type, 1);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 2);
|
||||
+ /* Number of Initiator Proximity Domains (s) */
|
||||
+ build_append_int_noprefix(table_data, num_initiator, 4);
|
||||
+ /* Number of Target Proximity Domains (t) */
|
||||
+ build_append_int_noprefix(table_data, num_target, 4);
|
||||
+ /* Reserved */
|
||||
+ build_append_int_noprefix(table_data, 0, 4);
|
||||
+
|
||||
+ /* Entry Base Unit */
|
||||
+ if (hmat_lb->data_type <= HMAT_LB_DATA_WRITE_LATENCY) {
|
||||
+ /* Convert latency base from nanoseconds to picosecond */
|
||||
+ base = hmat_lb->base * 1000;
|
||||
+ } else {
|
||||
+ /* Convert bandwidth base from Byte to Megabyte */
|
||||
+ base = hmat_lb->base / MiB;
|
||||
+ }
|
||||
+ build_append_int_noprefix(table_data, base, 8);
|
||||
+
|
||||
+ /* Initiator Proximity Domain List */
|
||||
+ for (i = 0; i < num_initiator; i++) {
|
||||
+ build_append_int_noprefix(table_data, initiator_list[i], 4);
|
||||
+ }
|
||||
+
|
||||
+ /* Target Proximity Domain List */
|
||||
+ for (i = 0; i < num_target; i++) {
|
||||
+ build_append_int_noprefix(table_data, i, 4);
|
||||
+ }
|
||||
+
|
||||
+ /* Latency or Bandwidth Entries */
|
||||
+ entry_list = g_malloc0(num_initiator * num_target * sizeof(uint16_t));
|
||||
+ for (i = 0; i < hmat_lb->list->len; i++) {
|
||||
+ lb_data = &g_array_index(hmat_lb->list, HMAT_LB_Data, i);
|
||||
+ index = lb_data->initiator * num_target + lb_data->target;
|
||||
+
|
||||
+ entry_list[index] = (uint16_t)(lb_data->data / hmat_lb->base);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < num_initiator * num_target; i++) {
|
||||
+ build_append_int_noprefix(table_data, entry_list[i], 2);
|
||||
+ }
|
||||
+
|
||||
+ g_free(entry_list);
|
||||
+}
|
||||
+
|
||||
/* Build HMAT sub table structures */
|
||||
static void hmat_build_table_structs(GArray *table_data, NumaState *numa_state)
|
||||
{
|
||||
uint16_t flags;
|
||||
- int i;
|
||||
+ uint32_t num_initiator = 0;
|
||||
+ uint32_t initiator_list[MAX_NODES];
|
||||
+ int i, hierarchy, type;
|
||||
+ HMAT_LB_Info *hmat_lb;
|
||||
|
||||
for (i = 0; i < numa_state->num_nodes; i++) {
|
||||
flags = 0;
|
||||
@@ -82,6 +161,29 @@ static void hmat_build_table_structs(GArray *table_data, NumaState *numa_state)
|
||||
|
||||
build_hmat_mpda(table_data, flags, numa_state->nodes[i].initiator, i);
|
||||
}
|
||||
+
|
||||
+ for (i = 0; i < numa_state->num_nodes; i++) {
|
||||
+ if (numa_state->nodes[i].has_cpu) {
|
||||
+ initiator_list[num_initiator++] = i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * ACPI 6.3: 5.2.27.4 System Locality Latency and Bandwidth Information
|
||||
+ * Structure: Table 5-146
|
||||
+ */
|
||||
+ for (hierarchy = HMAT_LB_MEM_MEMORY;
|
||||
+ hierarchy <= HMAT_LB_MEM_CACHE_3RD_LEVEL; hierarchy++) {
|
||||
+ for (type = HMAT_LB_DATA_ACCESS_LATENCY;
|
||||
+ type <= HMAT_LB_DATA_WRITE_BANDWIDTH; type++) {
|
||||
+ hmat_lb = numa_state->hmat_lb[hierarchy][type];
|
||||
+
|
||||
+ if (hmat_lb && hmat_lb->list->len) {
|
||||
+ build_hmat_lb(table_data, hmat_lb, num_initiator,
|
||||
+ numa_state->num_nodes, initiator_list);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void build_hmat(GArray *table_data, BIOSLinker *linker, NumaState *numa_state)
|
||||
--
|
||||
1.8.3.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user