diff --git a/kvm-Fix-for-ppc64le-build.patch b/kvm-Fix-for-ppc64le-build.patch new file mode 100644 index 0000000..263286c --- /dev/null +++ b/kvm-Fix-for-ppc64le-build.patch @@ -0,0 +1,73 @@ +From 81c5a3cec15194bf75366813274f63d596f04807 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Mon, 15 Nov 2021 05:46:15 -0500 +Subject: [PATCH 6/6] Fix for ppc64le build + +Although we do not support ppc64 build, there can be some custom builds running +it. Fix code so the ppc64le build is buildable. + +Signed-off-by: Miroslav Rezanina +--- + hw/ppc/spapr.c | 7 +++++-- + target/ppc/kvm.c | 5 ++--- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index 1386e45e70..8699cc3d0c 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -4991,7 +4991,6 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false); + /* + * pseries-2.7 + */ +-#endif + + static bool phb_placement_2_7(SpaprMachineState *spapr, uint32_t index, + uint64_t *buid, hwaddr *pio, +@@ -5047,7 +5046,6 @@ static bool phb_placement_2_7(SpaprMachineState *spapr, uint32_t index, + return true; + } + +-#if 0 /* Disabled for Red Hat Enterprise Linux */ + static void spapr_machine_2_7_class_options(MachineClass *mc) + { + SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc); +@@ -5372,4 +5370,9 @@ static void spapr_machine_rhel760sxxm_class_options(MachineClass *mc) + + DEFINE_SPAPR_MACHINE(rhel760sxxm, "rhel7.6.0-sxxm", false); + ++static void spapr_machine_register_types(void) ++{ ++ type_register_static(&spapr_machine_info); ++} ++ + type_init(spapr_machine_register_types) +diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c +index 0f4f072fbd..154888cce5 100644 +--- a/target/ppc/kvm.c ++++ b/target/ppc/kvm.c +@@ -2560,11 +2560,11 @@ int kvmppc_enable_cap_large_decr(PowerPCCPU *cpu, int enable) + return 0; + } + +-<<<<<<< HEAD + int kvmppc_has_cap_rpt_invalidate(void) + { + return cap_rpt_invalidate; +-======= ++} ++ + bool kvmppc_has_cap_secure_guest(void) + { + return !!cap_ppc_secure_guest; +@@ -2573,7 +2573,6 @@ bool kvmppc_has_cap_secure_guest(void) + int kvmppc_enable_cap_secure_guest(void) + { + return kvm_vm_enable_cap(kvm_state, KVM_CAP_PPC_SECURE_GUEST, 0, 1); +->>>>>>> 89c02f0e37... Add ppc64 machine types + } + + PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) +-- +2.27.0 + diff --git a/kvm-dump-guest-memory-Block-live-migration.patch b/kvm-dump-guest-memory-Block-live-migration.patch new file mode 100644 index 0000000..08da454 --- /dev/null +++ b/kvm-dump-guest-memory-Block-live-migration.patch @@ -0,0 +1,93 @@ +From d1c6d059f8936adf7b8c3e2b29b2eb290b0792ac Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Wed, 22 Sep 2021 12:20:09 -0400 +Subject: [PATCH 3/6] dump-guest-memory: Block live migration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Peter Xu +RH-MergeRequest: 51: dump-guest-memory: Add blocker for migration +RH-Commit: [3/3] 711dcc0018f70bcb87496c5aa235633a6daf5c2d (peterx/qemu-kvm) +RH-Bugzilla: 1996609 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: quintela1 +RH-Acked-by: Laszlo Ersek + +Both dump-guest-memory and live migration caches vm state at the beginning. +Either of them entering the other one will cause race on the vm state, and even +more severe on that (please refer to the crash report in the bug link). + +Let's block live migration in dump-guest-memory, and that'll also block +dump-guest-memory if it detected that we're during a live migration. + +Side note: migrate_del_blocker() can be called even if the blocker is not +inserted yet, so it's safe to unconditionally delete that blocker in +dump_cleanup (g_slist_remove allows no-entry-found case). + +Suggested-by: Dr. David Alan Gilbert +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1996609 +Signed-off-by: Peter Xu +Reviewed-by: Marc-André Lureau +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit b7bc6b182883bb3097dde2a25d041f28bde2b89c) +Signed-off-by: Peter Xu +--- + dump/dump.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/dump/dump.c b/dump/dump.c +index ab625909f3..662d0a62cd 100644 +--- a/dump/dump.c ++++ b/dump/dump.c +@@ -29,6 +29,7 @@ + #include "qemu/error-report.h" + #include "qemu/main-loop.h" + #include "hw/misc/vmcoreinfo.h" ++#include "migration/blocker.h" + + #ifdef TARGET_X86_64 + #include "win_dump.h" +@@ -47,6 +48,8 @@ + + #define MAX_GUEST_NOTE_SIZE (1 << 20) /* 1MB should be enough */ + ++static Error *dump_migration_blocker; ++ + #define ELF_NOTE_SIZE(hdr_size, name_size, desc_size) \ + ((DIV_ROUND_UP((hdr_size), 4) + \ + DIV_ROUND_UP((name_size), 4) + \ +@@ -101,6 +104,7 @@ static int dump_cleanup(DumpState *s) + qemu_mutex_unlock_iothread(); + } + } ++ migrate_del_blocker(dump_migration_blocker); + + return 0; + } +@@ -2005,6 +2009,21 @@ void qmp_dump_guest_memory(bool paging, const char *file, + return; + } + ++ if (!dump_migration_blocker) { ++ error_setg(&dump_migration_blocker, ++ "Live migration disabled: dump-guest-memory in progress"); ++ } ++ ++ /* ++ * Allows even for -only-migratable, but forbid migration during the ++ * process of dump guest memory. ++ */ ++ if (migrate_add_blocker_internal(dump_migration_blocker, errp)) { ++ /* Remember to release the fd before passing it over to dump state */ ++ close(fd); ++ return; ++ } ++ + s = &dump_state_global; + dump_state_prepare(s); + +-- +2.27.0 + diff --git a/kvm-migration-Add-migrate_add_blocker_internal.patch b/kvm-migration-Add-migrate_add_blocker_internal.patch new file mode 100644 index 0000000..f00183f --- /dev/null +++ b/kvm-migration-Add-migrate_add_blocker_internal.patch @@ -0,0 +1,100 @@ +From 58d47d795b91beb1f87929fb07d9f1b4af79cb14 Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Wed, 22 Sep 2021 12:20:08 -0400 +Subject: [PATCH 2/6] migration: Add migrate_add_blocker_internal() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Peter Xu +RH-MergeRequest: 51: dump-guest-memory: Add blocker for migration +RH-Commit: [2/3] 44cf3879ee66cc9974dd3d8a5f9a0d4f762b7c01 (peterx/qemu-kvm) +RH-Bugzilla: 1996609 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: quintela1 +RH-Acked-by: Laszlo Ersek + +An internal version that removes -only-migratable implications. It can be used +for temporary migration blockers like dump-guest-memory. + +Reviewed-by: Marc-André Lureau +Reviewed-by: Juan Quintela +Signed-off-by: Peter Xu +Signed-off-by: Juan Quintela +(cherry picked from commit 60fd680193119e7e4d50eccff7b55a0aadc934ab) +Signed-off-by: Peter Xu +--- + include/migration/blocker.h | 16 ++++++++++++++++ + migration/migration.c | 21 +++++++++++++-------- + 2 files changed, 29 insertions(+), 8 deletions(-) + +diff --git a/include/migration/blocker.h b/include/migration/blocker.h +index acd27018e9..9cebe2ba06 100644 +--- a/include/migration/blocker.h ++++ b/include/migration/blocker.h +@@ -25,6 +25,22 @@ + */ + int migrate_add_blocker(Error *reason, Error **errp); + ++/** ++ * @migrate_add_blocker_internal - prevent migration from proceeding without ++ * only-migrate implications ++ * ++ * @reason - an error to be returned whenever migration is attempted ++ * ++ * @errp - [out] The reason (if any) we cannot block migration right now. ++ * ++ * @returns - 0 on success, -EBUSY on failure, with errp set. ++ * ++ * Some of the migration blockers can be temporary (e.g., for a few seconds), ++ * so it shouldn't need to conflict with "-only-migratable". For those cases, ++ * we can call this function rather than @migrate_add_blocker(). ++ */ ++int migrate_add_blocker_internal(Error *reason, Error **errp); ++ + /** + * @migrate_del_blocker - remove a blocking error from migration + * +diff --git a/migration/migration.c b/migration/migration.c +index f476e2101e..2aaf2fd449 100644 +--- a/migration/migration.c ++++ b/migration/migration.c +@@ -2053,15 +2053,8 @@ void migrate_init(MigrationState *s) + s->threshold_size = 0; + } + +-int migrate_add_blocker(Error *reason, Error **errp) ++int migrate_add_blocker_internal(Error *reason, Error **errp) + { +- if (only_migratable) { +- error_propagate_prepend(errp, error_copy(reason), +- "disallowing migration blocker " +- "(--only-migratable) for: "); +- return -EACCES; +- } +- + /* Snapshots are similar to migrations, so check RUN_STATE_SAVE_VM too. */ + if (runstate_check(RUN_STATE_SAVE_VM) || !migration_is_idle()) { + error_propagate_prepend(errp, error_copy(reason), +@@ -2074,6 +2067,18 @@ int migrate_add_blocker(Error *reason, Error **errp) + return 0; + } + ++int migrate_add_blocker(Error *reason, Error **errp) ++{ ++ if (only_migratable) { ++ error_propagate_prepend(errp, error_copy(reason), ++ "disallowing migration blocker " ++ "(--only-migratable) for: "); ++ return -EACCES; ++ } ++ ++ return migrate_add_blocker_internal(reason, errp); ++} ++ + void migrate_del_blocker(Error *reason) + { + migration_blockers = g_slist_remove(migration_blockers, reason); +-- +2.27.0 + diff --git a/kvm-migration-Make-migration-blocker-work-for-snapshots-.patch b/kvm-migration-Make-migration-blocker-work-for-snapshots-.patch new file mode 100644 index 0000000..afdbdb1 --- /dev/null +++ b/kvm-migration-Make-migration-blocker-work-for-snapshots-.patch @@ -0,0 +1,61 @@ +From 0a9b55b44c5c548ff6f3da7335acf2138ecb4376 Mon Sep 17 00:00:00 2001 +From: Peter Xu +Date: Wed, 22 Sep 2021 12:20:07 -0400 +Subject: [PATCH 1/6] migration: Make migration blocker work for snapshots too +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Peter Xu +RH-MergeRequest: 51: dump-guest-memory: Add blocker for migration +RH-Commit: [1/3] 241888d12c7197dd4ee1e1ba6e3115f70901636e (peterx/qemu-kvm) +RH-Bugzilla: 1996609 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: quintela1 +RH-Acked-by: Laszlo Ersek + +save_snapshot() checks migration blocker, which looks sane. At the meantime we +should also teach the blocker add helper to fail if during a snapshot, just +like for migrations. + +Reviewed-by: Marc-André Lureau +Signed-off-by: Peter Xu +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 4c170330aae4a4ed75c3a8638b7d4c5d9f365244) +Signed-off-by: Peter Xu +--- + migration/migration.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/migration/migration.c b/migration/migration.c +index 041b8451a6..f476e2101e 100644 +--- a/migration/migration.c ++++ b/migration/migration.c +@@ -2062,15 +2062,16 @@ int migrate_add_blocker(Error *reason, Error **errp) + return -EACCES; + } + +- if (migration_is_idle()) { +- migration_blockers = g_slist_prepend(migration_blockers, reason); +- return 0; ++ /* Snapshots are similar to migrations, so check RUN_STATE_SAVE_VM too. */ ++ if (runstate_check(RUN_STATE_SAVE_VM) || !migration_is_idle()) { ++ error_propagate_prepend(errp, error_copy(reason), ++ "disallowing migration blocker " ++ "(migration/snapshot in progress) for: "); ++ return -EBUSY; + } + +- error_propagate_prepend(errp, error_copy(reason), +- "disallowing migration blocker " +- "(migration in progress) for: "); +- return -EBUSY; ++ migration_blockers = g_slist_prepend(migration_blockers, reason); ++ return 0; + } + + void migrate_del_blocker(Error *reason) +-- +2.27.0 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index c826698..5f3f3d0 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -103,8 +103,8 @@ %endif %global target_list %{kvm_target}-softmmu -%global block_drivers_rw_list qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle -%global block_drivers_ro_list vmdk,vhdx,vpc,https,ssh +%global block_drivers_rw_list qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress +%global block_drivers_ro_list vdi,vmdk,vhdx,vpc,https,ssh %define qemudocdir %{_docdir}/%{name} %global firmwaredirs "%{_datadir}/qemu-firmware:%{_datadir}/ipxe/qemu:%{_datadir}/seavgabios:%{_datadir}/seabios" @@ -133,7 +133,7 @@ Obsoletes: %{name}-block-iscsi <= %{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 6.1.0 -Release: 6%{?rcrel}%{?dist}%{?cc_suffix} +Release: 7%{?rcrel}%{?dist}%{?cc_suffix} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped # Epoch 15 used for RHEL 8 # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) @@ -194,6 +194,13 @@ Patch23: kvm-redhat-Add-s390x-machine-type-compatibility-update-f.patch Patch24: kvm-virtio-balloon-Fix-page-poison-subsection-name.patch # For bz#1998942 - Add machine type compatibility update for 6.1 rebase [aarch64] Patch25: kvm-hw-arm-virt-Add-hw_compat_rhel_8_5-to-8.5-machine-ty.patch +# For bz#1996609 - Qemu hit core dump when dump guest memory during live migration +Patch26: kvm-migration-Make-migration-blocker-work-for-snapshots-.patch +# For bz#1996609 - Qemu hit core dump when dump guest memory during live migration +Patch27: kvm-migration-Add-migrate_add_blocker_internal.patch +# For bz#1996609 - Qemu hit core dump when dump guest memory during live migration +Patch28: kvm-dump-guest-memory-Block-live-migration.patch +Patch29: kvm-Fix-for-ppc64le-build.patch # Source-git patches @@ -686,6 +693,7 @@ run_configure \ %if %{have_usbredir} --enable-usb-redir \ %endif + --enable-vdi \ --enable-virtiofsd \ --enable-vhost-kernel \ --enable-vhost-net \ @@ -1185,6 +1193,19 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Fri Nov 19 2021 Miroslav Rezanina - 6.1.0-7 +- kvm-migration-Make-migration-blocker-work-for-snapshots-.patch [bz#1996609] +- kvm-migration-Add-migrate_add_blocker_internal.patch [bz#1996609] +- kvm-dump-guest-memory-Block-live-migration.patch [bz#1996609] +- kvm-spec-Build-the-VDI-block-driver.patch [bz#2013331] +- kvm-spec-Explicitly-include-compress-filter.patch [bz#1980035] +- Resolves: bz#1996609 + (Qemu hit core dump when dump guest memory during live migration) +- Resolves: bz#2013331 + (RFE: qemu-img cannot convert from vdi format) +- Resolves: bz#1980035 + (RFE: Enable compress filter so we can create new, compressed qcow2 files via qemu-nbd) + * Mon Oct 18 2021 Miroslav Rezanina - 6.1.0-6 - kvm-hw-arm-virt-Add-hw_compat_rhel_8_5-to-8.5-machine-ty.patch [bz#1998942] - Resolves: bz#1998942