From b855dce76d1a7b2525e7a93902e0c6eca317162f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 6 Jun 2019 12:58:15 +0200 Subject: [PATCH] update patches for v4.0.0 Signed-off-by: Thomas Lamprecht --- ...iothread-access-by-mon-use_io_thread.patch | 36 -- ...0001-target-i386-add-MDS-NO-feature.patch} | 10 +- ...itor-delay-monitor-iothread-creation.patch | 114 ---- ...002-target-i386-define-md-clear-bit.patch} | 10 +- ...to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch | 146 ------ ...it-and-feature-words-for-IA32_ARCH_C.patch | 54 -- ...-indices-for-IA32_PRED_CMD-and-IA32_.patch | 36 -- ...re-changes-to-support-MSR-based-feat.patch | 485 ------------------ ...-MSR-based-feature-word-FEATURE_WORD.patch | 113 ---- ...k-file-change-locking-default-to-off.patch | 9 +- ...djust-network-script-path-to-etc-kvm.patch | 7 +- ...e-CPU-model-to-kvm64-32-instead-of-.patch} | 7 +- .../0003-PVE-Config-use-kvm-by-default.patch | 27 - ...i-spice-default-to-pve-certificates.patch} | 5 +- ...0005-PVE-Config-smm_available-false.patch} | 7 +- ...rfs-no-default-logfile-if-daemonize.patch} | 17 +- ...ock-rbd-disable-rbd_cache_writethro.patch} | 5 +- ...0008-PVE-Up-qmp-add-get_link_status.patch} | 25 +- ...VE-Up-glusterfs-allow-partial-reads.patch} | 18 +- ...eturn-success-on-info-without-snaps.patch} | 7 +- ...d-add-osize-and-read-from-to-stdin-.patch} | 142 ++--- ...-Up-qemu-img-dd-add-isize-parameter.patch} | 15 +- ...VE-Up-qemu-img-dd-add-n-skip_create.patch} | 13 +- ...irtio-balloon-improve-query-balloon.patch} | 16 +- ...0015-PVE-qapi-modify-query-machines.patch} | 14 +- ...=> 0016-PVE-qapi-modify-spice-query.patch} | 10 +- ...=> 0017-PVE-internal-snapshot-async.patch} | 95 ++-- ...dd-the-zeroinit-block-driver-filter.patch} | 15 +- ...h => 0019-PVE-backup-modify-job-api.patch} | 28 +- ...backup-introduce-vma-archive-format.patch} | 159 +++--- ...PVE-Deprecated-adding-old-vma-files.patch} | 145 +++--- ...tling-options-to-drive-mapping-fifo.patch} | 5 +- ...-vma-add-cache-option-to-device-map.patch} | 3 +- ...E-vma-remove-forced-NO_FLUSH-option.patch} | 3 +- ...Add-dummy-id-command-line-parameter.patch} | 13 +- ...-target-i386-disable-LINT0-after-re.patch} | 4 +- ...e-posix-make-locking-optiono-on-cre.patch} | 52 +- ...se-of-md-clear-feature-on-all-Intel-.patch | 47 ++ ...c-kick-AIO-wait-on-block-state-write.patch | 25 + ...ve-snapshot-cleanup-into-bottom-half.patch | 41 ++ ...1-PVE-monitor-disable-oob-capability.patch | 38 ++ debian/patches/series | 66 ++- 42 files changed, 633 insertions(+), 1454 deletions(-) delete mode 100644 debian/patches/extra/0001-monitor-guard-iothread-access-by-mon-use_io_thread.patch rename debian/patches/extra/{0008-target-i386-add-MDS-NO-feature.patch => 0001-target-i386-add-MDS-NO-feature.patch} (84%) delete mode 100644 debian/patches/extra/0002-monitor-delay-monitor-iothread-creation.patch rename debian/patches/extra/{0009-target-i386-define-md-clear-bit.patch => 0002-target-i386-define-md-clear-bit.patch} (82%) delete mode 100644 debian/patches/extra/0003-kvm-Add-support-to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch delete mode 100644 debian/patches/extra/0004-i386-Add-CPUID-bit-and-feature-words-for-IA32_ARCH_C.patch delete mode 100644 debian/patches/extra/0005-i386-Add-new-MSR-indices-for-IA32_PRED_CMD-and-IA32_.patch delete mode 100644 debian/patches/extra/0006-x86-Data-structure-changes-to-support-MSR-based-feat.patch delete mode 100644 debian/patches/extra/0007-x86-define-a-new-MSR-based-feature-word-FEATURE_WORD.patch rename debian/patches/pve/{0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch => 0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch} (83%) delete mode 100644 debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch rename debian/patches/pve/{0005-PVE-Config-ui-spice-default-to-pve-certificates.patch => 0004-PVE-Config-ui-spice-default-to-pve-certificates.patch} (94%) rename debian/patches/pve/{0006-PVE-Config-smm_available-false.patch => 0005-PVE-Config-smm_available-false.patch} (79%) rename debian/patches/pve/{0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch => 0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch} (76%) rename debian/patches/pve/{0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch => 0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch} (91%) rename debian/patches/pve/{0009-PVE-Up-qmp-add-get_link_status.patch => 0008-PVE-Up-qmp-add-get_link_status.patch} (82%) rename debian/patches/pve/{0010-PVE-Up-glusterfs-allow-partial-reads.patch => 0009-PVE-Up-glusterfs-allow-partial-reads.patch} (82%) rename debian/patches/pve/{0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch => 0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch} (79%) rename debian/patches/pve/{0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch => 0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch} (93%) rename debian/patches/pve/{0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch => 0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch} (87%) rename debian/patches/pve/{0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch => 0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch} (84%) rename debian/patches/pve/{0015-PVE-virtio-balloon-improve-query-balloon.patch => 0014-PVE-virtio-balloon-improve-query-balloon.patch} (93%) rename debian/patches/pve/{0016-PVE-qapi-modify-query-machines.patch => 0015-PVE-qapi-modify-query-machines.patch} (84%) rename debian/patches/pve/{0017-PVE-qapi-modify-spice-query.patch => 0016-PVE-qapi-modify-spice-query.patch} (87%) rename debian/patches/pve/{0018-PVE-internal-snapshot-async.patch => 0017-PVE-internal-snapshot-async.patch} (94%) rename debian/patches/pve/{0019-PVE-block-add-the-zeroinit-block-driver-filter.patch => 0018-PVE-block-add-the-zeroinit-block-driver-filter.patch} (95%) rename debian/patches/pve/{0020-PVE-backup-modify-job-api.patch => 0019-PVE-backup-modify-job-api.patch} (84%) rename debian/patches/pve/{0021-PVE-backup-introduce-vma-archive-format.patch => 0020-PVE-backup-introduce-vma-archive-format.patch} (94%) rename debian/patches/pve/{0022-PVE-Deprecated-adding-old-vma-files.patch => 0021-PVE-Deprecated-adding-old-vma-files.patch} (96%) rename debian/patches/pve/{0023-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch => 0022-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch} (97%) rename debian/patches/pve/{0024-PVE-vma-add-cache-option-to-device-map.patch => 0023-PVE-vma-add-cache-option-to-device-map.patch} (98%) rename debian/patches/pve/{0025-PVE-vma-remove-forced-NO_FLUSH-option.patch => 0024-PVE-vma-remove-forced-NO_FLUSH-option.patch} (93%) rename debian/patches/pve/{0026-PVE-Add-dummy-id-command-line-parameter.patch => 0025-PVE-Add-dummy-id-command-line-parameter.patch} (84%) rename debian/patches/pve/{0027-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch => 0026-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch} (93%) rename debian/patches/pve/{0028-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch => 0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch} (68%) create mode 100644 debian/patches/pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch create mode 100644 debian/patches/pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch create mode 100644 debian/patches/pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch create mode 100644 debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch diff --git a/debian/patches/extra/0001-monitor-guard-iothread-access-by-mon-use_io_thread.patch b/debian/patches/extra/0001-monitor-guard-iothread-access-by-mon-use_io_thread.patch deleted file mode 100644 index 136a2a6..0000000 --- a/debian/patches/extra/0001-monitor-guard-iothread-access-by-mon-use_io_thread.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Tue, 25 Sep 2018 10:15:06 +0200 -Subject: [PATCH] monitor: guard iothread access by mon->use_io_thread - -monitor_resume() and monitor_suspend() both want to -"kick" the I/O thread if it is there, but in -monitor_suspend() lacked the use_io_thread flag condition. -This is required when we later only spawn the thread on -first use. - -Signed-off-by: Wolfgang Bumiller -Reviewed-by: Eric Blake -Reviewed-by: Peter Xu -Message-Id: <20180925081507.11873-2-w.bumiller@proxmox.com> -Signed-off-by: Markus Armbruster ---- - monitor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/monitor.c b/monitor.c -index a1999e396c..836c0bbdaa 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -4376,7 +4376,7 @@ int monitor_suspend(Monitor *mon) - - atomic_inc(&mon->suspend_cnt); - -- if (monitor_is_qmp(mon)) { -+ if (monitor_is_qmp(mon) && mon->use_io_thread) { - /* - * Kick I/O thread to make sure this takes effect. It'll be - * evaluated again in prepare() of the watch object. --- -2.11.0 - diff --git a/debian/patches/extra/0008-target-i386-add-MDS-NO-feature.patch b/debian/patches/extra/0001-target-i386-add-MDS-NO-feature.patch similarity index 84% rename from debian/patches/extra/0008-target-i386-add-MDS-NO-feature.patch rename to debian/patches/extra/0001-target-i386-add-MDS-NO-feature.patch index 6da1947..7b69dd0 100644 --- a/debian/patches/extra/0008-target-i386-add-MDS-NO-feature.patch +++ b/debian/patches/extra/0001-target-i386-add-MDS-NO-feature.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 16 May 2019 20:53:20 +0200 -Subject: [PATCH 8/9] target/i386: add MDS-NO feature +Subject: [PATCH] target/i386: add MDS-NO feature Microarchitectural Data Sampling is a hardware vulnerability which allows unprivileged speculative access to data which is available in various CPU @@ -14,15 +14,16 @@ MSR to report that they are not vulnerable, make it available to guests. Signed-off-by: Paolo Bonzini Message-Id: <20190516185320.28340-1-pbonzini@redhat.com> Signed-off-by: Eduardo Habkost +Signed-off-by: Thomas Lamprecht --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index a64aa8793e..02b64f730c 100644 +index d6bb57d210..ee4b8b47e2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c -@@ -1146,7 +1146,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { +@@ -1183,7 +1183,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .type = MSR_FEATURE_WORD, .feat_names = { "rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry", @@ -31,6 +32,3 @@ index a64aa8793e..02b64f730c 100644 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, --- -2.20.1 - diff --git a/debian/patches/extra/0002-monitor-delay-monitor-iothread-creation.patch b/debian/patches/extra/0002-monitor-delay-monitor-iothread-creation.patch deleted file mode 100644 index 7a9cda7..0000000 --- a/debian/patches/extra/0002-monitor-delay-monitor-iothread-creation.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Tue, 25 Sep 2018 10:15:07 +0200 -Subject: [PATCH] monitor: delay monitor iothread creation - -Commit d32749deb615 moved the call to monitor_init_globals() -to before os_daemonize(), making it an unsuitable place to -spawn the monitor iothread as it won't be inherited over the -fork() in os_daemonize(). - -We now spawn the thread the first time we instantiate a -monitor which actually has use_io_thread == true. -Instantiation of monitors happens only after os_daemonize(). -We still need to create the qmp_dispatcher_bh when not using -iothreads, so this now still happens in -monitor_init_globals(). - -Signed-off-by: Wolfgang Bumiller -Fixes: d32749deb615 ("monitor: move init global earlier") -Message-Id: <20180925081507.11873-3-w.bumiller@proxmox.com> -Reviewed-by: Eric Blake -Reviewed-by: Peter Xu -Tested-by: Peter Xu -[This fixes a crash on shutdown with --daemonize] -Signed-off-by: Markus Armbruster ---- - monitor.c | 36 ++++++++++++++++++++++-------------- - 1 file changed, 22 insertions(+), 14 deletions(-) - -diff --git a/monitor.c b/monitor.c -index 836c0bbdaa..c7eae64fd9 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -807,9 +807,14 @@ static void monitor_qapi_event_init(void) - - static void handle_hmp_command(Monitor *mon, const char *cmdline); - -+static void monitor_iothread_init(void); -+ - static void monitor_data_init(Monitor *mon, bool skip_flush, - bool use_io_thread) - { -+ if (use_io_thread && !mon_iothread) { -+ monitor_iothread_init(); -+ } - memset(mon, 0, sizeof(Monitor)); - qemu_mutex_init(&mon->mon_lock); - qemu_mutex_init(&mon->qmp.qmp_queue_lock); -@@ -4544,6 +4549,15 @@ static AioContext *monitor_get_aio_context(void) - static void monitor_iothread_init(void) - { - mon_iothread = iothread_create("mon_iothread", &error_abort); -+} -+ -+void monitor_init_globals(void) -+{ -+ monitor_init_qmp_commands(); -+ monitor_qapi_event_init(); -+ sortcmdlist(); -+ qemu_mutex_init(&monitor_lock); -+ qemu_mutex_init(&mon_fdsets_lock); - - /* - * The dispatcher BH must run in the main loop thread, since we -@@ -4559,21 +4573,11 @@ static void monitor_iothread_init(void) - * monitors that are using the I/O thread have their output - * written by the I/O thread. - */ -- qmp_respond_bh = aio_bh_new(monitor_get_aio_context(), -+ qmp_respond_bh = aio_bh_new(iohandler_get_aio_context(), - monitor_qmp_bh_responder, - NULL); - } - --void monitor_init_globals(void) --{ -- monitor_init_qmp_commands(); -- monitor_qapi_event_init(); -- sortcmdlist(); -- qemu_mutex_init(&monitor_lock); -- qemu_mutex_init(&mon_fdsets_lock); -- monitor_iothread_init(); --} -- - /* These functions just adapt the readline interface in a typesafe way. We - * could cast function pointers but that discards compiler checks. - */ -@@ -4711,7 +4715,9 @@ void monitor_cleanup(void) - * we need to unregister from chardev below in - * monitor_data_destroy(), and chardev is not thread-safe yet - */ -- iothread_stop(mon_iothread); -+ if (mon_iothread) { -+ iothread_stop(mon_iothread); -+ } - - /* - * Flush all response queues. Note that even after this flush, -@@ -4735,8 +4741,10 @@ void monitor_cleanup(void) - qemu_bh_delete(qmp_respond_bh); - qmp_respond_bh = NULL; - -- iothread_destroy(mon_iothread); -- mon_iothread = NULL; -+ if (mon_iothread) { -+ iothread_destroy(mon_iothread); -+ mon_iothread = NULL; -+ } - } - - QemuOptsList qemu_mon_opts = { --- -2.11.0 - diff --git a/debian/patches/extra/0009-target-i386-define-md-clear-bit.patch b/debian/patches/extra/0002-target-i386-define-md-clear-bit.patch similarity index 82% rename from debian/patches/extra/0009-target-i386-define-md-clear-bit.patch rename to debian/patches/extra/0002-target-i386-define-md-clear-bit.patch index 445a6f6..e638235 100644 --- a/debian/patches/extra/0009-target-i386-define-md-clear-bit.patch +++ b/debian/patches/extra/0002-target-i386-define-md-clear-bit.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 15 May 2019 15:10:10 +0100 -Subject: [PATCH 9/9] target/i386: define md-clear bit +Subject: [PATCH] target/i386: define md-clear bit md-clear is a new CPUID bit which is set when microcode provides the mechanism to invoke a flush of various exploitable CPU buffers by invoking @@ -10,15 +10,16 @@ the VERW instruction. Signed-off-by: Paolo Bonzini Message-Id: <20190515141011.5315-2-berrange@redhat.com> Signed-off-by: Eduardo Habkost +Signed-off-by: Thomas Lamprecht --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index 02b64f730c..5ddcd72c9c 100644 +index ee4b8b47e2..331a364a1b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c -@@ -1038,7 +1038,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { +@@ -1076,7 +1076,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .feat_names = { NULL, NULL, "avx512-4vnniw", "avx512-4fmaps", NULL, NULL, NULL, NULL, @@ -27,6 +28,3 @@ index 02b64f730c..5ddcd72c9c 100644 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, --- -2.20.1 - diff --git a/debian/patches/extra/0003-kvm-Add-support-to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch b/debian/patches/extra/0003-kvm-Add-support-to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch deleted file mode 100644 index a1b80a9..0000000 --- a/debian/patches/extra/0003-kvm-Add-support-to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Hoo -Date: Mon, 15 Oct 2018 12:47:23 +0800 -Subject: [PATCH 3/9] kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and - KVM_GET_MSRS system ioctl - -Add kvm_get_supported_feature_msrs() to get supported MSR feature index list. -Add kvm_arch_get_supported_msr_feature() to get each MSR features value. - -Signed-off-by: Robert Hoo -Message-Id: <1539578845-37944-2-git-send-email-robert.hu@linux.intel.com> -Reviewed-by: Eduardo Habkost -Signed-off-by: Eduardo Habkost ---- - include/sysemu/kvm.h | 2 ++ - target/i386/kvm.c | 80 ++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 82 insertions(+) - -diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h -index 0b64b8e067..97d8d9d0d5 100644 ---- a/include/sysemu/kvm.h -+++ b/include/sysemu/kvm.h -@@ -463,6 +463,8 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension); - - uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, - uint32_t index, int reg); -+uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index); -+ - - void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len); - -diff --git a/target/i386/kvm.c b/target/i386/kvm.c -index 9313602d3d..cd45c79169 100644 ---- a/target/i386/kvm.c -+++ b/target/i386/kvm.c -@@ -107,6 +107,7 @@ static int has_pit_state2; - static bool has_msr_mcg_ext_ctl; - - static struct kvm_cpuid2 *cpuid_cache; -+static struct kvm_msr_list *kvm_feature_msrs; - - int kvm_has_pit_state2(void) - { -@@ -420,6 +421,42 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, - return ret; - } - -+uint32_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index) -+{ -+ struct { -+ struct kvm_msrs info; -+ struct kvm_msr_entry entries[1]; -+ } msr_data; -+ uint32_t ret; -+ -+ if (kvm_feature_msrs == NULL) { /* Host doesn't support feature MSRs */ -+ return 0; -+ } -+ -+ /* Check if requested MSR is supported feature MSR */ -+ int i; -+ for (i = 0; i < kvm_feature_msrs->nmsrs; i++) -+ if (kvm_feature_msrs->indices[i] == index) { -+ break; -+ } -+ if (i == kvm_feature_msrs->nmsrs) { -+ return 0; /* if the feature MSR is not supported, simply return 0 */ -+ } -+ -+ msr_data.info.nmsrs = 1; -+ msr_data.entries[0].index = index; -+ -+ ret = kvm_ioctl(s, KVM_GET_MSRS, &msr_data); -+ if (ret != 1) { -+ error_report("KVM get MSR (index=0x%x) feature failed, %s", -+ index, strerror(-ret)); -+ exit(1); -+ } -+ -+ return msr_data.entries[0].data; -+} -+ -+ - typedef struct HWPoisonPage { - ram_addr_t ram_addr; - QLIST_ENTRY(HWPoisonPage) list; -@@ -1239,6 +1276,47 @@ void kvm_arch_do_init_vcpu(X86CPU *cpu) - } - } - -+static int kvm_get_supported_feature_msrs(KVMState *s) -+{ -+ int ret = 0; -+ -+ if (kvm_feature_msrs != NULL) { -+ return 0; -+ } -+ -+ if (!kvm_check_extension(s, KVM_CAP_GET_MSR_FEATURES)) { -+ return 0; -+ } -+ -+ struct kvm_msr_list msr_list; -+ -+ msr_list.nmsrs = 0; -+ ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, &msr_list); -+ if (ret < 0 && ret != -E2BIG) { -+ error_report("Fetch KVM feature MSR list failed: %s", -+ strerror(-ret)); -+ return ret; -+ } -+ -+ assert(msr_list.nmsrs > 0); -+ kvm_feature_msrs = (struct kvm_msr_list *) \ -+ g_malloc0(sizeof(msr_list) + -+ msr_list.nmsrs * sizeof(msr_list.indices[0])); -+ -+ kvm_feature_msrs->nmsrs = msr_list.nmsrs; -+ ret = kvm_ioctl(s, KVM_GET_MSR_FEATURE_INDEX_LIST, kvm_feature_msrs); -+ -+ if (ret < 0) { -+ error_report("Fetch KVM feature MSR list failed: %s", -+ strerror(-ret)); -+ g_free(kvm_feature_msrs); -+ kvm_feature_msrs = NULL; -+ return ret; -+ } -+ -+ return 0; -+} -+ - static int kvm_get_supported_msrs(KVMState *s) - { - static int kvm_supported_msrs; -@@ -1400,6 +1478,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s) - return ret; - } - -+ kvm_get_supported_feature_msrs(s); -+ - uname(&utsname); - lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0; - --- -2.20.1 - diff --git a/debian/patches/extra/0004-i386-Add-CPUID-bit-and-feature-words-for-IA32_ARCH_C.patch b/debian/patches/extra/0004-i386-Add-CPUID-bit-and-feature-words-for-IA32_ARCH_C.patch deleted file mode 100644 index a41a203..0000000 --- a/debian/patches/extra/0004-i386-Add-CPUID-bit-and-feature-words-for-IA32_ARCH_C.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Hoo -Date: Thu, 5 Jul 2018 17:09:55 +0800 -Subject: [PATCH 4/9] i386: Add CPUID bit and feature words for - IA32_ARCH_CAPABILITIES MSR - -Support of IA32_PRED_CMD MSR already be enumerated by same CPUID bit as -SPEC_CTRL. - -At present, mark CPUID_7_0_EDX_ARCH_CAPABILITIES unmigratable, per Paolo's -comment. - -Signed-off-by: Robert Hoo -Message-Id: <1530781798-183214-3-git-send-email-robert.hu@linux.intel.com> -Signed-off-by: Eduardo Habkost ---- - target/i386/cpu.c | 3 ++- - target/i386/cpu.h | 1 + - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index 3ac627978f..1d74be02ce 100644 ---- a/target/i386/cpu.c -+++ b/target/i386/cpu.c -@@ -1006,12 +1006,13 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, "spec-ctrl", NULL, -- NULL, NULL, NULL, "ssbd", -+ NULL, "arch-capabilities", NULL, "ssbd", - }, - .cpuid_eax = 7, - .cpuid_needs_ecx = true, .cpuid_ecx = 0, - .cpuid_reg = R_EDX, - .tcg_features = TCG_7_0_EDX_FEATURES, -+ .unmigratable_flags = CPUID_7_0_EDX_ARCH_CAPABILITIES, - }, - [FEAT_8000_0007_EDX] = { - .feat_names = { -diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index 93ede116d1..58ae637edc 100644 ---- a/target/i386/cpu.h -+++ b/target/i386/cpu.h -@@ -688,6 +688,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; - #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network Instructions */ - #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */ - #define CPUID_7_0_EDX_SPEC_CTRL (1U << 26) /* Speculation Control */ -+#define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29) /*Arch Capabilities*/ - #define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31) /* Speculative Store Bypass Disable */ - - #define CPUID_8000_0008_EBX_IBPB (1U << 12) /* Indirect Branch Prediction Barrier */ --- -2.20.1 - diff --git a/debian/patches/extra/0005-i386-Add-new-MSR-indices-for-IA32_PRED_CMD-and-IA32_.patch b/debian/patches/extra/0005-i386-Add-new-MSR-indices-for-IA32_PRED_CMD-and-IA32_.patch deleted file mode 100644 index 261f4a0..0000000 --- a/debian/patches/extra/0005-i386-Add-new-MSR-indices-for-IA32_PRED_CMD-and-IA32_.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Hoo -Date: Thu, 5 Jul 2018 17:09:54 +0800 -Subject: [PATCH 5/9] i386: Add new MSR indices for IA32_PRED_CMD and - IA32_ARCH_CAPABILITIES - -IA32_PRED_CMD MSR gives software a way to issue commands that affect the state -of indirect branch predictors. Enumerated by CPUID.(EAX=7H,ECX=0):EDX[26]. -IA32_ARCH_CAPABILITIES MSR enumerates architectural features of RDCL_NO and -IBRS_ALL. Enumerated by CPUID.(EAX=07H, ECX=0):EDX[29]. - -https://software.intel.com/sites/default/files/managed/c5/63/336996-Speculative-Execution-Side-Channel-Mitigations.pdf - -Signed-off-by: Robert Hoo -Message-Id: <1530781798-183214-2-git-send-email-robert.hu@linux.intel.com> -Signed-off-by: Eduardo Habkost ---- - target/i386/cpu.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index 58ae637edc..fb2f5f6ebc 100644 ---- a/target/i386/cpu.h -+++ b/target/i386/cpu.h -@@ -354,6 +354,8 @@ typedef enum X86Seg { - #define MSR_TSC_ADJUST 0x0000003b - #define MSR_IA32_SPEC_CTRL 0x48 - #define MSR_VIRT_SSBD 0xc001011f -+#define MSR_IA32_PRED_CMD 0x49 -+#define MSR_IA32_ARCH_CAPABILITIES 0x10a - #define MSR_IA32_TSCDEADLINE 0x6e0 - - #define FEATURE_CONTROL_LOCKED (1<<0) --- -2.20.1 - diff --git a/debian/patches/extra/0006-x86-Data-structure-changes-to-support-MSR-based-feat.patch b/debian/patches/extra/0006-x86-Data-structure-changes-to-support-MSR-based-feat.patch deleted file mode 100644 index 278325c..0000000 --- a/debian/patches/extra/0006-x86-Data-structure-changes-to-support-MSR-based-feat.patch +++ /dev/null @@ -1,485 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Hoo -Date: Mon, 15 Oct 2018 12:47:24 +0800 -Subject: [PATCH 6/9] x86: Data structure changes to support MSR based features - -Add FeatureWordType indicator in struct FeatureWordInfo. -Change feature_word_info[] accordingly. -Change existing functions that refer to feature_word_info[] accordingly. - -Signed-off-by: Robert Hoo -Message-Id: <1539578845-37944-3-git-send-email-robert.hu@linux.intel.com> -[ehabkost: fixed hvf_enabled() case] -Signed-off-by: Eduardo Habkost ---- - target/i386/cpu.c | 197 +++++++++++++++++++++++++++++++++------------- - 1 file changed, 142 insertions(+), 55 deletions(-) - -diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index 1d74be02ce..d2985144a3 100644 ---- a/target/i386/cpu.c -+++ b/target/i386/cpu.c -@@ -770,17 +770,36 @@ static void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, - /* missing: - CPUID_XSAVE_XSAVEC, CPUID_XSAVE_XSAVES */ - -+typedef enum FeatureWordType { -+ CPUID_FEATURE_WORD, -+ MSR_FEATURE_WORD, -+} FeatureWordType; -+ - typedef struct FeatureWordInfo { -+ FeatureWordType type; - /* feature flags names are taken from "Intel Processor Identification and - * the CPUID Instruction" and AMD's "CPUID Specification". - * In cases of disagreement between feature naming conventions, - * aliases may be added. - */ - const char *feat_names[32]; -- uint32_t cpuid_eax; /* Input EAX for CPUID */ -- bool cpuid_needs_ecx; /* CPUID instruction uses ECX as input */ -- uint32_t cpuid_ecx; /* Input ECX value for CPUID */ -- int cpuid_reg; /* output register (R_* constant) */ -+ union { -+ /* If type==CPUID_FEATURE_WORD */ -+ struct { -+ uint32_t eax; /* Input EAX for CPUID */ -+ bool needs_ecx; /* CPUID instruction uses ECX as input */ -+ uint32_t ecx; /* Input ECX value for CPUID */ -+ int reg; /* output register (R_* constant) */ -+ } cpuid; -+ /* If type==MSR_FEATURE_WORD */ -+ struct { -+ uint32_t index; -+ struct { /*CPUID that enumerate this MSR*/ -+ FeatureWord cpuid_class; -+ uint32_t cpuid_flag; -+ } cpuid_dep; -+ } msr; -+ }; - uint32_t tcg_features; /* Feature flags supported by TCG */ - uint32_t unmigratable_flags; /* Feature flags known to be unmigratable */ - uint32_t migratable_flags; /* Feature flags known to be migratable */ -@@ -790,6 +809,7 @@ typedef struct FeatureWordInfo { - - static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - [FEAT_1_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "fpu", "vme", "de", "pse", - "tsc", "msr", "pae", "mce", -@@ -800,10 +820,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "fxsr", "sse", "sse2", "ss", - "ht" /* Intel htt */, "tm", "ia64", "pbe", - }, -- .cpuid_eax = 1, .cpuid_reg = R_EDX, -+ .cpuid = {.eax = 1, .reg = R_EDX, }, - .tcg_features = TCG_FEATURES, - }, - [FEAT_1_ECX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "monitor", - "ds-cpl", "vmx", "smx", "est", -@@ -814,7 +835,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "tsc-deadline", "aes", "xsave", NULL /* osxsave */, - "avx", "f16c", "rdrand", "hypervisor", - }, -- .cpuid_eax = 1, .cpuid_reg = R_ECX, -+ .cpuid = { .eax = 1, .reg = R_ECX, }, - .tcg_features = TCG_EXT_FEATURES, - }, - /* Feature names that are already defined on feature_name[] but -@@ -823,6 +844,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD. - */ - [FEAT_8000_0001_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */, - NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */, -@@ -833,10 +855,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp", - NULL, "lm", "3dnowext", "3dnow", - }, -- .cpuid_eax = 0x80000001, .cpuid_reg = R_EDX, -+ .cpuid = { .eax = 0x80000001, .reg = R_EDX, }, - .tcg_features = TCG_EXT2_FEATURES, - }, - [FEAT_8000_0001_ECX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "lahf-lm", "cmp-legacy", "svm", "extapic", - "cr8legacy", "abm", "sse4a", "misalignsse", -@@ -847,7 +870,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "perfctr-nb", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x80000001, .cpuid_reg = R_ECX, -+ .cpuid = { .eax = 0x80000001, .reg = R_ECX, }, - .tcg_features = TCG_EXT3_FEATURES, - /* - * TOPOEXT is always allowed but can't be enabled blindly by -@@ -857,6 +880,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - .no_autoenable_flags = CPUID_EXT3_TOPOEXT, - }, - [FEAT_C000_0001_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, NULL, "xstore", "xstore-en", - NULL, NULL, "xcrypt", "xcrypt-en", -@@ -867,10 +891,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0xC0000001, .cpuid_reg = R_EDX, -+ .cpuid = { .eax = 0xC0000001, .reg = R_EDX, }, - .tcg_features = TCG_EXT4_FEATURES, - }, - [FEAT_KVM] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock", - "kvm-asyncpf", "kvm-steal-time", "kvm-pv-eoi", "kvm-pv-unhalt", -@@ -881,10 +906,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "kvmclock-stable-bit", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = KVM_CPUID_FEATURES, .cpuid_reg = R_EAX, -+ .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EAX, }, - .tcg_features = TCG_KVM_FEATURES, - }, - [FEAT_KVM_HINTS] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "kvm-hint-dedicated", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, -@@ -895,7 +921,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = KVM_CPUID_FEATURES, .cpuid_reg = R_EDX, -+ .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EDX, }, - .tcg_features = TCG_KVM_FEATURES, - /* - * KVM hints aren't auto-enabled by -cpu host, they need to be -@@ -904,6 +930,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - .no_autoenable_flags = ~0U, - }, - [FEAT_HYPERV_EAX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL /* hv_msr_vp_runtime_access */, NULL /* hv_msr_time_refcount_access */, - NULL /* hv_msr_synic_access */, NULL /* hv_msr_stimer_access */, -@@ -918,9 +945,10 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x40000003, .cpuid_reg = R_EAX, -+ .cpuid = { .eax = 0x40000003, .reg = R_EAX, }, - }, - [FEAT_HYPERV_EBX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL /* hv_create_partitions */, NULL /* hv_access_partition_id */, - NULL /* hv_access_memory_pool */, NULL /* hv_adjust_message_buffers */, -@@ -934,9 +962,10 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x40000003, .cpuid_reg = R_EBX, -+ .cpuid = { .eax = 0x40000003, .reg = R_EBX, }, - }, - [FEAT_HYPERV_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL /* hv_mwait */, NULL /* hv_guest_debugging */, - NULL /* hv_perf_monitor */, NULL /* hv_cpu_dynamic_part */, -@@ -949,9 +978,10 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x40000003, .cpuid_reg = R_EDX, -+ .cpuid = { .eax = 0x40000003, .reg = R_EDX, }, - }, - [FEAT_SVM] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "npt", "lbrv", "svm-lock", "nrip-save", - "tsc-scale", "vmcb-clean", "flushbyasid", "decodeassists", -@@ -962,10 +992,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x8000000A, .cpuid_reg = R_EDX, -+ .cpuid = { .eax = 0x8000000A, .reg = R_EDX, }, - .tcg_features = TCG_SVM_FEATURES, - }, - [FEAT_7_0_EBX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "fsgsbase", "tsc-adjust", NULL, "bmi1", - "hle", "avx2", NULL, "smep", -@@ -976,12 +1007,15 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "clwb", "intel-pt", "avx512pf", "avx512er", - "avx512cd", "sha-ni", "avx512bw", "avx512vl", - }, -- .cpuid_eax = 7, -- .cpuid_needs_ecx = true, .cpuid_ecx = 0, -- .cpuid_reg = R_EBX, -+ .cpuid = { -+ .eax = 7, -+ .needs_ecx = true, .ecx = 0, -+ .reg = R_EBX, -+ }, - .tcg_features = TCG_7_0_EBX_FEATURES, - }, - [FEAT_7_0_ECX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, "avx512vbmi", "umip", "pku", - NULL /* ospke */, NULL, "avx512vbmi2", NULL, -@@ -992,12 +1026,15 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, "cldemote", NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 7, -- .cpuid_needs_ecx = true, .cpuid_ecx = 0, -- .cpuid_reg = R_ECX, -+ .cpuid = { -+ .eax = 7, -+ .needs_ecx = true, .ecx = 0, -+ .reg = R_ECX, -+ }, - .tcg_features = TCG_7_0_ECX_FEATURES, - }, - [FEAT_7_0_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, NULL, "avx512-4vnniw", "avx512-4fmaps", - NULL, NULL, NULL, NULL, -@@ -1008,13 +1045,16 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, "spec-ctrl", NULL, - NULL, "arch-capabilities", NULL, "ssbd", - }, -- .cpuid_eax = 7, -- .cpuid_needs_ecx = true, .cpuid_ecx = 0, -- .cpuid_reg = R_EDX, -+ .cpuid = { -+ .eax = 7, -+ .needs_ecx = true, .ecx = 0, -+ .reg = R_EDX, -+ }, - .tcg_features = TCG_7_0_EDX_FEATURES, - .unmigratable_flags = CPUID_7_0_EDX_ARCH_CAPABILITIES, - }, - [FEAT_8000_0007_EDX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, -@@ -1025,12 +1065,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x80000007, -- .cpuid_reg = R_EDX, -+ .cpuid = { .eax = 0x80000007, .reg = R_EDX, }, - .tcg_features = TCG_APM_FEATURES, - .unmigratable_flags = CPUID_APM_INVTSC, - }, - [FEAT_8000_0008_EBX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, -@@ -1041,12 +1081,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0x80000008, -- .cpuid_reg = R_EBX, -+ .cpuid = { .eax = 0x80000008, .reg = R_EBX, }, - .tcg_features = 0, - .unmigratable_flags = 0, - }, - [FEAT_XSAVE] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - "xsaveopt", "xsavec", "xgetbv1", "xsaves", - NULL, NULL, NULL, NULL, -@@ -1057,12 +1097,15 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 0xd, -- .cpuid_needs_ecx = true, .cpuid_ecx = 1, -- .cpuid_reg = R_EAX, -+ .cpuid = { -+ .eax = 0xd, -+ .needs_ecx = true, .ecx = 1, -+ .reg = R_EAX, -+ }, - .tcg_features = TCG_XSAVE_FEATURES, - }, - [FEAT_6_EAX] = { -+ .type = CPUID_FEATURE_WORD, - .feat_names = { - NULL, NULL, "arat", NULL, - NULL, NULL, NULL, NULL, -@@ -1073,13 +1116,16 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, -- .cpuid_eax = 6, .cpuid_reg = R_EAX, -+ .cpuid = { .eax = 6, .reg = R_EAX, }, - .tcg_features = TCG_6_EAX_FEATURES, - }, - [FEAT_XSAVE_COMP_LO] = { -- .cpuid_eax = 0xD, -- .cpuid_needs_ecx = true, .cpuid_ecx = 0, -- .cpuid_reg = R_EAX, -+ .type = CPUID_FEATURE_WORD, -+ .cpuid = { -+ .eax = 0xD, -+ .needs_ecx = true, .ecx = 0, -+ .reg = R_EAX, -+ }, - .tcg_features = ~0U, - .migratable_flags = XSTATE_FP_MASK | XSTATE_SSE_MASK | - XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK | -@@ -1087,9 +1133,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - XSTATE_PKRU_MASK, - }, - [FEAT_XSAVE_COMP_HI] = { -- .cpuid_eax = 0xD, -- .cpuid_needs_ecx = true, .cpuid_ecx = 0, -- .cpuid_reg = R_EDX, -+ .type = CPUID_FEATURE_WORD, -+ .cpuid = { -+ .eax = 0xD, -+ .needs_ecx = true, .ecx = 0, -+ .reg = R_EDX, -+ }, - .tcg_features = ~0U, - }, - }; -@@ -2860,21 +2909,41 @@ static const TypeInfo host_x86_cpu_type_info = { - - #endif - -+static char *feature_word_description(FeatureWordInfo *f, uint32_t bit) -+{ -+ assert(f->type == CPUID_FEATURE_WORD || f->type == MSR_FEATURE_WORD); -+ -+ switch (f->type) { -+ case CPUID_FEATURE_WORD: -+ { -+ const char *reg = get_register_name_32(f->cpuid.reg); -+ assert(reg); -+ return g_strdup_printf("CPUID.%02XH:%s", -+ f->cpuid.eax, reg); -+ } -+ case MSR_FEATURE_WORD: -+ return g_strdup_printf("MSR(%02XH)", -+ f->msr.index); -+ } -+ -+ return NULL; -+} -+ - static void report_unavailable_features(FeatureWord w, uint32_t mask) - { - FeatureWordInfo *f = &feature_word_info[w]; - int i; -+ char *feat_word_str; - - for (i = 0; i < 32; ++i) { - if ((1UL << i) & mask) { -- const char *reg = get_register_name_32(f->cpuid_reg); -- assert(reg); -- warn_report("%s doesn't support requested feature: " -- "CPUID.%02XH:%s%s%s [bit %d]", -+ feat_word_str = feature_word_description(f, i); -+ warn_report("%s doesn't support requested feature: %s%s%s [bit %d]", - accel_uses_host_cpuid() ? "host" : "TCG", -- f->cpuid_eax, reg, -+ feat_word_str, - f->feat_names[i] ? "." : "", - f->feat_names[i] ? f->feat_names[i] : "", i); -+ g_free(feat_word_str); - } - } - } -@@ -3118,11 +3187,18 @@ static void x86_cpu_get_feature_words(Object *obj, Visitor *v, - - for (w = 0; w < FEATURE_WORDS; w++) { - FeatureWordInfo *wi = &feature_word_info[w]; -+ /* -+ * We didn't have MSR features when "feature-words" was -+ * introduced. Therefore skipped other type entries. -+ */ -+ if (wi->type != CPUID_FEATURE_WORD) { -+ continue; -+ } - X86CPUFeatureWordInfo *qwi = &word_infos[w]; -- qwi->cpuid_input_eax = wi->cpuid_eax; -- qwi->has_cpuid_input_ecx = wi->cpuid_needs_ecx; -- qwi->cpuid_input_ecx = wi->cpuid_ecx; -- qwi->cpuid_register = x86_reg_info_32[wi->cpuid_reg].qapi_enum; -+ qwi->cpuid_input_eax = wi->cpuid.eax; -+ qwi->has_cpuid_input_ecx = wi->cpuid.needs_ecx; -+ qwi->cpuid_input_ecx = wi->cpuid.ecx; -+ qwi->cpuid_register = x86_reg_info_32[wi->cpuid.reg].qapi_enum; - qwi->features = array[w]; - - /* List will be in reverse order, but order shouldn't matter */ -@@ -3495,16 +3571,26 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, - bool migratable_only) - { - FeatureWordInfo *wi = &feature_word_info[w]; -- uint32_t r; -+ uint32_t r = 0; - - if (kvm_enabled()) { -- r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax, -- wi->cpuid_ecx, -- wi->cpuid_reg); -+ switch (wi->type) { -+ case CPUID_FEATURE_WORD: -+ r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid.eax, -+ wi->cpuid.ecx, -+ wi->cpuid.reg); -+ break; -+ case MSR_FEATURE_WORD: -+ r = kvm_arch_get_supported_msr_feature(kvm_state, wi->msr.index); -+ break; -+ } - } else if (hvf_enabled()) { -- r = hvf_get_supported_cpuid(wi->cpuid_eax, -- wi->cpuid_ecx, -- wi->cpuid_reg); -+ if (wi->type != CPUID_FEATURE_WORD) { -+ return 0; -+ } -+ r = hvf_get_supported_cpuid(wi->cpuid.eax, -+ wi->cpuid.ecx, -+ wi->cpuid.reg); - } else if (tcg_enabled()) { - r = wi->tcg_features; - } else { -@@ -4568,9 +4654,10 @@ static void x86_cpu_adjust_feat_level(X86CPU *cpu, FeatureWord w) - { - CPUX86State *env = &cpu->env; - FeatureWordInfo *fi = &feature_word_info[w]; -- uint32_t eax = fi->cpuid_eax; -+ uint32_t eax = fi->cpuid.eax; - uint32_t region = eax & 0xF0000000; - -+ assert(feature_word_info[w].type == CPUID_FEATURE_WORD); - if (!env->features[w]) { - return; - } --- -2.20.1 - diff --git a/debian/patches/extra/0007-x86-define-a-new-MSR-based-feature-word-FEATURE_WORD.patch b/debian/patches/extra/0007-x86-define-a-new-MSR-based-feature-word-FEATURE_WORD.patch deleted file mode 100644 index 32365cd..0000000 --- a/debian/patches/extra/0007-x86-define-a-new-MSR-based-feature-word-FEATURE_WORD.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Hoo -Date: Mon, 15 Oct 2018 12:47:25 +0800 -Subject: [PATCH 7/9] x86: define a new MSR based feature word -- - FEATURE_WORDS_ARCH_CAPABILITIES - -Note RSBA is specially treated -- no matter host support it or not, qemu -pretends it is supported. - -Signed-off-by: Robert Hoo -Message-Id: <1539578845-37944-4-git-send-email-robert.hu@linux.intel.com> -[ehabkost: removed automatic enabling of RSBA] -Reviewed-by: Eduardo Habkost -Signed-off-by: Eduardo Habkost ---- - target/i386/cpu.c | 24 +++++++++++++++++++++++- - target/i386/cpu.h | 8 ++++++++ - target/i386/kvm.c | 11 +++++++++++ - 3 files changed, 42 insertions(+), 1 deletion(-) - -diff --git a/target/i386/cpu.c b/target/i386/cpu.c -index d2985144a3..a64aa8793e 100644 ---- a/target/i386/cpu.c -+++ b/target/i386/cpu.c -@@ -1141,6 +1141,27 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { - }, - .tcg_features = ~0U, - }, -+ /*Below are MSR exposed features*/ -+ [FEAT_ARCH_CAPABILITIES] = { -+ .type = MSR_FEATURE_WORD, -+ .feat_names = { -+ "rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry", -+ "ssb-no", NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, -+ }, -+ .msr = { -+ .index = MSR_IA32_ARCH_CAPABILITIES, -+ .cpuid_dep = { -+ FEAT_7_0_EDX, -+ CPUID_7_0_EDX_ARCH_CAPABILITIES -+ } -+ }, -+ }, - }; - - typedef struct X86RegisterInfo32 { -@@ -3581,7 +3602,8 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, - wi->cpuid.reg); - break; - case MSR_FEATURE_WORD: -- r = kvm_arch_get_supported_msr_feature(kvm_state, wi->msr.index); -+ r = kvm_arch_get_supported_msr_feature(kvm_state, -+ wi->msr.index); - break; - } - } else if (hvf_enabled()) { -diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index fb2f5f6ebc..ae54a98249 100644 ---- a/target/i386/cpu.h -+++ b/target/i386/cpu.h -@@ -502,6 +502,7 @@ typedef enum FeatureWord { - FEAT_6_EAX, /* CPUID[6].EAX */ - FEAT_XSAVE_COMP_LO, /* CPUID[EAX=0xd,ECX=0].EAX */ - FEAT_XSAVE_COMP_HI, /* CPUID[EAX=0xd,ECX=0].EDX */ -+ FEAT_ARCH_CAPABILITIES, - FEATURE_WORDS, - } FeatureWord; - -@@ -727,6 +728,13 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; - #define CPUID_TOPOLOGY_LEVEL_SMT (1U << 8) - #define CPUID_TOPOLOGY_LEVEL_CORE (2U << 8) - -+/* MSR Feature Bits */ -+#define MSR_ARCH_CAP_RDCL_NO (1U << 0) -+#define MSR_ARCH_CAP_IBRS_ALL (1U << 1) -+#define MSR_ARCH_CAP_RSBA (1U << 2) -+#define MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY (1U << 3) -+#define MSR_ARCH_CAP_SSB_NO (1U << 4) -+ - #ifndef HYPERV_SPINLOCK_NEVER_RETRY - #define HYPERV_SPINLOCK_NEVER_RETRY 0xFFFFFFFF - #endif -diff --git a/target/i386/kvm.c b/target/i386/kvm.c -index cd45c79169..0b7fcb4f7f 100644 ---- a/target/i386/kvm.c -+++ b/target/i386/kvm.c -@@ -1936,6 +1936,17 @@ static int kvm_put_msrs(X86CPU *cpu, int level) - } - #endif - -+ /* If host supports feature MSR, write down. */ -+ if (kvm_feature_msrs) { -+ int i; -+ for (i = 0; i < kvm_feature_msrs->nmsrs; i++) -+ if (kvm_feature_msrs->indices[i] == MSR_IA32_ARCH_CAPABILITIES) { -+ kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES, -+ env->features[FEAT_ARCH_CAPABILITIES]); -+ break; -+ } -+ } -+ - /* - * The following MSRs have side effects on the guest or are too heavy - * for normal writeback. Limit them to reset or full state updates. --- -2.20.1 - diff --git a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch index cdae871..a5723bd 100644 --- a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch +++ b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch @@ -8,15 +8,16 @@ locks but not whether the storage the file resides on supports any locking, causing issues with NFS. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- block/file-posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c -index fe83cbf0eb..431a9dddc6 100644 +index 1cf4ee49eb..89f014f39a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c -@@ -421,7 +421,7 @@ static QemuOptsList raw_runtime_opts = { +@@ -428,7 +428,7 @@ static QemuOptsList raw_runtime_opts = { { .name = "locking", .type = QEMU_OPT_STRING, @@ -25,7 +26,7 @@ index fe83cbf0eb..431a9dddc6 100644 }, { .name = "pr-manager", -@@ -503,7 +503,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, +@@ -517,7 +517,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, s->use_lock = false; break; case ON_OFF_AUTO_AUTO: @@ -35,5 +36,5 @@ index fe83cbf0eb..431a9dddc6 100644 default: abort(); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch index 4811863..706ffd3 100644 --- a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch +++ b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch @@ -3,15 +3,16 @@ From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:16:49 +0100 Subject: [PATCH] PVE: [Config] Adjust network script path to /etc/kvm/ +Signed-off-by: Thomas Lamprecht --- include/net/net.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/net/net.h b/include/net/net.h -index 3e4638b8c6..e4dfe43f75 100644 +index acf0451fc4..4a64633577 100644 --- a/include/net/net.h +++ b/include/net/net.h -@@ -210,8 +210,9 @@ void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp); +@@ -209,8 +209,9 @@ void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp); int net_hub_id_for_client(NetClientState *nc, int *id); NetClientState *net_hub_port_find(int hub_id); @@ -24,5 +25,5 @@ index 3e4638b8c6..e4dfe43f75 100644 #define DEFAULT_BRIDGE_INTERFACE "br0" -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch similarity index 83% rename from debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch rename to debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch index 3d40d16..704fb5d 100644 --- a/debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch +++ b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch @@ -4,15 +4,16 @@ Date: Wed, 9 Dec 2015 14:30:21 +0100 Subject: [PATCH] PVE: [Config] set the CPU model to kvm64/32 instead of qemu64/32 +Signed-off-by: Thomas Lamprecht --- target/i386/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index c18863ec7a..93ede116d1 100644 +index 83fb522554..154a443071 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h -@@ -1687,9 +1687,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); +@@ -1720,9 +1720,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define CPU_RESOLVING_TYPE TYPE_X86_CPU #ifdef TARGET_X86_64 @@ -25,5 +26,5 @@ index c18863ec7a..93ede116d1 100644 #define cpu_signal_handler cpu_x86_signal_handler -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch b/debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch deleted file mode 100644 index add1c72..0000000 --- a/debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Wed, 9 Dec 2015 14:27:05 +0100 -Subject: [PATCH] PVE: [Config] use kvm by default - ---- - accel/accel.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/accel/accel.c b/accel/accel.c -index 966b2d8f53..08aeadaef2 100644 ---- a/accel/accel.c -+++ b/accel/accel.c -@@ -79,8 +79,8 @@ void configure_accelerator(MachineState *ms) - - accel = qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (accel == NULL) { -- /* Use the default "accelerator", tcg */ -- accel = "tcg"; -+ /* Use the default "accelerator", kvm */ -+ accel = "kvm"; - } - - accel_list = g_strsplit(accel, ":", 0); --- -2.11.0 - diff --git a/debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch similarity index 94% rename from debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch rename to debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch index b6d1781..f8edd19 100644 --- a/debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch +++ b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch @@ -3,12 +3,13 @@ From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:33:34 +0100 Subject: [PATCH] PVE: [Config] ui/spice: default to pve certificates +Signed-off-by: Thomas Lamprecht --- ui/spice-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/spice-core.c b/ui/spice-core.c -index f8c0878529..d327533c8f 100644 +index 0632c74e9f..5593dfcb06 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -667,32 +667,35 @@ void qemu_spice_init(void) @@ -54,5 +55,5 @@ index f8c0878529..d327533c8f 100644 x509_key_password = qemu_opt_get(opts, "x509-key-password"); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0006-PVE-Config-smm_available-false.patch b/debian/patches/pve/0005-PVE-Config-smm_available-false.patch similarity index 79% rename from debian/patches/pve/0006-PVE-Config-smm_available-false.patch rename to debian/patches/pve/0005-PVE-Config-smm_available-false.patch index 222cf59..07aebc9 100644 --- a/debian/patches/pve/0006-PVE-Config-smm_available-false.patch +++ b/debian/patches/pve/0005-PVE-Config-smm_available-false.patch @@ -4,15 +4,16 @@ Date: Tue, 29 Sep 2015 15:37:44 +0200 Subject: [PATCH] PVE: [Config] smm_available = false Signed-off-by: Alexandre Derumier +Signed-off-by: Thomas Lamprecht --- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index 83a444472b..f6fd5e15ff 100644 +index f2c15bf1f2..652eb72b2b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c -@@ -2145,7 +2145,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms) +@@ -2530,7 +2530,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms) if (tcg_enabled() || qtest_enabled()) { smm_available = true; } else if (kvm_enabled()) { @@ -22,5 +23,5 @@ index 83a444472b..f6fd5e15ff 100644 if (smm_available) { -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch b/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch similarity index 76% rename from debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch rename to debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch index 9e27a02..18caccd 100644 --- a/debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch +++ b/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch @@ -3,24 +3,25 @@ From: Wolfgang Bumiller Date: Mon, 24 Oct 2016 09:32:36 +0200 Subject: [PATCH] PVE: [Config] glusterfs: no default logfile if daemonized +Signed-off-by: Thomas Lamprecht --- block/gluster.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/block/gluster.c b/block/gluster.c -index 4fd55a9cc5..20d99aa1c3 100644 +index e664ca4462..70c59db107 100644 --- a/block/gluster.c +++ b/block/gluster.c -@@ -36,7 +36,7 @@ +@@ -41,7 +41,7 @@ #define GLUSTER_DEBUG_DEFAULT 4 #define GLUSTER_DEBUG_MAX 9 #define GLUSTER_OPT_LOGFILE "logfile" -#define GLUSTER_LOGFILE_DEFAULT "-" /* handled in libgfapi as /dev/stderr */ +#define GLUSTER_LOGFILE_DEFAULT NULL - - #define GERR_INDEX_HINT "hint: check in 'server' array index '%d'\n" - -@@ -405,6 +405,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, + /* + * Several versions of GlusterFS (3.12? -> 6.0.1) fail when the transfer size + * is greater or equal to 1024 MiB, so we are limiting the transfer size to 512 +@@ -416,6 +416,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, int old_errno; SocketAddressList *server; unsigned long long port; @@ -28,7 +29,7 @@ index 4fd55a9cc5..20d99aa1c3 100644 glfs = glfs_find_preopened(gconf->volume); if (glfs) { -@@ -447,9 +448,15 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, +@@ -458,9 +459,15 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, } } @@ -48,5 +49,5 @@ index 4fd55a9cc5..20d99aa1c3 100644 ret = glfs_init(glfs); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch b/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch similarity index 91% rename from debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch rename to debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch index ba42289..1f51ddc 100644 --- a/debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch +++ b/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch @@ -12,12 +12,13 @@ yet, VMs affected by the related issue should simply explicitly choose writethrough. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- block/rbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/rbd.c b/block/rbd.c -index 014c68d629..53293845f6 100644 +index 0c549c9935..7f7a5d4c35 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -634,6 +634,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, @@ -30,5 +31,5 @@ index 014c68d629..53293845f6 100644 if (r < 0) { error_setg_errno(errp, -r, "error connecting"); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch b/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch similarity index 82% rename from debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch rename to debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch index 1e05516..afa5f2d 100644 --- a/debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch +++ b/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch @@ -3,6 +3,7 @@ From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 16:34:41 +0100 Subject: [PATCH] PVE: [Up] qmp: add get_link_status +Signed-off-by: Thomas Lamprecht --- net/net.c | 27 +++++++++++++++++++++++++++ qapi/net.json | 15 +++++++++++++++ @@ -10,10 +11,10 @@ Subject: [PATCH] PVE: [Up] qmp: add get_link_status 3 files changed, 43 insertions(+) diff --git a/net/net.c b/net/net.c -index f8275843fb..8c8e100afa 100644 +index f3a3c5444c..1023cff921 100644 --- a/net/net.c +++ b/net/net.c -@@ -1342,6 +1342,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) +@@ -1346,6 +1346,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) } } @@ -44,17 +45,18 @@ index f8275843fb..8c8e100afa 100644 + return (int64_t) ret ? 0 : 1; +} + - void qmp_set_link(const char *name, bool up, Error **errp) + void colo_notify_filters_event(int event, Error **errp) { - NetClientState *ncs[MAX_QUEUE_NUM]; + NetClientState *nc; diff --git a/qapi/net.json b/qapi/net.json -index c86f351161..9a69a3b0f7 100644 +index 5f7bff1637..5991d1e5b8 100644 --- a/qapi/net.json +++ b/qapi/net.json -@@ -35,6 +35,21 @@ +@@ -34,6 +34,21 @@ + ## { 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} } - ## ++## +# @get_link_status: +# +# Get the current link state of the nics or nic. @@ -69,12 +71,11 @@ index c86f351161..9a69a3b0f7 100644 +## +{ 'command': 'get_link_status', 'data': {'name': 'str'}, 'returns': 'int'} + -+## + ## # @netdev_add: # - # Add a network backend. diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json -index 65b6dc2f6f..4bc906bc7c 100644 +index 4bd1223637..d8facba0a2 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -61,6 +61,7 @@ @@ -84,7 +85,7 @@ index 65b6dc2f6f..4bc906bc7c 100644 + 'get_link_status', 'ringbuf-read' ], 'name-case-whitelist': [ - 'ACPISlotType', # DIMM, visible through query-acpi-ospm-status + 'ACPISlotType', # DIMM, visible through query-acpi-ospm-status -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch b/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch similarity index 82% rename from debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch rename to debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch index 8ee5698..51c4a70 100644 --- a/debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch +++ b/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch @@ -9,15 +9,17 @@ away from sector based block APIs and with that in mind, and when comparing to other network block backends (eg. nfs) treating partial reads as errors doesn't seem to make much sense. + +Signed-off-by: Thomas Lamprecht --- block/gluster.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block/gluster.c b/block/gluster.c -index 20d99aa1c3..569866421b 100644 +index 70c59db107..e8e2739b53 100644 --- a/block/gluster.c +++ b/block/gluster.c -@@ -45,6 +45,7 @@ typedef struct GlusterAIOCB { +@@ -56,6 +56,7 @@ typedef struct GlusterAIOCB { int ret; Coroutine *coroutine; AioContext *aio_context; @@ -25,7 +27,7 @@ index 20d99aa1c3..569866421b 100644 } GlusterAIOCB; typedef struct BDRVGlusterState { -@@ -740,8 +741,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) +@@ -755,8 +756,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, acb->ret = 0; /* Success */ } else if (ret < 0) { acb->ret = -errno; /* Read/Write failed */ @@ -37,7 +39,7 @@ index 20d99aa1c3..569866421b 100644 } aio_co_schedule(acb->aio_context, acb->coroutine); -@@ -989,6 +992,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, +@@ -1017,6 +1020,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); @@ -45,7 +47,7 @@ index 20d99aa1c3..569866421b 100644 ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1169,9 +1173,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, +@@ -1197,9 +1201,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, acb.aio_context = bdrv_get_aio_context(bs); if (write) { @@ -57,7 +59,7 @@ index 20d99aa1c3..569866421b 100644 ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0, gluster_finish_aiocb, &acb); } -@@ -1233,6 +1239,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs) +@@ -1261,6 +1267,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs) acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); @@ -65,7 +67,7 @@ index 20d99aa1c3..569866421b 100644 ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1279,6 +1286,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, +@@ -1307,6 +1314,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, acb.ret = 0; acb.coroutine = qemu_coroutine_self(); acb.aio_context = bdrv_get_aio_context(bs); @@ -74,5 +76,5 @@ index 20d99aa1c3..569866421b 100644 ret = glfs_discard_async(s->fd, offset, size, gluster_finish_aiocb, &acb); if (ret < 0) { -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch b/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch similarity index 79% rename from debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch rename to debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch index f2232eb..be88f80 100644 --- a/debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch +++ b/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch @@ -3,15 +3,16 @@ From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:18:46 +0100 Subject: [PATCH] PVE: [Up] qemu-img: return success on info without snapshots +Signed-off-by: Thomas Lamprecht --- qemu-img.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c -index 4799e097dc..789217cd35 100644 +index aa6f81f1ea..4546198471 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -2719,7 +2719,8 @@ static int img_info(int argc, char **argv) +@@ -2717,7 +2717,8 @@ static int img_info(int argc, char **argv) list = collect_image_info_list(image_opts, filename, fmt, chain, force_share); if (!list) { @@ -22,5 +23,5 @@ index 4799e097dc..789217cd35 100644 switch (output_format) { -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch similarity index 93% rename from debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch rename to debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch index 470cb1b..bcc9004 100644 --- a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch +++ b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch @@ -30,13 +30,14 @@ used to limit it), the "osize" option is added to explicitly override the output file's size. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- qemu-img-cmds.hx | 4 +- - qemu-img.c | 192 ++++++++++++++++++++++++++++++++++--------------------- - 2 files changed, 122 insertions(+), 74 deletions(-) + qemu-img.c | 194 +++++++++++++++++++++++++++++------------------ + 2 files changed, 123 insertions(+), 75 deletions(-) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx -index 1526f327a5..0ea4b6ffb2 100644 +index 4b47f7495d..db1df8f60b 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@ -56,9 +56,9 @@ STEXI @@ -52,10 +53,10 @@ index 1526f327a5..0ea4b6ffb2 100644 DEF("info", img_info, diff --git a/qemu-img.c b/qemu-img.c -index 789217cd35..f459dd8345 100644 +index 4546198471..6e1a3b8933 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4301,10 +4301,12 @@ out: +@@ -4313,10 +4313,12 @@ out: #define C_IF 04 #define C_OF 010 #define C_SKIP 020 @@ -68,7 +69,7 @@ index 789217cd35..f459dd8345 100644 }; struct DdIo { -@@ -4383,6 +4385,20 @@ static int img_dd_skip(const char *arg, +@@ -4395,6 +4397,20 @@ static int img_dd_skip(const char *arg, return 0; } @@ -89,7 +90,7 @@ index 789217cd35..f459dd8345 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4423,6 +4439,7 @@ static int img_dd(int argc, char **argv) +@@ -4435,6 +4451,7 @@ static int img_dd(int argc, char **argv) { "if", img_dd_if, C_IF }, { "of", img_dd_of, C_OF }, { "skip", img_dd_skip, C_SKIP }, @@ -97,7 +98,7 @@ index 789217cd35..f459dd8345 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -4501,8 +4518,13 @@ static int img_dd(int argc, char **argv) +@@ -4513,8 +4530,13 @@ static int img_dd(int argc, char **argv) arg = NULL; } @@ -113,7 +114,7 @@ index 789217cd35..f459dd8345 100644 ret = -1; goto out; } -@@ -4514,85 +4536,101 @@ static int img_dd(int argc, char **argv) +@@ -4526,85 +4548,101 @@ static int img_dd(int argc, char **argv) goto out; } @@ -135,24 +136,11 @@ index 789217cd35..f459dd8345 100644 - drv = bdrv_find_format(out_fmt); - if (!drv) { - error_report("Unknown file format"); -+ if (dd.flags & C_OSIZE) { -+ size = dd.osize; -+ } else if (dd.flags & C_IF) { -+ size = blk_getlength(blk1); -+ if (size < 0) { -+ error_report("Failed to get size for '%s'", in.filename); -+ ret = -1; -+ goto out; -+ } -+ } else if (dd.flags & C_COUNT) { -+ size = dd.count * in.bsz; -+ } else { -+ error_report("Output size must be known when reading from stdin"); - ret = -1; - goto out; - } +- ret = -1; +- goto out; +- } - proto_drv = bdrv_find_protocol(out.filename, true, &local_err); - +- - if (!proto_drv) { - error_report_err(local_err); - ret = -1; @@ -169,14 +157,46 @@ index 789217cd35..f459dd8345 100644 - proto_drv->format_name); - ret = -1; - goto out; -+ if (!(dd.flags & C_OSIZE) && dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz && -+ dd.count * in.bsz < size) { -+ size = dd.count * in.bsz; - } +- } - create_opts = qemu_opts_append(create_opts, drv->create_opts); - create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); - +- - opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); +- +- size = blk_getlength(blk1); +- if (size < 0) { +- error_report("Failed to get size for '%s'", in.filename); ++ if (dd.flags & C_OSIZE) { ++ size = dd.osize; ++ } else if (dd.flags & C_IF) { ++ size = blk_getlength(blk1); ++ if (size < 0) { ++ error_report("Failed to get size for '%s'", in.filename); ++ ret = -1; ++ goto out; ++ } ++ } else if (dd.flags & C_COUNT) { ++ size = dd.count * in.bsz; ++ } else { ++ error_report("Output size must be known when reading from stdin"); + ret = -1; + goto out; + } + +- if (dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz && ++ if (!(dd.flags & C_OSIZE) && dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz && + dd.count * in.bsz < size) { + size = dd.count * in.bsz; + } + +- /* Overflow means the specified offset is beyond input image's size */ +- if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || +- size < in.bsz * in.offset)) { +- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, 0, &error_abort); +- } else { +- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, +- size - in.bsz * in.offset, &error_abort); +- } + if (dd.flags & C_OF) { + drv = bdrv_find_format(out_fmt); + if (!drv) { @@ -186,9 +206,11 @@ index 789217cd35..f459dd8345 100644 + } + proto_drv = bdrv_find_protocol(out.filename, true, &local_err); -- size = blk_getlength(blk1); -- if (size < 0) { -- error_report("Failed to get size for '%s'", in.filename); +- ret = bdrv_create(drv, out.filename, opts, &local_err); +- if (ret < 0) { +- error_reportf_err(local_err, +- "%s: error while creating output image: ", +- out.filename); - ret = -1; - goto out; - } @@ -212,20 +234,18 @@ index 789217cd35..f459dd8345 100644 + create_opts = qemu_opts_append(create_opts, drv->create_opts); + create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); -- if (dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz && -- dd.count * in.bsz < size) { -- size = dd.count * in.bsz; -- } +- /* TODO, we can't honour --image-opts for the target, +- * since it needs to be given in a format compatible +- * with the bdrv_create() call above which does not +- * support image-opts style. +- */ +- blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR, +- false, false, false); + opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); -- /* Overflow means the specified offset is beyond input image's size */ -- if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || -- size < in.bsz * in.offset)) { -- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, 0, &error_abort); -- } else { -- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, -- size - in.bsz * in.offset, &error_abort); -- } +- if (!blk2) { +- ret = -1; +- goto out; + /* Overflow means the specified offset is beyond input image's size */ + if (dd.flags & C_OSIZE) { + qemu_opt_set_number(opts, BLOCK_OPT_SIZE, size, &error_abort); @@ -236,15 +256,7 @@ index 789217cd35..f459dd8345 100644 + qemu_opt_set_number(opts, BLOCK_OPT_SIZE, + size - in.bsz * in.offset, &error_abort); + } - -- ret = bdrv_create(drv, out.filename, opts, &local_err); -- if (ret < 0) { -- error_reportf_err(local_err, -- "%s: error while creating output image: ", -- out.filename); -- ret = -1; -- goto out; -- } ++ + ret = bdrv_create(drv, out.filename, opts, &local_err); + if (ret < 0) { + error_reportf_err(local_err, @@ -253,14 +265,7 @@ index 789217cd35..f459dd8345 100644 + ret = -1; + goto out; + } - -- /* TODO, we can't honour --image-opts for the target, -- * since it needs to be given in a format compatible -- * with the bdrv_create() call above which does not -- * support image-opts style. -- */ -- blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR, -- false, false, false); ++ + /* TODO, we can't honour --image-opts for the target, + * since it needs to be given in a format compatible + * with the bdrv_create() call above which does not @@ -268,10 +273,7 @@ index 789217cd35..f459dd8345 100644 + */ + blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR, + false, false, false); - -- if (!blk2) { -- ret = -1; -- goto out; ++ + if (!blk2) { + ret = -1; + goto out; @@ -279,7 +281,7 @@ index 789217cd35..f459dd8345 100644 } if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || -@@ -4610,11 +4648,17 @@ static int img_dd(int argc, char **argv) +@@ -4622,11 +4660,17 @@ static int img_dd(int argc, char **argv) for (out_pos = 0; in_pos < size; block_count++) { int in_ret, out_ret; @@ -301,7 +303,7 @@ index 789217cd35..f459dd8345 100644 } if (in_ret < 0) { error_report("error while reading from input image file: %s", -@@ -4624,9 +4668,13 @@ static int img_dd(int argc, char **argv) +@@ -4636,9 +4680,13 @@ static int img_dd(int argc, char **argv) } in_pos += in_ret; @@ -318,5 +320,5 @@ index 789217cd35..f459dd8345 100644 strerror(-out_ret)); ret = -1; -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch similarity index 87% rename from debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch rename to debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch index 3a751d8..a8e5a08 100644 --- a/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch +++ b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch @@ -9,15 +9,16 @@ In order to distinguish between an actually unexpected and an expected end of input. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- qemu-img.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index f459dd8345..1f623f5bba 100644 +index 6e1a3b8933..6a76897c01 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4302,11 +4302,13 @@ out: +@@ -4314,11 +4314,13 @@ out: #define C_OF 010 #define C_SKIP 020 #define C_OSIZE 040 @@ -31,7 +32,7 @@ index f459dd8345..1f623f5bba 100644 }; struct DdIo { -@@ -4399,6 +4401,20 @@ static int img_dd_osize(const char *arg, +@@ -4411,6 +4413,20 @@ static int img_dd_osize(const char *arg, return 0; } @@ -52,7 +53,7 @@ index f459dd8345..1f623f5bba 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4413,12 +4429,14 @@ static int img_dd(int argc, char **argv) +@@ -4425,12 +4441,14 @@ static int img_dd(int argc, char **argv) int c, i; const char *out_fmt = "raw"; const char *fmt = NULL; @@ -68,7 +69,7 @@ index f459dd8345..1f623f5bba 100644 }; struct DdIo in = { .bsz = 512, /* Block size is by default 512 bytes */ -@@ -4440,6 +4458,7 @@ static int img_dd(int argc, char **argv) +@@ -4452,6 +4470,7 @@ static int img_dd(int argc, char **argv) { "of", img_dd_of, C_OF }, { "skip", img_dd_skip, C_SKIP }, { "osize", img_dd_osize, C_OSIZE }, @@ -76,7 +77,7 @@ index f459dd8345..1f623f5bba 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -4646,14 +4665,18 @@ static int img_dd(int argc, char **argv) +@@ -4658,14 +4677,18 @@ static int img_dd(int argc, char **argv) in.buf = g_new(uint8_t, in.bsz); @@ -98,5 +99,5 @@ index f459dd8345..1f623f5bba 100644 error_report("Input ended unexpectedly"); ret = -1; -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch similarity index 84% rename from debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch rename to debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch index 531d22c..ff2006f 100644 --- a/debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch +++ b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch @@ -3,15 +3,16 @@ From: Alexandre Derumier Date: Wed, 21 Mar 2018 08:51:34 +0100 Subject: [PATCH] PVE: [Up] qemu-img dd : add -n skip_create +Signed-off-by: Thomas Lamprecht --- qemu-img.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index 1f623f5bba..5d9322db33 100644 +index 6a76897c01..506ae959af 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4431,7 +4431,7 @@ static int img_dd(int argc, char **argv) +@@ -4443,7 +4443,7 @@ static int img_dd(int argc, char **argv) const char *fmt = NULL; int64_t size = 0, readsize = 0; int64_t block_count = 0, out_pos, in_pos; @@ -20,7 +21,7 @@ index 1f623f5bba..5d9322db33 100644 struct DdInfo dd = { .flags = 0, .count = 0, -@@ -4469,7 +4469,7 @@ static int img_dd(int argc, char **argv) +@@ -4481,7 +4481,7 @@ static int img_dd(int argc, char **argv) { 0, 0, 0, 0 } }; @@ -29,7 +30,7 @@ index 1f623f5bba..5d9322db33 100644 if (c == EOF) { break; } -@@ -4489,6 +4489,9 @@ static int img_dd(int argc, char **argv) +@@ -4501,6 +4501,9 @@ static int img_dd(int argc, char **argv) case 'h': help(); break; @@ -39,7 +40,7 @@ index 1f623f5bba..5d9322db33 100644 case 'U': force_share = true; break; -@@ -4629,13 +4632,15 @@ static int img_dd(int argc, char **argv) +@@ -4641,13 +4644,15 @@ static int img_dd(int argc, char **argv) size - in.bsz * in.offset, &error_abort); } @@ -63,5 +64,5 @@ index 1f623f5bba..5d9322db33 100644 /* TODO, we can't honour --image-opts for the target, -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch b/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch similarity index 93% rename from debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch rename to debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch index 4ea4e22..64cbf6a 100644 --- a/debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch +++ b/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch @@ -5,6 +5,8 @@ Subject: [PATCH] PVE: virtio-balloon: improve query-balloon Actually provide memory information via the query-balloon command. + +Signed-off-by: Thomas Lamprecht --- hmp.c | 30 +++++++++++++++++++++++++++++- hw/virtio/virtio-balloon.c | 33 +++++++++++++++++++++++++++++++-- @@ -12,10 +14,10 @@ command. 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c -index 2aafb50e8e..4d60782f56 100644 +index 8eec768088..25fe18cbcf 100644 --- a/hmp.c +++ b/hmp.c -@@ -794,7 +794,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) +@@ -863,7 +863,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) return; } @@ -53,10 +55,10 @@ index 2aafb50e8e..4d60782f56 100644 qapi_free_BalloonInfo(info); } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 1f7a87f094..6295be2f49 100644 +index 2112874055..d96e4aa96f 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c -@@ -385,8 +385,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, +@@ -701,8 +701,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, static void virtio_balloon_stat(void *opaque, BalloonInfo *info) { VirtIOBalloon *dev = opaque; @@ -97,10 +99,10 @@ index 1f7a87f094..6295be2f49 100644 static void virtio_balloon_to_target(void *opaque, ram_addr_t target) diff --git a/qapi/misc.json b/qapi/misc.json -index d450cfef21..a7d890c076 100644 +index 8b3ca4fdd3..c98bb4b559 100644 --- a/qapi/misc.json +++ b/qapi/misc.json -@@ -679,10 +679,30 @@ +@@ -682,10 +682,30 @@ # # @actual: the number of bytes the balloon currently contains # @@ -133,5 +135,5 @@ index d450cfef21..a7d890c076 100644 ## # @query-balloon: -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch b/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch similarity index 84% rename from debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch rename to debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch index 4abfa8b..51e4b5a 100644 --- a/debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch +++ b/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch @@ -4,16 +4,18 @@ Date: Wed, 9 Dec 2015 14:31:18 +0100 Subject: [PATCH] PVE: qapi: modify query machines provide '*is-current' in MachineInfo struct + +Signed-off-by: Thomas Lamprecht --- qapi/misc.json | 4 +++- vl.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qapi/misc.json b/qapi/misc.json -index a7d890c076..4e8ebf9adc 100644 +index c98bb4b559..4a0e26720e 100644 --- a/qapi/misc.json +++ b/qapi/misc.json -@@ -2000,6 +2000,8 @@ +@@ -2033,6 +2033,8 @@ # # @is-default: whether the machine is default # @@ -22,7 +24,7 @@ index a7d890c076..4e8ebf9adc 100644 # @cpu-max: maximum number of CPUs supported by the machine type # (since 1.5.0) # -@@ -2009,7 +2011,7 @@ +@@ -2042,7 +2044,7 @@ ## { 'struct': 'MachineInfo', 'data': { 'name': 'str', '*alias': 'str', @@ -32,10 +34,10 @@ index a7d890c076..4e8ebf9adc 100644 ## diff --git a/vl.c b/vl.c -index 12d27fa028..9c3a41bfe2 100644 +index c696ad2a13..5c4b1a281e 100644 --- a/vl.c +++ b/vl.c -@@ -1455,6 +1455,11 @@ MachineInfoList *qmp_query_machines(Error **errp) +@@ -1531,6 +1531,11 @@ MachineInfoList *qmp_query_machines(Error **errp) info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; info->hotpluggable_cpus = mc->has_hotpluggable_cpus; @@ -48,5 +50,5 @@ index 12d27fa028..9c3a41bfe2 100644 entry->value = info; entry->next = mach_list; -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch b/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch similarity index 87% rename from debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch rename to debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch index d1eb3a1..1d7b754 100644 --- a/debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch +++ b/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch @@ -4,13 +4,15 @@ Date: Wed, 9 Dec 2015 14:32:11 +0100 Subject: [PATCH] PVE: qapi: modify spice query Provide the last ticket in the SpiceInfo struct optionally. + +Signed-off-by: Thomas Lamprecht --- qapi/ui.json | 3 +++ ui/spice-core.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/qapi/ui.json b/qapi/ui.json -index 4ca91bb45a..636256dacc 100644 +index 59e412139a..bcd781a1b9 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -211,11 +211,14 @@ @@ -29,10 +31,10 @@ index 4ca91bb45a..636256dacc 100644 'if': 'defined(CONFIG_SPICE)' } diff --git a/ui/spice-core.c b/ui/spice-core.c -index d327533c8f..74bd443462 100644 +index 5593dfcb06..bd80c18210 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c -@@ -539,6 +539,11 @@ SpiceInfo *qmp_query_spice(Error **errp) +@@ -538,6 +538,11 @@ SpiceInfo *qmp_query_spice(Error **errp) micro = SPICE_SERVER_VERSION & 0xff; info->compiled_version = g_strdup_printf("%d.%d.%d", major, minor, micro); @@ -45,5 +47,5 @@ index d327533c8f..74bd443462 100644 info->has_port = true; info->port = port; -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0018-PVE-internal-snapshot-async.patch b/debian/patches/pve/0017-PVE-internal-snapshot-async.patch similarity index 94% rename from debian/patches/pve/0018-PVE-internal-snapshot-async.patch rename to debian/patches/pve/0017-PVE-internal-snapshot-async.patch index 7347a8b..a121503 100644 --- a/debian/patches/pve/0018-PVE-internal-snapshot-async.patch +++ b/debian/patches/pve/0017-PVE-internal-snapshot-async.patch @@ -3,26 +3,27 @@ From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 16:04:32 +0100 Subject: [PATCH] PVE: internal snapshot async +Signed-off-by: Thomas Lamprecht --- Makefile.objs | 1 + - hmp-commands-info.hx | 13 ++ + hmp-commands-info.hx | 13 + hmp-commands.hx | 32 +++ - hmp.c | 57 ++++++ + hmp.c | 57 +++++ hmp.h | 5 + include/migration/snapshot.h | 1 + - qapi/migration.json | 34 ++++ + qapi/migration.json | 34 +++ qapi/misc.json | 32 +++ - qemu-options.hx | 13 ++ - savevm-async.c | 460 +++++++++++++++++++++++++++++++++++++++++++ + qemu-options.hx | 13 + + savevm-async.c | 460 +++++++++++++++++++++++++++++++++++ vl.c | 10 + 11 files changed, 658 insertions(+) create mode 100644 savevm-async.c diff --git a/Makefile.objs b/Makefile.objs -index 7a9828da28..a836ee87d7 100644 +index cf065de5ed..559486973a 100644 --- a/Makefile.objs +++ b/Makefile.objs -@@ -98,6 +98,7 @@ ifeq ($(CONFIG_SOFTMMU),y) +@@ -46,6 +46,7 @@ ifeq ($(CONFIG_SOFTMMU),y) common-obj-y = blockdev.o blockdev-nbd.o block/ common-obj-y += bootdevice.o iothread.o common-obj-y += job-qmp.o @@ -31,13 +32,16 @@ index 7a9828da28..a836ee87d7 100644 common-obj-y += qdev-monitor.o device-hotplug.o common-obj-$(CONFIG_WIN32) += os-win32.o diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index 70639f656a..42c148fdc9 100644 +index c59444c461..444bd8e43d 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -575,6 +575,19 @@ Show current migration xbzrle cache size. - ETEXI - - { +@@ -608,6 +608,19 @@ STEXI + @item info migrate_cache_size + @findex info migrate_cache_size + Show current migration xbzrle cache size. ++ETEXI ++ ++ { + .name = "savevm", + .args_type = "", + .params = "", @@ -48,17 +52,14 @@ index 70639f656a..42c148fdc9 100644 +STEXI +@item info savevm +show savevm status -+ETEXI -+ -+ { - .name = "balloon", - .args_type = "", - .params = "", + ETEXI + + { diff --git a/hmp-commands.hx b/hmp-commands.hx -index 91dfe51c37..a6f0720442 100644 +index 9b4035965c..284e97973a 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx -@@ -1886,3 +1886,35 @@ ETEXI +@@ -1926,3 +1926,35 @@ ETEXI STEXI @end table ETEXI @@ -95,10 +96,10 @@ index 91dfe51c37..a6f0720442 100644 + .cmd = hmp_savevm_end, + }, diff --git a/hmp.c b/hmp.c -index 4d60782f56..7c975f3ead 100644 +index 25fe18cbcf..16243bba50 100644 --- a/hmp.c +++ b/hmp.c -@@ -2558,6 +2558,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) +@@ -2722,6 +2722,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } @@ -163,7 +164,7 @@ index 4d60782f56..7c975f3ead 100644 { IOThreadInfoList *info_list = qmp_query_iothreads(NULL); diff --git a/hmp.h b/hmp.h -index 33354f1bdd..98bb7a44db 100644 +index 43617f2646..bcb90c478f 100644 --- a/hmp.h +++ b/hmp.h @@ -24,6 +24,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict); @@ -174,7 +175,7 @@ index 33354f1bdd..98bb7a44db 100644 void hmp_info_migrate(Monitor *mon, const QDict *qdict); void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); -@@ -98,6 +99,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); +@@ -101,6 +102,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); @@ -197,13 +198,14 @@ index c85b6ec75b..4411b7121d 100644 #endif diff --git a/qapi/migration.json b/qapi/migration.json -index 186e8a7303..8d2626f6ad 100644 +index 9cfbaf8c6c..e206355d56 100644 --- a/qapi/migration.json +++ b/qapi/migration.json -@@ -189,6 +189,40 @@ - '*postcopy-vcpu-blocktime': ['uint32']} } +@@ -219,6 +219,40 @@ + '*compression': 'CompressionStats', + '*socket-address': ['SocketAddress'] } } - ## ++## +# @SaveVMInfo: +# +# Information about current migration process. @@ -237,18 +239,18 @@ index 186e8a7303..8d2626f6ad 100644 +## +{ 'command': 'query-savevm', 'returns': 'SaveVMInfo' } + -+## + ## # @query-migrate: # - # Returns information about current migration process. If migration diff --git a/qapi/misc.json b/qapi/misc.json -index 4e8ebf9adc..b6ad5f028d 100644 +index 4a0e26720e..49dfda0b28 100644 --- a/qapi/misc.json +++ b/qapi/misc.json -@@ -2525,6 +2525,38 @@ +@@ -2358,6 +2358,38 @@ + ## { 'command': 'query-target', 'returns': 'TargetInfo' } - ## ++## +# @savevm-start: +# +# Prepare for snapshot and halt VM. Save VM state to statefile. @@ -280,15 +282,14 @@ index 4e8ebf9adc..b6ad5f028d 100644 +## +{ 'command': 'savevm-end' } + -+## + ## # @AcpiTableOptions: # - # Specify an ACPI table on the command line to load. diff --git a/qemu-options.hx b/qemu-options.hx -index b1bf0f485f..31329e26e2 100644 +index 08749a3391..880c63dab2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx -@@ -3520,6 +3520,19 @@ STEXI +@@ -3680,6 +3680,19 @@ STEXI Start right away with a saved state (@code{loadvm} in monitor) ETEXI @@ -310,7 +311,7 @@ index b1bf0f485f..31329e26e2 100644 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) diff --git a/savevm-async.c b/savevm-async.c new file mode 100644 -index 0000000000..73b7fe75ed +index 0000000000..2149010bb8 --- /dev/null +++ b/savevm-async.c @@ -0,0 +1,460 @@ @@ -566,7 +567,7 @@ index 0000000000..73b7fe75ed + DPRINTF("savevm inerate pending size %lu ret %d\n", pending_size, ret); + } else { + qemu_mutex_lock_iothread(); -+ qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); ++ qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); + ret = global_state_store(); + if (ret) { + save_snapshot_error("global_state_store error %d", ret); @@ -775,10 +776,10 @@ index 0000000000..73b7fe75ed + return ret; +} diff --git a/vl.c b/vl.c -index 9c3a41bfe2..63107d82a3 100644 +index 5c4b1a281e..577e9b0f40 100644 --- a/vl.c +++ b/vl.c -@@ -2927,6 +2927,7 @@ int main(int argc, char **argv, char **envp) +@@ -3006,6 +3006,7 @@ int main(int argc, char **argv, char **envp) int optind; const char *optarg; const char *loadvm = NULL; @@ -786,7 +787,7 @@ index 9c3a41bfe2..63107d82a3 100644 MachineClass *machine_class; const char *cpu_model; const char *vga_model = NULL; -@@ -3529,6 +3530,9 @@ int main(int argc, char **argv, char **envp) +@@ -3573,6 +3574,9 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_loadvm: loadvm = optarg; break; @@ -796,9 +797,9 @@ index 9c3a41bfe2..63107d82a3 100644 case QEMU_OPTION_full_screen: dpy.has_full_screen = true; dpy.full_screen = true; -@@ -4624,6 +4628,12 @@ int main(int argc, char **argv, char **envp) - error_report_err(local_err); +@@ -4580,6 +4584,12 @@ int main(int argc, char **argv, char **envp) autostart = 0; + exit(1); } + } else if (loadstate) { + Error *local_err = NULL; @@ -807,8 +808,8 @@ index 9c3a41bfe2..63107d82a3 100644 + autostart = 0; + } } - - qdev_prop_check_globals(); + if (replay_mode != REPLAY_MODE_NONE) { + replay_vmstate_init(); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch b/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch similarity index 95% rename from debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch rename to debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch index dd2fc49..a970cc3 100644 --- a/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch +++ b/debian/patches/pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch @@ -3,24 +3,25 @@ From: Wolfgang Bumiller Date: Thu, 17 Mar 2016 11:33:37 +0100 Subject: [PATCH] PVE: block: add the zeroinit block driver filter +Signed-off-by: Thomas Lamprecht --- block/Makefile.objs | 1 + - block/zeroinit.c | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + block/zeroinit.c | 203 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 block/zeroinit.c diff --git a/block/Makefile.objs b/block/Makefile.objs -index c8337bf186..c00f0b32d6 100644 +index 7a81892a52..03b5763bfa 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs -@@ -4,6 +4,7 @@ block-obj-y += qed.o qed-l2-cache.o qed-table.o qed-cluster.o - block-obj-y += qed-check.o +@@ -11,6 +11,7 @@ block-obj-$(CONFIG_QED) += qed.o qed-l2-cache.o qed-table.o qed-cluster.o + block-obj-$(CONFIG_QED) += qed-check.o block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o block-obj-y += quorum.o +block-obj-y += zeroinit.o - block-obj-y += parallels.o blkdebug.o blkverify.o blkreplay.o + block-obj-y += blkdebug.o blkverify.o blkreplay.o + block-obj-$(CONFIG_PARALLELS) += parallels.o block-obj-y += blklogwrites.o - block-obj-y += block-backend.o snapshot.o qapi.o diff --git a/block/zeroinit.c b/block/zeroinit.c new file mode 100644 index 0000000000..64c49ad0e0 @@ -231,5 +232,5 @@ index 0000000000..64c49ad0e0 + +block_init(bdrv_zeroinit_init); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0020-PVE-backup-modify-job-api.patch b/debian/patches/pve/0019-PVE-backup-modify-job-api.patch similarity index 84% rename from debian/patches/pve/0020-PVE-backup-modify-job-api.patch rename to debian/patches/pve/0019-PVE-backup-modify-job-api.patch index 6b040d4..19a6ce8 100644 --- a/debian/patches/pve/0020-PVE-backup-modify-job-api.patch +++ b/debian/patches/pve/0019-PVE-backup-modify-job-api.patch @@ -7,6 +7,8 @@ Introduce a pause_count parameter to start a backup in paused mode. This way backups of multiple drives can be started up sequentially via the completion callback while having been started at the same point in time. + +Signed-off-by: Thomas Lamprecht --- block/backup.c | 2 ++ block/replication.c | 2 +- @@ -16,10 +18,10 @@ having been started at the same point in time. 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/backup.c b/block/backup.c -index 8630d32926..3aaa75892a 100644 +index 9988753249..51c36d291b 100644 --- a/block/backup.c +++ b/block/backup.c -@@ -613,6 +613,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -572,6 +572,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, @@ -27,7 +29,7 @@ index 8630d32926..3aaa75892a 100644 JobTxn *txn, Error **errp) { int64_t len; -@@ -746,6 +747,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -705,6 +706,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, &error_abort); job->len = len; @@ -36,10 +38,10 @@ index 8630d32926..3aaa75892a 100644 return &job->common; diff --git a/block/replication.c b/block/replication.c -index 6349d6958e..84e07cc4d4 100644 +index 3d4dedddfc..0a265db1b5 100644 --- a/block/replication.c +++ b/block/replication.c -@@ -571,7 +571,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, +@@ -543,7 +543,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, 0, MIRROR_SYNC_MODE_NONE, NULL, false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, @@ -49,10 +51,10 @@ index 6349d6958e..84e07cc4d4 100644 error_propagate(errp, local_err); backup_job_cleanup(bs); diff --git a/blockdev.c b/blockdev.c -index dcf8c8d2ab..d5eb6b62ca 100644 +index 4775a07d93..ce4506f3af 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -3568,7 +3568,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, +@@ -3550,7 +3550,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, @@ -63,7 +65,7 @@ index dcf8c8d2ab..d5eb6b62ca 100644 error_propagate(errp, local_err); @@ -3660,7 +3660,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, NULL, backup->compress, + backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, - job_flags, NULL, NULL, txn, &local_err); + job_flags, NULL, NULL, 0, txn, &local_err); @@ -71,10 +73,10 @@ index dcf8c8d2ab..d5eb6b62ca 100644 error_propagate(errp, local_err); } diff --git a/include/block/block_int.h b/include/block/block_int.h -index 903b9c1034..0b2516c3cf 100644 +index 01e855a066..b409e02be8 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -1083,6 +1083,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -1157,6 +1157,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, @@ -83,10 +85,10 @@ index 903b9c1034..0b2516c3cf 100644 void hmp_drive_add_node(Monitor *mon, const char *optstr); diff --git a/job.c b/job.c -index a3bec7fb22..950924ebad 100644 +index da8e4b7bf2..86161bd9f3 100644 --- a/job.c +++ b/job.c -@@ -549,7 +549,7 @@ void job_start(Job *job) +@@ -899,7 +899,7 @@ void job_start(Job *job) job->co = qemu_coroutine_create(job_co_entry, job); job->pause_count--; job->busy = true; @@ -96,5 +98,5 @@ index a3bec7fb22..950924ebad 100644 aio_co_enter(job->aio_context, job->co); } -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0021-PVE-backup-introduce-vma-archive-format.patch b/debian/patches/pve/0020-PVE-backup-introduce-vma-archive-format.patch similarity index 94% rename from debian/patches/pve/0021-PVE-backup-introduce-vma-archive-format.patch rename to debian/patches/pve/0020-PVE-backup-introduce-vma-archive-format.patch index 66b1408..34de35d 100644 --- a/debian/patches/pve/0021-PVE-backup-introduce-vma-archive-format.patch +++ b/debian/patches/pve/0020-PVE-backup-introduce-vma-archive-format.patch @@ -4,27 +4,28 @@ Date: Wed, 2 Aug 2017 13:51:02 +0200 Subject: [PATCH] PVE: backup: introduce vma archive format TODO: Move to a libvma block backend. +Signed-off-by: Thomas Lamprecht --- MAINTAINERS | 6 + block/Makefile.objs | 3 + - block/vma.c | 503 +++++++++++++++++++++++++++++++++++++++++++++++ - blockdev.c | 536 +++++++++++++++++++++++++++++++++++++++++++++++++++ + block/vma.c | 503 ++++++++++++++++++++++++++++++++++++++++ + blockdev.c | 536 +++++++++++++++++++++++++++++++++++++++++++ configure | 29 +++ hmp-commands-info.hx | 13 ++ hmp-commands.hx | 31 +++ - hmp.c | 63 ++++++ + hmp.c | 63 +++++ hmp.h | 3 + - qapi/block-core.json | 109 ++++++++++- + qapi/block-core.json | 109 ++++++++- qapi/common.json | 13 ++ qapi/misc.json | 13 -- 12 files changed, 1308 insertions(+), 14 deletions(-) create mode 100644 block/vma.c diff --git a/MAINTAINERS b/MAINTAINERS -index 666e936812..299a73cd86 100644 +index 56139ac8ab..5588f5c91e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -2140,6 +2140,12 @@ L: qemu-block@nongnu.org +@@ -2499,6 +2499,12 @@ L: qemu-block@nongnu.org S: Supported F: block/vvfat.c @@ -38,10 +39,10 @@ index 666e936812..299a73cd86 100644 M: Stefan Hajnoczi L: qemu-block@nongnu.org diff --git a/block/Makefile.objs b/block/Makefile.objs -index c00f0b32d6..abfd0f69d7 100644 +index 03b5763bfa..00fa730d7b 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs -@@ -24,6 +24,7 @@ block-obj-$(CONFIG_RBD) += rbd.o +@@ -33,6 +33,7 @@ block-obj-$(CONFIG_RBD) += rbd.o block-obj-$(CONFIG_GLUSTERFS) += gluster.o block-obj-$(CONFIG_VXHS) += vxhs.o block-obj-$(CONFIG_LIBSSH2) += ssh.o @@ -49,7 +50,7 @@ index c00f0b32d6..abfd0f69d7 100644 block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o block-obj-y += backup.o -@@ -52,3 +53,5 @@ qcow.o-libs := -lz +@@ -64,3 +65,5 @@ qcow.o-libs := -lz linux-aio.o-libs := -laio parallels.o-cflags := $(LIBXML2_CFLAGS) parallels.o-libs := $(LIBXML2_LIBS) @@ -565,7 +566,7 @@ index 0000000000..b911b198dc + +block_init(bdrv_vma_init); diff --git a/blockdev.c b/blockdev.c -index d5eb6b62ca..4f18d3c3d7 100644 +index ce4506f3af..9210494b47 100644 --- a/blockdev.c +++ b/blockdev.c @@ -31,11 +31,13 @@ @@ -590,7 +591,7 @@ index d5eb6b62ca..4f18d3c3d7 100644 #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" -@@ -3220,6 +3223,539 @@ out: +@@ -3152,6 +3155,539 @@ out: aio_context_release(aio_context); } @@ -1131,20 +1132,20 @@ index d5eb6b62ca..4f18d3c3d7 100644 bool has_base, const char *base, bool has_base_node, const char *base_node, diff --git a/configure b/configure -index 7b3f80a49c..d2cc11cdbb 100755 +index 1c563a7027..d164677950 100755 --- a/configure +++ b/configure -@@ -475,6 +475,7 @@ vxhs="" - libxml2="" - docker="no" +@@ -491,6 +491,7 @@ docker="no" debug_mutex="no" + libpmem="" + default_devices="yes" +vma="" # cross compilers defaults, can be overridden with --cross-cc-ARCH cross_cc_aarch64="aarch64-linux-gnu-gcc" -@@ -1435,6 +1436,10 @@ for opt do +@@ -1518,6 +1519,10 @@ for opt do ;; - --disable-debug-mutex) debug_mutex=no + --disable-libpmem) libpmem=no ;; + --enable-vma) vma=yes + ;; @@ -1153,18 +1154,19 @@ index 7b3f80a49c..d2cc11cdbb 100755 *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" -@@ -1710,6 +1715,7 @@ disabled with --disable-FEATURE, default is enabled if available: - vhost-user vhost-user support +@@ -1818,6 +1823,7 @@ disabled with --disable-FEATURE, default is enabled if available: capstone capstone disassembler support debug-mutex mutex debugging support + libpmem libpmem support + vma VMA archive backend NOTE: The object files are built at the place where configure is launched EOF -@@ -4121,6 +4127,22 @@ EOF +@@ -4378,6 +4384,22 @@ EOF + fi fi - ########################################## ++########################################## +# vma probe +if test "$vma" != "no" ; then + if $pkg_config --exact-version=0.1.0 vma; then @@ -1180,19 +1182,18 @@ index 7b3f80a49c..d2cc11cdbb 100755 + fi +fi + -+########################################## + ########################################## # signalfd probe signalfd="no" - cat > $TMPC << EOF -@@ -6007,6 +6029,7 @@ echo "replication support $replication" - echo "VxHS block device $vxhs" - echo "capstone $capstone" - echo "docker $docker" +@@ -6438,6 +6460,7 @@ echo "docker $docker" + echo "libpmem support $libpmem" + echo "libudev $libudev" + echo "default devices $default_devices" +echo "VMA support $vma" - if test "$sdl_too_old" = "yes"; then - echo "-> Your SDL version is too old - please upgrade to have SDL support" -@@ -6493,6 +6516,12 @@ if test "$usb_redir" = "yes" ; then + if test "$supported_cpu" = "no"; then + echo +@@ -6931,6 +6954,12 @@ if test "$usb_redir" = "yes" ; then echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak fi @@ -1206,13 +1207,15 @@ index 7b3f80a49c..d2cc11cdbb 100755 echo "CONFIG_OPENGL=y" >> $config_host_mak echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index 42c148fdc9..277e140092 100644 +index 444bd8e43d..21106bcbe6 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -502,6 +502,19 @@ STEXI +@@ -536,6 +536,19 @@ STEXI + @item info cpustats + @findex info cpustats Show CPU statistics. - ETEXI - ++ETEXI ++ + { + .name = "backup", + .args_type = "", @@ -1224,19 +1227,19 @@ index 42c148fdc9..277e140092 100644 +STEXI +@item info backup +show backup status -+ETEXI -+ - #if defined(CONFIG_SLIRP) - { - .name = "usernet", -diff --git a/hmp-commands.hx b/hmp-commands.hx -index a6f0720442..956cbf04b9 100644 ---- a/hmp-commands.hx -+++ b/hmp-commands.hx -@@ -107,6 +107,37 @@ STEXI - Copy data from a backing file into a block device. ETEXI + #if defined(CONFIG_SLIRP) +diff --git a/hmp-commands.hx b/hmp-commands.hx +index 284e97973a..d723552bee 100644 +--- a/hmp-commands.hx ++++ b/hmp-commands.hx +@@ -105,6 +105,37 @@ STEXI + @item block_stream + @findex block_stream + Copy data from a backing file into a block device. ++ETEXI ++ + { + .name = "backup", + .args_type = "directory:-d,backupfile:s,speed:o?,devlist:s?", @@ -1266,16 +1269,14 @@ index a6f0720442..956cbf04b9 100644 +@findex backup_cancel +Cancel the current VM backup. + -+ETEXI -+ + ETEXI + { - .name = "block_job_set_speed", - .args_type = "device:B,speed:o", diff --git a/hmp.c b/hmp.c -index 7c975f3ead..8d659e20f6 100644 +index 16243bba50..113671ad2a 100644 --- a/hmp.c +++ b/hmp.c -@@ -166,6 +166,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) +@@ -167,6 +167,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) qapi_free_MouseInfoList(mice_list); } @@ -1317,10 +1318,10 @@ index 7c975f3ead..8d659e20f6 100644 + qapi_free_BackupStatus(info); +} + - void hmp_info_migrate(Monitor *mon, const QDict *qdict) + static char *SocketAddress_to_str(SocketAddress *addr) { - MigrationInfo *info; -@@ -1899,6 +1937,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) + switch (addr->type) { +@@ -2059,6 +2097,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &error); } @@ -1353,7 +1354,7 @@ index 7c975f3ead..8d659e20f6 100644 { Error *error = NULL; diff --git a/hmp.h b/hmp.h -index 98bb7a44db..853f233195 100644 +index bcb90c478f..043b74edee 100644 --- a/hmp.h +++ b/hmp.h @@ -29,6 +29,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict); @@ -1364,7 +1365,7 @@ index 98bb7a44db..853f233195 100644 void hmp_info_cpus(Monitor *mon, const QDict *qdict); void hmp_info_block(Monitor *mon, const QDict *qdict); void hmp_info_blockstats(Monitor *mon, const QDict *qdict); -@@ -86,6 +87,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict); +@@ -89,6 +90,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); void hmp_block_stream(Monitor *mon, const QDict *qdict); @@ -1374,13 +1375,14 @@ index 98bb7a44db..853f233195 100644 void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); void hmp_block_job_pause(Monitor *mon, const QDict *qdict); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 5b9084a394..9c3c2d4917 100644 +index 7ccbfff9d0..6f97460806 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -718,6 +718,97 @@ +@@ -796,6 +796,97 @@ + { 'command': 'query-block', 'returns': ['BlockInfo'] } - ## ++## +# @BackupStatus: +# +# Detailed backup status. @@ -1471,23 +1473,23 @@ index 5b9084a394..9c3c2d4917 100644 +## +{ 'command': 'backup-cancel' } + -+## + ## # @BlockDeviceTimedStats: # - # Statistics of a block device during a given interval of time. -@@ -2549,7 +2640,7 @@ - 'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks', - 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', - 'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', +@@ -2819,7 +2910,7 @@ + 'qcow2', 'qed', 'quorum', 'raw', 'rbd', + { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, + 'sheepdog', - 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } + 'ssh', 'throttle', 'vdi', 'vhdx', 'vma-drive', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } ## # @BlockdevOptionsFile: -@@ -3550,6 +3641,21 @@ +@@ -3836,6 +3927,21 @@ + 'server': 'InetSocketAddressBase', '*tls-creds': 'str' } } - ## ++## +# @BlockdevOptionsVMADrive: +# +# Driver specific block device options for VMA Drives @@ -1502,11 +1504,10 @@ index 5b9084a394..9c3c2d4917 100644 + 'data': { 'filename': 'str', + 'size': 'int' } } + -+## + ## # @BlockdevOptionsThrottle: # - # Driver specific block device options for the throttle driver -@@ -3633,6 +3739,7 @@ +@@ -3931,6 +4037,7 @@ 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', 'vhdx': 'BlockdevOptionsGenericFormat', @@ -1515,11 +1516,11 @@ index 5b9084a394..9c3c2d4917 100644 'vpc': 'BlockdevOptionsGenericFormat', 'vvfat': 'BlockdevOptionsVVFAT', diff --git a/qapi/common.json b/qapi/common.json -index c367adc4b6..070b7b52c8 100644 +index 99d313ef3b..bae0650c51 100644 --- a/qapi/common.json +++ b/qapi/common.json -@@ -149,3 +149,16 @@ - 'ppc64', 'ppcemb', 'riscv32', 'riscv64', 's390x', 'sh4', +@@ -193,3 +193,16 @@ + 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] } + @@ -1536,13 +1537,14 @@ index c367adc4b6..070b7b52c8 100644 +## +{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } diff --git a/qapi/misc.json b/qapi/misc.json -index b6ad5f028d..3dd5117fc3 100644 +index 49dfda0b28..376f26002a 100644 --- a/qapi/misc.json +++ b/qapi/misc.json -@@ -275,19 +275,6 @@ +@@ -274,19 +274,6 @@ + ## { 'command': 'query-kvm', 'returns': 'KvmInfo' } - ## +-## -# @UuidInfo: -# -# Guest UUID information (Universally Unique Identifier). @@ -1555,10 +1557,9 @@ index b6ad5f028d..3dd5117fc3 100644 -## -{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } - --## + ## # @query-uuid: # - # Query the guest UUID information. -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0022-PVE-Deprecated-adding-old-vma-files.patch b/debian/patches/pve/0021-PVE-Deprecated-adding-old-vma-files.patch similarity index 96% rename from debian/patches/pve/0022-PVE-Deprecated-adding-old-vma-files.patch rename to debian/patches/pve/0021-PVE-Deprecated-adding-old-vma-files.patch index 24cf94c..66bf570 100644 --- a/debian/patches/pve/0022-PVE-Deprecated-adding-old-vma-files.patch +++ b/debian/patches/pve/0021-PVE-Deprecated-adding-old-vma-files.patch @@ -4,50 +4,51 @@ Date: Mon, 7 Aug 2017 08:51:16 +0200 Subject: [PATCH] PVE: [Deprecated] adding old vma files TODO: Move to using a libvma block backend +Signed-off-by: Thomas Lamprecht --- Makefile | 3 +- Makefile.objs | 1 + - block/backup.c | 107 ++++-- + block/backup.c | 103 +++-- block/replication.c | 1 + - blockdev.c | 208 +++++++---- + blockdev.c | 208 +++++---- include/block/block_int.h | 4 + job.c | 3 +- - vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++++++++++ - vma-writer.c | 771 +++++++++++++++++++++++++++++++++++++++++ - vma.c | 756 ++++++++++++++++++++++++++++++++++++++++ - vma.h | 150 ++++++++ - 11 files changed, 2754 insertions(+), 107 deletions(-) + vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++ + vma-writer.c | 771 ++++++++++++++++++++++++++++++++++ + vma.c | 756 +++++++++++++++++++++++++++++++++ + vma.h | 150 +++++++ + 11 files changed, 2752 insertions(+), 105 deletions(-) create mode 100644 vma-reader.c create mode 100644 vma-writer.c create mode 100644 vma.c create mode 100644 vma.h diff --git a/Makefile b/Makefile -index 2da686be33..5a0aad2004 100644 +index 04a0d45050..0b5a8353ea 100644 --- a/Makefile +++ b/Makefile -@@ -436,7 +436,7 @@ dummy := $(call unnest-vars,, \ +@@ -419,7 +419,7 @@ dummy := $(call unnest-vars,, \ include $(SRC_PATH)/tests/Makefile.include --all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules -+all: $(DOCS) $(TOOLS) vma$(EXESUF) $(HELPERS-y) recurse-all modules +-all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules ++all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) vma$(EXESUF) $(HELPERS-y) recurse-all modules qemu-version.h: FORCE $(call quiet-command, \ -@@ -537,6 +537,7 @@ qemu-img.o: qemu-img-cmds.h - qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) - qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) - qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) -+vma$(EXESUF): vma.o vma-reader.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) +@@ -509,6 +509,7 @@ qemu-img.o: qemu-img-cmds.h + qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) + qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) + qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) ++vma$(EXESUF): vma.o vma-reader.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS) diff --git a/Makefile.objs b/Makefile.objs -index a836ee87d7..92c7886dee 100644 +index 559486973a..9477a23ca2 100644 --- a/Makefile.objs +++ b/Makefile.objs -@@ -70,6 +70,7 @@ block-obj-y += block.o blockjob.o job.o +@@ -18,6 +18,7 @@ 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 @@ -56,10 +57,10 @@ index a836ee87d7..92c7886dee 100644 block-obj-m = block/ diff --git a/block/backup.c b/block/backup.c -index 3aaa75892a..2410cca257 100644 +index 51c36d291b..18598fd491 100644 --- a/block/backup.c +++ b/block/backup.c -@@ -34,6 +34,7 @@ typedef struct BackupBlockJob { +@@ -41,6 +41,7 @@ typedef struct BackupBlockJob { /* bitmap for sync=incremental */ BdrvDirtyBitmap *sync_bitmap; MirrorSyncMode sync_mode; @@ -67,7 +68,7 @@ index 3aaa75892a..2410cca257 100644 BlockdevOnError on_source_error; BlockdevOnError on_target_error; CoRwlock flush_rwlock; -@@ -126,12 +127,20 @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, +@@ -130,12 +131,20 @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, } if (qemu_iovec_is_zero(&qiov)) { @@ -93,7 +94,7 @@ index 3aaa75892a..2410cca257 100644 } if (ret < 0) { trace_backup_do_cow_write_fail(job, start, ret); -@@ -209,7 +218,11 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job, +@@ -213,7 +222,11 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job, trace_backup_do_cow_process(job, start); if (job->use_copy_range) { @@ -106,7 +107,7 @@ index 3aaa75892a..2410cca257 100644 if (ret < 0) { job->use_copy_range = false; } -@@ -293,7 +306,9 @@ static void backup_abort(Job *job) +@@ -297,7 +310,9 @@ static void backup_abort(Job *job) static void backup_clean(Job *job) { BackupBlockJob *s = container_of(job, BackupBlockJob, common.job); @@ -117,7 +118,7 @@ index 3aaa75892a..2410cca257 100644 blk_unref(s->target); s->target = NULL; } -@@ -302,7 +317,9 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context) +@@ -306,7 +321,9 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context) { BackupBlockJob *s = container_of(job, BackupBlockJob, common); @@ -128,7 +129,7 @@ index 3aaa75892a..2410cca257 100644 } void backup_do_checkpoint(BlockJob *job, Error **errp) -@@ -374,9 +391,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job, +@@ -347,9 +364,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job, if (read) { return block_job_error_action(&job->common, job->on_source_error, true, error); @@ -141,7 +142,7 @@ index 3aaa75892a..2410cca257 100644 } } -@@ -612,6 +631,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -571,6 +590,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, @@ -149,7 +150,7 @@ index 3aaa75892a..2410cca257 100644 BlockCompletionFunc *cb, void *opaque, int pause_count, JobTxn *txn, Error **errp) -@@ -622,7 +642,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -581,7 +601,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, int ret; assert(bs); @@ -158,7 +159,7 @@ index 3aaa75892a..2410cca257 100644 if (bs == target) { error_setg(errp, "Source and target cannot be the same"); -@@ -635,13 +655,13 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -594,13 +614,13 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, return NULL; } @@ -174,7 +175,7 @@ index 3aaa75892a..2410cca257 100644 error_setg(errp, "Compression is not supported for this drive %s", bdrv_get_device_name(target)); return NULL; -@@ -651,7 +671,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -610,7 +630,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, return NULL; } @@ -183,7 +184,7 @@ index 3aaa75892a..2410cca257 100644 return NULL; } -@@ -691,15 +711,18 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -650,15 +670,18 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, goto error; } @@ -209,7 +210,7 @@ index 3aaa75892a..2410cca257 100644 job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->sync_mode = sync_mode; -@@ -710,6 +733,9 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -669,6 +692,9 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, /* Detect image-fleecing (and similar) schemes */ job->serialize_target_writes = bdrv_chain_contains(target, bs); @@ -219,22 +220,11 @@ index 3aaa75892a..2410cca257 100644 /* If there is no backing file on the target, we cannot rely on COW if our * backup cluster size is smaller than the target cluster size. Even for * targets with a backing file, try to avoid COW if possible. */ -@@ -734,18 +760,35 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -693,18 +719,35 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, /* Not fatal; just trudge on ahead. */ job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { - job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); -- } -- job->use_copy_range = true; -- job->copy_range_size = MIN_NON_ZERO(blk_get_max_transfer(job->common.blk), -- blk_get_max_transfer(job->target)); -- job->copy_range_size = MAX(job->cluster_size, -- QEMU_ALIGN_UP(job->copy_range_size, -- job->cluster_size)); -- -- /* Required permissions are already taken with target's blk_new() */ -- block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, -- &error_abort); + use_default_cluster_size: + ret = bdrv_get_info(bs, &bdi); + if (ret < 0) { @@ -257,8 +247,17 @@ index 3aaa75892a..2410cca257 100644 + job->cluster_size)); + } else { + job->use_copy_range = false; -+ } -+ + } +- job->use_copy_range = true; +- job->copy_range_size = MIN_NON_ZERO(blk_get_max_transfer(job->common.blk), +- blk_get_max_transfer(job->target)); +- job->copy_range_size = MAX(job->cluster_size, +- QEMU_ALIGN_UP(job->copy_range_size, +- job->cluster_size)); + +- /* Required permissions are already taken with target's blk_new() */ +- block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, +- &error_abort); + if (target) { + /* Required permissions are already taken with target's blk_new() */ + block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, @@ -268,10 +267,10 @@ index 3aaa75892a..2410cca257 100644 job->common.job.pause_count += pause_count; diff --git a/block/replication.c b/block/replication.c -index 84e07cc4d4..04fa448a5b 100644 +index 0a265db1b5..e85c62ba9c 100644 --- a/block/replication.c +++ b/block/replication.c -@@ -571,6 +571,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, +@@ -543,6 +543,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, 0, MIRROR_SYNC_MODE_NONE, NULL, false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, @@ -280,7 +279,7 @@ index 84e07cc4d4..04fa448a5b 100644 if (local_err) { error_propagate(errp, local_err); diff --git a/blockdev.c b/blockdev.c -index 4f18d3c3d7..86508066cc 100644 +index 9210494b47..f8ce285caa 100644 --- a/blockdev.c +++ b/blockdev.c @@ -31,7 +31,6 @@ @@ -299,7 +298,7 @@ index 4f18d3c3d7..86508066cc 100644 static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states = QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states); -@@ -3228,15 +3228,14 @@ out: +@@ -3160,15 +3160,14 @@ out: static struct PVEBackupState { Error *error; bool cancel; @@ -317,7 +316,7 @@ index 4f18d3c3d7..86508066cc 100644 size_t total; size_t transferred; size_t zero_bytes; -@@ -3255,6 +3254,71 @@ typedef struct PVEBackupDevInfo { +@@ -3187,6 +3186,71 @@ typedef struct PVEBackupDevInfo { static void pvebackup_run_next_job(void); @@ -389,7 +388,7 @@ index 4f18d3c3d7..86508066cc 100644 static void pvebackup_cleanup(void) { qemu_mutex_lock(&backup_state.backup_mutex); -@@ -3266,9 +3330,11 @@ static void pvebackup_cleanup(void) +@@ -3198,9 +3262,11 @@ static void pvebackup_cleanup(void) backup_state.end_time = time(NULL); @@ -404,7 +403,7 @@ index 4f18d3c3d7..86508066cc 100644 } g_list_free(backup_state.di_list); -@@ -3276,6 +3342,13 @@ static void pvebackup_cleanup(void) +@@ -3208,6 +3274,13 @@ static void pvebackup_cleanup(void) qemu_mutex_unlock(&backup_state.backup_mutex); } @@ -418,7 +417,7 @@ index 4f18d3c3d7..86508066cc 100644 static void pvebackup_complete_cb(void *opaque, int ret) { // This always runs in the main loop -@@ -3292,9 +3365,9 @@ static void pvebackup_complete_cb(void *opaque, int ret) +@@ -3224,9 +3297,9 @@ static void pvebackup_complete_cb(void *opaque, int ret) di->bs = NULL; di->target = NULL; @@ -431,7 +430,7 @@ index 4f18d3c3d7..86508066cc 100644 } // remove self from job queue -@@ -3322,14 +3395,9 @@ static void pvebackup_cancel(void *opaque) +@@ -3254,14 +3327,9 @@ static void pvebackup_cancel(void *opaque) error_setg(&backup_state.error, "backup cancelled"); } @@ -448,7 +447,7 @@ index 4f18d3c3d7..86508066cc 100644 } GList *l = backup_state.di_list; -@@ -3360,18 +3428,14 @@ void qmp_backup_cancel(Error **errp) +@@ -3292,18 +3360,14 @@ void qmp_backup_cancel(Error **errp) Coroutine *co = qemu_coroutine_create(pvebackup_cancel, NULL); qemu_coroutine_enter(co); @@ -470,7 +469,7 @@ index 4f18d3c3d7..86508066cc 100644 Error **errp) { char *cdata = NULL; -@@ -3385,7 +3449,12 @@ static int config_to_vma(const char *file, BackupFormat format, +@@ -3317,7 +3381,12 @@ static int config_to_vma(const char *file, BackupFormat format, char *basename = g_path_get_basename(file); if (format == BACKUP_FORMAT_VMA) { @@ -484,7 +483,7 @@ index 4f18d3c3d7..86508066cc 100644 } else if (format == BACKUP_FORMAT_DIR) { char config_path[PATH_MAX]; snprintf(config_path, PATH_MAX, "%s/%s", backup_dir, basename); -@@ -3402,28 +3471,30 @@ static int config_to_vma(const char *file, BackupFormat format, +@@ -3334,28 +3403,30 @@ static int config_to_vma(const char *file, BackupFormat format, return 0; } @@ -524,7 +523,7 @@ index 4f18d3c3d7..86508066cc 100644 } qemu_mutex_unlock(&backup_state.backup_mutex); -@@ -3434,7 +3505,7 @@ static void pvebackup_run_next_job(void) +@@ -3366,7 +3437,7 @@ static void pvebackup_run_next_job(void) UuidInfo *qmp_backup(const char *backup_file, bool has_format, BackupFormat format, bool has_config_file, const char *config_file, @@ -533,7 +532,7 @@ index 4f18d3c3d7..86508066cc 100644 bool has_devlist, const char *devlist, bool has_speed, int64_t speed, Error **errp) { -@@ -3442,7 +3513,8 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3374,7 +3445,8 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, BlockDriverState *bs = NULL; const char *backup_dir = NULL; Error *local_err = NULL; @@ -543,7 +542,7 @@ index 4f18d3c3d7..86508066cc 100644 gchar **devs = NULL; GList *di_list = NULL; GList *l; -@@ -3454,7 +3526,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3386,7 +3458,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, backup_state.backup_mutex_initialized = true; } @@ -552,7 +551,7 @@ index 4f18d3c3d7..86508066cc 100644 error_set(errp, ERROR_CLASS_GENERIC_ERROR, "previous backup not finished"); return NULL; -@@ -3529,40 +3601,28 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3461,40 +3533,28 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, total += size; } @@ -601,7 +600,7 @@ index 4f18d3c3d7..86508066cc 100644 goto err; } } -@@ -3603,14 +3663,14 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3535,14 +3595,14 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, /* add configuration file to archive */ if (has_config_file) { @@ -618,7 +617,7 @@ index 4f18d3c3d7..86508066cc 100644 goto err; } } -@@ -3633,12 +3693,13 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3565,12 +3625,13 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, } backup_state.backup_file = g_strdup(backup_file); @@ -635,7 +634,7 @@ index 4f18d3c3d7..86508066cc 100644 backup_state.total = total; backup_state.transferred = 0; -@@ -3649,21 +3710,21 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3581,21 +3642,21 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, while (l) { PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; l = g_list_next(l); @@ -663,7 +662,7 @@ index 4f18d3c3d7..86508066cc 100644 } qemu_mutex_unlock(&backup_state.backup_mutex); -@@ -3699,9 +3760,10 @@ err: +@@ -3631,9 +3692,10 @@ err: g_strfreev(devs); } @@ -677,7 +676,7 @@ index 4f18d3c3d7..86508066cc 100644 } if (backup_dir) { -@@ -4104,7 +4166,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, +@@ -4086,7 +4148,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, @@ -688,7 +687,7 @@ index 4f18d3c3d7..86508066cc 100644 error_propagate(errp, local_err); @@ -4196,7 +4258,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, NULL, backup->compress, + backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, - job_flags, NULL, NULL, 0, txn, &local_err); + job_flags, NULL, NULL, NULL, 0, txn, &local_err); @@ -696,10 +695,10 @@ index 4f18d3c3d7..86508066cc 100644 error_propagate(errp, local_err); } diff --git a/include/block/block_int.h b/include/block/block_int.h -index 0b2516c3cf..ecd6243440 100644 +index b409e02be8..fd1828cd70 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -59,6 +59,9 @@ +@@ -61,6 +61,9 @@ #define BLOCK_PROBE_BUF_SIZE 512 @@ -709,7 +708,7 @@ index 0b2516c3cf..ecd6243440 100644 enum BdrvTrackedRequestType { BDRV_TRACKED_READ, BDRV_TRACKED_WRITE, -@@ -1082,6 +1085,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -1156,6 +1159,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, @@ -718,10 +717,10 @@ index 0b2516c3cf..ecd6243440 100644 int pause_count, JobTxn *txn, Error **errp); diff --git a/job.c b/job.c -index 950924ebad..b4eaf57e64 100644 +index 86161bd9f3..114640688a 100644 --- a/job.c +++ b/job.c -@@ -248,7 +248,8 @@ static bool job_started(Job *job) +@@ -249,7 +249,8 @@ static bool job_started(Job *job) return job->co; } @@ -3290,5 +3289,5 @@ index 0000000000..c895c97f6d + +#endif /* BACKUP_VMA_H */ -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0023-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch b/debian/patches/pve/0022-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch similarity index 97% rename from debian/patches/pve/0023-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch rename to debian/patches/pve/0022-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch index 2c14854..78c6832 100644 --- a/debian/patches/pve/0023-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch +++ b/debian/patches/pve/0022-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch @@ -7,8 +7,9 @@ Subject: [PATCH] PVE: vma: add throttling options to drive mapping fifo We now need to call initialize the qom module as well. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- - vma.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- + vma.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 12 deletions(-) diff --git a/vma.c b/vma.c @@ -185,5 +186,5 @@ index 1b59fd1555..f9f5c308fe 100644 if (argc < 2) { help(); -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0024-PVE-vma-add-cache-option-to-device-map.patch b/debian/patches/pve/0023-PVE-vma-add-cache-option-to-device-map.patch similarity index 98% rename from debian/patches/pve/0024-PVE-vma-add-cache-option-to-device-map.patch rename to debian/patches/pve/0023-PVE-vma-add-cache-option-to-device-map.patch index 15e0deb..4931330 100644 --- a/debian/patches/pve/0024-PVE-vma-add-cache-option-to-device-map.patch +++ b/debian/patches/pve/0023-PVE-vma-add-cache-option-to-device-map.patch @@ -4,6 +4,7 @@ Date: Thu, 22 Mar 2018 15:32:04 +0100 Subject: [PATCH] PVE: vma: add cache option to device map Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- vma.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) @@ -91,5 +92,5 @@ index f9f5c308fe..476b7bee00 100644 blk_io_limits_enable(blk, throttling_group); } -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0025-PVE-vma-remove-forced-NO_FLUSH-option.patch b/debian/patches/pve/0024-PVE-vma-remove-forced-NO_FLUSH-option.patch similarity index 93% rename from debian/patches/pve/0025-PVE-vma-remove-forced-NO_FLUSH-option.patch rename to debian/patches/pve/0024-PVE-vma-remove-forced-NO_FLUSH-option.patch index 6b814b6..61b227e 100644 --- a/debian/patches/pve/0025-PVE-vma-remove-forced-NO_FLUSH-option.patch +++ b/debian/patches/pve/0024-PVE-vma-remove-forced-NO_FLUSH-option.patch @@ -8,6 +8,7 @@ types storages. Instead, we want to honor the cache option passed along. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) @@ -26,5 +27,5 @@ index 476b7bee00..3289fd722f 100644 if (readmap) { -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0026-PVE-Add-dummy-id-command-line-parameter.patch b/debian/patches/pve/0025-PVE-Add-dummy-id-command-line-parameter.patch similarity index 84% rename from debian/patches/pve/0026-PVE-Add-dummy-id-command-line-parameter.patch rename to debian/patches/pve/0025-PVE-Add-dummy-id-command-line-parameter.patch index 334125c..9a03199 100644 --- a/debian/patches/pve/0026-PVE-Add-dummy-id-command-line-parameter.patch +++ b/debian/patches/pve/0025-PVE-Add-dummy-id-command-line-parameter.patch @@ -7,16 +7,17 @@ This used to be part of the qemu-side PVE authentication for VNC. Now this does nothing. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- qemu-options.hx | 3 +++ vl.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx -index 31329e26e2..15df7e4fab 100644 +index 880c63dab2..6c98b2b510 100644 --- a/qemu-options.hx +++ b/qemu-options.hx -@@ -591,6 +591,9 @@ STEXI +@@ -801,6 +801,9 @@ STEXI @table @option ETEXI @@ -27,10 +28,10 @@ index 31329e26e2..15df7e4fab 100644 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL) DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL) diff --git a/vl.c b/vl.c -index 63107d82a3..e349797245 100644 +index 577e9b0f40..88512e26e9 100644 --- a/vl.c +++ b/vl.c -@@ -2915,6 +2915,7 @@ static void register_global_properties(MachineState *ms) +@@ -2994,6 +2994,7 @@ static void user_register_global_props(void) int main(int argc, char **argv, char **envp) { int i; @@ -38,7 +39,7 @@ index 63107d82a3..e349797245 100644 int snapshot, linux_boot; const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; -@@ -3660,6 +3661,13 @@ int main(int argc, char **argv, char **envp) +@@ -3682,6 +3683,13 @@ int main(int argc, char **argv, char **envp) exit(1); } break; @@ -53,5 +54,5 @@ index 63107d82a3..e349797245 100644 vnc_parse(optarg, &error_fatal); break; -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0027-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch b/debian/patches/pve/0026-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch similarity index 93% rename from debian/patches/pve/0027-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch rename to debian/patches/pve/0026-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch index abbfaf6..6e78335 100644 --- a/debian/patches/pve/0027-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch +++ b/debian/patches/pve/0026-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch @@ -4,6 +4,8 @@ Date: Mon, 4 Jul 2016 15:02:26 +0200 Subject: [PATCH] PVE: [Config] Revert "target-i386: disable LINT0 after reset" This reverts commit b8eb5512fd8a115f164edbbe897cdf8884920ccb. + +Signed-off-by: Thomas Lamprecht --- hw/intc/apic_common.c | 9 +++++++++ 1 file changed, 9 insertions(+) @@ -29,5 +31,5 @@ index 78903ea909..cdfbec5e47 100644 /* This function is only used for old state version 1 and 2 */ -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0028-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch b/debian/patches/pve/0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch similarity index 68% rename from debian/patches/pve/0028-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch rename to debian/patches/pve/0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch index d5f2da8..0b3bab2 100644 --- a/debian/patches/pve/0028-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch +++ b/debian/patches/pve/0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch @@ -6,16 +6,17 @@ Subject: [PATCH] PVE: [Up+Config] file-posix: make locking optiono on create Otherwise creating images on nfs/cifs can be problematic. Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht --- - block/file-posix.c | 53 ++++++++++++++++++++++++++++++++++++---------------- + block/file-posix.c | 61 +++++++++++++++++++++++++++++--------------- qapi/block-core.json | 3 ++- - 2 files changed, 39 insertions(+), 17 deletions(-) + 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c -index 431a9dddc6..be34698d04 100644 +index 89f014f39a..ad2f9bf243 100644 --- a/block/file-posix.c +++ b/block/file-posix.c -@@ -2175,6 +2175,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2223,6 +2223,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) int fd; uint64_t perm, shared; int result = 0; @@ -23,18 +24,18 @@ index 431a9dddc6..be34698d04 100644 /* Validate options and set default values */ assert(options->driver == BLOCKDEV_DRIVER_FILE); -@@ -2208,16 +2209,19 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2256,19 +2257,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) perm = BLK_PERM_WRITE | BLK_PERM_RESIZE; shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE; - /* Step one: Take locks */ -- result = raw_apply_lock_bytes(fd, perm, ~shared, false, errp); +- result = raw_apply_lock_bytes(NULL, fd, perm, ~shared, false, errp); - if (result < 0) { - goto out_close; - } + if (file_opts->locking != ON_OFF_AUTO_OFF) { + /* Step one: Take locks */ -+ result = raw_apply_lock_bytes(fd, perm, ~shared, false, errp); ++ result = raw_apply_lock_bytes(NULL, fd, perm, ~shared, false, errp); + if (result < 0) { + goto out_close; + } @@ -43,39 +44,45 @@ index 431a9dddc6..be34698d04 100644 - /* Step two: Check that nobody else has taken conflicting locks */ - result = raw_check_lock_bytes(fd, perm, shared, errp); - if (result < 0) { +- error_append_hint(errp, +- "Is another process using the image [%s]?\n", +- file_opts->filename); - goto out_unlock; + /* Step two: Check that nobody else has taken conflicting locks */ + result = raw_check_lock_bytes(fd, perm, shared, errp); + if (result < 0) { ++ error_append_hint(errp, ++ "Is another process using the image [%s]?\n", ++ file_opts->filename); + goto out_unlock; + } } /* Clear the file by truncating it to 0 */ -@@ -2250,13 +2254,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) +@@ -2301,13 +2305,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) } out_unlock: -- raw_apply_lock_bytes(fd, 0, 0, true, &local_err); +- raw_apply_lock_bytes(NULL, fd, 0, 0, true, &local_err); - if (local_err) { - /* The above call should not fail, and if it does, that does - * not mean the whole creation operation has failed. So - * report it the user for their convenience, but do not report - * it to the caller. */ -- error_report_err(local_err); +- warn_report_err(local_err); + if (locked) { -+ raw_apply_lock_bytes(fd, 0, 0, true, &local_err); ++ raw_apply_lock_bytes(NULL, fd, 0, 0, true, &local_err); + if (local_err) { + /* The above call should not fail, and if it does, that does + * not mean the whole creation operation has failed. So + * report it the user for their convenience, but do not report + * it to the caller. */ -+ error_report_err(local_err); ++ warn_report_err(local_err); + } } out_close: -@@ -2277,6 +2283,7 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, +@@ -2328,6 +2334,7 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, PreallocMode prealloc; char *buf = NULL; Error *local_err = NULL; @@ -83,7 +90,7 @@ index 431a9dddc6..be34698d04 100644 /* Skip file: protocol prefix */ strstart(filename, "file:", &filename); -@@ -2294,6 +2301,18 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, +@@ -2345,6 +2352,18 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, return -EINVAL; } @@ -102,7 +109,7 @@ index 431a9dddc6..be34698d04 100644 options = (BlockdevCreateOptions) { .driver = BLOCKDEV_DRIVER_FILE, .u.file = { -@@ -2303,6 +2322,8 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, +@@ -2354,6 +2373,8 @@ static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, .preallocation = prealloc, .has_nocow = true, .nocow = nocow, @@ -111,11 +118,20 @@ index 431a9dddc6..be34698d04 100644 }, }; return raw_co_create(&options, errp); +@@ -2773,7 +2794,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared, + } + + /* Copy locks to the new fd */ +- if (s->perm_change_fd) { ++ if (s->use_lock && s->perm_change_fd) { + ret = raw_apply_lock_bytes(NULL, s->perm_change_fd, perm, ~shared, + false, errp); + if (ret < 0) { diff --git a/qapi/block-core.json b/qapi/block-core.json -index 9c3c2d4917..db859e20fa 100644 +index 6f97460806..0e9c239485 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -3879,7 +3879,8 @@ +@@ -4219,7 +4219,8 @@ 'data': { 'filename': 'str', 'size': 'size', '*preallocation': 'PreallocMode', @@ -126,5 +142,5 @@ index 9c3c2d4917..db859e20fa 100644 ## # @BlockdevCreateOptionsGluster: -- -2.11.0 +2.20.1 diff --git a/debian/patches/pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch b/debian/patches/pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch new file mode 100644 index 0000000..27c7e83 --- /dev/null +++ b/debian/patches/pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 15 May 2019 15:10:11 +0100 +Subject: [PATCH] docs: recommend use of md-clear feature on all Intel CPUs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Update x86 CPU model guidance to recommend that the md-clear feature is +manually enabled with all Intel CPU models, when supported by the host +microcode. + +Signed-off-by: Daniel P. Berrangé +Message-Id: <20190515141011.5315-3-berrange@redhat.com> +Signed-off-by: Eduardo Habkost +(cherry picked from commit 2c7e82a30774730100da9dbe68d2360459030d91) +Signed-off-by: Thomas Lamprecht +--- + docs/qemu-cpu-models.texi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/docs/qemu-cpu-models.texi b/docs/qemu-cpu-models.texi +index 23c11dc86f..ad040cfc98 100644 +--- a/docs/qemu-cpu-models.texi ++++ b/docs/qemu-cpu-models.texi +@@ -200,6 +200,18 @@ Not included by default in any Intel CPU model. + Should be explicitly turned on for all Intel CPU models. + + Note that not all CPU hardware will support this feature. ++ ++@item @code{md-clear} ++ ++Required to confirm the MDS (CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, ++CVE-2019-11091) fixes. ++ ++Not included by default in any Intel CPU model. ++ ++Must be explicitly turned on for all Intel CPU models. ++ ++Requires the host CPU microcode to support this feature before it ++can be used for guest CPUs. + @end table + + +-- +2.20.1 + diff --git a/debian/patches/pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch b/debian/patches/pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch new file mode 100644 index 0000000..b1ef5f7 --- /dev/null +++ b/debian/patches/pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Lamprecht +Date: Fri, 21 Jun 2019 10:38:46 +0200 +Subject: [PATCH] PVE: savevm-async: kick AIO wait on block state write + +Signed-off-by: Thomas Lamprecht +--- + savevm-async.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/savevm-async.c b/savevm-async.c +index 2149010bb8..0bbbbf51ba 100644 +--- a/savevm-async.c ++++ b/savevm-async.c +@@ -154,6 +154,7 @@ static void coroutine_fn block_state_write_entry(void *opaque) { + BlkRwCo *rwco = opaque; + rwco->ret = blk_co_pwritev(snap_state.target, rwco->offset, rwco->qiov->size, + rwco->qiov, 0); ++ aio_wait_kick(); + } + + static ssize_t block_state_writev_buffer(void *opaque, struct iovec *iov, +-- +2.20.1 + diff --git a/debian/patches/pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch b/debian/patches/pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch new file mode 100644 index 0000000..c1109b8 --- /dev/null +++ b/debian/patches/pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wolfgang Bumiller +Date: Mon, 24 Jun 2019 10:19:50 +0200 +Subject: [PATCH] PVE: move snapshot cleanup into bottom half + +as per: + (0ceccd858a8d) migration: qemu_savevm_state_cleanup() in cleanup + +may affect held locks and therefore change assumptions made +by that function! + +Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht +--- + savevm-async.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/savevm-async.c b/savevm-async.c +index 0bbbbf51ba..f9355c5036 100644 +--- a/savevm-async.c ++++ b/savevm-async.c +@@ -197,6 +197,8 @@ static void process_savevm_cleanup(void *opaque) + int ret; + qemu_bh_delete(snap_state.cleanup_bh); + snap_state.cleanup_bh = NULL; ++ qemu_savevm_state_cleanup(); ++ + qemu_mutex_unlock_iothread(); + qemu_thread_join(&snap_state.thread); + qemu_mutex_lock_iothread(); +@@ -273,7 +275,6 @@ static void *process_savevm_thread(void *opaque) + save_snapshot_error("qemu_savevm_state_iterate error %d", ret); + break; + } +- qemu_savevm_state_cleanup(); + DPRINTF("save complete\n"); + break; + } +-- +2.20.1 + diff --git a/debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch b/debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch new file mode 100644 index 0000000..31d7e9e --- /dev/null +++ b/debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wolfgang Bumiller +Date: Tue, 25 Jun 2019 11:17:58 +0200 +Subject: [PATCH] PVE: monitor: disable oob capability + +A bisect revealed that commit 8258292e18c3 +("monitor: Remove "x-oob", offer capability "oob" unconditionally") +causes unexpected hangs when restoring live snapshots from some +types of block devices (particularly RBD). +We need to figure out what's happnening there. For now, since we +had this disabled before and probably don't need it now either, +disable oob, so we can get a functioning qemu out... + +Signed-off-by: Wolfgang Bumiller +Signed-off-by: Thomas Lamprecht +--- + monitor.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/monitor.c b/monitor.c +index 4807bbe811..f8d2338667 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -4605,10 +4605,7 @@ void monitor_init(Chardev *chr, int flags) + bool use_readline = flags & MONITOR_USE_READLINE; + + /* Note: we run QMP monitor in I/O thread when @chr supports that */ +- monitor_data_init(mon, false, +- (flags & MONITOR_USE_CONTROL) +- && qemu_chr_has_feature(chr, +- QEMU_CHAR_FEATURE_GCONTEXT)); ++ monitor_data_init(mon, false, false); + + qemu_chr_fe_init(&mon->chr, chr, &error_abort); + mon->flags = flags; +-- +2.20.1 + diff --git a/debian/patches/series b/debian/patches/series index f3e6c45..6626a47 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,37 +1,33 @@ +extra/0001-target-i386-add-MDS-NO-feature.patch +extra/0002-target-i386-define-md-clear-bit.patch pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch -pve/0003-PVE-Config-use-kvm-by-default.patch -pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch -pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch -pve/0006-PVE-Config-smm_available-false.patch -pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch -pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch -pve/0009-PVE-Up-qmp-add-get_link_status.patch -pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch -pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch -pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch -pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch -pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch -pve/0015-PVE-virtio-balloon-improve-query-balloon.patch -pve/0016-PVE-qapi-modify-query-machines.patch -pve/0017-PVE-qapi-modify-spice-query.patch -pve/0018-PVE-internal-snapshot-async.patch -pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch -pve/0020-PVE-backup-modify-job-api.patch -pve/0021-PVE-backup-introduce-vma-archive-format.patch -pve/0022-PVE-Deprecated-adding-old-vma-files.patch -pve/0023-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch -pve/0024-PVE-vma-add-cache-option-to-device-map.patch -pve/0025-PVE-vma-remove-forced-NO_FLUSH-option.patch -pve/0026-PVE-Add-dummy-id-command-line-parameter.patch -pve/0027-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch -pve/0028-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch -extra/0001-monitor-guard-iothread-access-by-mon-use_io_thread.patch -extra/0002-monitor-delay-monitor-iothread-creation.patch -extra/0003-kvm-Add-support-to-KVM_GET_MSR_FEATURE_INDEX_LIST-an.patch -extra/0004-i386-Add-CPUID-bit-and-feature-words-for-IA32_ARCH_C.patch -extra/0005-i386-Add-new-MSR-indices-for-IA32_PRED_CMD-and-IA32_.patch -extra/0006-x86-Data-structure-changes-to-support-MSR-based-feat.patch -extra/0007-x86-define-a-new-MSR-based-feature-word-FEATURE_WORD.patch -extra/0008-target-i386-add-MDS-NO-feature.patch -extra/0009-target-i386-define-md-clear-bit.patch +pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch +pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch +pve/0005-PVE-Config-smm_available-false.patch +pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch +pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch +pve/0008-PVE-Up-qmp-add-get_link_status.patch +pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch +pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch +pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch +pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch +pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch +pve/0014-PVE-virtio-balloon-improve-query-balloon.patch +pve/0015-PVE-qapi-modify-query-machines.patch +pve/0016-PVE-qapi-modify-spice-query.patch +pve/0017-PVE-internal-snapshot-async.patch +pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch +pve/0019-PVE-backup-modify-job-api.patch +pve/0020-PVE-backup-introduce-vma-archive-format.patch +pve/0021-PVE-Deprecated-adding-old-vma-files.patch +pve/0022-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch +pve/0023-PVE-vma-add-cache-option-to-device-map.patch +pve/0024-PVE-vma-remove-forced-NO_FLUSH-option.patch +pve/0025-PVE-Add-dummy-id-command-line-parameter.patch +pve/0026-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch +pve/0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch +pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch +pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch +pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch +pve/0031-PVE-monitor-disable-oob-capability.patch