From 958e1b8dccf9809600478f316ab641d490881fe7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:09:16 +0000 Subject: import qemu-kvm-1.5.3-86.el7 --- diff --git a/.qemu-kvm.metadata b/.qemu-kvm.metadata index 06335af..0722292 100644 --- a/.qemu-kvm.metadata +++ b/.qemu-kvm.metadata @@ -1,4 +1,4 @@ -7c83cf03604d7db8ca5e7c8fce49b59cda240596 SOURCES/bios-256k.bin +9d4dcfdd25605fed27e625620e78a6a83eadd04c SOURCES/bios-256k.bin e5a40bb63de8445a465c507ce27e736cff35ec12 SOURCES/qemu-1.5.3.tar.bz2 a07ce6c2f11c692f70c80cea3345aefd20be8a7b SOURCES/rhel6-e1000.rom faac4c56f0ef593721edc66af965bac63760965b SOURCES/rhel6-ne2k_pci.rom diff --git a/SOURCES/kvm-Allow-mismatched-virtio-config-len.patch b/SOURCES/kvm-Allow-mismatched-virtio-config-len.patch index 8e05351..65986c3 100644 --- a/SOURCES/kvm-Allow-mismatched-virtio-config-len.patch +++ b/SOURCES/kvm-Allow-mismatched-virtio-config-len.patch @@ -1,16 +1,16 @@ -From 88fd47b4c3a1a272d7e21ba0e7358e0a4e9ecf88 Mon Sep 17 00:00:00 2001 +From 3741ae811d3287e34779a307480dfb3e93dbb451 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) -Date: Mon, 30 Jun 2014 11:10:01 +0200 +Date: Mon, 30 Jun 2014 09:49:51 +0200 Subject: [PATCH] Allow mismatched virtio config-len RH-Author: Dr. David Alan Gilbert (git) -Message-id: <1404126601-23992-2-git-send-email-dgilbert@redhat.com> -Patchwork-id: 59407 -O-Subject: [RHEL-7.0.z qemu-kvm PATCH 1/1] Allow mismatched virtio config-len -Bugzilla: 1095782 -RH-Acked-by: Paolo Bonzini -RH-Acked-by: Juan Quintela +Message-id: <1404121791-14438-2-git-send-email-dgilbert@redhat.com> +Patchwork-id: 59405 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] Allow mismatched virtio config-len +Bugzilla: 1113009 RH-Acked-by: Michael S. Tsirkin +RH-Acked-by: Juan Quintela +RH-Acked-by: Paolo Bonzini From: "Dr. David Alan Gilbert" diff --git a/SOURCES/kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch b/SOURCES/kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch index f8afbca..3dd3540 100644 --- a/SOURCES/kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch +++ b/SOURCES/kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch @@ -1,20 +1,20 @@ -From 118493a7515526d7adc52b1ca1b667db1458e98c Mon Sep 17 00:00:00 2001 +From 20a401a160bb959469e95cc809b53609eedccb40 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) Date: Thu, 8 May 2014 11:27:33 +0200 -Subject: [PATCH 21/30] Count used RAMBlock pages for migration_dirty_pages +Subject: [PATCH 08/31] Count used RAMBlock pages for migration_dirty_pages RH-Author: Dr. David Alan Gilbert (git) Message-id: <1399548453-9181-2-git-send-email-dgilbert@redhat.com> Patchwork-id: 58746 O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 1/1] Count used RAMBlock pages for migration_dirty_pages -Bugzilla: 1110189 +Bugzilla: 1074913 RH-Acked-by: Juan Quintela RH-Acked-by: Markus Armbruster RH-Acked-by: Amit Shah From: "Dr. David Alan Gilbert" -This is a fix for a bug triggered by a migration after hot unplugging +This is a fix for a bug* triggered by a migration after hot unplugging a few virtio-net NICs, that caused migration never to converge, because 'migration_dirty_pages' is incorrectly initialised. @@ -29,6 +29,8 @@ migration_dirty_pages ended up too large. Signed-off-by: Dr. David Alan Gilbert +(* https://bugzilla.redhat.com/show_bug.cgi?id=1074913 ) + Signed-off-by: Juan Quintela (cherry picked from commit e30d1d8c7195848abb28a8c734a82b845b8b456a) --- diff --git a/SOURCES/kvm-Define-the-architecture-for-compressed-dump-format.patch b/SOURCES/kvm-Define-the-architecture-for-compressed-dump-format.patch new file mode 100644 index 0000000..44206f1 --- /dev/null +++ b/SOURCES/kvm-Define-the-architecture-for-compressed-dump-format.patch @@ -0,0 +1,90 @@ +From da105287a0b61d57f015299cdf5211ba2e21a70f Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:04 +0100 +Subject: [PATCH 17/41] Define the architecture for compressed dump format + +Message-id: <1415380693-16593-18-git-send-email-lersek@redhat.com> +Patchwork-id: 62203 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 17/26] Define the architecture for compressed dump format +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +Signed-off-by: Ekaterina Tumanova +Reviewed-by: Laszlo Ersek +Reviewed-by: Qiao Nuohan +Signed-off-by: Luiz Capitulino +(cherry picked from commit 4ab23a918249772458fd330758dc0fad96edce50) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 7 +++++-- + target-i386/cpu.h | 2 ++ + target-s390x/cpu.h | 1 + + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/dump.c b/dump.c +index c0d5877..507a250 100644 +--- a/dump.c ++++ b/dump.c +@@ -32,6 +32,9 @@ + #ifdef CONFIG_SNAPPY + #include + #endif ++#ifndef ELF_MACHINE_UNAME ++#define ELF_MACHINE_UNAME "Unknown" ++#endif + + static uint16_t cpu_convert_to_target16(uint16_t val, int endian) + { +@@ -823,7 +826,7 @@ static int create_header32(DumpState *s) + dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian); + bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; + dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian); +- memcpy(&(dh->utsname.machine), "i686", 4); ++ strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine)); + + if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { + status |= DUMP_DH_COMPRESSED_ZLIB; +@@ -930,7 +933,7 @@ static int create_header64(DumpState *s) + dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian); + bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; + dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian); +- memcpy(&(dh->utsname.machine), "x86_64", 6); ++ strncpy(dh->utsname.machine, ELF_MACHINE_UNAME, sizeof(dh->utsname.machine)); + + if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { + status |= DUMP_DH_COMPRESSED_ZLIB; +diff --git a/target-i386/cpu.h b/target-i386/cpu.h +index ad40aab..207645c 100644 +--- a/target-i386/cpu.h ++++ b/target-i386/cpu.h +@@ -38,8 +38,10 @@ + + #ifdef TARGET_X86_64 + #define ELF_MACHINE EM_X86_64 ++#define ELF_MACHINE_UNAME "x86_64" + #else + #define ELF_MACHINE EM_386 ++#define ELF_MACHINE_UNAME "i686" + #endif + + #define CPUArchState struct CPUX86State +diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h +index 0ce82cf..4979e0e 100644 +--- a/target-s390x/cpu.h ++++ b/target-s390x/cpu.h +@@ -28,6 +28,7 @@ + #define TARGET_LONG_BITS 64 + + #define ELF_MACHINE EM_S390 ++#define ELF_MACHINE_UNAME "S390X" + + #define CPUArchState struct CPUS390XState + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Disallow-outward-migration-while-awaiting-incoming-m.patch b/SOURCES/kvm-Disallow-outward-migration-while-awaiting-incoming-m.patch new file mode 100644 index 0000000..a4b93a0 --- /dev/null +++ b/SOURCES/kvm-Disallow-outward-migration-while-awaiting-incoming-m.patch @@ -0,0 +1,62 @@ +From 6bdff9954d46304a278bff833ecb15450c19c4f5 Mon Sep 17 00:00:00 2001 +From: Dr. David Alan Gilbert (git) +Date: Thu, 8 May 2014 11:52:12 +0200 +Subject: [PATCH 05/13] Disallow outward migration while awaiting incoming migration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Dr. David Alan Gilbert (git) +Message-id: <1399549932-9977-1-git-send-email-dgilbert@redhat.com> +Patchwork-id: 58747 +O-Subject: [RHEL7.1 qemu-kvm PATCH 1/1] Disallow outward migration while awaiting incoming migration +Bugzilla: 1086987 +RH-Acked-by: Amos Kong +RH-Acked-by: Juan Quintela +RH-Acked-by: Markus Armbruster + +From: "Dr. David Alan Gilbert" + +bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1086987 +brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7432751 +upstream: ca99993adc9205c905dba5dc1bb819959ada7200 + +QEMU will assert if you attempt to start an outgoing migration on +a QEMU that's sitting waiting for an incoming migration (started +with -incoming), so disallow it with a proper error. + +(This is a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1086987 ) + +Signed-off-by: Dr. David Alan Gilbert +Reviewed-by: Andreas Färber +Reviewed-by: Eric Blake +Signed-off-by: Juan Quintela +(cherry picked from commit ca99993adc9205c905dba5dc1bb819959ada7200) +--- + migration.c | 5 +++++ + 1 file changed, 5 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + migration.c | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/migration.c b/migration.c +index 7efbd25..44b993a 100644 +--- a/migration.c ++++ b/migration.c +@@ -430,6 +430,11 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, + return; + } + ++ if (runstate_check(RUN_STATE_INMIGRATE)) { ++ error_setg(errp, "Guest is waiting for an incoming migration"); ++ return; ++ } ++ + if (qemu_savevm_state_blocked(errp)) { + return; + } +-- +1.7.1 + diff --git a/SOURCES/kvm-Enforce-stack-protector-usage.patch b/SOURCES/kvm-Enforce-stack-protector-usage.patch new file mode 100644 index 0000000..2017826 --- /dev/null +++ b/SOURCES/kvm-Enforce-stack-protector-usage.patch @@ -0,0 +1,70 @@ +From 3938c85004bbd742c5a8c7e1480ed14c2420cd9d Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Tue, 26 Aug 2014 13:33:14 +0200 +Subject: [PATCH 1/6] Enforce stack protector usage + +Message-id: <1409059994-2966-1-git-send-email-mrezanin@redhat.com> +Patchwork-id: 60699 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] Enforce stack protector usage +Bugzilla: 1064260 +RH-Acked-by: Amos Kong +RH-Acked-by: Jeff Nelson +RH-Acked-by: Fam Zheng + +From: Miroslav Rezanina + +If --enable-stack-protector is used is used, configure script try to use +--fstack-protector-strong. In case it's not supported, --fstack-protector-all +is enabled. If both protectors are not supported, configure does not use +any protector at all without any notification. + +This patch reports error when user requests stack protector to be used and +both protector modes are not supported. Behavior is not changed in case +user do not use any of --enable-stack-protector/--disable-stack-protector. + +Signed-off-by: Miroslav Rezanina +[Fix non-POSIX operator in test. - Paolo] +Signed-off-by: Paolo Bonzini + +(cherry picked from commit 3b463a3fa8f7690ffa3ef273993dff349b3a73d3) + +Conflicts: + configure - upstream use -fstack-protector-all as second option + we used -fstack-protector. + Updated to upstream behavior + +Signed-off-by: Miroslav Rezanina +--- + configure | 9 ++++++++- + 1 files changed, 8 insertions(+), 1 deletions(-) + +diff --git a/configure b/configure +index 4552e08..0c666e5 100755 +--- a/configure ++++ b/configure +@@ -1303,14 +1303,21 @@ for flag in $gcc_flags; do + done + + if test "$stack_protector" != "no" ; then +- gcc_flags="-fstack-protector-strong -fstack-protector" ++ gcc_flags="-fstack-protector-strong -fstack-protector-all" ++ sp_on=0 + for flag in $gcc_flags; do + if compile_prog "-Werror $flag" "" ; then + QEMU_CFLAGS="$QEMU_CFLAGS $flag" + LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag" ++ sp_on=1 + break + fi + done ++ if test "$stack_protector" = yes; then ++ if test $sp_on = 0; then ++ error_exit "Stack protector not supported" ++ fi ++ fi + fi + + # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and +-- +1.7.1 + diff --git a/SOURCES/kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch b/SOURCES/kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch index 2cb8c51..fb3382a 100644 --- a/SOURCES/kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch +++ b/SOURCES/kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch @@ -1,13 +1,13 @@ -From ac978ade92aa12ae6c700b8be85a10355f728c78 Mon Sep 17 00:00:00 2001 +From 7b47ae208675e0da813f9f46838d9a8935c68a02 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) Date: Thu, 8 May 2014 10:58:41 +0200 -Subject: [PATCH 19/30] Init the XBZRLE.lock in ram_mig_init +Subject: [PATCH 06/31] Init the XBZRLE.lock in ram_mig_init RH-Author: Dr. David Alan Gilbert (git) Message-id: <1399546722-6350-4-git-send-email-dgilbert@redhat.com> Patchwork-id: 58743 O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 3/4] Init the XBZRLE.lock in ram_mig_init -Bugzilla: 1110191 +Bugzilla: 1066338 RH-Acked-by: Juan Quintela RH-Acked-by: Markus Armbruster RH-Acked-by: Amit Shah diff --git a/SOURCES/kvm-Introduce-cpu_clean_all_dirty.patch b/SOURCES/kvm-Introduce-cpu_clean_all_dirty.patch new file mode 100644 index 0000000..5990ab5 --- /dev/null +++ b/SOURCES/kvm-Introduce-cpu_clean_all_dirty.patch @@ -0,0 +1,114 @@ +From 2611b6a31041da5b9ed3793152d309aae77932bb Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Wed, 22 Oct 2014 09:46:35 +0200 +Subject: [PATCH 4/6] Introduce cpu_clean_all_dirty + +Message-id: <1413971197-4624-4-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61791 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 3/5] Introduce cpu_clean_all_dirty +Bugzilla: 1098602 1130428 +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Paolo Bonzini + +From: Marcelo Tosatti + +Introduce cpu_clean_all_dirty, to force subsequent cpu_synchronize_all_states +to read in-kernel register state. + +Signed-off-by: Marcelo Tosatti +Signed-off-by: Paolo Bonzini +(cherry picked from commit de9d61e83d43be9069e6646fa9d57a3f47779d28) +Signed-off-by: Miroslav Rezanina + +Conflicts: + cpus.c + kvm-all.c + +dgilbert: Had to replace CPU_FOREACH by a loop + +Signed-off-by: Dr. David Alan Gilbert +--- + cpus.c | 9 +++++++++ + include/sysemu/cpus.h | 1 + + include/sysemu/kvm.h | 8 ++++++++ + kvm-all.c | 5 +++++ + 4 files changed, 23 insertions(+) + +diff --git a/cpus.c b/cpus.c +index caccf5a..3948cdf 100644 +--- a/cpus.c ++++ b/cpus.c +@@ -437,6 +437,15 @@ bool cpu_is_stopped(CPUState *cpu) + return !runstate_is_running() || cpu->stopped; + } + ++void cpu_clean_all_dirty(void) ++{ ++ CPUArchState *cpu; ++ ++ for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) { ++ cpu_clean_state(ENV_GET_CPU(cpu)); ++ } ++} ++ + static int do_vm_stop(RunState state) + { + int ret = 0; +diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h +index 6502488..4f8a3df 100644 +--- a/include/sysemu/cpus.h ++++ b/include/sysemu/cpus.h +@@ -10,6 +10,7 @@ void cpu_stop_current(void); + void cpu_synchronize_all_states(void); + void cpu_synchronize_all_post_reset(void); + void cpu_synchronize_all_post_init(void); ++void cpu_clean_all_dirty(void); + + void qtest_clock_warp(int64_t dest); + +diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h +index e722027..0c6833f 100644 +--- a/include/sysemu/kvm.h ++++ b/include/sysemu/kvm.h +@@ -274,6 +274,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, + + void kvm_cpu_synchronize_post_reset(CPUState *cpu); + void kvm_cpu_synchronize_post_init(CPUState *cpu); ++void kvm_cpu_clean_state(CPUState *cpu); + + static inline void cpu_synchronize_post_reset(CPUState *cpu) + { +@@ -289,6 +290,13 @@ static inline void cpu_synchronize_post_init(CPUState *cpu) + } + } + ++static inline void cpu_clean_state(CPUState *cpu) ++{ ++ if (kvm_enabled()) { ++ kvm_cpu_clean_state(cpu); ++ } ++} ++ + int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg); + int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg); + void kvm_irqchip_release_virq(KVMState *s, int virq); +diff --git a/kvm-all.c b/kvm-all.c +index f7f621b..fc6e3ab 100644 +--- a/kvm-all.c ++++ b/kvm-all.c +@@ -1615,6 +1615,11 @@ void kvm_cpu_synchronize_post_init(CPUState *cpu) + cpu->kvm_vcpu_dirty = false; + } + ++void kvm_cpu_clean_state(CPUState *cpu) ++{ ++ cpu->kvm_vcpu_dirty = false; ++} ++ + int kvm_cpu_exec(CPUArchState *env) + { + CPUState *cpu = ENV_GET_CPU(env); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Provide-init-function-for-ram-migration.patch b/SOURCES/kvm-Provide-init-function-for-ram-migration.patch index d94b29f..821dc5a 100644 --- a/SOURCES/kvm-Provide-init-function-for-ram-migration.patch +++ b/SOURCES/kvm-Provide-init-function-for-ram-migration.patch @@ -1,13 +1,13 @@ -From 8928f6a2f77e167b7602c3f3bb071641134e544e Mon Sep 17 00:00:00 2001 +From 86303381279f7c0e9d98693496d888801a503148 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) Date: Thu, 8 May 2014 10:58:40 +0200 -Subject: [PATCH 18/30] Provide init function for ram migration +Subject: [PATCH 05/31] Provide init function for ram migration RH-Author: Dr. David Alan Gilbert (git) Message-id: <1399546722-6350-3-git-send-email-dgilbert@redhat.com> Patchwork-id: 58742 O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 2/4] Provide init function for ram migration -Bugzilla: 1110191 +Bugzilla: 1066338 RH-Acked-by: Juan Quintela RH-Acked-by: Markus Armbruster RH-Acked-by: Amit Shah diff --git a/SOURCES/kvm-Revert-Build-ceph-rbd-only-for-rhev.patch b/SOURCES/kvm-Revert-Build-ceph-rbd-only-for-rhev.patch new file mode 100644 index 0000000..2c24d69 --- /dev/null +++ b/SOURCES/kvm-Revert-Build-ceph-rbd-only-for-rhev.patch @@ -0,0 +1,87 @@ +From 6c1152b03b7ba00048ca46c424064aab14b2a18d Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 20 Nov 2014 13:47:21 +0100 +Subject: [PATCH 2/5] Revert "Build ceph/rbd only for rhev" + +Message-id: <1416491244-20209-2-git-send-email-kwolf@redhat.com> +Patchwork-id: 62496 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/4] Revert "Build ceph/rbd only for rhev" +Bugzilla: 1140742 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +This reverts commit 5d5af5b18e07ef4c97a45feeaad3fe493d38f427. + +Signed-off-by: Miroslav Rezanina + +Conflicts: + configure + redhat/qemu-kvm.spec.template + +Signed-off-by: Kevin Wolf +--- + block/Makefile.objs | 2 +- + configure | 11 ----------- + redhat/qemu-kvm.spec.template | 6 ------ + 3 files changed, 1 insertion(+), 18 deletions(-) + +diff --git a/block/Makefile.objs b/block/Makefile.objs +index dd01fb3..6b578d9 100644 +--- a/block/Makefile.objs ++++ b/block/Makefile.objs +@@ -13,7 +13,7 @@ ifeq ($(CONFIG_POSIX),y) + block-obj-y += nbd.o sheepdog.o + block-obj-$(CONFIG_LIBISCSI) += iscsi.o + block-obj-$(CONFIG_CURL) += curl.o +-block-obj-$(CONFIG_CEPH_SUPPORT) += rbd.o ++block-obj-y += rbd.o + block-obj-$(CONFIG_GLUSTERFS) += gluster.o + block-obj-$(CONFIG_LIBSSH2) += ssh.o + endif +diff --git a/configure b/configure +index ca8b107..8db9dbe 100755 +--- a/configure ++++ b/configure +@@ -248,7 +248,6 @@ tpm="no" + libssh2="" + live_block_ops="yes" + live_block_migration="no" +-ceph_support="yes" + vhdx="" + + # parse CC options first +@@ -959,10 +958,6 @@ for opt do + ;; + --enable-live-block-migration) live_block_migration="yes" + ;; +- --disable-ceph-support) ceph_support="no" +- ;; +- --enable-ceph-support) ceph_support="yes" +- ;; + --enable-vhdx) vhdx="yes" + ;; + --disable-vhdx) vhdx="no" +@@ -1245,8 +1240,6 @@ echo " --disable-live-block-ops disable live block operations support" + echo " --enable-live-block-ops enable live block operations support" + echo " --disable-live-block-migration disable live block migration" + echo " --enable-live-block-migration enable live block migration" +-echo " --disable-ceph-support disable support for rbd block driver support" +-echo " --enable-ceph-support enable support for rbd block driver support" + echo " --disable-vhdx disables support for the Microsoft VHDX image format" + echo " --enable-vhdx enable support for the Microsoft VHDX image format" + echo "" +@@ -4105,10 +4098,6 @@ if test "$live_block_migration" = "yes" ; then + echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak + fi + +-if test "$ceph_support" = "yes"; then +- echo "CONFIG_CEPH_SUPPORT=y" >> $config_host_mak +-fi +- + if test "$vhdx" = "yes" ; then + echo "CONFIG_VHDX=y" >> $config_host_mak + fi +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Revert-kvmclock-Ensure-proper-env-tsc-value-for-kvmc.patch b/SOURCES/kvm-Revert-kvmclock-Ensure-proper-env-tsc-value-for-kvmc.patch new file mode 100644 index 0000000..523b386 --- /dev/null +++ b/SOURCES/kvm-Revert-kvmclock-Ensure-proper-env-tsc-value-for-kvmc.patch @@ -0,0 +1,58 @@ +From 51db6795c68e1d00373d373c043543bbc6fb8f08 Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Wed, 22 Oct 2014 09:46:33 +0200 +Subject: [PATCH 2/6] Revert "kvmclock: Ensure proper env->tsc value for + kvmclock_current_nsec calculation" + +Message-id: <1413971197-4624-2-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61789 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/5] Revert "kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation" +Bugzilla: 1098602 1130428 +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Paolo Bonzini + +From: "Dr. David Alan Gilbert" + +This reverts commit da4fe791cecafbec05395041c52cb545308b1b61. + +The equivalent upstream revert is Paolo's 108e4c3871e0d0cd185c + +Signed-off-by: Dr. David Alan Gilbert +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index d52c2ea..1f2a26e 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -17,7 +17,6 @@ + #include "qemu/host-utils.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" +-#include "sysemu/cpus.h" + #include "hw/sysbus.h" + #include "hw/kvm/clock.h" + +@@ -61,7 +60,6 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s) + + cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); + +- assert(time.tsc_timestamp <= migration_tsc); + delta = migration_tsc - time.tsc_timestamp; + if (time.tsc_shift < 0) { + delta >>= -time.tsc_shift; +@@ -120,8 +118,6 @@ static void kvmclock_vm_state_change(void *opaque, int running, + if (s->clock_valid) { + return; + } +- +- cpu_synchronize_all_states(); + ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data); + if (ret < 0) { + fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret)); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Revert-kvmclock-Ensure-time-in-migration-never-goes-.patch b/SOURCES/kvm-Revert-kvmclock-Ensure-time-in-migration-never-goes-.patch new file mode 100644 index 0000000..1b02581 --- /dev/null +++ b/SOURCES/kvm-Revert-kvmclock-Ensure-time-in-migration-never-goes-.patch @@ -0,0 +1,106 @@ +From 62ac85ec7c8e41b0454bdec0e0a9c7d5adc39280 Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Wed, 22 Oct 2014 09:46:34 +0200 +Subject: [PATCH 3/6] Revert "kvmclock: Ensure time in migration never goes + backward" + +Message-id: <1413971197-4624-3-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61788 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/5] Revert "kvmclock: Ensure time in migration never goes backward" +Bugzilla: 1098602 1130428 +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Paolo Bonzini + +From: "Dr. David Alan Gilbert" + +This reverts commit 4b6035c2a739bc4c086abbb36f0883a1178a8f1c. + +The equivalent upstream revert is Paolo's fa666c10f2f3e15685ff + +Signed-off-by: Dr. David Alan Gilbert +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 49 ------------------------------------------------- + 1 file changed, 49 deletions(-) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index 1f2a26e..6d6f3a7 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -14,7 +14,6 @@ + */ + + #include "qemu-common.h" +-#include "qemu/host-utils.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" + #include "hw/sysbus.h" +@@ -29,48 +28,6 @@ typedef struct KVMClockState { + bool clock_valid; + } KVMClockState; + +-struct pvclock_vcpu_time_info { +- uint32_t version; +- uint32_t pad0; +- uint64_t tsc_timestamp; +- uint64_t system_time; +- uint32_t tsc_to_system_mul; +- int8_t tsc_shift; +- uint8_t flags; +- uint8_t pad[2]; +-} __attribute__((__packed__)); /* 32 bytes */ +- +-static uint64_t kvmclock_current_nsec(KVMClockState *s) +-{ +- CPUArchState *acpu = first_cpu; +- CPUState *cpu = ENV_GET_CPU(acpu); +- CPUX86State *env = cpu->env_ptr; +- hwaddr kvmclock_struct_pa = env->system_time_msr & ~1ULL; +- uint64_t migration_tsc = env->tsc; +- struct pvclock_vcpu_time_info time; +- uint64_t delta; +- uint64_t nsec_lo; +- uint64_t nsec_hi; +- uint64_t nsec; +- +- if (!(env->system_time_msr & 1ULL)) { +- /* KVM clock not active */ +- return 0; +- } +- +- cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); +- +- delta = migration_tsc - time.tsc_timestamp; +- if (time.tsc_shift < 0) { +- delta >>= -time.tsc_shift; +- } else { +- delta <<= time.tsc_shift; +- } +- +- mulu64(&nsec_lo, &nsec_hi, delta, time.tsc_to_system_mul); +- nsec = (nsec_lo >> 32) | (nsec_hi << 32); +- return nsec + time.system_time; +-} + + static void kvmclock_vm_state_change(void *opaque, int running, + RunState state) +@@ -82,15 +39,9 @@ static void kvmclock_vm_state_change(void *opaque, int running, + + if (running) { + struct kvm_clock_data data; +- uint64_t time_at_migration = kvmclock_current_nsec(s); + + s->clock_valid = false; + +- /* We can't rely on the migrated clock value, just discard it */ +- if (time_at_migration) { +- s->clock = time_at_migration; +- } +- + data.clock = s->clock; + data.flags = 0; + ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Revert-linux-aio-use-event-notifiers.patch b/SOURCES/kvm-Revert-linux-aio-use-event-notifiers.patch new file mode 100644 index 0000000..caefc37 --- /dev/null +++ b/SOURCES/kvm-Revert-linux-aio-use-event-notifiers.patch @@ -0,0 +1,189 @@ +From 31d1d075a4cb1526d4c0ba43a8a6d581cedf0292 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Fri, 7 Nov 2014 10:09:29 +0100 +Subject: [PATCH 8/9] Revert "linux-aio: use event notifiers" + +Message-id: <1415354969-14209-1-git-send-email-famz@redhat.com> +Patchwork-id: 62180 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v3] Revert "linux-aio: use event notifiers" +Bugzilla: 1104748 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini + +This reverts commit c90caf25e2b6945ae13560476a5ecd7992e9f945: + + linux-aio: use event notifiers + + Since linux-aio already uses an eventfd, converting it to use the + EventNotifier-based API simplifies the code even though it is not + meant to be portable. + + Reviewed-by: Anthony Liguori + Signed-off-by: Paolo Bonzini + +Signed-off-by: Fam Zheng + +Justification: + + There is a performance regression compared to RHEL 6 since we picked + this patch during RHEL 7 rebase. The bugzilla has more data but as a + quick overview we can see the difference is significant: + + Configuration rw bs iodepth bw iops + ------------------------------------------------------------------ + Before revert randwrite 4k 32 579 148464 + After revert randwrite 4k 32 877 224752 + + The reason is that before revert, we pass min_nr=MAX_EVENTS to + io_getevents, which is much slower (50000+ ns compared to a few + hundreds) than when min_nr is val, the number of events, after + revert. + + The decisive difference is that MAX_EVENTS is usually strictly + greater than the number of pending events, hence the kernel code + takes a different path into the hrtimer, despite timeout=0. + + In other words, the root cause is in kernel. A fix is posted to + upstream. But let's have this workaround in qemu-kvm anyway. + +Upstream: + + The issue is silently compensated since cd758dd0aca (aio / timers: + Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack), and the + io_getevents call is moved to a BH, so changing min_nr back to 1 in + upstream is not demanding. As the ultimate fix in kernel is on its + way, reverting is a reasonable move for RHEL. + +Signed-off-by: Fam Zheng +Signed-off-by: Miroslav Rezanina + +Conflicts: + block/linux-aio.c +Trivial context conflict in #include section. +--- + block/linux-aio.c | 49 ++++++++++++++++++++++++++++++------------------- + 1 file changed, 30 insertions(+), 19 deletions(-) + +diff --git a/block/linux-aio.c b/block/linux-aio.c +index ee0f8d1..40041d1 100644 +--- a/block/linux-aio.c ++++ b/block/linux-aio.c +@@ -11,8 +11,8 @@ + #include "block/aio.h" + #include "qemu/queue.h" + #include "block/raw-aio.h" +-#include "qemu/event_notifier.h" + ++#include + #include + + /* +@@ -38,7 +38,7 @@ struct qemu_laiocb { + + struct qemu_laio_state { + io_context_t ctx; +- EventNotifier e; ++ int efd; + int count; + }; + +@@ -77,17 +77,29 @@ static void qemu_laio_process_completion(struct qemu_laio_state *s, + qemu_aio_release(laiocb); + } + +-static void qemu_laio_completion_cb(EventNotifier *e) ++static void qemu_laio_completion_cb(void *opaque) + { +- struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e); ++ struct qemu_laio_state *s = opaque; + +- while (event_notifier_test_and_clear(&s->e)) { ++ while (1) { + struct io_event events[MAX_EVENTS]; ++ uint64_t val; ++ ssize_t ret; + struct timespec ts = { 0 }; + int nevents, i; + + do { +- nevents = io_getevents(s->ctx, MAX_EVENTS, MAX_EVENTS, events, &ts); ++ ret = read(s->efd, &val, sizeof(val)); ++ } while (ret == -1 && errno == EINTR); ++ ++ if (ret == -1 && errno == EAGAIN) ++ break; ++ ++ if (ret != 8) ++ break; ++ ++ do { ++ nevents = io_getevents(s->ctx, val, MAX_EVENTS, events, &ts); + } while (nevents == -EINTR); + + for (i = 0; i < nevents; i++) { +@@ -101,9 +113,9 @@ static void qemu_laio_completion_cb(EventNotifier *e) + } + } + +-static int qemu_laio_flush_cb(EventNotifier *e) ++static int qemu_laio_flush_cb(void *opaque) + { +- struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e); ++ struct qemu_laio_state *s = opaque; + + return (s->count > 0) ? 1 : 0; + } +@@ -135,9 +147,8 @@ static void laio_cancel(BlockDriverAIOCB *blockacb) + * We might be able to do this slightly more optimal by removing the + * O_NONBLOCK flag. + */ +- while (laiocb->ret == -EINPROGRESS) { +- qemu_laio_completion_cb(&laiocb->ctx->e); +- } ++ while (laiocb->ret == -EINPROGRESS) ++ qemu_laio_completion_cb(laiocb->ctx); + } + + static const AIOCBInfo laio_aiocb_info = { +@@ -176,7 +187,7 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, + __func__, type); + goto out_free_aiocb; + } +- io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e)); ++ io_set_eventfd(&laiocb->iocb, s->efd); + s->count++; + + if (io_submit(s->ctx, 1, &iocbs) < 0) +@@ -195,21 +206,21 @@ void *laio_init(void) + struct qemu_laio_state *s; + + s = g_malloc0(sizeof(*s)); +- if (event_notifier_init(&s->e, false) < 0) { ++ s->efd = eventfd(0, 0); ++ if (s->efd == -1) + goto out_free_state; +- } ++ fcntl(s->efd, F_SETFL, O_NONBLOCK); + +- if (io_setup(MAX_EVENTS, &s->ctx) != 0) { ++ if (io_setup(MAX_EVENTS, &s->ctx) != 0) + goto out_close_efd; +- } + +- qemu_aio_set_event_notifier(&s->e, qemu_laio_completion_cb, +- qemu_laio_flush_cb); ++ qemu_aio_set_fd_handler(s->efd, qemu_laio_completion_cb, NULL, ++ qemu_laio_flush_cb, s); + + return s; + + out_close_efd: +- event_notifier_cleanup(&s->e); ++ close(s->efd); + out_free_state: + g_free(s); + return NULL; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Revert-rbd-Only-look-for-qemu-specific-copy-of-librb.patch b/SOURCES/kvm-Revert-rbd-Only-look-for-qemu-specific-copy-of-librb.patch new file mode 100644 index 0000000..0190151 --- /dev/null +++ b/SOURCES/kvm-Revert-rbd-Only-look-for-qemu-specific-copy-of-librb.patch @@ -0,0 +1,38 @@ +From 7e01df44401fb6a0aeeecabdb0026290b36f0a03 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 20 Nov 2014 13:47:22 +0100 +Subject: [PATCH 3/5] Revert "rbd: Only look for qemu-specific copy of + librbd.so.1" + +Message-id: <1416491244-20209-3-git-send-email-kwolf@redhat.com> +Patchwork-id: 62498 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 2/4] Revert "rbd: Only look for qemu-specific copy of librbd.so.1" +Bugzilla: 1140742 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +This reverts commit ece4ff225717364edc3136599113709dacdc5731. + +Signed-off-by: Kevin Wolf +Signed-off-by: Miroslav Rezanina +--- + block/rbd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/rbd.c b/block/rbd.c +index b870401..89319dc 100644 +--- a/block/rbd.c ++++ b/block/rbd.c +@@ -1125,7 +1125,7 @@ static int qemu_rbd_load_libs(void) + return -1; + } + +- librbd_handle = g_module_open("/usr/lib64/qemu/librbd.so.1", 0); ++ librbd_handle = g_module_open("librbd.so.1", 0); + if (!librbd_handle) { + error_report("error loading librbd: %s", g_module_error()); + return -1; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Revert-rbd-link-and-load-librbd-dynamically.patch b/SOURCES/kvm-Revert-rbd-link-and-load-librbd-dynamically.patch new file mode 100644 index 0000000..447b31d --- /dev/null +++ b/SOURCES/kvm-Revert-rbd-link-and-load-librbd-dynamically.patch @@ -0,0 +1,564 @@ +From e2fd1947f5c17139ab279ff155f31f1a74d8d3e0 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 20 Nov 2014 13:47:23 +0100 +Subject: [PATCH 4/5] Revert "rbd: link and load librbd dynamically" + +Message-id: <1416491244-20209-4-git-send-email-kwolf@redhat.com> +Patchwork-id: 62493 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 3/4] Revert "rbd: link and load librbd dynamically" +Bugzilla: 1140742 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +This reverts commit 64d9964fc97fc525b86e12c5f385dea7e646a3b0. + +Signed-off-by: Miroslav Rezanina + +Conflicts: + configure + +Signed-off-by: Kevin Wolf +--- + block/Makefile.objs | 2 +- + block/rbd.c | 218 ++++++++++++---------------------------------------- + block/rbd_types.h | 91 ---------------------- + configure | 41 +++++++++- + 4 files changed, 89 insertions(+), 263 deletions(-) + delete mode 100644 block/rbd_types.h + +diff --git a/block/Makefile.objs b/block/Makefile.objs +index 6b578d9..0be180f 100644 +--- a/block/Makefile.objs ++++ b/block/Makefile.objs +@@ -13,7 +13,7 @@ ifeq ($(CONFIG_POSIX),y) + block-obj-y += nbd.o sheepdog.o + block-obj-$(CONFIG_LIBISCSI) += iscsi.o + block-obj-$(CONFIG_CURL) += curl.o +-block-obj-y += rbd.o ++block-obj-$(CONFIG_RBD) += rbd.o + block-obj-$(CONFIG_GLUSTERFS) += gluster.o + block-obj-$(CONFIG_LIBSSH2) += ssh.o + endif +diff --git a/block/rbd.c b/block/rbd.c +index 89319dc..4eea455 100644 +--- a/block/rbd.c ++++ b/block/rbd.c +@@ -11,14 +11,13 @@ + * GNU GPL, version 2 or (at your option) any later version. + */ + +-#include + #include + + #include "qemu-common.h" + #include "qemu/error-report.h" + #include "block/block_int.h" + +-#include "rbd_types.h" ++#include + + /* + * When specifying the image filename use: +@@ -45,6 +44,13 @@ + * leading "\". + */ + ++/* rbd_aio_discard added in 0.1.2 */ ++#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 2) ++#define LIBRBD_SUPPORTS_DISCARD ++#else ++#undef LIBRBD_SUPPORTS_DISCARD ++#endif ++ + #define OBJ_MAX_SIZE (1UL << OBJ_DEFAULT_OBJ_ORDER) + + #define RBD_MAX_CONF_NAME_SIZE 128 +@@ -100,10 +106,6 @@ typedef struct BDRVRBDState { + RADOSCB *event_rcb; + } BDRVRBDState; + +-static bool librbd_loaded; +-static GModule *librbd_handle; +- +-static int qemu_rbd_load_libs(void); + static void rbd_aio_bh_cb(void *opaque); + + static int qemu_rbd_next_tok(char *dst, int dst_len, +@@ -309,10 +311,6 @@ static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options, + return -EINVAL; + } + +- if (qemu_rbd_load_libs() < 0) { +- return -EIO; +- } +- + /* Read out options */ + while (options && options->name) { + if (!strcmp(options->name, BLOCK_OPT_SIZE)) { +@@ -491,10 +489,6 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, + goto failed_opts; + } + +- if (qemu_rbd_load_libs() < 0) { +- return -EIO; +- } +- + clientname = qemu_rbd_parse_clientname(conf, clientname_buf); + r = rados_create(&s->cluster, clientname); + if (r < 0) { +@@ -686,6 +680,28 @@ static void rbd_aio_bh_cb(void *opaque) + } + } + ++static int rbd_aio_discard_wrapper(rbd_image_t image, ++ uint64_t off, ++ uint64_t len, ++ rbd_completion_t comp) ++{ ++#ifdef LIBRBD_SUPPORTS_DISCARD ++ return rbd_aio_discard(image, off, len, comp); ++#else ++ return -ENOTSUP; ++#endif ++} ++ ++static int rbd_aio_flush_wrapper(rbd_image_t image, ++ rbd_completion_t comp) ++{ ++#ifdef LIBRBD_SUPPORTS_AIO_FLUSH ++ return rbd_aio_flush(image, comp); ++#else ++ return -ENOTSUP; ++#endif ++} ++ + static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, +@@ -748,10 +764,10 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, + r = rbd_aio_read(s->image, off, size, buf, c); + break; + case RBD_AIO_DISCARD: +- r = rbd_aio_discard(s->image, off, size, c); ++ r = rbd_aio_discard_wrapper(s->image, off, size, c); + break; + case RBD_AIO_FLUSH: +- r = rbd_aio_flush(s->image, c); ++ r = rbd_aio_flush_wrapper(s->image, c); + break; + default: + r = -EINVAL; +@@ -792,6 +808,7 @@ static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs, + RBD_AIO_WRITE); + } + ++#ifdef LIBRBD_SUPPORTS_AIO_FLUSH + static BlockDriverAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, + BlockDriverCompletionFunc *cb, + void *opaque) +@@ -799,14 +816,19 @@ static BlockDriverAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, + return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH); + } + ++#else ++ + static int qemu_rbd_co_flush(BlockDriverState *bs) + { ++#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 1) ++ /* rbd_flush added in 0.1.1 */ + BDRVRBDState *s = bs->opaque; +- if (rbd_flush) { +- return rbd_flush(s->image); +- } ++ return rbd_flush(s->image); ++#else + return 0; ++#endif + } ++#endif + + static int qemu_rbd_getinfo(BlockDriverState *bs, BlockDriverInfo *bdi) + { +@@ -944,6 +966,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, + return snap_count; + } + ++#ifdef LIBRBD_SUPPORTS_DISCARD + static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs, + int64_t sector_num, + int nb_sectors, +@@ -953,6 +976,7 @@ static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs, + return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque, + RBD_AIO_DISCARD); + } ++#endif + + static QEMUOptionParameter qemu_rbd_create_options[] = { + { +@@ -983,9 +1007,16 @@ static BlockDriver bdrv_rbd = { + + .bdrv_aio_readv = qemu_rbd_aio_readv, + .bdrv_aio_writev = qemu_rbd_aio_writev, ++ ++#ifdef LIBRBD_SUPPORTS_AIO_FLUSH + .bdrv_aio_flush = qemu_rbd_aio_flush, ++#else + .bdrv_co_flush_to_disk = qemu_rbd_co_flush, ++#endif ++ ++#ifdef LIBRBD_SUPPORTS_DISCARD + .bdrv_aio_discard = qemu_rbd_aio_discard, ++#endif + + .bdrv_snapshot_create = qemu_rbd_snap_create, + .bdrv_snapshot_delete = qemu_rbd_snap_remove, +@@ -998,153 +1029,4 @@ static void bdrv_rbd_init(void) + bdrv_register(&bdrv_rbd); + } + +-typedef struct LibSymbol { +- const char *name; +- gpointer *addr; +-} LibSymbol; +- +-static int qemu_rbd_set_functions(GModule *lib, const LibSymbol *funcs) +-{ +- int i = 0; +- while (funcs[i].name) { +- const char *name = funcs[i].name; +- if (!g_module_symbol(lib, name, funcs[i].addr)) { +- error_report("%s could not be loaded from librbd or librados: %s", +- name, g_module_error()); +- return -1; +- } +- ++i; +- } +- return 0; +-} +- +-/* +- * Set function pointers for basic librados and librbd +- * functions that have always been present in these libraries. +- */ +-static int qemu_rbd_set_mandatory_functions(void) +-{ +- LibSymbol symbols[] = { +- {"rados_create", +- (gpointer *) &rados_create}, +- {"rados_connect", +- (gpointer *) &rados_connect}, +- {"rados_shutdown", +- (gpointer *) &rados_shutdown}, +- {"rados_conf_read_file", +- (gpointer *) &rados_conf_read_file}, +- {"rados_conf_set", +- (gpointer *) &rados_conf_set}, +- {"rados_ioctx_create", +- (gpointer *) &rados_ioctx_create}, +- {"rados_ioctx_destroy", +- (gpointer *) &rados_ioctx_destroy}, +- {"rbd_create", +- (gpointer *) &rbd_create}, +- {"rbd_open", +- (gpointer *) &rbd_open}, +- {"rbd_close", +- (gpointer *) &rbd_close}, +- {"rbd_resize", +- (gpointer *) &rbd_resize}, +- {"rbd_stat", +- (gpointer *) &rbd_stat}, +- {"rbd_snap_list", +- (gpointer *) &rbd_snap_list}, +- {"rbd_snap_list_end", +- (gpointer *) &rbd_snap_list_end}, +- {"rbd_snap_create", +- (gpointer *) &rbd_snap_create}, +- {"rbd_snap_remove", +- (gpointer *) &rbd_snap_remove}, +- {"rbd_snap_rollback", +- (gpointer *) &rbd_snap_rollback}, +- {"rbd_aio_write", +- (gpointer *) &rbd_aio_write}, +- {"rbd_aio_read", +- (gpointer *) &rbd_aio_read}, +- {"rbd_aio_create_completion", +- (gpointer *) &rbd_aio_create_completion}, +- {"rbd_aio_get_return_value", +- (gpointer *) &rbd_aio_get_return_value}, +- {"rbd_aio_release", +- (gpointer *) &rbd_aio_release}, +- {NULL} +- }; +- +- if (qemu_rbd_set_functions(librbd_handle, symbols) < 0) { +- return -1; +- } +- +- return 0; +-} +- +-/* +- * Detect whether the installed version of librbd +- * supports newer functionality, and enable or disable +- * it appropriately in bdrv_rbd. +- */ +-static void qemu_rbd_set_optional_functions(void) +-{ +- if (g_module_symbol(librbd_handle, "rbd_flush", +- (gpointer *) &rbd_flush)) { +- bdrv_rbd.bdrv_aio_flush = NULL; +- bdrv_rbd.bdrv_co_flush_to_disk = qemu_rbd_co_flush; +- } else { +- rbd_flush = NULL; +- bdrv_rbd.bdrv_co_flush_to_disk = NULL; +- } +- +- if (g_module_symbol(librbd_handle, "rbd_aio_flush", +- (gpointer *) &rbd_aio_flush)) { +- bdrv_rbd.bdrv_co_flush_to_disk = NULL; +- bdrv_rbd.bdrv_aio_flush = qemu_rbd_aio_flush; +- } else { +- rbd_aio_flush = NULL; +- bdrv_rbd.bdrv_aio_flush = NULL; +- } +- +- if (g_module_symbol(librbd_handle, "rbd_aio_discard", +- (gpointer *) &rbd_aio_discard)) { +- bdrv_rbd.bdrv_aio_discard = qemu_rbd_aio_discard; +- } else { +- rbd_aio_discard = NULL; +- bdrv_rbd.bdrv_aio_discard = NULL; +- } +-} +- +-static int qemu_rbd_load_libs(void) +-{ +- if (librbd_loaded) { +- return 0; +- } +- +- if (!g_module_supported()) { +- error_report("modules are not supported on this platform: %s", +- g_module_error()); +- return -1; +- } +- +- librbd_handle = g_module_open("librbd.so.1", 0); +- if (!librbd_handle) { +- error_report("error loading librbd: %s", g_module_error()); +- return -1; +- } +- +- /* +- * Due to c++ templates used in librbd/librados and their +- * dependencies, and linker duplicate trimming rules, closing +- * librbd would leave it mapped. Make this explicit. +- */ +- g_module_make_resident(librbd_handle); +- +- if (qemu_rbd_set_mandatory_functions() < 0) { +- return -1; +- } +- qemu_rbd_set_optional_functions(); +- librbd_loaded = true; +- +- return 0; +-} +- + block_init(bdrv_rbd_init); +diff --git a/block/rbd_types.h b/block/rbd_types.h +deleted file mode 100644 +index f327cb4..0000000 +--- a/block/rbd_types.h ++++ /dev/null +@@ -1,91 +0,0 @@ +-/* +- * Types and signatures for librados and librbd +- * +- * Copyright (C) 2013 Inktank Storage Inc. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, see . +- */ +- +-#ifndef QEMU_BLOCK_RBD_TYPES_H +-#define QEMU_BLOCK_RBD_TYPES_H +- +-/* types from librados used by the rbd block driver */ +- +-typedef void *rados_t; +-typedef void *rados_ioctx_t; +- +-static int (*rados_create)(rados_t *cluster, const char * const id); +-static int (*rados_connect)(rados_t cluster); +-static void (*rados_shutdown)(rados_t cluster); +-static int (*rados_conf_read_file)(rados_t cluster, const char *path); +-static int (*rados_conf_set)(rados_t cluster, const char *option, +- const char *value); +-static int (*rados_ioctx_create)(rados_t cluster, const char *pool_name, +- rados_ioctx_t *ioctx); +-static void (*rados_ioctx_destroy)(rados_ioctx_t io); +- +-/* types from librbd used by the rbd block driver*/ +- +-typedef void *rbd_image_t; +-typedef void *rbd_completion_t; +-typedef void (*rbd_callback_t)(rbd_completion_t cb, void *arg); +- +-typedef struct { +- uint64_t id; +- uint64_t size; +- const char *name; +-} rbd_snap_info_t; +- +-#define RBD_MAX_IMAGE_NAME_SIZE 96 +-#define RBD_MAX_BLOCK_NAME_SIZE 24 +- +-typedef struct { +- uint64_t size; +- uint64_t obj_size; +- uint64_t num_objs; +- int order; +- char block_name_prefix[RBD_MAX_BLOCK_NAME_SIZE]; +- int64_t parent_pool; +- char parent_name[RBD_MAX_IMAGE_NAME_SIZE]; +-} rbd_image_info_t; +- +-static int (*rbd_create)(rados_ioctx_t io, const char *name, uint64_t size, +- int *order); +-static int (*rbd_open)(rados_ioctx_t io, const char *name, rbd_image_t *image, +- const char *snap_name); +-static int (*rbd_close)(rbd_image_t image); +-static int (*rbd_resize)(rbd_image_t image, uint64_t size); +-static int (*rbd_stat)(rbd_image_t image, rbd_image_info_t *info, +- size_t infosize); +-static int (*rbd_snap_list)(rbd_image_t image, rbd_snap_info_t *snaps, +- int *max_snaps); +-static void (*rbd_snap_list_end)(rbd_snap_info_t *snaps); +-static int (*rbd_snap_create)(rbd_image_t image, const char *snapname); +-static int (*rbd_snap_remove)(rbd_image_t image, const char *snapname); +-static int (*rbd_snap_rollback)(rbd_image_t image, const char *snapname); +-static int (*rbd_aio_write)(rbd_image_t image, uint64_t off, size_t len, +- const char *buf, rbd_completion_t c); +-static int (*rbd_aio_read)(rbd_image_t image, uint64_t off, size_t len, +- char *buf, rbd_completion_t c); +-static int (*rbd_aio_discard)(rbd_image_t image, uint64_t off, uint64_t len, +- rbd_completion_t c); +-static int (*rbd_aio_create_completion)(void *cb_arg, +- rbd_callback_t complete_cb, +- rbd_completion_t *c); +-static ssize_t (*rbd_aio_get_return_value)(rbd_completion_t c); +-static void (*rbd_aio_release)(rbd_completion_t c); +-static int (*rbd_flush)(rbd_image_t image); +-static int (*rbd_aio_flush)(rbd_image_t image, rbd_completion_t c); +- +-#endif +diff --git a/configure b/configure +index 8db9dbe..1583359 100755 +--- a/configure ++++ b/configure +@@ -227,6 +227,7 @@ qom_cast_debug="yes" + trace_backend="nop" + trace_file="trace" + spice="" ++rbd="" + smartcard_nss="" + libusb="" + usb_redir="" +@@ -892,6 +893,10 @@ for opt do + ;; + --enable-glx) glx="yes" + ;; ++ --disable-rbd) rbd="no" ++ ;; ++ --enable-rbd) rbd="yes" ++ ;; + --disable-xfsctl) xfs="no" + ;; + --enable-xfsctl) xfs="yes" +@@ -1213,6 +1218,7 @@ echo " --with-trace-file=NAME Full PATH,NAME of file to store traces" + echo " Default:trace-" + echo " --disable-spice disable spice" + echo " --enable-spice enable spice" ++echo " --enable-rbd enable building the rados block device (rbd)" + echo " --disable-libiscsi disable iscsi support" + echo " --enable-libiscsi enable iscsi support" + echo " --disable-smartcard-nss disable smartcard nss support" +@@ -2372,10 +2378,10 @@ if test "$mingw32" = yes; then + else + glib_req_ver=2.12 + fi +-if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 gmodule-2.0 > /dev/null 2>&1 ++if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1 + then +- glib_cflags=`$pkg_config --cflags gthread-2.0 gmodule-2.0 2>/dev/null` +- glib_libs=`$pkg_config --libs gthread-2.0 gmodule-2.0 2>/dev/null` ++ glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` ++ glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` + CFLAGS="$glib_cflags $CFLAGS" + LIBS="$glib_libs $LIBS" + libs_qga="$glib_libs $libs_qga" +@@ -2477,6 +2483,31 @@ if test "$mingw32" != yes -a "$pthread" = no; then + fi + + ########################################## ++# rbd probe ++if test "$rbd" != "no" ; then ++ cat > $TMPC < ++#include ++int main(void) { ++ rados_t cluster; ++ rados_create(&cluster, NULL); ++ return 0; ++} ++EOF ++ rbd_libs="-lrbd -lrados" ++ if compile_prog "" "$rbd_libs" ; then ++ rbd=yes ++ libs_tools="$rbd_libs $libs_tools" ++ libs_softmmu="$rbd_libs $libs_softmmu" ++ else ++ if test "$rbd" = "yes" ; then ++ feature_not_found "rados block device" ++ fi ++ rbd=no ++ fi ++fi ++ ++########################################## + # libssh2 probe + min_libssh2_version=1.2.8 + if test "$libssh2" != "no" ; then +@@ -3665,6 +3696,7 @@ echo "vhost-scsi support $vhost_scsi" + echo "Trace backend $trace_backend" + echo "Trace output file $trace_file-" + echo "spice support $spice ($spice_protocol_version/$spice_server_version)" ++echo "rbd support $rbd" + echo "xfsctl support $xfs" + echo "nss used $smartcard_nss" + echo "libusb $libusb" +@@ -4035,6 +4067,9 @@ fi + if test "$qom_cast_debug" = "yes" ; then + echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak + fi ++if test "$rbd" = "yes" ; then ++ echo "CONFIG_RBD=y" >> $config_host_mak ++fi + + echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch b/SOURCES/kvm-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch new file mode 100644 index 0000000..cb3e666 --- /dev/null +++ b/SOURCES/kvm-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch @@ -0,0 +1,809 @@ +From 7266fe6b09986cfa24d704075d940022cabdc8f5 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Fri, 14 Nov 2014 08:28:01 +0100 +Subject: [PATCH 32/41] ] Use qemu-kvm in documentation instead of + qemu-system-i386 + +Message-id: <1415953681-20015-1-git-send-email-mrezanin@redhat.com> +Patchwork-id: 62376 +O-Subject: [RHEL-7.1 qemu-kvm PATCHv4]] Use qemu-kvm in documentation instead of qemu-system-i386 +Bugzilla: 1140618 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Stefan Hajnoczi + +From: Miroslav Rezanina + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1140618 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=8244530 + +We change the name and location of qemu-kvm binaries. Update documentation +to reflect this change. + +Signed-off-by: Miroslav Rezanina +--- +v4: + - Replace qemu with qemu-kvm + +v3: + - Use qemu-kvm instead of /usr/libexec/qemu-kvm + - Replace qemu-system-x86_64 too + +v2: + - do not replace qemu-system-i386.exe +--- + qemu-doc.texi | 98 ++++++++++++++++++++++----------------------- + qemu-options.hx | 120 ++++++++++++++++++++++++++++---------------------------- + 2 files changed, 109 insertions(+), 109 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + qemu-doc.texi | 98 ++++++++++++++++++++++----------------------- + qemu-options.hx | 120 ++++++++++++++++++++++++++++---------------------------- + 2 files changed, 109 insertions(+), 109 deletions(-) + +diff --git a/qemu-doc.texi b/qemu-doc.texi +index 0f7e5f8..ff124fe 100644 +--- a/qemu-doc.texi ++++ b/qemu-doc.texi +@@ -226,12 +226,12 @@ Note that, by default, GUS shares IRQ(7) with parallel ports and so + QEMU must be told to not have parallel ports to have working GUS. + + @example +-qemu-system-i386 dos.img -soundhw gus -parallel none ++qemu-kvm dos.img -soundhw gus -parallel none + @end example + + Alternatively: + @example +-qemu-system-i386 dos.img -device gus,irq=5 ++qemu-kvm dos.img -device gus,irq=5 + @end example + + Or some other unclaimed IRQ. +@@ -247,7 +247,7 @@ CS4231A is the chip used in Windows Sound System and GUSMAX products + Download and uncompress the linux image (@file{linux.img}) and type: + + @example +-qemu-system-i386 linux.img ++qemu-kvm linux.img + @end example + + Linux should boot and give you a prompt. +@@ -257,7 +257,7 @@ Linux should boot and give you a prompt. + + @example + @c man begin SYNOPSIS +-usage: qemu-system-i386 [options] [@var{disk_image}] ++usage: qemu-kvm [options] [@var{disk_image}] + @c man end + @end example + +@@ -766,7 +766,7 @@ QEMU can automatically create a virtual FAT disk image from a + directory tree. In order to use it, just type: + + @example +-qemu-system-i386 linux.img -hdb fat:/my_directory ++qemu-kvm linux.img -hdb fat:/my_directory + @end example + + Then you access access to all the files in the @file{/my_directory} +@@ -776,14 +776,14 @@ them via SAMBA or NFS. The default access is @emph{read-only}. + Floppies can be emulated with the @code{:floppy:} option: + + @example +-qemu-system-i386 linux.img -fda fat:floppy:/my_directory ++qemu-kvm linux.img -fda fat:floppy:/my_directory + @end example + + A read/write support is available for testing (beta stage) with the + @code{:rw:} option: + + @example +-qemu-system-i386 linux.img -fda fat:floppy:rw:/my_directory ++qemu-kvm linux.img -fda fat:floppy:rw:/my_directory + @end example + + What you should @emph{never} do: +@@ -801,14 +801,14 @@ QEMU can access directly to block device exported using the Network Block Device + protocol. + + @example +-qemu-system-i386 linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/ ++qemu-kvm linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/ + @end example + + If the NBD server is located on the same host, you can use an unix socket instead + of an inet socket: + + @example +-qemu-system-i386 linux.img -hdb nbd+unix://?socket=/tmp/my_socket ++qemu-kvm linux.img -hdb nbd+unix://?socket=/tmp/my_socket + @end example + + In this case, the block device must be exported using qemu-nbd: +@@ -825,23 +825,23 @@ qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2 + @noindent + and then you can use it with two guests: + @example +-qemu-system-i386 linux1.img -hdb nbd+unix://?socket=/tmp/my_socket +-qemu-system-i386 linux2.img -hdb nbd+unix://?socket=/tmp/my_socket ++qemu-kvm linux1.img -hdb nbd+unix://?socket=/tmp/my_socket ++qemu-kvm linux2.img -hdb nbd+unix://?socket=/tmp/my_socket + @end example + + If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's + own embedded NBD server), you must specify an export name in the URI: + @example +-qemu-system-i386 -cdrom nbd://localhost/debian-500-ppc-netinst +-qemu-system-i386 -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst ++qemu-kvm -cdrom nbd://localhost/debian-500-ppc-netinst ++qemu-kvm -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst + @end example + + The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax is + also available. Here are some example of the older syntax: + @example +-qemu-system-i386 linux.img -hdb nbd:my_nbd_server.mydomain.org:1024 +-qemu-system-i386 linux2.img -hdb nbd:unix:/tmp/my_socket +-qemu-system-i386 -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst ++qemu-kvm linux.img -hdb nbd:my_nbd_server.mydomain.org:1024 ++qemu-kvm linux2.img -hdb nbd:unix:/tmp/my_socket ++qemu-kvm -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst + @end example + + @node disk_images_sheepdog +@@ -866,7 +866,7 @@ qemu-img convert @var{filename} sheepdog:///@var{image} + + You can boot from the Sheepdog disk image with the command: + @example +-qemu-system-i386 sheepdog:///@var{image} ++qemu-kvm sheepdog:///@var{image} + @end example + + You can also create a snapshot of the Sheepdog image like qcow2. +@@ -878,7 +878,7 @@ where @var{tag} is a tag name of the newly created snapshot. + To boot from the Sheepdog snapshot, specify the tag name of the + snapshot. + @example +-qemu-system-i386 sheepdog:///@var{image}#@var{tag} ++qemu-kvm sheepdog:///@var{image}#@var{tag} + @end example + + You can create a cloned image from the existing snapshot. +@@ -891,14 +891,14 @@ is its tag name. + You can use an unix socket instead of an inet socket: + + @example +-qemu-system-i386 sheepdog+unix:///@var{image}?socket=@var{path} ++qemu-kvm sheepdog+unix:///@var{image}?socket=@var{path} + @end example + + If the Sheepdog daemon doesn't run on the local host, you need to + specify one of the Sheepdog servers to connect to. + @example + qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size} +-qemu-system-i386 sheepdog://@var{hostname}:@var{port}/@var{image} ++qemu-kvm sheepdog://@var{hostname}:@var{port}/@var{image} + @end example + + @node disk_images_iscsi +@@ -940,7 +940,7 @@ Various session related parameters can be set via special options, either + in a configuration file provided via '-readconfig' or directly on the + command line. + +-If the initiator-name is not specified qemu will use a default name ++If the initiator-name is not specified qemu-kvm will use a default name + of 'iqn.2008-11.org.linux-kvm[:'] where is the name of the + virtual machine. + +@@ -987,7 +987,7 @@ cat >iscsi.conf <[,shm=] ++qemu-kvm -device ivshmem,size=[,shm=] + @end example + + If desired, interrupts can be sent between guest VMs accessing the same shared +@@ -1221,9 +1221,9 @@ is qemu.git/contrib/ivshmem-server. An example syntax when using the shared + memory server is: + + @example +-qemu-system-i386 -device ivshmem,size=[,chardev=] ++qemu-kvm -device ivshmem,size=[,chardev=] + [,msi=on][,ioeventfd=on][,vectors=n][,role=peer|master] +-qemu-system-i386 -chardev socket,path=,id= ++qemu-kvm -chardev socket,path=,id= + @end example + + When using the server, the guest will be assigned a VM ID (>=0) that allows guests +@@ -1253,7 +1253,7 @@ kernel testing. + + The syntax is: + @example +-qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda" ++qemu-kvm -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda" + @end example + + Use @option{-kernel} to provide the Linux kernel image and +@@ -1268,7 +1268,7 @@ If you do not need graphical output, you can disable it and redirect + the virtual serial port and the QEMU monitor to the console with the + @option{-nographic} option. The typical command line is: + @example +-qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ ++qemu-kvm -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ + -append "root=/dev/hda console=ttyS0" -nographic + @end example + +@@ -1332,7 +1332,7 @@ Network adapter that supports CDC ethernet and RNDIS protocols. @var{options} + specifies NIC options as with @code{-net nic,}@var{options} (see description). + For instance, user-mode networking can be used with + @example +-qemu-system-i386 [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0 ++qemu-kvm [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0 + @end example + Currently this cannot be used in machines that support PCI NICs. + @item bt[:@var{hci-type}] +@@ -1342,7 +1342,7 @@ no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}. + This USB device implements the USB Transport Layer of HCI. Example + usage: + @example +-qemu-system-i386 [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3 ++qemu-kvm [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3 + @end example + @end table + +@@ -1420,7 +1420,7 @@ For this setup it is recommended to restrict it to listen on a UNIX domain + socket only. For example + + @example +-qemu-system-i386 [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc ++qemu-kvm [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc + @end example + + This ensures that only users on local box with read/write access to that +@@ -1443,7 +1443,7 @@ is running the password is set with the monitor. Until the monitor is used to + set the password all clients will be rejected. + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,password -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,password -monitor stdio + (qemu) change vnc password + Password: ******** + (qemu) +@@ -1460,7 +1460,7 @@ support provides a secure session, but no authentication. This allows any + client to connect, and provides an encrypted session. + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio + @end example + + In the above example @code{/etc/pki/qemu} should contain at least three files, +@@ -1478,7 +1478,7 @@ then validate against the CA certificate. This is a good choice if deploying + in an environment with a private internal certificate authority. + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio + @end example + + +@@ -1489,7 +1489,7 @@ Finally, the previous method can be combined with VNC password authentication + to provide two layers of authentication for clients. + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio + (qemu) change vnc password + Password: ******** + (qemu) +@@ -1512,7 +1512,7 @@ used for authentication, but assuming use of one supporting SSF, + then QEMU can be launched with: + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,sasl -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,sasl -monitor stdio + @end example + + @node vnc_sec_certificate_sasl +@@ -1526,7 +1526,7 @@ credentials. This can be enabled, by combining the 'sasl' option + with the aforementioned TLS + x509 options: + + @example +-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio ++qemu-kvm [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio + @end example + + +@@ -1694,7 +1694,7 @@ QEMU has a primitive support to work with gdb, so that you can do + In order to use gdb, launch QEMU with the '-s' option. It will wait for a + gdb connection: + @example +-qemu-system-i386 -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ ++qemu-kvm -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ + -append "root=/dev/hda" + Connected to host network interface: tun0 + Waiting gdb connection on port 1234 +diff --git a/qemu-options.hx b/qemu-options.hx +index 5d0f2cd..62c3e06 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -124,7 +124,7 @@ This option defines a free-form string that can be used to describe @var{fd}. + + You can open an image using pre-opened file descriptors from an fd set: + @example +-qemu-system-i386 ++qemu-kvm + -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" + -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" + -drive file=/dev/fdset/2,index=0,media=disk +@@ -151,7 +151,7 @@ STEXI + Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.: + + @example +-qemu-system-i386 -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk ++qemu-kvm -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk + @end example + + In particular, you can use this to set driver properties for devices which are +@@ -189,7 +189,7 @@ the recommended is 320x240, 640x480, 800x640. + + A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms + when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not +-reboot, qemu passes '-1' to bios by default. Currently Seabios for X86 ++reboot, qemu-kvm passes '-1' to bios by default. Currently Seabios for X86 + system support it. + + Do strict boot via @option{strict=on} as far as firmware/BIOS +@@ -198,11 +198,11 @@ bootindex options. The default is non-strict boot. + + @example + # try to boot from network first, then from hard disk +-qemu-system-i386 -boot order=nc ++qemu-kvm -boot order=nc + # boot from CD-ROM first, switch back to default order after reboot +-qemu-system-i386 -boot once=d ++qemu-kvm -boot once=d + # boot with a splash picture for 5 seconds. +-qemu-system-i386 -boot menu=on,splash=/root/boot.bmp,splash-time=5000 ++qemu-kvm -boot menu=on,splash=/root/boot.bmp,splash-time=5000 + @end example + + Note: The legacy format '-boot @var{drives}' is still supported but its +@@ -282,12 +282,12 @@ Enable audio and selected sound hardware. Use 'help' to print all + available sound hardware. + + @example +-qemu-system-i386 -soundhw sb16,adlib disk.img +-qemu-system-i386 -soundhw es1370 disk.img +-qemu-system-i386 -soundhw ac97 disk.img +-qemu-system-i386 -soundhw hda disk.img +-qemu-system-i386 -soundhw all disk.img +-qemu-system-i386 -soundhw help ++qemu-kvm -soundhw sb16,adlib disk.img ++qemu-kvm -soundhw es1370 disk.img ++qemu-kvm -soundhw ac97 disk.img ++qemu-kvm -soundhw hda disk.img ++qemu-kvm -soundhw all disk.img ++qemu-kvm -soundhw help + @end example + + Note that Linux's i810_audio OSS kernel (for AC97) module might +@@ -500,21 +500,21 @@ is off. + + Instead of @option{-cdrom} you can use: + @example +-qemu-system-i386 -drive file=file,index=2,media=cdrom ++qemu-kvm -drive file=file,index=2,media=cdrom + @end example + + Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can + use: + @example +-qemu-system-i386 -drive file=file,index=0,media=disk +-qemu-system-i386 -drive file=file,index=1,media=disk +-qemu-system-i386 -drive file=file,index=2,media=disk +-qemu-system-i386 -drive file=file,index=3,media=disk ++qemu-kvm -drive file=file,index=0,media=disk ++qemu-kvm -drive file=file,index=1,media=disk ++qemu-kvm -drive file=file,index=2,media=disk ++qemu-kvm -drive file=file,index=3,media=disk + @end example + + You can open an image using pre-opened file descriptors from an fd set: + @example +-qemu-system-i386 ++qemu-kvm + -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" + -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" + -drive file=/dev/fdset/2,index=0,media=disk +@@ -522,33 +522,33 @@ qemu-system-i386 + + You can connect a CDROM to the slave of ide0: + @example +-qemu-system-i386 -drive file=file,if=ide,index=1,media=cdrom ++qemu-kvm -drive file=file,if=ide,index=1,media=cdrom + @end example + + If you don't specify the "file=" argument, you define an empty drive: + @example +-qemu-system-i386 -drive if=ide,index=1,media=cdrom ++qemu-kvm -drive if=ide,index=1,media=cdrom + @end example + + You can connect a SCSI disk with unit ID 6 on the bus #0: + @example +-qemu-system-i386 -drive file=file,if=scsi,bus=0,unit=6 ++qemu-kvm -drive file=file,if=scsi,bus=0,unit=6 + @end example + + Instead of @option{-fda}, @option{-fdb}, you can use: + @example +-qemu-system-i386 -drive file=file,index=0,if=floppy +-qemu-system-i386 -drive file=file,index=1,if=floppy ++qemu-kvm -drive file=file,index=0,if=floppy ++qemu-kvm -drive file=file,index=1,if=floppy + @end example + + By default, @var{interface} is "ide" and @var{index} is automatically + incremented: + @example +-qemu-system-i386 -drive file=a -drive file=b" ++qemu-kvm -drive file=a -drive file=b" + @end example + is interpreted like: + @example +-qemu-system-i386 -hda a -hdb b ++qemu-kvm -hda a -hdb b + @end example + ETEXI + +@@ -1477,7 +1477,7 @@ can not be resolved. + + Example: + @example +-qemu -net user,dnssearch=mgmt.example.org,dnssearch=example.org [...] ++qemu-kvm -net user,dnssearch=mgmt.example.org,dnssearch=example.org [...] + @end example + + @item tftp=@var{dir} +@@ -1493,7 +1493,7 @@ a guest from a local directory. + + Example (using pxelinux): + @example +-qemu-system-i386 -hda linux.img -boot n -net user,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 ++qemu-kvm -hda linux.img -boot n -net user,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 + @end example + + @item smb=@var{dir}[,smbserver=@var{addr}] +@@ -1528,7 +1528,7 @@ screen 0, use the following: + + @example + # on the host +-qemu-system-i386 -net user,hostfwd=tcp:127.0.0.1:6001-:6000 [...] ++qemu-kvm -net user,hostfwd=tcp:127.0.0.1:6001-:6000 [...] + # this host xterm should open in the guest X11 server + xterm -display :1 + @end example +@@ -1538,7 +1538,7 @@ the guest, use the following: + + @example + # on the host +-qemu-system-i386 -net user,hostfwd=tcp::5555-:23 [...] ++qemu-kvm -net user,hostfwd=tcp::5555-:23 [...] + telnet localhost 5555 + @end example + +@@ -1557,7 +1557,7 @@ lifetime, like in the following example: + @example + # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever + # the guest accesses it +-qemu -net user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 [...] ++qemu-kvm -net user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 [...] + @end example + + Or you can execute a command on every TCP connection established by the guest, +@@ -1566,7 +1566,7 @@ so that QEMU behaves similar to an inetd process for that virtual server: + @example + # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234 + # and connect the TCP stream to its stdin/stdout +-qemu -net 'user,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' ++qemu-kvm -net 'user,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' + @end example + + @end table +@@ -1598,13 +1598,13 @@ Examples: + + @example + #launch a QEMU instance with the default network script +-qemu-system-i386 linux.img -net nic -net tap ++qemu-kvm linux.img -net nic -net tap + @end example + + @example + #launch a QEMU instance with two NICs, each one connected + #to a TAP device +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ + -net nic,vlan=1 -net tap,vlan=1,ifname=tap1 + @end example +@@ -1612,7 +1612,7 @@ qemu-system-i386 linux.img \ + @example + #launch a QEMU instance with the default network helper to + #connect a TAP device to bridge br0 +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic -net tap,"helper=/path/to/qemu-bridge-helper" + @end example + +@@ -1630,13 +1630,13 @@ Examples: + @example + #launch a QEMU instance with the default network helper to + #connect a TAP device to bridge br0 +-qemu-system-i386 linux.img -net bridge -net nic,model=virtio ++qemu-kvm linux.img -net bridge -net nic,model=virtio + @end example + + @example + #launch a QEMU instance with the default network helper to + #connect a TAP device to bridge qemubr0 +-qemu-system-i386 linux.img -net bridge,br=qemubr0 -net nic,model=virtio ++qemu-kvm linux.img -net bridge,br=qemubr0 -net nic,model=virtio + @end example + + @item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] +@@ -1652,12 +1652,12 @@ specifies an already opened TCP socket. + Example: + @example + # launch a first QEMU instance +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:56 \ + -net socket,listen=:1234 + # connect the VLAN 0 of this instance to the VLAN 0 + # of the first instance +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:57 \ + -net socket,connect=127.0.0.1:1234 + @end example +@@ -1683,15 +1683,15 @@ Use @option{fd=h} to specify an already opened UDP multicast socket. + Example: + @example + # launch one QEMU instance +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:56 \ + -net socket,mcast=230.0.0.1:1234 + # launch another QEMU instance on same "bus" +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:57 \ + -net socket,mcast=230.0.0.1:1234 + # launch yet another QEMU instance on same "bus" +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:58 \ + -net socket,mcast=230.0.0.1:1234 + @end example +@@ -1700,7 +1700,7 @@ Example (User Mode Linux compat.): + @example + # launch QEMU instance (note mcast address selected + # is UML's default) +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:56 \ + -net socket,mcast=239.192.168.1:1102 + # launch UML +@@ -1709,7 +1709,7 @@ qemu-system-i386 linux.img \ + + Example (send packets from host's 1.2.3.4): + @example +-qemu-system-i386 linux.img \ ++qemu-kvm linux.img \ + -net nic,macaddr=52:54:00:12:34:56 \ + -net socket,mcast=239.192.168.1:1102,localaddr=1.2.3.4 + @end example +@@ -1727,7 +1727,7 @@ Example: + # launch vde switch + vde_switch -F -sock /tmp/myswitch + # launch QEMU instance +-qemu-system-i386 linux.img -net nic -net vde,sock=/tmp/myswitch ++qemu-kvm linux.img -net nic -net vde,sock=/tmp/myswitch + @end example + + @item -netdev hubport,id=@var{id},hubid=@var{hubid} +@@ -2043,28 +2043,28 @@ images for the guest storage. Both disk and cdrom images are supported. + Syntax for specifying iSCSI LUNs is + ``iscsi://[:]//'' + +-By default qemu will use the iSCSI initiator-name ++By default qemu-kvm will use the iSCSI initiator-name + 'iqn.2008-11.org.linux-kvm[:]' but this can also be set from the command + line or a configuration file. + + + Example (without authentication): + @example +-qemu-system-i386 -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \ ++qemu-kvm -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \ + -cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \ + -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 + @end example + + Example (CHAP username/password via URL): + @example +-qemu-system-i386 -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1 ++qemu-kvm -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1 + @end example + + Example (CHAP username/password via environment variables): + @example + LIBISCSI_CHAP_USERNAME="user" \ + LIBISCSI_CHAP_PASSWORD="password" \ +-qemu-system-i386 -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 ++qemu-kvm -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1 + @end example + + iSCSI support is an optional feature of QEMU and only available when +@@ -2093,12 +2093,12 @@ Syntax for specifying a NBD device using Unix Domain Sockets + + Example for TCP + @example +-qemu-system-i386 --drive file=nbd:192.0.2.1:30000 ++qemu-kvm --drive file=nbd:192.0.2.1:30000 + @end example + + Example for Unix Domain Sockets + @example +-qemu-system-i386 --drive file=nbd:unix:/tmp/nbd-socket ++qemu-kvm --drive file=nbd:unix:/tmp/nbd-socket + @end example + + @item SSH +@@ -2106,8 +2106,8 @@ QEMU supports SSH (Secure Shell) access to remote disks. + + Examples: + @example +-qemu-system-i386 -drive file=ssh://user@@host/path/to/disk.img +-qemu-system-i386 -drive file.driver=ssh,file.user=user,file.host=host,file.port=22,file.path=/path/to/disk.img ++qemu-kvm -drive file=ssh://user@@host/path/to/disk.img ++qemu-kvm -drive file.driver=ssh,file.user=user,file.host=host,file.port=22,file.path=/path/to/disk.img + @end example + + Currently authentication must be done using ssh-agent. Other +@@ -2125,7 +2125,7 @@ sheepdog[+tcp|+unix]://[host:port]/vdiname[?socket=path][#snapid|#tag] + + Example + @example +-qemu-system-i386 --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine ++qemu-kvm --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine + @end example + + See also @url{http://http://www.osrg.net/sheepdog/}. +@@ -2143,7 +2143,7 @@ gluster[+transport]://[server[:port]]/volname/image[?socket=...] + + Example + @example +-qemu-system-x86_64 --drive file=gluster://192.0.2.1/testvol/a.img ++qemu-kvm --drive file=gluster://192.0.2.1/testvol/a.img + @end example + + See also @url{http://www.gluster.org}. +@@ -2209,7 +2209,7 @@ and communicate. Requires the Linux @code{vhci} driver installed. Can + be used as following: + + @example +-qemu-system-i386 [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5 ++qemu-kvm [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5 + @end example + + @item -bt device:@var{dev}[,vlan=@var{n}] +@@ -2255,7 +2255,7 @@ Options to each backend are described below. + + Use 'help' to print all available TPM backend types. + @example +-qemu -tpmdev help ++qemu-kvm -tpmdev help + @end example + + @item -tpmdev passthrough, id=@var{id}, path=@var{path}, cancel-path=@var{cancel-path} +@@ -2579,14 +2579,14 @@ ETEXI + + DEF("realtime", HAS_ARG, QEMU_OPTION_realtime, + "-realtime [mlock=on|off]\n" +- " run qemu with realtime features\n" ++ " run qemu-kvm with realtime features\n" + " mlock=on|off controls mlock support (default: on)\n", + QEMU_ARCH_ALL) + STEXI + @item -realtime mlock=on|off + @findex -realtime +-Run qemu with realtime features. +-mlocking qemu and guest memory can be enabled via @option{mlock=on} ++Run qemu-kvm with realtime features. ++mlocking qemu-kvm and guest memory can be enabled via @option{mlock=on} + (enabled by default). + ETEXI + +@@ -2600,7 +2600,7 @@ connections will likely be TCP-based, but also UDP, pseudo TTY, or even + stdio are reasonable use case. The latter is allowing to start QEMU from + within gdb and establish the connection via a pipe: + @example +-(gdb) target remote | exec qemu-system-i386 -gdb stdio ... ++(gdb) target remote | exec qemu-kvm -gdb stdio ... + @end example + ETEXI + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch b/SOURCES/kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch index 3130627..2bba0d7 100644 --- a/SOURCES/kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch +++ b/SOURCES/kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch @@ -1,13 +1,13 @@ -From a00bde30c0730d3434d9f4556a9cb119f3f8d68d Mon Sep 17 00:00:00 2001 +From c66cd34696f1f7f04b367a5f8b4d79802cddafb4 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) Date: Thu, 8 May 2014 10:58:42 +0200 -Subject: [PATCH 20/30] XBZRLE: Fix one XBZRLE corruption issues +Subject: [PATCH 07/31] XBZRLE: Fix one XBZRLE corruption issues RH-Author: Dr. David Alan Gilbert (git) Message-id: <1399546722-6350-5-git-send-email-dgilbert@redhat.com> Patchwork-id: 58744 O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 4/4] XBZRLE: Fix one XBZRLE corruption issues -Bugzilla: 1110191 +Bugzilla: 1066338 RH-Acked-by: Juan Quintela RH-Acked-by: Markus Armbruster RH-Acked-by: Amit Shah diff --git a/SOURCES/kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch b/SOURCES/kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch index 261ad8f..8f1c81d 100644 --- a/SOURCES/kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch +++ b/SOURCES/kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch @@ -1,13 +1,13 @@ -From e30b7a4a8810a49a1b8a915a9ed174b9b254c999 Mon Sep 17 00:00:00 2001 +From 600b6421fd97881aad2471ea0a6f465a2d55e9d6 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert (git) Date: Thu, 8 May 2014 10:58:39 +0200 -Subject: [PATCH 17/30] XBZRLE: Fix qemu crash when resize the xbzrle cache +Subject: [PATCH 04/31] XBZRLE: Fix qemu crash when resize the xbzrle cache RH-Author: Dr. David Alan Gilbert (git) Message-id: <1399546722-6350-2-git-send-email-dgilbert@redhat.com> Patchwork-id: 58741 O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 1/4] XBZRLE: Fix qemu crash when resize the xbzrle cache -Bugzilla: 1110191 +Bugzilla: 1066338 RH-Acked-by: Juan Quintela RH-Acked-by: Markus Armbruster RH-Acked-by: Amit Shah diff --git a/SOURCES/kvm-ac97-register-reset-via-qom.patch b/SOURCES/kvm-ac97-register-reset-via-qom.patch new file mode 100644 index 0000000..f4b8424 --- /dev/null +++ b/SOURCES/kvm-ac97-register-reset-via-qom.patch @@ -0,0 +1,60 @@ +From ce4b6f19e7e027480606076804cc6da2cccf99ba Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 27 Oct 2014 11:45:22 +0100 +Subject: [PATCH 14/19] ac97: register reset via qom + +Message-id: <1414410322-25041-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 61905 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] ac97: register reset via qom +Bugzilla: 1141667 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Marcel Apfelbaum +RH-Acked-by: Amos Kong + +So it gets properly unregistered on hot-unplug. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 133771477c39f3716d9a85609aca0d3e5a77c55c) +Signed-off-by: Miroslav Rezanina +--- + hw/audio/ac97.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c +index 8455a96..7f6763f 100644 +--- a/hw/audio/ac97.c ++++ b/hw/audio/ac97.c +@@ -1323,9 +1323,9 @@ static const MemoryRegionOps ac97_io_nabm_ops = { + .endianness = DEVICE_LITTLE_ENDIAN, + }; + +-static void ac97_on_reset (void *opaque) ++static void ac97_on_reset (DeviceState *dev) + { +- AC97LinkState *s = opaque; ++ AC97LinkState *s = container_of(dev, AC97LinkState, dev.qdev); + + reset_bm_regs (s, &s->bm_regs[0]); + reset_bm_regs (s, &s->bm_regs[1]); +@@ -1382,9 +1382,8 @@ static int ac97_initfn (PCIDevice *dev) + memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256); + pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); + pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); +- qemu_register_reset (ac97_on_reset, s); + AUD_register_card ("ac97", &s->card); +- ac97_on_reset (s); ++ ac97_on_reset (&s->dev.qdev); + return 0; + } + +@@ -1422,6 +1421,7 @@ static void ac97_class_init (ObjectClass *klass, void *data) + dc->desc = "Intel 82801AA AC97 Audio"; + dc->vmsd = &vmstate_ac97; + dc->props = ac97_properties; ++ dc->reset = ac97_on_reset; + } + + static const TypeInfo ac97_info = { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-acpi-fix-tables-for-no-hpet-configuration.patch b/SOURCES/kvm-acpi-fix-tables-for-no-hpet-configuration.patch new file mode 100644 index 0000000..75345ff --- /dev/null +++ b/SOURCES/kvm-acpi-fix-tables-for-no-hpet-configuration.patch @@ -0,0 +1,66 @@ +From aa98e5248b83b5eed5230e582a21156373d9fc72 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Wed, 13 Aug 2014 07:59:41 +0200 +Subject: [PATCH 04/11] acpi: fix tables for no-hpet configuration + +Message-id: <1407916781-22610-2-git-send-email-lersek@redhat.com> +Patchwork-id: 60549 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] acpi: fix tables for no-hpet configuration +Bugzilla: 1129552 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Michael S. Tsirkin +RH-Acked-by: Marcel Apfelbaum + +From: "Michael S. Tsirkin" + +acpi build tried to add offset of hpet table to rsdt even when hpet was +disabled. If no tables follow hpet, this could lead to a malformed +rsdt. + +Fix it up. + +To avoid such errors in the future, rearrange code slightly to make it +clear that acpi_add_table stores the offset of the following table - not +of the previous one. + +Reported-by: TeLeMan +Signed-off-by: Michael S. Tsirkin +Cc: qemu-stable@nongnu.org +(cherry picked from commit 9ac1c4c07e7e6ab16a3e2149e9b32c0d092cb3f5) +Signed-off-by: Laszlo Ersek +--- + hw/i386/acpi-build.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/i386/acpi-build.c | 7 ++++--- + 1 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c +index 33012c9..8be1286 100644 +--- a/hw/i386/acpi-build.c ++++ b/hw/i386/acpi-build.c +@@ -1076,15 +1076,16 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) + /* ACPI tables pointed to by RSDT */ + acpi_add_table(table_offsets, tables->table_data); + build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt); +- acpi_add_table(table_offsets, tables->table_data); + ++ acpi_add_table(table_offsets, tables->table_data); + build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci, + guest_info); +- acpi_add_table(table_offsets, tables->table_data); + +- build_madt(tables->table_data, tables->linker, &cpu, guest_info); + acpi_add_table(table_offsets, tables->table_data); ++ build_madt(tables->table_data, tables->linker, &cpu, guest_info); ++ + if (misc.has_hpet) { ++ acpi_add_table(table_offsets, tables->table_data); + build_hpet(tables->table_data, tables->linker); + } + if (guest_info->numa_nodes) { +-- +1.7.1 + diff --git a/SOURCES/kvm-aio-Fix-use-after-free-in-cancellation-path.patch b/SOURCES/kvm-aio-Fix-use-after-free-in-cancellation-path.patch new file mode 100644 index 0000000..d587c2e --- /dev/null +++ b/SOURCES/kvm-aio-Fix-use-after-free-in-cancellation-path.patch @@ -0,0 +1,96 @@ +From 4283e6a300b8b05f8fb32dc27dfe0bd774ef16db Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Fri, 30 May 2014 03:46:55 +0200 +Subject: [PATCH 08/13] aio: Fix use-after-free in cancellation path + +RH-Author: Fam Zheng +Message-id: <1401421615-17300-1-git-send-email-famz@redhat.com> +Patchwork-id: 59078 +O-Subject: [RHEL-7 qemu-kvm PATCH] aio: Fix use-after-free in cancellation path +Bugzilla: 1095877 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Kevin Wolf + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1095877 +Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7519118 (RHEL) + https://brewweb.devel.redhat.com/taskinfo?taskID=7519129 (RHEV) + +The current flow of canceling a thread from THREAD_ACTIVE state is: + + 1) Caller wants to cancel a request, so it calls thread_pool_cancel. + + 2) thread_pool_cancel waits on the conditional variable + elem->check_cancel. + + 3) The worker thread changes state to THREAD_DONE once the task is + done, and notifies elem->check_cancel to allow thread_pool_cancel + to continue execution, and signals the notifier (pool->notifier) to + allow callback function to be called later. But because of the + global mutex, the notifier won't get processed until step 4) and 5) + are done. + + 4) thread_pool_cancel continues, leaving the notifier signaled, it + just returns to caller. + + 5) Caller thinks the request is already canceled successfully, so it + releases any related data, such as freeing elem->common.opaque. + + 6) In the next main loop iteration, the notifier handler, + event_notifier_ready, is called. It finds the canceled thread in + THREAD_DONE state, so calls elem->common.cb, with an (likely) + dangling opaque pointer. This is a use-after-free. + +Fix it by calling event_notifier_ready before leaving +thread_pool_cancel. + +Test case update: This change will let cancel complete earlier than +test-thread-pool.c expects, so update the code to check this case: if +it's already done, done_cb sets .aiocb to NULL, skip calling +bdrv_aio_cancel on them. + +Reported-by: Ulrich Obergfell +Suggested-by: Paolo Bonzini +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 271c0f68b4eae72691721243a1c37f46a3232d61) +Signed-off-by: Fam Zheng +--- + tests/test-thread-pool.c | 2 +- + thread-pool.c | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + tests/test-thread-pool.c | 2 +- + thread-pool.c | 1 + + 2 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c +index b62338f..1be970d 100644 +--- a/tests/test-thread-pool.c ++++ b/tests/test-thread-pool.c +@@ -181,7 +181,7 @@ static void test_cancel(void) + + /* Canceling the others will be a blocking operation. */ + for (i = 0; i < 100; i++) { +- if (data[i].n != 3) { ++ if (data[i].aiocb && data[i].n != 3) { + bdrv_aio_cancel(data[i].aiocb); + } + } +diff --git a/thread-pool.c b/thread-pool.c +index 0ebd4c2..fc6a33b 100644 +--- a/thread-pool.c ++++ b/thread-pool.c +@@ -229,6 +229,7 @@ static void thread_pool_cancel(BlockDriverAIOCB *acb) + pool->pending_cancellations--; + } + qemu_mutex_unlock(&pool->lock); ++ event_notifier_ready(&pool->notifier); + } + + static const AIOCBInfo thread_pool_aiocb_info = { +-- +1.7.1 + diff --git a/SOURCES/kvm-aio-fix-qemu_bh_schedule-bh-ctx-race-condition.patch b/SOURCES/kvm-aio-fix-qemu_bh_schedule-bh-ctx-race-condition.patch new file mode 100644 index 0000000..3f9a1b5 --- /dev/null +++ b/SOURCES/kvm-aio-fix-qemu_bh_schedule-bh-ctx-race-condition.patch @@ -0,0 +1,80 @@ +From 068000dc97228f85b878634e3d49d3354f5cbafe Mon Sep 17 00:00:00 2001 +From: John Snow +Date: Fri, 11 Jul 2014 19:07:24 -0500 +Subject: [CHANGE 20/29] aio: fix qemu_bh_schedule() bh->ctx race condition +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: John Snow +Message-id: <1405105644-21039-1-git-send-email-jsnow@redhat.com> +Patchwork-id: 59866 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] aio: fix qemu_bh_schedule() bh->ctx race condition +Bugzilla: 1116728 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Fam Zheng + +From: Stefan Hajnoczi + +bz: https://bugzilla.redhat.com/show_bug.cgi?id=1116728 +brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7690195 +upstream: 924fe1293c3e7a3c787bbdfb351e7f168caee3e9 + +qemu_bh_schedule() is supposed to be thread-safe at least the first time +it is called. Unfortunately this is not quite true: + + bh->scheduled = 1; + aio_notify(bh->ctx); + +Since another thread may run the BH callback once it has been scheduled, +there is a race condition if the callback frees the BH before +aio_notify(bh->ctx) has a chance to run. + +Reported-by: Stefan Priebe +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Paolo Bonzini +Tested-by: Stefan Priebe +(cherry picked from commit 924fe1293c3e7a3c787bbdfb351e7f168caee3e9) +Signed-off-by: John Snow +--- + async.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +Signed-off-by: jen +--- + async.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/async.c b/async.c +index 5ce3633..d7ec1ea 100644 +--- a/async.c ++++ b/async.c +@@ -117,15 +117,21 @@ void qemu_bh_schedule_idle(QEMUBH *bh) + + void qemu_bh_schedule(QEMUBH *bh) + { ++ AioContext *ctx; ++ + if (bh->scheduled) + return; ++ ctx = bh->ctx; + bh->idle = 0; +- /* Make sure that idle & any writes needed by the callback are done +- * before the locations are read in the aio_bh_poll. ++ /* Make sure that: ++ * 1. idle & any writes needed by the callback are done before the ++ * locations are read in the aio_bh_poll. ++ * 2. ctx is loaded before scheduled is set and the callback has a chance ++ * to execute. + */ +- smp_wmb(); ++ smp_mb(); + bh->scheduled = 1; +- aio_notify(bh->ctx); ++ aio_notify(ctx); + } + + +-- +1.9.3 + diff --git a/SOURCES/kvm-block-Add-errp-to-bdrv_new.patch b/SOURCES/kvm-block-Add-errp-to-bdrv_new.patch new file mode 100644 index 0000000..f2c9eec --- /dev/null +++ b/SOURCES/kvm-block-Add-errp-to-bdrv_new.patch @@ -0,0 +1,308 @@ +From bfec9b88263e72c7425df04601bfcae5c06dca23 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:06 +0200 +Subject: [PATCH 06/19] block: Add errp to bdrv_new() + +Message-id: <1414059011-15516-4-git-send-email-kwolf@redhat.com> +Patchwork-id: 61837 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 3/8] block: Add errp to bdrv_new() +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +This patch adds an errp parameter to bdrv_new() and updates all its +callers. The next patches will make use of this in order to check for +duplicate IDs. Most of the callers know that their ID is fine, so they +can simply assert that there is no error. + +Behaviour doesn't change with this patch yet as bdrv_new() doesn't +actually assign errors to errp. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +(cherry picked from commit 98522f63f40adaebc412481e1d2e9170160d4539) +Signed-off-by: Miroslav Rezanina + +Conflicts: + block.c + qemu-img.c + qemu-io.c + +In RHEL 7, we have a different set of bdrv_new() callers. Fortunately, +the additional ones compared to upstream are trivial: Either we know +for sure that their name is unique (e.g. fixed names used in qemu-img) +and therefore bdrv_new() will never fail even after the final patch of +this series ('block: Catch duplicate IDs in bdrv_new()'), or they use an +empty name "" which can't conflict either. + +This patch leaks local_err in xen_disk, which was fixed in upstream +commit cedccf13. Downstream, we don't care about Xen, so it will remain +unfixed. + +Signed-off-by: Kevin Wolf +--- + block.c | 10 +++++----- + block/blkverify.c | 2 +- + block/iscsi.c | 2 +- + block/vmdk.c | 2 +- + block/vvfat.c | 4 ++-- + blockdev.c | 13 +++++++++---- + hw/block/xen_disk.c | 7 +++++-- + include/block/block.h | 2 +- + qemu-img.c | 6 +++--- + qemu-io.c | 2 +- + qemu-nbd.c | 3 ++- + 11 files changed, 31 insertions(+), 22 deletions(-) + +diff --git a/block.c b/block.c +index 496eb72..eb0810e 100644 +--- a/block.c ++++ b/block.c +@@ -300,7 +300,7 @@ void bdrv_register(BlockDriver *bdrv) + } + + /* create a new block device (by default it is empty) */ +-BlockDriverState *bdrv_new(const char *device_name) ++BlockDriverState *bdrv_new(const char *device_name, Error **errp) + { + BlockDriverState *bs; + +@@ -892,7 +892,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, + options = qdict_new(); + } + +- bs = bdrv_new(""); ++ bs = bdrv_new("", &error_abort); + bs->options = options; + options = qdict_clone_shallow(options); + +@@ -1014,7 +1014,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp) + sizeof(backing_filename)); + } + +- bs->backing_hd = bdrv_new(""); ++ bs->backing_hd = bdrv_new("", &error_abort); + + if (bs->backing_format[0] != '\0') { + back_drv = bdrv_find_format(bs->backing_format); +@@ -1111,7 +1111,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, + instead of opening 'filename' directly */ + + /* if there is a backing file, use it */ +- bs1 = bdrv_new(""); ++ bs1 = bdrv_new("", &error_abort); + ret = bdrv_open(bs1, filename, NULL, 0, drv, &local_err); + if (ret < 0) { + bdrv_unref(bs1); +@@ -5273,7 +5273,7 @@ void bdrv_img_create(const char *filename, const char *fmt, + back_flags = + flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); + +- bs = bdrv_new(""); ++ bs = bdrv_new("", &error_abort); + + ret = bdrv_open(bs, backing_file->value.s, NULL, back_flags, + backing_drv, &local_err); +diff --git a/block/blkverify.c b/block/blkverify.c +index 4ff7688..e623f6e 100644 +--- a/block/blkverify.c ++++ b/block/blkverify.c +@@ -155,7 +155,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, + goto fail; + } + +- s->test_file = bdrv_new(""); ++ s->test_file = bdrv_new("", &error_abort); + ret = bdrv_open(s->test_file, filename, NULL, flags, NULL, &local_err); + if (ret < 0) { + error_propagate(errp, local_err); +diff --git a/block/iscsi.c b/block/iscsi.c +index 9fe3be8..4f42f29 100644 +--- a/block/iscsi.c ++++ b/block/iscsi.c +@@ -1576,7 +1576,7 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options, + IscsiLun *iscsilun = NULL; + QDict *bs_options; + +- bs = bdrv_new(""); ++ bs = bdrv_new("", &error_abort); + + /* Read out options */ + while (options && options->name) { +diff --git a/block/vmdk.c b/block/vmdk.c +index eff0663..a5b1f1c 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1745,7 +1745,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + goto exit; + } + if (backing_file) { +- BlockDriverState *bs = bdrv_new(""); ++ BlockDriverState *bs = bdrv_new("", &error_abort); + ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp); + if (ret != 0) { + bdrv_unref(bs); +diff --git a/block/vvfat.c b/block/vvfat.c +index 3ddaa0b..6fd52df 100644 +--- a/block/vvfat.c ++++ b/block/vvfat.c +@@ -2935,7 +2935,7 @@ static int enable_write_target(BDRVVVFATState *s) + goto err; + } + +- s->qcow = bdrv_new(""); ++ s->qcow = bdrv_new("", &error_abort); + + ret = bdrv_open(s->qcow, s->qcow_filename, NULL, + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow, +@@ -2951,7 +2951,7 @@ static int enable_write_target(BDRVVVFATState *s) + unlink(s->qcow_filename); + #endif + +- s->bs->backing_hd = bdrv_new(""); ++ s->bs->backing_hd = bdrv_new("", &error_abort); + s->bs->backing_hd->drv = &vvfat_write_target; + s->bs->backing_hd->opaque = g_malloc(sizeof(void*)); + *(void**)s->bs->backing_hd->opaque = s; +diff --git a/blockdev.c b/blockdev.c +index 1ac8804..b5792a2 100644 +--- a/blockdev.c ++++ b/blockdev.c +@@ -471,7 +471,11 @@ static DriveInfo *blockdev_init(QDict *bs_opts, + /* init */ + dinfo = g_malloc0(sizeof(*dinfo)); + dinfo->id = g_strdup(qemu_opts_id(opts)); +- dinfo->bdrv = bdrv_new(dinfo->id); ++ dinfo->bdrv = bdrv_new(dinfo->id, &error); ++ if (error) { ++ error_propagate(errp, error); ++ goto bdrv_new_err; ++ } + dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; + dinfo->bdrv->read_only = ro; + dinfo->type = type; +@@ -531,8 +535,9 @@ static DriveInfo *blockdev_init(QDict *bs_opts, + + err: + bdrv_unref(dinfo->bdrv); +- g_free(dinfo->id); + QTAILQ_REMOVE(&drives, dinfo, next); ++bdrv_new_err: ++ g_free(dinfo->id); + g_free(dinfo); + early_err: + QDECREF(bs_opts); +@@ -1056,7 +1061,7 @@ static void external_snapshot_prepare(BlkTransactionStates *common, + } + + /* We will manually add the backing_hd field to the bs later */ +- states->new_bs = bdrv_new(""); ++ states->new_bs = bdrv_new("", &error_abort); + /* TODO Inherit bs->options or only take explicit options with an + * extended QMP command? */ + ret = bdrv_open(states->new_bs, new_image_file, NULL, +@@ -1678,7 +1683,7 @@ void qmp_drive_mirror(const char *device, const char *target, + /* Mirroring takes care of copy-on-write using the source's backing + * file. + */ +- target_bs = bdrv_new(""); ++ target_bs = bdrv_new("", &error_abort); + ret = bdrv_open(target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv, + &local_err); + if (ret < 0) { +diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c +index a2653b2..fc45f36 100644 +--- a/hw/block/xen_disk.c ++++ b/hw/block/xen_disk.c +@@ -793,11 +793,14 @@ static int blk_connect(struct XenDevice *xendev) + index = (blkdev->xendev.dev - 202 * 256) / 16; + blkdev->dinfo = drive_get(IF_XEN, 0, index); + if (!blkdev->dinfo) { ++ Error *local_err = NULL; + /* setup via xenbus -> create new block driver instance */ + xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); +- blkdev->bs = bdrv_new(blkdev->dev); ++ blkdev->bs = bdrv_new(blkdev->dev, &local_err); ++ if (local_err) { ++ blkdev->bs = NULL; ++ } + if (blkdev->bs) { +- Error *local_err = NULL; + BlockDriver *drv = bdrv_find_whitelisted_format(blkdev->fileproto, + readonly); + if (bdrv_open(blkdev->bs, +diff --git a/include/block/block.h b/include/block/block.h +index 03b7960..3651bd9 100644 +--- a/include/block/block.h ++++ b/include/block/block.h +@@ -178,7 +178,7 @@ int bdrv_create(BlockDriver *drv, const char* filename, + QEMUOptionParameter *options, Error **errp); + int bdrv_create_file(const char* filename, QEMUOptionParameter *options, + Error **errp); +-BlockDriverState *bdrv_new(const char *device_name); ++BlockDriverState *bdrv_new(const char *device_name, Error **errp); + void bdrv_make_anon(BlockDriverState *bs); + void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old); + void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top); +diff --git a/qemu-img.c b/qemu-img.c +index ed1799c..5c2f36a 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -274,7 +274,7 @@ static BlockDriverState *bdrv_new_open(const char *filename, + Error *local_err = NULL; + int ret; + +- bs = bdrv_new("image"); ++ bs = bdrv_new("image", &error_abort); + + if (fmt) { + drv = bdrv_find_format(fmt); +@@ -2299,7 +2299,7 @@ static int img_rebase(int argc, char **argv) + } else { + char backing_name[1024]; + +- bs_old_backing = bdrv_new("old_backing"); ++ bs_old_backing = bdrv_new("old_backing", &error_abort); + bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); + ret = bdrv_open(bs_old_backing, backing_name, NULL, BDRV_O_FLAGS, + old_backing_drv, &local_err); +@@ -2310,7 +2310,7 @@ static int img_rebase(int argc, char **argv) + goto out; + } + if (out_baseimg[0]) { +- bs_new_backing = bdrv_new("new_backing"); ++ bs_new_backing = bdrv_new("new_backing", &error_abort); + ret = bdrv_open(bs_new_backing, out_baseimg, NULL, BDRV_O_FLAGS, + new_backing_drv, &local_err); + if (ret) { +diff --git a/qemu-io.c b/qemu-io.c +index bbe2518..cc89947 100644 +--- a/qemu-io.c ++++ b/qemu-io.c +@@ -1831,7 +1831,7 @@ static int openfile(char *name, int flags, int growable, QDict *opts) + return 1; + } + } else { +- bs = bdrv_new("hda"); ++ bs = bdrv_new("hda", &error_abort); + + if (bdrv_open(bs, name, opts, flags, NULL, &local_err) < 0) { + fprintf(stderr, "%s: can't open device %s: %s\n", progname, name, +diff --git a/qemu-nbd.c b/qemu-nbd.c +index 207a610..ff792ef 100644 +--- a/qemu-nbd.c ++++ b/qemu-nbd.c +@@ -572,7 +572,8 @@ int main(int argc, char **argv) + drv = NULL; + } + +- bs = bdrv_new("hda"); ++ bs = bdrv_new("hda", &error_abort); ++ + srcpath = argv[optind]; + ret = bdrv_open(bs, srcpath, NULL, flags, drv, &local_err); + if (ret < 0) { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-block-Catch-duplicate-IDs-in-bdrv_new.patch b/SOURCES/kvm-block-Catch-duplicate-IDs-in-bdrv_new.patch new file mode 100644 index 0000000..937aff0 --- /dev/null +++ b/SOURCES/kvm-block-Catch-duplicate-IDs-in-bdrv_new.patch @@ -0,0 +1,123 @@ +From 48398d9b96fa334e8c0e626d99cf2df8f4a5c664 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:11 +0200 +Subject: [PATCH 08/19] block: Catch duplicate IDs in bdrv_new() + +Message-id: <1414059011-15516-9-git-send-email-kwolf@redhat.com> +Patchwork-id: 61840 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 8/8] block: Catch duplicate IDs in bdrv_new() +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Since commit f298d071, block devices added with blockdev-add don't have +a QemuOpts around in dinfo->opts. Consequently, we can't rely any more +on QemuOpts catching duplicate IDs for block devices. + +This patch adds a new check for duplicate IDs to bdrv_new(), and moves +the existing check that the ID isn't already taken for a node-name there +as well. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +(cherry picked from commit f2d953ec31eeeb3029ca915a55938c538a14efa8) + +In RHEL 7, node names don't exist yet, so only check the ID. + +Signed-off-by: Kevin Wolf +Signed-off-by: Miroslav Rezanina +--- + block.c | 6 ++++++ + tests/qemu-iotests/087 | 33 +++++++++++++++++++++++++++++++++ + tests/qemu-iotests/087.out | 13 +++++++++++++ + 3 files changed, 52 insertions(+) + +diff --git a/block.c b/block.c +index eb0810e..d7b6376 100644 +--- a/block.c ++++ b/block.c +@@ -304,6 +304,12 @@ BlockDriverState *bdrv_new(const char *device_name, Error **errp) + { + BlockDriverState *bs; + ++ if (bdrv_find(device_name)) { ++ error_setg(errp, "Device with id '%s' already exists", ++ device_name); ++ return NULL; ++ } ++ + bs = g_malloc0(sizeof(BlockDriverState)); + pstrcpy(bs->device_name, sizeof(bs->device_name), device_name); + if (device_name[0] != '\0') { +diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087 +index 53b6c43..f2fb3f4 100755 +--- a/tests/qemu-iotests/087 ++++ b/tests/qemu-iotests/087 +@@ -73,6 +73,39 @@ run_qemu < +Date: Tue, 27 May 2014 18:34:03 +0200 +Subject: [PATCH 06/13] block: Ignore duplicate or NULL format_name in bdrv_iterate_format + +RH-Author: Jeffrey Cody +Message-id: +Patchwork-id: 59038 +O-Subject: [PATCH qemu-kvm RHEL7.1] block: Ignore duplicate or NULL format_name in bdrv_iterate_format +Bugzilla: 1088695 1093983 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Max Reitz + +Some block drivers have multiple BlockDriver instances with identical +format_name fields (e.g. gluster, nbd). + +Both qemu-img and qemu will use bdrv_iterate_format() to list the +supported formats when a help option is invoked. As protocols and +formats may register multiple drivers, redundant listings of formats +occur (e.g., "Supported formats: ... gluster gluster gluster gluster ... +"). + +Since the list of driver formats will be small, this performs a simple +linear search on format_name, and ignores any duplicates. + +The end result change is that the iterator will no longer receive +duplicate string names, nor will it receive NULL pointers. + +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit e855e4fb7b97f7f605e1f44427b98022e39e6f8f) +--- + +RHEL7 Notes: +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7505698 +BZ: 1093983 +BZ: 1088695 + + block.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + block.c | 17 ++++++++++++++++- + 1 files changed, 16 insertions(+), 1 deletions(-) + +diff --git a/block.c b/block.c +index 4906f6b..43e325e 100644 +--- a/block.c ++++ b/block.c +@@ -3402,10 +3402,25 @@ void bdrv_iterate_format(void (*it)(void *opaque, const char *name), + void *opaque) + { + BlockDriver *drv; ++ int count = 0; ++ const char **formats = NULL; + + QLIST_FOREACH(drv, &bdrv_drivers, list) { +- it(opaque, drv->format_name); ++ if (drv->format_name) { ++ bool found = false; ++ int i = count; ++ while (formats && i && !found) { ++ found = !strcmp(formats[--i], drv->format_name); ++ } ++ ++ if (!found) { ++ formats = g_realloc(formats, (count + 1) * sizeof(char *)); ++ formats[count++] = drv->format_name; ++ it(opaque, drv->format_name); ++ } ++ } + } ++ g_free(formats); + } + + BlockDriverState *bdrv_find(const char *name) +-- +1.7.1 + diff --git a/SOURCES/kvm-block-Improve-driver-whitelist-checks.patch b/SOURCES/kvm-block-Improve-driver-whitelist-checks.patch new file mode 100644 index 0000000..00c82e5 --- /dev/null +++ b/SOURCES/kvm-block-Improve-driver-whitelist-checks.patch @@ -0,0 +1,103 @@ +From 8a53023561ad1fdc87104ef15494803ae00e069b Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Mon, 14 Jul 2014 01:05:21 -0500 +Subject: [CHANGE 21/29] block: Improve driver whitelist checks +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405299921-2619-1-git-send-email-famz@redhat.com> +Patchwork-id: 59871 +O-Subject: [RHEL-7 qemu-kvm PATCH] block: Improve driver whitelist checks +Bugzilla: 999789 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi + +From: Kevin Wolf + +Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7695744 +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=999789 + +The main intent of this patch is to consolidate the whitelist checks to +a single point in the code instead of spreading it everywhere. This adds +a nicer error message for read-only whitelisting, too, in places where +it was still missing. + +The patch also contains a bonus bug fix: By finding the format first in +bdrv_open() and then independently checking against the whitelist only +later, we avoid the case that use of a non-whitelisted format results in +probing rather than an error message. Previously, this could happen when +using the driver=... option. + +Signed-off-by: Kevin Wolf +Reviewed-by: Fam Zheng +(cherry picked from commit 8f94a6e40e46cbc8e8014da825d25824b1803b34) +Signed-off-by: Fam Zheng +Signed-off-by: jen + +Conflicts: + blockdev.c +Error report is different. +--- + block.c | 10 +++++++--- + blockdev.c | 2 +- + 2 files changed, 8 insertions(+), 4 deletions(-) + +Signed-off-by: jen +--- + block.c | 10 +++++++--- + blockdev.c | 2 +- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/block.c b/block.c +index 43e325e..a2e95f6 100644 +--- a/block.c ++++ b/block.c +@@ -786,7 +786,11 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, + bs->read_only = !(open_flags & BDRV_O_RDWR); + + if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) { +- error_setg(errp, "Driver '%s' is not whitelisted", drv->format_name); ++ error_setg(errp, ++ !bs->read_only && bdrv_is_whitelisted(drv, true) ++ ? "Driver '%s' can only be used for read-only devices" ++ : "Driver '%s' is not whitelisted", ++ drv->format_name); + return -ENOTSUP; + } + +@@ -908,7 +912,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, + /* Find the right block driver */ + drvname = qdict_get_try_str(options, "driver"); + if (drvname) { +- drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR)); ++ drv = bdrv_find_format(drvname); + if (!drv) { + error_setg(errp, "Unknown driver '%s'", drvname); + } +@@ -1177,7 +1181,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, + /* Find the right image format driver */ + drvname = qdict_get_try_str(options, "driver"); + if (drvname) { +- drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR)); ++ drv = bdrv_find_format(drvname); + qdict_del(options, "driver"); + } + +diff --git a/blockdev.c b/blockdev.c +index e51203c..aa5d0a6 100644 +--- a/blockdev.c ++++ b/blockdev.c +@@ -414,7 +414,7 @@ static DriveInfo *blockdev_init(QDict *bs_opts, + goto early_err; + } + +- drv = bdrv_find_whitelisted_format(buf, ro); ++ drv = bdrv_find_format(buf); + if (!drv) { + error_setg(errp, "'%s' invalid format", buf); + goto early_err; +-- +1.9.3 + diff --git a/SOURCES/kvm-block-New-bdrv_nb_sectors.patch b/SOURCES/kvm-block-New-bdrv_nb_sectors.patch new file mode 100644 index 0000000..3276c59 --- /dev/null +++ b/SOURCES/kvm-block-New-bdrv_nb_sectors.patch @@ -0,0 +1,135 @@ +From 47601d6fd4a620799984340c1fd44ff472f9d824 Mon Sep 17 00:00:00 2001 +Message-Id: <47601d6fd4a620799984340c1fd44ff472f9d824.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:18 -0600 +Subject: [CHANGE 24/31] block: New bdrv_nb_sectors() +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-25-git-send-email-famz@redhat.com> +Patchwork-id: 62697 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 24/30] block: New bdrv_nb_sectors() +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Markus Armbruster + +A call to retrieve the image size converts between bytes and sectors +several times: + +* BlockDriver method bdrv_getlength() returns bytes. + +* refresh_total_sectors() converts to sectors, rounding up, and stores + in total_sectors. + +* bdrv_getlength() converts total_sectors back to bytes (now rounded + up to a multiple of the sector size). + +* Callers wanting sectors rather bytes convert it right back. + Example: bdrv_get_geometry(). + +bdrv_nb_sectors() provides a way to omit the last two conversions. +It's exactly bdrv_getlength() with the conversion to bytes omitted. +It's functionally like bdrv_get_geometry() without its odd error +handling. + +Reimplement bdrv_getlength() and bdrv_get_geometry() on top of +bdrv_nb_sectors(). + +The next patches will convert some users of bdrv_getlength() to +bdrv_nb_sectors(). + +Signed-off-by: Markus Armbruster +Reviewed-by: Eric Blake +Reviewed-by: Benoit Canet +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 65a9bb25d6b7a4bb41edb102fa0363d81800b417) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block.c | 29 +++++++++++++++++++---------- + include/block/block.h | 1 + + 2 files changed, 20 insertions(+), 10 deletions(-) + +diff --git a/block.c b/block.c +index d7b6376..21418a6 100644 +--- a/block.c ++++ b/block.c +@@ -647,6 +647,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename, + + /** + * Set the current 'total_sectors' value ++ * Return 0 on success, -errno on error. + */ + static int refresh_total_sectors(BlockDriverState *bs, int64_t hint) + { +@@ -3255,11 +3256,12 @@ int64_t bdrv_get_allocated_file_size(BlockDriverState *bs) + } + + /** +- * Length of a file in bytes. Return < 0 if error or unknown. ++ * Return number of sectors on success, -errno on error. + */ +-int64_t bdrv_getlength(BlockDriverState *bs) ++int64_t bdrv_nb_sectors(BlockDriverState *bs) + { + BlockDriver *drv = bs->drv; ++ + if (!drv) + return -ENOMEDIUM; + +@@ -3269,19 +3271,26 @@ int64_t bdrv_getlength(BlockDriverState *bs) + return ret; + } + } +- return bs->total_sectors * BDRV_SECTOR_SIZE; ++ return bs->total_sectors; ++} ++ ++/** ++ * Return length in bytes on success, -errno on error. ++ * The length is always a multiple of BDRV_SECTOR_SIZE. ++ */ ++int64_t bdrv_getlength(BlockDriverState *bs) ++{ ++ int64_t ret = bdrv_nb_sectors(bs); ++ ++ return ret < 0 ? ret : ret * BDRV_SECTOR_SIZE; + } + + /* return 0 as number of sectors if no device present or error */ + void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) + { +- int64_t length; +- length = bdrv_getlength(bs); +- if (length < 0) +- length = 0; +- else +- length = length >> BDRV_SECTOR_BITS; +- *nb_sectors_ptr = length; ++ int64_t nb_sectors = bdrv_nb_sectors(bs); ++ ++ *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; + } + + /* throttling disk io limits */ +diff --git a/include/block/block.h b/include/block/block.h +index b06a9dc..c79a1e1 100644 +--- a/include/block/block.h ++++ b/include/block/block.h +@@ -250,6 +250,7 @@ BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, + const char *backing_file); + int bdrv_get_backing_file_depth(BlockDriverState *bs); + int bdrv_truncate(BlockDriverState *bs, int64_t offset); ++int64_t bdrv_nb_sectors(BlockDriverState *bs); + int64_t bdrv_getlength(BlockDriverState *bs); + int64_t bdrv_get_allocated_file_size(BlockDriverState *bs); + void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr); +-- +2.1.0 + diff --git a/SOURCES/kvm-block-Use-correct-width-in-format-strings.patch b/SOURCES/kvm-block-Use-correct-width-in-format-strings.patch new file mode 100644 index 0000000..381169a --- /dev/null +++ b/SOURCES/kvm-block-Use-correct-width-in-format-strings.patch @@ -0,0 +1,213 @@ +From 7e3dcd5daa2a5e7350bf3dadacdd6dcd1a2460fc Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:45 +0200 +Subject: [PATCH 07/20] block: Use correct width in format strings + +Message-id: +Patchwork-id: 61211 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 06/15] block: Use correct width in format strings +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Max Reitz + +Instead of blindly relying on a normal integer having a width of 32 bits +(which is a pretty good assumption, but we should not rely on it if +there is no need), use the correct format string macros. + +This does not touch DEBUG output. + +Signed-off-by: Max Reitz +Signed-off-by: Kevin Wolf +(cherry picked from commit 521b2b5df0ccad764cf95164c6e428f855067a6f) + +Conflicts: + block/vdi.c + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/cow.c | 2 +- + block/dmg.c | 8 ++++---- + block/qcow.c | 3 ++- + block/qcow2.c | 12 +++++++----- + block/sheepdog.c | 6 +++--- + block/vdi.c | 21 +++++++++++---------- + 6 files changed, 28 insertions(+), 24 deletions(-) + +diff --git a/block/cow.c b/block/cow.c +index 651bdff..c75668b 100644 +--- a/block/cow.c ++++ b/block/cow.c +@@ -82,7 +82,7 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags, + if (be32_to_cpu(cow_header.version) != COW_VERSION) { + char version[64]; + snprintf(version, sizeof(version), +- "COW version %d", cow_header.version); ++ "COW version %" PRIu32, cow_header.version); + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, "cow", version); + ret = -ENOTSUP; +diff --git a/block/dmg.c b/block/dmg.c +index 856402e..1e153cd 100644 +--- a/block/dmg.c ++++ b/block/dmg.c +@@ -248,8 +248,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, + offset += 8; + + if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) { +- error_report("sector count %" PRIu64 " for chunk %u is " +- "larger than max (%u)", ++ error_report("sector count %" PRIu64 " for chunk %" PRIu32 ++ " is larger than max (%u)", + s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX); + ret = -EINVAL; + goto fail; +@@ -269,8 +269,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, + offset += 8; + + if (s->lengths[i] > DMG_LENGTHS_MAX) { +- error_report("length %" PRIu64 " for chunk %u is larger " +- "than max (%u)", ++ error_report("length %" PRIu64 " for chunk %" PRIu32 ++ " is larger than max (%u)", + s->lengths[i], i, DMG_LENGTHS_MAX); + ret = -EINVAL; + goto fail; +diff --git a/block/qcow.c b/block/qcow.c +index a5f601f..be5d3e9 100644 +--- a/block/qcow.c ++++ b/block/qcow.c +@@ -121,7 +121,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, + } + if (header.version != QCOW_VERSION) { + char version[64]; +- snprintf(version, sizeof(version), "QCOW version %d", header.version); ++ snprintf(version, sizeof(version), "QCOW version %" PRIu32, ++ header.version); + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, "qcow", version); + ret = -ENOTSUP; +diff --git a/block/qcow2.c b/block/qcow2.c +index 0878d88..a679355 100644 +--- a/block/qcow2.c ++++ b/block/qcow2.c +@@ -124,8 +124,9 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, + + case QCOW2_EXT_MAGIC_BACKING_FORMAT: + if (ext.len >= sizeof(bs->backing_format)) { +- error_setg(errp, "ERROR: ext_backing_format: len=%u too large" +- " (>=%zu)", ext.len, sizeof(bs->backing_format)); ++ error_setg(errp, "ERROR: ext_backing_format: len=%" PRIu32 ++ " too large (>=%zu)", ext.len, ++ sizeof(bs->backing_format)); + return 2; + } + ret = bdrv_pread(bs->file, offset, bs->backing_format, ext.len); +@@ -480,7 +481,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, + goto fail; + } + if (header.version < 2 || header.version > 3) { +- report_unsupported(bs, errp, "QCOW version %d", header.version); ++ report_unsupported(bs, errp, "QCOW version %" PRIu32, header.version); + ret = -ENOTSUP; + goto fail; + } +@@ -490,7 +491,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, + /* Initialise cluster size */ + if (header.cluster_bits < MIN_CLUSTER_BITS || + header.cluster_bits > MAX_CLUSTER_BITS) { +- error_setg(errp, "Unsupported cluster size: 2^%i", header.cluster_bits); ++ error_setg(errp, "Unsupported cluster size: 2^%" PRIu32, ++ header.cluster_bits); + ret = -EINVAL; + goto fail; + } +@@ -587,7 +589,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, + s->refcount_order = header.refcount_order; + + if (header.crypt_method > QCOW_CRYPT_AES) { +- error_setg(errp, "Unsupported encryption method: %i", ++ error_setg(errp, "Unsupported encryption method: %" PRIu32, + header.crypt_method); + ret = -EINVAL; + goto fail; +diff --git a/block/sheepdog.c b/block/sheepdog.c +index b3a2ae8..f29b4e7 100644 +--- a/block/sheepdog.c ++++ b/block/sheepdog.c +@@ -995,7 +995,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename, + } + + if (rsp->result != SD_RES_SUCCESS) { +- error_report("cannot get vdi info, %s, %s %d %s", ++ error_report("cannot get vdi info, %s, %s %" PRIu32 " %s", + sd_strerror(rsp->result), filename, snapid, tag); + if (rsp->result == SD_RES_NO_VDI) { + ret = -ENOENT; +@@ -2175,8 +2175,8 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) + sn_tab[found].vm_state_size = inode.vm_state_size; + sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec; + +- snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), "%u", +- inode.snap_id); ++ snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), ++ "%" PRIu32, inode.snap_id); + pstrcpy(sn_tab[found].name, + MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)), + inode.tag); +diff --git a/block/vdi.c b/block/vdi.c +index 0f8b294..fecfa14 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -408,34 +408,35 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, + } + + if (header.signature != VDI_SIGNATURE) { +- error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature); ++ error_setg(errp, "Image not in VDI format (bad signature %08" PRIx32 ++ ")", header.signature); + ret = -EINVAL; + goto fail; + } else if (header.version != VDI_VERSION_1_1) { +- error_setg(errp, "unsupported VDI image (version %u.%u)", +- header.version >> 16, header.version & 0xffff); ++ error_setg(errp, "unsupported VDI image (version %" PRIu32 ".%" PRIu32 ++ ")", header.version >> 16, header.version & 0xffff); + ret = -ENOTSUP; + goto fail; + } else if (header.offset_bmap % SECTOR_SIZE != 0) { + /* We only support block maps which start on a sector boundary. */ + error_setg(errp, "unsupported VDI image (unaligned block map offset " +- "0x%x)", header.offset_bmap); ++ "0x%" PRIx32 ")", header.offset_bmap); + ret = -ENOTSUP; + goto fail; + } else if (header.offset_data % SECTOR_SIZE != 0) { + /* We only support data blocks which start on a sector boundary. */ +- error_setg(errp, "unsupported VDI image (unaligned data offset 0x%x)", +- header.offset_data); ++ error_setg(errp, "unsupported VDI image (unaligned data offset 0x%" ++ PRIx32 ")", header.offset_data); + ret = -ENOTSUP; + goto fail; + } else if (header.sector_size != SECTOR_SIZE) { +- error_setg(errp, "unsupported VDI image (sector size %u is not %u)", +- header.sector_size, SECTOR_SIZE); ++ error_setg(errp, "unsupported VDI image (sector size %" PRIu32 ++ " is not %u)", header.sector_size, SECTOR_SIZE); + ret = -ENOTSUP; + goto fail; + } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { +- error_setg(errp, "unsupported VDI image (sector size %u is not %u)", +- header.block_size, DEFAULT_CLUSTER_SIZE); ++ error_setg(errp, "unsupported VDI image (block size %" PRIu32 ++ " is not %u)", header.block_size, DEFAULT_CLUSTER_SIZE); + ret = -ENOTSUP; + goto fail; + } else if (header.disk_size > +-- +1.7.1 + diff --git a/SOURCES/kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch b/SOURCES/kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch index 06f8023..f3149c4 100644 --- a/SOURCES/kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch +++ b/SOURCES/kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch @@ -1,7 +1,7 @@ -From ce7b70a0a59a571095a9bec614cce7b260c8c4fd Mon Sep 17 00:00:00 2001 +From 8e79bb0e25c48354f895077b206ded171507ba55 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Fri, 19 Sep 2014 03:18:59 +0200 -Subject: [PATCH 4/4] block: add __com.redhat_change-backing-file qmp command +Subject: [PATCH 20/20] block: add __com.redhat_change-backing-file qmp command Message-id: Patchwork-id: 61313 @@ -41,7 +41,7 @@ Signed-off-by: Miroslav Rezanina 3 files changed, 46 insertions(+), 0 deletions(-) diff --git a/blockdev.c b/blockdev.c -index c4fb129..ff0fe9d 100644 +index 09ef3f7..7d4a53f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1782,6 +1782,14 @@ void qmp_block_job_complete(const char *device, Error **errp) @@ -60,10 +60,10 @@ index c4fb129..ff0fe9d 100644 { QmpOutputVisitor *ov = qmp_output_visitor_new(); diff --git a/qapi-schema.json b/qapi-schema.json -index e11b641..3a5a743 100644 +index 40bd2a6..d3d4e57 100644 --- a/qapi-schema.json +++ b/qapi-schema.json -@@ -1826,6 +1826,22 @@ +@@ -1832,6 +1832,22 @@ 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str' } @@ -87,7 +87,7 @@ index e11b641..3a5a743 100644 ## # @block-commit diff --git a/qmp-commands.hx b/qmp-commands.hx -index 94f8671..a300d10 100644 +index c07cf8a..e164ff8 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1241,6 +1241,28 @@ EQMP diff --git a/SOURCES/kvm-block-add-backing-file-option-to-block-stream.patch b/SOURCES/kvm-block-add-backing-file-option-to-block-stream.patch index c9eeaeb..ecc2c5e 100644 --- a/SOURCES/kvm-block-add-backing-file-option-to-block-stream.patch +++ b/SOURCES/kvm-block-add-backing-file-option-to-block-stream.patch @@ -1,7 +1,7 @@ -From dd7f33dff7cdf1d3481936560a1a1db285856eeb Mon Sep 17 00:00:00 2001 +From 9482cf37df20d18140b24751972697f9349f1441 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Fri, 19 Sep 2014 03:18:58 +0200 -Subject: [PATCH 3/4] block: add backing-file option to block-stream +Subject: [PATCH 19/20] block: add backing-file option to block-stream Message-id: <5b8611fab581db6b4c5eb31c998378090819268d.1411096194.git.jcody@redhat.com> Patchwork-id: 61312 @@ -113,7 +113,7 @@ index 2a6f533..367120d 100644 s->on_error = on_error; s->common.co = qemu_coroutine_create(stream_run); diff --git a/blockdev.c b/blockdev.c -index b22b42e..c4fb129 100644 +index 96dc3df..09ef3f7 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1425,14 +1425,17 @@ static void block_job_cb(void *opaque, int ret) @@ -180,10 +180,10 @@ index 841929d..b723b26 100644 BLOCKDEV_ON_ERROR_REPORT, true, &error); diff --git a/qapi-schema.json b/qapi-schema.json -index 100b059..e11b641 100644 +index ed79eb9..40bd2a6 100644 --- a/qapi-schema.json +++ b/qapi-schema.json -@@ -2274,6 +2274,21 @@ +@@ -2280,6 +2280,21 @@ # # @base: #optional the common backing file name # @@ -205,7 +205,7 @@ index 100b059..e11b641 100644 # @speed: #optional the maximum speed, in bytes per second # # @on-error: #optional the action to take on an error (default report). -@@ -2286,8 +2301,8 @@ +@@ -2292,8 +2307,8 @@ # Since: 1.1 ## { 'command': 'block-stream', @@ -217,7 +217,7 @@ index 100b059..e11b641 100644 ## diff --git a/qmp-commands.hx b/qmp-commands.hx -index 79006c5..94f8671 100644 +index 5ece4f9..c07cf8a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -999,7 +999,7 @@ EQMP diff --git a/SOURCES/kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch b/SOURCES/kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch index 1747065..f5c5264 100644 --- a/SOURCES/kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch +++ b/SOURCES/kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch @@ -1,7 +1,7 @@ -From 77785494f8bb202a99f895a1888ea6246ed81b2f Mon Sep 17 00:00:00 2001 +From e49f2991513ff786625bff7e729ebe9b292e633a Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Fri, 19 Sep 2014 03:18:56 +0200 -Subject: [PATCH 1/4] block: add helper function to determine if a BDS is in a chain +Subject: [PATCH 17/20] block: add helper function to determine if a BDS is in a chain Message-id: Patchwork-id: 61310 @@ -36,10 +36,10 @@ Signed-off-by: Miroslav Rezanina 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c -index 4906f6b..058255d 100644 +index af162fe..7bdbbc6 100644 --- a/block.c +++ b/block.c -@@ -3420,6 +3420,17 @@ BlockDriverState *bdrv_find(const char *name) +@@ -3439,6 +3439,17 @@ BlockDriverState *bdrv_find(const char *name) return NULL; } diff --git a/SOURCES/kvm-block-allow-bdrv_unref-to-be-passed-NULL-pointers.patch b/SOURCES/kvm-block-allow-bdrv_unref-to-be-passed-NULL-pointers.patch new file mode 100644 index 0000000..19e5a00 --- /dev/null +++ b/SOURCES/kvm-block-allow-bdrv_unref-to-be-passed-NULL-pointers.patch @@ -0,0 +1,44 @@ +From 9a9800bbe9e2a38adaccc98314fff2354a52037e Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:50 +0200 +Subject: [PATCH 12/20] block: allow bdrv_unref() to be passed NULL pointers + +Message-id: +Patchwork-id: 61216 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 11/15] block: allow bdrv_unref() to be passed NULL pointers +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +If bdrv_unref() is passed a NULL BDS pointer, it is safe to +exit with no operation. This will allow cleanup code to blindly +call bdrv_unref() on a BDS that has been initialized to NULL. + +Reviewed-by: Max Reitz +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit 9a4d5ca60772e09d0cbac01f1b4778aa68e00eaa) + +Signed-off-by: Miroslav Rezanina +--- + block.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/block.c b/block.c +index a2e95f6..af162fe 100644 +--- a/block.c ++++ b/block.c +@@ -5083,6 +5083,9 @@ void bdrv_ref(BlockDriverState *bs) + * deleted. */ + void bdrv_unref(BlockDriverState *bs) + { ++ if (!bs) { ++ return; ++ } + assert(bs->refcnt > 0); + if (--bs->refcnt == 0) { + bdrv_delete(bs); +-- +1.7.1 + diff --git a/SOURCES/kvm-block-delete-cow-block-driver.patch b/SOURCES/kvm-block-delete-cow-block-driver.patch new file mode 100644 index 0000000..eb674ff --- /dev/null +++ b/SOURCES/kvm-block-delete-cow-block-driver.patch @@ -0,0 +1,644 @@ +From c21689e9b457b3790a5d0294c2815f2df561dece Mon Sep 17 00:00:00 2001 +Message-Id: +From: Stefan Hajnoczi +Date: Thu, 18 Dec 2014 11:11:06 -0600 +Subject: [CHANGE] block: delete cow block driver +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Stefan Hajnoczi +Message-id: <1418901066-25891-1-git-send-email-stefanha@redhat.com> +Patchwork-id: 62969 +O-Subject: [RHEL-7.1 qemu-kvm PATCH RESEND] block: delete cow block driver +Bugzilla: 1175325 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Fam Zheng +RH-Acked-by: Max Reitz + +This patch removes support for the cow file format. + +Normally we do not break backwards compatibility but in this case there +is no impact and it is the most logical option. Extraordinary claims +require extraordinary evidence so I will show why removing the cow block +driver is the right thing to do. + +The cow file format is the disk image format for Usermode Linux, a way +of running a Linux system in userspace. The performance of UML was +never great and it was hacky, but it enjoyed some popularity before +hardware virtualization support became mainstream. + +QEMU's block/cow.c is supposed to read this image file format. +Unfortunately the file format was underspecified: + +1. Earlier Linux versions used the MAXPATHLEN constant for the backing + filename field. The value of MAXPATHLEN can change, so Linux + switched to a 4096 literal but QEMU has a 1024 literal. + +2. Padding was not used on the header struct (both in the Linux kernel + and in QEMU) so the struct layout varied across architectures. In + particular, i386 and x86_64 were different due to int64_t alignment + differences. Linux now uses __attribute__((packed)), QEMU does not. + +Therefore: + +1. QEMU cow images do not conform to the Linux cow image file format. + +2. cow images cannot be shared between different host architectures. + +This means QEMU cow images are useless and QEMU has not had bug reports +from users actually hitting these issues. + +Let's get rid of this thing, it serves no purpose and no one will be +affected. + +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Markus Armbruster +Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 550830f9351291c585c963204ad9127998b1c1ce) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Jeff E. Nelson + +Conflicts: + block/Makefile.objs + +Context conflict, easy to resolve. + + block/cow.c + +No problem, we're deleting this file anyway. + + qapi/block-core.json + +Downstream still uses qapi-schema.json. + + tests/image-fuzzer/runner.py + +Not present downstream, skip it. + + tests/qemu-iotests/069 + +Context conflict, easy to resolve. + + tests/qemu-iotests/072 + tests/qemu-iotests/099 + +Not present downstream, skip these tests. + + ui/cocoa.m + +We just want to drop "cow", the context conflict does not matter. + +Signed-off-by: Jeff E. Nelson +--- + block/Makefile.objs | 2 +- + block/cow.c | 402 ---------------------------------------------- + qapi-schema.json | 2 +- + qemu-doc.texi | 9 -- + qemu-img.texi | 4 +- + qmp-commands.hx | 2 +- + tests/qemu-iotests/069 | 2 +- + tests/qemu-iotests/common | 6 - + ui/cocoa.m | 2 +- + 9 files changed, 7 insertions(+), 424 deletions(-) + delete mode 100644 block/cow.c + +diff --git a/block/Makefile.objs b/block/Makefile.objs +index 0be180f..ebc350b 100644 +--- a/block/Makefile.objs ++++ b/block/Makefile.objs +@@ -1,4 +1,4 @@ +-block-obj-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o ++block-obj-y += raw.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o + block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o + block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o + block-obj-y += qed-check.o +diff --git a/block/cow.c b/block/cow.c +deleted file mode 100644 +index c75668b..0000000 +--- a/block/cow.c ++++ /dev/null +@@ -1,402 +0,0 @@ +-/* +- * Block driver for the COW format +- * +- * Copyright (c) 2004 Fabrice Bellard +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-#include "qemu-common.h" +-#include "block/block_int.h" +-#include "qemu/module.h" +- +-/**************************************************************/ +-/* COW block driver using file system holes */ +- +-/* user mode linux compatible COW file */ +-#define COW_MAGIC 0x4f4f4f4d /* MOOO */ +-#define COW_VERSION 2 +- +-struct cow_header_v2 { +- uint32_t magic; +- uint32_t version; +- char backing_file[1024]; +- int32_t mtime; +- uint64_t size; +- uint32_t sectorsize; +-}; +- +-typedef struct BDRVCowState { +- CoMutex lock; +- int64_t cow_sectors_offset; +-} BDRVCowState; +- +-static int cow_probe(const uint8_t *buf, int buf_size, const char *filename) +-{ +- const struct cow_header_v2 *cow_header = (const void *)buf; +- +- if (buf_size >= sizeof(struct cow_header_v2) && +- be32_to_cpu(cow_header->magic) == COW_MAGIC && +- be32_to_cpu(cow_header->version) == COW_VERSION) +- return 100; +- else +- return 0; +-} +- +-static int cow_open(BlockDriverState *bs, QDict *options, int flags, +- Error **errp) +-{ +- BDRVCowState *s = bs->opaque; +- struct cow_header_v2 cow_header; +- int bitmap_size; +- int64_t size; +- int ret; +- +- /* see if it is a cow image */ +- ret = bdrv_pread(bs->file, 0, &cow_header, sizeof(cow_header)); +- if (ret < 0) { +- goto fail; +- } +- +- if (be32_to_cpu(cow_header.magic) != COW_MAGIC) { +- error_setg(errp, "Image not in COW format"); +- ret = -EINVAL; +- goto fail; +- } +- +- if (be32_to_cpu(cow_header.version) != COW_VERSION) { +- char version[64]; +- snprintf(version, sizeof(version), +- "COW version %" PRIu32, cow_header.version); +- error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, +- bs->device_name, "cow", version); +- ret = -ENOTSUP; +- goto fail; +- } +- +- /* cow image found */ +- size = be64_to_cpu(cow_header.size); +- bs->total_sectors = size / 512; +- +- pstrcpy(bs->backing_file, sizeof(bs->backing_file), +- cow_header.backing_file); +- +- bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); +- s->cow_sectors_offset = (bitmap_size + 511) & ~511; +- qemu_co_mutex_init(&s->lock); +- return 0; +- fail: +- return ret; +-} +- +-/* +- * XXX(hch): right now these functions are extremely inefficient. +- * We should just read the whole bitmap we'll need in one go instead. +- */ +-static inline int cow_set_bit(BlockDriverState *bs, int64_t bitnum, bool *first) +-{ +- uint64_t offset = sizeof(struct cow_header_v2) + bitnum / 8; +- uint8_t bitmap; +- int ret; +- +- ret = bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap)); +- if (ret < 0) { +- return ret; +- } +- +- if (bitmap & (1 << (bitnum % 8))) { +- return 0; +- } +- +- if (*first) { +- ret = bdrv_flush(bs->file); +- if (ret < 0) { +- return ret; +- } +- *first = false; +- } +- +- bitmap |= (1 << (bitnum % 8)); +- +- ret = bdrv_pwrite(bs->file, offset, &bitmap, sizeof(bitmap)); +- if (ret < 0) { +- return ret; +- } +- return 0; +-} +- +-#define BITS_PER_BITMAP_SECTOR (512 * 8) +- +-/* Cannot use bitmap.c on big-endian machines. */ +-static int cow_test_bit(int64_t bitnum, const uint8_t *bitmap) +-{ +- return (bitmap[bitnum / 8] & (1 << (bitnum & 7))) != 0; +-} +- +-static int cow_find_streak(const uint8_t *bitmap, int value, int start, int nb_sectors) +-{ +- int streak_value = value ? 0xFF : 0; +- int last = MIN(start + nb_sectors, BITS_PER_BITMAP_SECTOR); +- int bitnum = start; +- while (bitnum < last) { +- if ((bitnum & 7) == 0 && bitmap[bitnum / 8] == streak_value) { +- bitnum += 8; +- continue; +- } +- if (cow_test_bit(bitnum, bitmap) == value) { +- bitnum++; +- continue; +- } +- break; +- } +- return MIN(bitnum, last) - start; +-} +- +-/* Return true if first block has been changed (ie. current version is +- * in COW file). Set the number of continuous blocks for which that +- * is true. */ +-static int coroutine_fn cow_co_is_allocated(BlockDriverState *bs, +- int64_t sector_num, int nb_sectors, int *num_same) +-{ +- int64_t bitnum = sector_num + sizeof(struct cow_header_v2) * 8; +- uint64_t offset = (bitnum / 8) & -BDRV_SECTOR_SIZE; +- uint8_t bitmap[BDRV_SECTOR_SIZE]; +- int ret; +- int changed; +- +- ret = bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap)); +- if (ret < 0) { +- return ret; +- } +- +- bitnum &= BITS_PER_BITMAP_SECTOR - 1; +- changed = cow_test_bit(bitnum, bitmap); +- *num_same = cow_find_streak(bitmap, changed, bitnum, nb_sectors); +- return changed; +-} +- +-static int64_t coroutine_fn cow_co_get_block_status(BlockDriverState *bs, +- int64_t sector_num, int nb_sectors, int *num_same) +-{ +- BDRVCowState *s = bs->opaque; +- int ret = cow_co_is_allocated(bs, sector_num, nb_sectors, num_same); +- int64_t offset = s->cow_sectors_offset + (sector_num << BDRV_SECTOR_BITS); +- if (ret < 0) { +- return ret; +- } +- return (ret ? BDRV_BLOCK_DATA : 0) | offset | BDRV_BLOCK_OFFSET_VALID; +-} +- +-static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num, +- int nb_sectors) +-{ +- int error = 0; +- int i; +- bool first = true; +- +- for (i = 0; i < nb_sectors; i++) { +- error = cow_set_bit(bs, sector_num + i, &first); +- if (error) { +- break; +- } +- } +- +- return error; +-} +- +-static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num, +- uint8_t *buf, int nb_sectors) +-{ +- BDRVCowState *s = bs->opaque; +- int ret, n; +- +- while (nb_sectors > 0) { +- ret = cow_co_is_allocated(bs, sector_num, nb_sectors, &n); +- if (ret < 0) { +- return ret; +- } +- if (ret) { +- ret = bdrv_pread(bs->file, +- s->cow_sectors_offset + sector_num * 512, +- buf, n * 512); +- if (ret < 0) { +- return ret; +- } +- } else { +- if (bs->backing_hd) { +- /* read from the base image */ +- ret = bdrv_read(bs->backing_hd, sector_num, buf, n); +- if (ret < 0) { +- return ret; +- } +- } else { +- memset(buf, 0, n * 512); +- } +- } +- nb_sectors -= n; +- sector_num += n; +- buf += n * 512; +- } +- return 0; +-} +- +-static coroutine_fn int cow_co_read(BlockDriverState *bs, int64_t sector_num, +- uint8_t *buf, int nb_sectors) +-{ +- int ret; +- BDRVCowState *s = bs->opaque; +- qemu_co_mutex_lock(&s->lock); +- ret = cow_read(bs, sector_num, buf, nb_sectors); +- qemu_co_mutex_unlock(&s->lock); +- return ret; +-} +- +-static int cow_write(BlockDriverState *bs, int64_t sector_num, +- const uint8_t *buf, int nb_sectors) +-{ +- BDRVCowState *s = bs->opaque; +- int ret; +- +- ret = bdrv_pwrite(bs->file, s->cow_sectors_offset + sector_num * 512, +- buf, nb_sectors * 512); +- if (ret < 0) { +- return ret; +- } +- +- return cow_update_bitmap(bs, sector_num, nb_sectors); +-} +- +-static coroutine_fn int cow_co_write(BlockDriverState *bs, int64_t sector_num, +- const uint8_t *buf, int nb_sectors) +-{ +- int ret; +- BDRVCowState *s = bs->opaque; +- qemu_co_mutex_lock(&s->lock); +- ret = cow_write(bs, sector_num, buf, nb_sectors); +- qemu_co_mutex_unlock(&s->lock); +- return ret; +-} +- +-static void cow_close(BlockDriverState *bs) +-{ +-} +- +-static int cow_create(const char *filename, QEMUOptionParameter *options, +- Error **errp) +-{ +- struct cow_header_v2 cow_header; +- struct stat st; +- int64_t image_sectors = 0; +- const char *image_filename = NULL; +- Error *local_err = NULL; +- int ret; +- BlockDriverState *cow_bs; +- +- /* Read out options */ +- while (options && options->name) { +- if (!strcmp(options->name, BLOCK_OPT_SIZE)) { +- image_sectors = options->value.n / 512; +- } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { +- image_filename = options->value.s; +- } +- options++; +- } +- +- ret = bdrv_create_file(filename, options, &local_err); +- if (ret < 0) { +- error_propagate(errp, local_err); +- return ret; +- } +- +- ret = bdrv_file_open(&cow_bs, filename, NULL, BDRV_O_RDWR, &local_err); +- if (ret < 0) { +- error_propagate(errp, local_err); +- return ret; +- } +- +- memset(&cow_header, 0, sizeof(cow_header)); +- cow_header.magic = cpu_to_be32(COW_MAGIC); +- cow_header.version = cpu_to_be32(COW_VERSION); +- if (image_filename) { +- /* Note: if no file, we put a dummy mtime */ +- cow_header.mtime = cpu_to_be32(0); +- +- if (stat(image_filename, &st) != 0) { +- goto mtime_fail; +- } +- cow_header.mtime = cpu_to_be32(st.st_mtime); +- mtime_fail: +- pstrcpy(cow_header.backing_file, sizeof(cow_header.backing_file), +- image_filename); +- } +- cow_header.sectorsize = cpu_to_be32(512); +- cow_header.size = cpu_to_be64(image_sectors * 512); +- ret = bdrv_pwrite(cow_bs, 0, &cow_header, sizeof(cow_header)); +- if (ret < 0) { +- goto exit; +- } +- +- /* resize to include at least all the bitmap */ +- ret = bdrv_truncate(cow_bs, +- sizeof(cow_header) + ((image_sectors + 7) >> 3)); +- if (ret < 0) { +- goto exit; +- } +- +-exit: +- bdrv_unref(cow_bs); +- return ret; +-} +- +-static QEMUOptionParameter cow_create_options[] = { +- { +- .name = BLOCK_OPT_SIZE, +- .type = OPT_SIZE, +- .help = "Virtual disk size" +- }, +- { +- .name = BLOCK_OPT_BACKING_FILE, +- .type = OPT_STRING, +- .help = "File name of a base image" +- }, +- { NULL } +-}; +- +-static BlockDriver bdrv_cow = { +- .format_name = "cow", +- .instance_size = sizeof(BDRVCowState), +- +- .bdrv_probe = cow_probe, +- .bdrv_open = cow_open, +- .bdrv_close = cow_close, +- .bdrv_create = cow_create, +- .bdrv_has_zero_init = bdrv_has_zero_init_1, +- +- .bdrv_read = cow_co_read, +- .bdrv_write = cow_co_write, +- .bdrv_co_get_block_status = cow_co_get_block_status, +- +- .create_options = cow_create_options, +-}; +- +-static void bdrv_cow_init(void) +-{ +- bdrv_register(&bdrv_cow); +-} +- +-block_init(bdrv_cow_init); +diff --git a/qapi-schema.json b/qapi-schema.json +index 2af2643..8a7cf0b 100644 +--- a/qapi-schema.json ++++ b/qapi-schema.json +@@ -826,6 +826,7 @@ + # 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device', + # 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow', + # 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat' ++# 2.2: 'cow' dropped + # + # @backing_file: #optional the name of the backing file (for copy-on-write) + # +@@ -4076,7 +4077,6 @@ + + 'bochs': 'BlockdevOptionsGenericFormat', + 'cloop': 'BlockdevOptionsGenericFormat', +- 'cow': 'BlockdevOptionsGenericCOWFormat', + 'dmg': 'BlockdevOptionsGenericFormat', + 'parallels': 'BlockdevOptionsGenericFormat', + 'qcow': 'BlockdevOptionsGenericCOWFormat', +diff --git a/qemu-doc.texi b/qemu-doc.texi +index ff124fe..33f709a 100644 +--- a/qemu-doc.texi ++++ b/qemu-doc.texi +@@ -621,15 +621,6 @@ File name of a base image (see @option{create} subcommand) + If this option is set to @code{on}, the image is encrypted. + @end table + +-@item cow +-User Mode Linux Copy On Write image format. It is supported only for +-compatibility with previous versions. +-Supported options: +-@table @code +-@item backing_file +-File name of a base image (see @option{create} subcommand) +-@end table +- + @item vdi + VirtualBox 1.1 compatible image format. + Supported options: +diff --git a/qemu-img.texi b/qemu-img.texi +index e943856..2099dd1 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -201,8 +201,8 @@ compression is read-only. It means that if a compressed sector is + rewritten, then it is rewritten as uncompressed data. + + Image conversion is also useful to get smaller image when using a +-growable format such as @code{qcow} or @code{cow}: the empty sectors +-are detected and suppressed from the destination image. ++growable format such as @code{qcow}: the empty sectors are detected and ++suppressed from the destination image. + + @var{sparse_size} indicates the consecutive number of bytes (defaults to 4k) + that must contain only zeros for qemu-img to create a sparse image during +diff --git a/qmp-commands.hx b/qmp-commands.hx +index 9c11213..44dd48e 100644 +--- a/qmp-commands.hx ++++ b/qmp-commands.hx +@@ -1903,7 +1903,7 @@ Each json-object contain the following: + - "file": device file name (json-string) + - "ro": true if read-only, false otherwise (json-bool) + - "drv": driver format name (json-string) +- - Possible values: "blkdebug", "bochs", "cloop", "cow", "dmg", ++ - Possible values: "blkdebug", "bochs", "cloop", "dmg", + "file", "file", "ftp", "ftps", "host_cdrom", + "host_device", "host_floppy", "http", "https", + "nbd", "parallels", "qcow", "qcow2", "raw", +diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069 +index 50347d9..d606685 100755 +--- a/tests/qemu-iotests/069 ++++ b/tests/qemu-iotests/069 +@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + . ./common.rc + . ./common.filter + +-_supported_fmt cow qed qcow qcow2 vmdk ++_supported_fmt qed qcow qcow2 vmdk + _supported_proto generic + _supported_os Linux + _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" +diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common +index f8c1b56..a90415a 100644 +--- a/tests/qemu-iotests/common ++++ b/tests/qemu-iotests/common +@@ -129,7 +129,6 @@ common options + check options + -raw test raw (default) + -bochs test bochs +- -cow test cow + -cloop test cloop + -parallels test parallels + -qcow test qcow +@@ -171,11 +170,6 @@ testlist options + xpand=false + ;; + +- -cow) +- IMGFMT=cow +- xpand=false +- ;; +- + -cloop) + IMGFMT=cloop + IMGFMT_GENERIC=false +diff --git a/ui/cocoa.m b/ui/cocoa.m +index 1971d9c..0c35f25 100644 +--- a/ui/cocoa.m ++++ b/ui/cocoa.m +@@ -771,7 +771,7 @@ QemuCocoaView *cocoaView; + NSOpenPanel *op = [[NSOpenPanel alloc] init]; + [op setPrompt:@"Boot image"]; + [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"]; +- [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil] ++ [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cloop",@"vmdk",nil] + modalForWindow:normalWindow modalDelegate:self + didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; + } else { +-- +2.1.0 + diff --git a/SOURCES/kvm-block-do-not-abuse-EMEDIUMTYPE.patch b/SOURCES/kvm-block-do-not-abuse-EMEDIUMTYPE.patch new file mode 100644 index 0000000..8a0e916 --- /dev/null +++ b/SOURCES/kvm-block-do-not-abuse-EMEDIUMTYPE.patch @@ -0,0 +1,177 @@ +From 0b0c86931a7da43b6358b202799510b20775aa17 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:43 +0200 +Subject: [PATCH 05/20] block: do not abuse EMEDIUMTYPE + +Message-id: +Patchwork-id: 61209 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 04/15] block: do not abuse EMEDIUMTYPE +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Returning "Wrong medium type" for an image that does not have a valid +header is a bit weird. Improve the error by mentioning what format +was trying to open it. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 76abe4071d111a9ca6dcc9b9689a831c39ffa718) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/bochs.c | 3 ++- + block/cow.c | 3 ++- + block/parallels.c | 3 ++- + block/qcow.c | 3 ++- + block/qcow2.c | 2 +- + block/qed.c | 3 ++- + block/vdi.c | 4 ++-- + block/vmdk.c | 6 ++++-- + block/vpc.c | 3 ++- + 9 files changed, 19 insertions(+), 11 deletions(-) + +diff --git a/block/bochs.c b/block/bochs.c +index 5c74223..826ec12 100644 +--- a/block/bochs.c ++++ b/block/bochs.c +@@ -113,7 +113,8 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, + strcmp(bochs.subtype, GROWING_TYPE) || + ((le32_to_cpu(bochs.version) != HEADER_VERSION) && + (le32_to_cpu(bochs.version) != HEADER_V1))) { +- return -EMEDIUMTYPE; ++ error_setg(errp, "Image not in Bochs format"); ++ return -EINVAL; + } + + if (le32_to_cpu(bochs.version) == HEADER_V1) { +diff --git a/block/cow.c b/block/cow.c +index 909c3e7..46295d4 100644 +--- a/block/cow.c ++++ b/block/cow.c +@@ -74,7 +74,8 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags, + } + + if (be32_to_cpu(cow_header.magic) != COW_MAGIC) { +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "Image not in COW format"); ++ ret = -EINVAL; + goto fail; + } + +diff --git a/block/parallels.c b/block/parallels.c +index d83cde4..1a5bd35 100644 +--- a/block/parallels.c ++++ b/block/parallels.c +@@ -85,7 +85,8 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, + + if (memcmp(ph.magic, HEADER_MAGIC, 16) || + (le32_to_cpu(ph.version) != HEADER_VERSION)) { +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "Image not in Parallels format"); ++ ret = -EINVAL; + goto fail; + } + +diff --git a/block/qcow.c b/block/qcow.c +index ad44f78..a5f601f 100644 +--- a/block/qcow.c ++++ b/block/qcow.c +@@ -115,7 +115,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, + be64_to_cpus(&header.l1_table_offset); + + if (header.magic != QCOW_MAGIC) { +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "Image not in qcow format"); ++ ret = -EINVAL; + goto fail; + } + if (header.version != QCOW_VERSION) { +diff --git a/block/qcow2.c b/block/qcow2.c +index 7398b16..0878d88 100644 +--- a/block/qcow2.c ++++ b/block/qcow2.c +@@ -476,7 +476,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, + + if (header.magic != QCOW_MAGIC) { + error_setg(errp, "Image is not in qcow2 format"); +- ret = -EMEDIUMTYPE; ++ ret = -EINVAL; + goto fail; + } + if (header.version < 2 || header.version > 3) { +diff --git a/block/qed.c b/block/qed.c +index 619f2d0..d1de0a2 100644 +--- a/block/qed.c ++++ b/block/qed.c +@@ -391,7 +391,8 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, + qed_header_le_to_cpu(&le_header, &s->header); + + if (s->header.magic != QED_MAGIC) { +- return -EMEDIUMTYPE; ++ error_setg(errp, "Image not in QED format"); ++ return -EINVAL; + } + if (s->header.features & ~QED_FEATURE_MASK) { + /* image uses unsupported feature bits */ +diff --git a/block/vdi.c b/block/vdi.c +index b095bee..0f8b294 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -408,8 +408,8 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, + } + + if (header.signature != VDI_SIGNATURE) { +- logout("bad vdi signature %08x\n", header.signature); +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature); ++ ret = -EINVAL; + goto fail; + } else if (header.version != VDI_VERSION_1_1) { + error_setg(errp, "unsupported VDI image (version %u.%u)", +diff --git a/block/vmdk.c b/block/vmdk.c +index 4ff9531..eff0663 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -712,7 +712,8 @@ static int vmdk_open_sparse(BlockDriverState *bs, + return vmdk_open_vmdk4(bs, file, flags, errp); + break; + default: +- return -EMEDIUMTYPE; ++ error_setg(errp, "Image not in VMDK format"); ++ return -EINVAL; + break; + } + } +@@ -828,7 +829,8 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, + goto exit; + } + if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) { +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "invalid VMDK image descriptor"); ++ ret = -EINVAL; + goto exit; + } + if (strcmp(ct, "monolithicFlat") && +diff --git a/block/vpc.c b/block/vpc.c +index 000d1c6..6e8fb33 100644 +--- a/block/vpc.c ++++ b/block/vpc.c +@@ -193,7 +193,8 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, + goto fail; + } + if (strncmp(footer->creator, "conectix", 8)) { +- ret = -EMEDIUMTYPE; ++ error_setg(errp, "invalid VPC image"); ++ ret = -EINVAL; + goto fail; + } + disk_type = VHD_FIXED; +-- +1.7.1 + diff --git a/SOURCES/kvm-block-extend-block-commit-to-accept-a-string-for-the.patch b/SOURCES/kvm-block-extend-block-commit-to-accept-a-string-for-the.patch index ad3a840..8e6e72e 100644 --- a/SOURCES/kvm-block-extend-block-commit-to-accept-a-string-for-the.patch +++ b/SOURCES/kvm-block-extend-block-commit-to-accept-a-string-for-the.patch @@ -1,7 +1,7 @@ -From c8dda202bd3faf6cdc91834586c8a42ff4a6f762 Mon Sep 17 00:00:00 2001 +From 820c45fa40b9763a207e9eeb1268f87c2ac06351 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Fri, 19 Sep 2014 03:18:57 +0200 -Subject: [PATCH 2/4] block: extend block-commit to accept a string for the backing file +Subject: [PATCH 18/20] block: extend block-commit to accept a string for the backing file Message-id: Patchwork-id: 61311 @@ -65,10 +65,10 @@ Signed-off-by: Miroslav Rezanina 7 files changed, 59 insertions(+), 11 deletions(-) diff --git a/block.c b/block.c -index 058255d..d26e9aa 100644 +index 7bdbbc6..496eb72 100644 --- a/block.c +++ b/block.c -@@ -2319,12 +2319,15 @@ typedef struct BlkIntermediateStates { +@@ -2323,12 +2323,15 @@ typedef struct BlkIntermediateStates { * * base <- active * @@ -85,7 +85,7 @@ index 058255d..d26e9aa 100644 { BlockDriverState *intermediate; BlockDriverState *base_bs = NULL; -@@ -2376,7 +2379,8 @@ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top, +@@ -2380,7 +2383,8 @@ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top, } /* success - we can delete the intermediate states, and link top->base */ @@ -144,7 +144,7 @@ index e3e395d..b6e1770 100644 s->common.co = qemu_coroutine_create(commit_run); diff --git a/blockdev.c b/blockdev.c -index a94c9d3..b22b42e 100644 +index 107e27e..96dc3df 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1465,6 +1465,7 @@ void qmp_block_stream(const char *device, bool has_base, @@ -208,10 +208,10 @@ index 53fc98c..e6874b4 100644 * commit_active_start: * @bs: Active block device to be committed. diff --git a/qapi-schema.json b/qapi-schema.json -index 3768872..100b059 100644 +index 18ab949..ed79eb9 100644 --- a/qapi-schema.json +++ b/qapi-schema.json -@@ -1842,6 +1842,23 @@ +@@ -1848,6 +1848,23 @@ # which contains the topmost data to be committed down. If # not specified, this is the active layer. # @@ -235,7 +235,7 @@ index 3768872..100b059 100644 # If top == base, that is an error. # If top == active, the job will not be completed by itself, # user needs to complete the job with the block-job-complete -@@ -1854,7 +1871,6 @@ +@@ -1860,7 +1877,6 @@ # size of the smaller top, you can safely truncate it # yourself once the commit operation successfully completes. # @@ -243,7 +243,7 @@ index 3768872..100b059 100644 # @speed: #optional the maximum speed, in bytes per second # # Returns: Nothing on success -@@ -1869,7 +1885,7 @@ +@@ -1875,7 +1891,7 @@ ## { 'command': 'block-commit', 'data': { 'device': 'str', '*base': 'str', '*top': 'str', @@ -253,7 +253,7 @@ index 3768872..100b059 100644 ## # @drive-mirror diff --git a/qmp-commands.hx b/qmp-commands.hx -index b6b6246..79006c5 100644 +index f67121a..5ece4f9 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1005,7 +1005,7 @@ EQMP diff --git a/SOURCES/kvm-block-iotest-update-084-to-test-static-VDI-image-cre.patch b/SOURCES/kvm-block-iotest-update-084-to-test-static-VDI-image-cre.patch new file mode 100644 index 0000000..ed479af --- /dev/null +++ b/SOURCES/kvm-block-iotest-update-084-to-test-static-VDI-image-cre.patch @@ -0,0 +1,97 @@ +From a1c05e91f427ee06521bdda8013091753736781f Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:54 +0200 +Subject: [PATCH 16/20] block: iotest - update 084 to test static VDI image creation + +Message-id: <179b35695a0f8dc312f7963cb818c630bcea84c7.1410897407.git.jcody@redhat.com> +Patchwork-id: 61220 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 15/15] block: iotest - update 084 to test static VDI image creation +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +This updates the VDI corruption test to also test static VDI image +creation, as well as the default dynamic image creation. + +Reviewed-by: Max Reitz +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit 23d20b5b4fb7bde102e6779b7a13b88375e4db66) + +Signed-off-by: Miroslav Rezanina +--- + tests/qemu-iotests/084 | 16 ++++++++++++++-- + tests/qemu-iotests/084.out | 14 ++++++++++++++ + 2 files changed, 28 insertions(+), 2 deletions(-) + +diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084 +index 10a5a65..66ebcc3 100755 +--- a/tests/qemu-iotests/084 ++++ b/tests/qemu-iotests/084 +@@ -1,6 +1,7 @@ + #!/bin/bash + # +-# Test case for VDI header corruption; image too large, and too many blocks ++# Test case for VDI header corruption; image too large, and too many blocks. ++# Also simple test for creating dynamic and static VDI images. + # + # Copyright (C) 2013 Red Hat, Inc. + # +@@ -43,14 +44,25 @@ _supported_fmt vdi + _supported_proto generic + _supported_os Linux + ++size=64M + ds_offset=368 # disk image size field offset + bs_offset=376 # block size field offset + bii_offset=384 # block in image field offset + + echo ++echo "=== Statically allocated image creation ===" ++echo ++_make_test_img $size -o static ++_img_info ++stat -c"disk image file size in bytes: %s" "${TEST_IMG}" ++_cleanup_test_img ++ ++echo + echo "=== Testing image size bounds ===" + echo +-_make_test_img 64M ++_make_test_img $size ++_img_info ++stat -c"disk image file size in bytes: %s" "${TEST_IMG}" + + # check for image size too large + # poke max image size, and appropriate blocks_in_image value +diff --git a/tests/qemu-iotests/084.out b/tests/qemu-iotests/084.out +index 99c8e74..943888a 100644 +--- a/tests/qemu-iotests/084.out ++++ b/tests/qemu-iotests/084.out +@@ -1,8 +1,22 @@ + QA output created by 084 + ++=== Statically allocated image creation === ++ ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 ++image: TEST_DIR/t.IMGFMT ++file format: IMGFMT ++virtual size: 64M (67108864 bytes) ++cluster_size: 1048576 ++disk image file size in bytes: 67109888 ++ + === Testing image size bounds === + + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 ++image: TEST_DIR/t.IMGFMT ++file format: IMGFMT ++virtual size: 64M (67108864 bytes) ++cluster_size: 1048576 ++disk image file size in bytes: 1024 + Test 1: Maximum size (1024 TB): + image: TEST_DIR/t.IMGFMT + file format: IMGFMT +-- +1.7.1 + diff --git a/SOURCES/kvm-block-iscsi-fix-segfault-if-writesame-fails.patch b/SOURCES/kvm-block-iscsi-fix-segfault-if-writesame-fails.patch index 1687f01..fb940e9 100644 --- a/SOURCES/kvm-block-iscsi-fix-segfault-if-writesame-fails.patch +++ b/SOURCES/kvm-block-iscsi-fix-segfault-if-writesame-fails.patch @@ -1,4 +1,4 @@ -From 51cb710930b200264555e47590c8a50b82588ecb Mon Sep 17 00:00:00 2001 +From 8bb562cbc4c70ea2d338db0e86d99b0578a73955 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:55:59 +0200 Subject: [PATCH 04/12] block/iscsi: fix segfault if writesame fails @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-5-git-send-email-famz@redhat.com> Patchwork-id: 58341 O-Subject: [RHEL-7 0day qemu-kvm PATCH 4/7] block/iscsi: fix segfault if writesame fails -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-block-iscsi-query-for-supported-VPD-pages.patch b/SOURCES/kvm-block-iscsi-query-for-supported-VPD-pages.patch index 3cd8ab2..e776aae 100644 --- a/SOURCES/kvm-block-iscsi-query-for-supported-VPD-pages.patch +++ b/SOURCES/kvm-block-iscsi-query-for-supported-VPD-pages.patch @@ -1,4 +1,4 @@ -From ea065d17bd4302027839cde0b038061ccfe616a4 Mon Sep 17 00:00:00 2001 +From ce9c2ba7bd509d0d92c6f5a12ea27b9899126d6d Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:55:58 +0200 Subject: [PATCH 03/12] block/iscsi: query for supported VPD pages @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-4-git-send-email-famz@redhat.com> Patchwork-id: 58340 O-Subject: [RHEL-7 0day qemu-kvm PATCH 3/7] block/iscsi: query for supported VPD pages -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-block-make-top-argument-to-block-commit-optional.patch b/SOURCES/kvm-block-make-top-argument-to-block-commit-optional.patch index 36f7b1d..d78bbc8 100644 --- a/SOURCES/kvm-block-make-top-argument-to-block-commit-optional.patch +++ b/SOURCES/kvm-block-make-top-argument-to-block-commit-optional.patch @@ -1,12 +1,12 @@ -From 915f7feb718ab551f6a0c0e05939e369c3aab759 Mon Sep 17 00:00:00 2001 +From 2513477895b7fd9434a66be645dfeae5dc2eccb8 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:12 +0200 -Subject: [PATCH 5/7] block: make 'top' argument to block-commit optional +Subject: [PATCH 09/11] block: make 'top' argument to block-commit optional Message-id: <1408552814-23031-6-git-send-email-eblake@redhat.com> Patchwork-id: 60647 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 5/7] block: make 'top' argument to block-commit optional -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi @@ -42,7 +42,7 @@ Signed-off-by: Miroslav Rezanina 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/blockdev.c b/blockdev.c -index e51203c..a94c9d3 100644 +index aa5d0a6..107e27e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1463,7 +1463,8 @@ void qmp_block_stream(const char *device, bool has_base, @@ -90,10 +90,10 @@ index e51203c..a94c9d3 100644 commit_active_start(bs, base_bs, speed, on_error, block_job_cb, bs, &local_err); diff --git a/qapi-schema.json b/qapi-schema.json -index aaa86f5..3768872 100644 +index 604ec69..18ab949 100644 --- a/qapi-schema.json +++ b/qapi-schema.json -@@ -1838,8 +1838,9 @@ +@@ -1844,8 +1844,9 @@ # @base: #optional The file name of the backing image to write data into. # If not specified, this is the deepest backing image # @@ -105,7 +105,7 @@ index aaa86f5..3768872 100644 # # If top == base, that is an error. # If top == active, the job will not be completed by itself, -@@ -1867,7 +1868,7 @@ +@@ -1873,7 +1874,7 @@ # ## { 'command': 'block-commit', @@ -115,7 +115,7 @@ index aaa86f5..3768872 100644 ## diff --git a/qmp-commands.hx b/qmp-commands.hx -index 1d4be84..b6b6246 100644 +index 405275c..f67121a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1005,7 +1005,7 @@ EQMP diff --git a/SOURCES/kvm-block-make-vdi-bounds-check-match-upstream.patch b/SOURCES/kvm-block-make-vdi-bounds-check-match-upstream.patch new file mode 100644 index 0000000..43f3737 --- /dev/null +++ b/SOURCES/kvm-block-make-vdi-bounds-check-match-upstream.patch @@ -0,0 +1,83 @@ +From 2f5fb1498fa48ea25f2d4155c9730001931bdef7 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:41 +0200 +Subject: [PATCH 03/20] block: make vdi bounds check match upstream + +Message-id: <0935a62fcd0e3cce1ed66aa79fc460804ed938c7.1410897407.git.jcody@redhat.com> +Patchwork-id: 61207 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 02/15] block: make vdi bounds check match upstream +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +There is a slight discrepancy between downstream, and upstream, +in a patch done for CVE-2014-0144. There is no difference in +functionality - the (earlier) downstream patch contained a redundant +'#define' that was removed upstream, and some upstream added error +messages and different error returns. + +Changing this to match upstream will make subsequent backports +easier. + +Downstream-only. + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 15 ++++++++++----- + 1 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index 0457298..5e2fad5 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -120,11 +120,10 @@ typedef unsigned char uuid_t[16]; + + #define VDI_IS_ALLOCATED(X) ((X) < VDI_DISCARDED) + +-#define VDI_BLOCK_SIZE (1 * MiB) + /* max blocks in image is (0xffffffff / 4) */ + #define VDI_BLOCKS_IN_IMAGE_MAX 0x3fffffff + #define VDI_DISK_SIZE_MAX ((uint64_t)VDI_BLOCKS_IN_IMAGE_MAX * \ +- (uint64_t)VDI_BLOCK_SIZE) ++ (uint64_t)DEFAULT_CLUSTER_SIZE) + + #if !defined(CONFIG_UUID) + static inline void uuid_generate(uuid_t out) +@@ -392,7 +391,10 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, + #endif + + if (header.disk_size > VDI_DISK_SIZE_MAX) { +- ret = -EINVAL; ++ error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 ++ ", max supported is 0x%" PRIx64 ")", ++ header.disk_size, VDI_DISK_SIZE_MAX); ++ ret = -ENOTSUP; + goto fail; + } + +@@ -428,7 +430,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, + logout("unsupported sector size %u B\n", header.sector_size); + ret = -ENOTSUP; + goto fail; +- } else if (header.block_size != VDI_BLOCK_SIZE) { ++ } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { + logout("unsupported block size %u B\n", header.block_size); + ret = -ENOTSUP; + goto fail; +@@ -698,7 +700,10 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + } + + if (bytes > VDI_DISK_SIZE_MAX) { +- result = -EINVAL; ++ result = -ENOTSUP; ++ error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 ++ ", max supported is 0x%" PRIx64 ")", ++ bytes, VDI_DISK_SIZE_MAX); + goto exit; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch b/SOURCES/kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch index 1c7f0a4..45b713f 100644 --- a/SOURCES/kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch +++ b/SOURCES/kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch @@ -1,7 +1,7 @@ -From d739988c668996b7ba21a87f066d25d6cc6eb578 Mon Sep 17 00:00:00 2001 +From 87fe4805dfc783c221090d90ded9c01a8a7e6535 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:15 +0100 -Subject: [PATCH 2/7] block/raw-posix: Fix disk corruption in try_fiemap +Subject: [PATCH 36/41] block/raw-posix: Fix disk corruption in try_fiemap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit Message-id: <1416324620-16229-3-git-send-email-mreitz@redhat.com> Patchwork-id: 62437 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 2/7] block/raw-posix: Fix disk corruption in try_fiemap -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -41,10 +41,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 965dda8..0d963eb 100644 +index 5f57412..8d31628 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -1277,7 +1277,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data, +@@ -1325,7 +1325,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data, f.fm.fm_start = start; f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE; diff --git a/SOURCES/kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch b/SOURCES/kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch index f315fb4..797ba1a 100644 --- a/SOURCES/kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch +++ b/SOURCES/kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch @@ -1,12 +1,12 @@ -From 8f381e0473b6ce4d068048f04043097209526b02 Mon Sep 17 00:00:00 2001 +From 04981be7338ba396410cdab91612c17d6383d3a3 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:14 +0100 -Subject: [PATCH 1/7] block/raw-posix: Try both FIEMAP and SEEK_HOLE +Subject: [PATCH 35/41] block/raw-posix: Try both FIEMAP and SEEK_HOLE Message-id: <1416324620-16229-2-git-send-email-mreitz@redhat.com> Patchwork-id: 62436 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 1/7] block/raw-posix: Try both FIEMAP and SEEK_HOLE -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -33,10 +33,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 77 insertions(+), 50 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 9ee5b8e..965dda8 100644 +index cfe7452..5f57412 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -146,6 +146,9 @@ typedef struct BDRVRawState { +@@ -147,6 +147,9 @@ typedef struct BDRVRawState { bool has_discard:1; bool has_write_zeroes:1; bool discard_zeroes:1; @@ -46,7 +46,7 @@ index 9ee5b8e..965dda8 100644 } BDRVRawState; typedef struct BDRVRawReopenState { -@@ -1257,53 +1260,29 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, +@@ -1305,53 +1308,29 @@ out: return result; } @@ -109,7 +109,7 @@ index 9ee5b8e..965dda8 100644 } if (f.fm.fm_mapped_extents == 0) { -@@ -1311,44 +1290,92 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1359,44 +1338,92 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, * f.fm.fm_start + f.fm.fm_length must be clamped to the file size! */ off_t length = lseek(s->fd, 0, SEEK_END); diff --git a/SOURCES/kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch b/SOURCES/kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch index f64ddf8..2a8f11e 100644 --- a/SOURCES/kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch +++ b/SOURCES/kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch @@ -1,7 +1,7 @@ -From aa604fc31ecd9c11e59bc586eabea7cfa9c9175e Mon Sep 17 00:00:00 2001 +From 1e5cc3d3a5f9bf21d1df2967ac76b15d0e384950 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:16 +0100 -Subject: [PATCH 3/7] block/raw-posix: use seek_hole ahead of fiemap +Subject: [PATCH 37/41] block/raw-posix: use seek_hole ahead of fiemap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit Message-id: <1416324620-16229-4-git-send-email-mreitz@redhat.com> Patchwork-id: 62438 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 3/7] block/raw-posix: use seek_hole ahead of fiemap -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -43,10 +43,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 0d963eb..47b4b71 100644 +index 8d31628..781ebf3 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -1366,9 +1366,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1414,9 +1414,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, start = sector_num * BDRV_SECTOR_SIZE; diff --git a/SOURCES/kvm-block-use-per-object-cflags-and-libs.patch b/SOURCES/kvm-block-use-per-object-cflags-and-libs.patch new file mode 100644 index 0000000..4a37fc3 --- /dev/null +++ b/SOURCES/kvm-block-use-per-object-cflags-and-libs.patch @@ -0,0 +1,157 @@ +From 37782b793485e0f45a6e6f0da40d24c04191a13b Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Wed, 16 Jul 2014 02:20:28 -0500 +Subject: [CHANGE 28/29] block: use per-object cflags and libs +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405477228-11490-5-git-send-email-famz@redhat.com> +Patchwork-id: 59918 +O-Subject: [RHEL-7 qemu-kvm PATCH 4/4] block: use per-object cflags and libs +Bugzilla: 1017685 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Miroslav Rezanina + +From: Miroslav Rezanina + +Upstream: 6ebc91e5d0f408371460ab4329dc6de7f93306ac + +No longer adds flags and libs for them to global variables, instead +create config-host.mak variables like FOO_CFLAGS and FOO_LIBS, which is +used as per object cflags and libs. + +This removes unwanted dependencies from libcacard. + +Signed-off-by: Fam Zheng +[Split from Fam's patch to enable modules. - Paolo] +Signed-off-by: Paolo Bonzini + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini + +Manual backport. +Signed-off-by: Miroslav Rezanina +Signed-off-by: Fam Zheng +--- + block/Makefile.objs | 13 ++++++++++++- + configure | 20 ++++++++------------ + 2 files changed, 20 insertions(+), 13 deletions(-) + +Signed-off-by: jen +--- + block/Makefile.objs | 13 ++++++++++++- + configure | 20 ++++++++------------ + 2 files changed, 20 insertions(+), 13 deletions(-) + +diff --git a/block/Makefile.objs b/block/Makefile.objs +index 84dd57f..dd01fb3 100644 +--- a/block/Makefile.objs ++++ b/block/Makefile.objs +@@ -24,4 +24,15 @@ common-obj-y += commit.o + common-obj-y += mirror.o + endif + +-$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS) ++iscsi.o-cflags := $(LIBISCSI_CFLAGS) ++iscsi.o-libs := $(LIBISCSI_LIBS) ++curl.o-cflags := $(CURL_CFLAGS) ++curl.o-libs := $(CURL_LIBS) ++rbd.o-cflags := $(RBD_CFLAGS) ++rbd.o-libs := $(RBD_LIBS) ++gluster.o-cflags := $(GLUSTERFS_CFLAGS) ++gluster.o-libs := $(GLUSTERFS_LIBS) ++ssh.o-cflags := $(LIBSSH2_CFLAGS) ++ssh.o-libs := $(LIBSSH2_LIBS) ++qcow.o-libs := -lz ++linux-aio.o-libs := -laio +diff --git a/configure b/configure +index 8c6f4e5..4552e08 100755 +--- a/configure ++++ b/configure +@@ -2290,8 +2290,6 @@ EOF + curl_libs=`$curlconfig --libs 2>/dev/null` + if compile_prog "$curl_cflags" "$curl_libs" ; then + curl=yes +- libs_tools="$curl_libs $libs_tools" +- libs_softmmu="$curl_libs $libs_softmmu" + else + if test "$curl" = "yes" ; then + feature_not_found "curl" +@@ -2442,9 +2440,6 @@ if test "$libssh2" != "no" ; then + libssh2_cflags=`$pkg_config libssh2 --cflags` + libssh2_libs=`$pkg_config libssh2 --libs` + libssh2=yes +- libs_tools="$libssh2_libs $libs_tools" +- libs_softmmu="$libssh2_libs $libs_softmmu" +- QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags" + else + if test "$libssh2" = "yes" ; then + error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" +@@ -2490,8 +2485,6 @@ int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); retu + EOF + if compile_prog "" "-laio" ; then + linux_aio=yes +- libs_softmmu="$libs_softmmu -laio" +- libs_tools="$libs_tools -laio" + else + if test "$linux_aio" = "yes" ; then + feature_not_found "linux AIO" +@@ -2644,8 +2637,6 @@ EOF + glusterfs_libs="-lgfapi -lgfrpc -lgfxdr" + if compile_prog "" "$glusterfs_libs" ; then + glusterfs=yes +- libs_tools="$glusterfs_libs $libs_tools" +- libs_softmmu="$glusterfs_libs $libs_softmmu" + else + if test "$glusterfs" = "yes" ; then + feature_not_found "GlusterFS backend support" +@@ -3002,11 +2993,9 @@ EOF + libiscsi="yes" + libiscsi_cflags=$($pkg_config --cflags libiscsi 2>/dev/null) + libiscsi_libs=$($pkg_config --libs libiscsi 2>/dev/null) +- CFLAGS="$CFLAGS $libiscsi_cflags" +- LIBS="$LIBS $libiscsi_libs" + elif compile_prog "" "-liscsi" ; then + libiscsi="yes" +- LIBS="$LIBS -liscsi" ++ libiscsi_libs="-liscsi" + else + if test "$libiscsi" = "yes" ; then + feature_not_found "libiscsi" +@@ -3877,6 +3866,7 @@ fi + if test "$curl" = "yes" ; then + echo "CONFIG_CURL=y" >> $config_host_mak + echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak ++ echo "CURL_LIBS=$curl_libs" >> $config_host_mak + fi + if test "$brlapi" = "yes" ; then + echo "CONFIG_BRLAPI=y" >> $config_host_mak +@@ -3966,6 +3956,8 @@ fi + + if test "$libiscsi" = "yes" ; then + echo "CONFIG_LIBISCSI=y" >> $config_host_mak ++ echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak ++ echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak + fi + + if test "$seccomp" = "yes"; then +@@ -4022,10 +4014,14 @@ fi + + if test "$glusterfs" = "yes" ; then + echo "CONFIG_GLUSTERFS=y" >> $config_host_mak ++ echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak ++ echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak + fi + + if test "$libssh2" = "yes" ; then + echo "CONFIG_LIBSSH2=y" >> $config_host_mak ++ echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak ++ echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak + fi + + if test "$virtio_blk_data_plane" = "yes" ; then +-- +1.9.3 + diff --git a/SOURCES/kvm-block-use-the-standard-ret-instead-of-result.patch b/SOURCES/kvm-block-use-the-standard-ret-instead-of-result.patch new file mode 100644 index 0000000..bb09b27 --- /dev/null +++ b/SOURCES/kvm-block-use-the-standard-ret-instead-of-result.patch @@ -0,0 +1,143 @@ +From 826ac25b8740b86a5c6081ae35eed45d6cbb5f2b Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:52 +0200 +Subject: [PATCH 14/20] block: use the standard 'ret' instead of 'result' + +Message-id: <48fc259f545a424dff6e0308e0f7a12ec425d0dc.1410897407.git.jcody@redhat.com> +Patchwork-id: 61218 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 13/15] block: use the standard 'ret' instead of 'result' +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +Most QEMU code uses 'ret' for function return values. The VDI driver +uses a mix of 'result' and 'ret'. This cleans that up, switching over +to the standard 'ret' usage. + +Reviewed-by: Max Reitz +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit dddc7750d68c3ea86d88b060a77acb60d2eeb4a7) + +RHEL7 Notes: Difference from upstream is due to conflict resolution from + previous patch. + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 34 +++++++++++++++++----------------- + 1 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index 1f4491f..298ee12 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -350,23 +350,23 @@ static int vdi_make_empty(BlockDriverState *bs) + static int vdi_probe(const uint8_t *buf, int buf_size, const char *filename) + { + const VdiHeader *header = (const VdiHeader *)buf; +- int result = 0; ++ int ret = 0; + + logout("\n"); + + if (buf_size < sizeof(*header)) { + /* Header too small, no VDI. */ + } else if (le32_to_cpu(header->signature) == VDI_SIGNATURE) { +- result = 100; ++ ret = 100; + } + +- if (result == 0) { ++ if (ret == 0) { + logout("no vdi image\n"); + } else { + logout("%s", header->text); + } + +- return result; ++ return ret; + } + + static int vdi_open(BlockDriverState *bs, QDict *options, int flags, +@@ -673,7 +673,7 @@ static int vdi_co_write(BlockDriverState *bs, + static int vdi_create(const char *filename, QEMUOptionParameter *options, + Error **errp) + { +- int result = 0; ++ int ret = 0; + uint64_t bytes = 0; + uint32_t blocks; + size_t block_size = DEFAULT_CLUSTER_SIZE; +@@ -710,20 +710,20 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + } + + if (bytes > VDI_DISK_SIZE_MAX) { +- result = -ENOTSUP; ++ ret = -ENOTSUP; + error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 + ", max supported is 0x%" PRIx64 ")", + bytes, VDI_DISK_SIZE_MAX); + goto exit; + } + +- result = bdrv_create_file(filename, options, &local_err); +- if (result < 0) { ++ ret = bdrv_create_file(filename, options, &local_err); ++ if (ret < 0) { + error_propagate(errp, local_err); + goto exit; + } +- result = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err); +- if (result < 0) { ++ ret = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err); ++ if (ret < 0) { + error_propagate(errp, local_err); + goto exit; + } +@@ -757,8 +757,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + vdi_header_print(&header); + #endif + vdi_header_to_le(&header); +- result = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); +- if (result < 0) { ++ ret = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); ++ if (ret < 0) { + error_setg(errp, "Error writing header to %s", filename); + goto exit; + } +@@ -773,8 +773,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + bmap[i] = VDI_UNALLOCATED; + } + } +- result = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); +- if (result < 0) { ++ ret = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); ++ if (ret < 0) { + error_setg(errp, "Error writing bmap to %s", filename); + goto exit; + } +@@ -782,8 +782,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + } + + if (image_type == VDI_TYPE_STATIC) { +- result = bdrv_truncate(bs, offset + blocks * block_size); +- if (result < 0) { ++ ret = bdrv_truncate(bs, offset + blocks * block_size); ++ if (ret < 0) { + error_setg(errp, "Failed to statically allocate %s", filename); + goto exit; + } +@@ -792,7 +792,7 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + exit: + bdrv_unref(bs); + g_free(bmap); +- return result; ++ return ret; + } + + static void vdi_close(BlockDriverState *bs) +-- +1.7.1 + diff --git a/SOURCES/kvm-block-vdi-Error-out-immediately-in-vdi_create.patch b/SOURCES/kvm-block-vdi-Error-out-immediately-in-vdi_create.patch new file mode 100644 index 0000000..c8c580e --- /dev/null +++ b/SOURCES/kvm-block-vdi-Error-out-immediately-in-vdi_create.patch @@ -0,0 +1,72 @@ +From 5a762ccf05fea97bc3e98b8dd317374c51c14c26 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:47 +0200 +Subject: [PATCH 09/20] block/vdi: Error out immediately in vdi_create() + +Message-id: <2947dd91a4c9967cbd5a241145c355263e04207a.1410897407.git.jcody@redhat.com> +Patchwork-id: 61213 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 08/15] block/vdi: Error out immediately in vdi_create() +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Max Reitz + +Currently, if an error occurs during the part of vdi_create() which +actually writes the image, the function stores -errno, but continues +anyway. + +Instead of trying to write data which (if it can be written at all) does +not make any sense without the operations before succeeding (e.g., +writing the image header), just error out immediately. + +Signed-off-by: Max Reitz +Reviewed-by: Stefan Weil +Signed-off-by: Kevin Wolf +(cherry picked from commit 0549ea8b6d3ed4eba9a3bd0abfaed3af5de69873) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index 0211023..fb25424 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -753,6 +753,7 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + vdi_header_to_le(&header); + if (write(fd, &header, sizeof(header)) < 0) { + result = -errno; ++ goto close_and_exit; + } + + if (bmap_size > 0) { +@@ -766,6 +767,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + } + if (write(fd, bmap, bmap_size) < 0) { + result = -errno; ++ g_free(bmap); ++ goto close_and_exit; + } + g_free(bmap); + } +@@ -773,10 +776,12 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + if (image_type == VDI_TYPE_STATIC) { + if (ftruncate(fd, sizeof(header) + bmap_size + blocks * block_size)) { + result = -errno; ++ goto close_and_exit; + } + } + +- if (close(fd) < 0) { ++close_and_exit: ++ if ((close(fd) < 0) && !result) { + result = -errno; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-block-vdi-use-block-layer-ops-in-vdi_create-instead-.patch b/SOURCES/kvm-block-vdi-use-block-layer-ops-in-vdi_create-instead-.patch new file mode 100644 index 0000000..1bc0f52 --- /dev/null +++ b/SOURCES/kvm-block-vdi-use-block-layer-ops-in-vdi_create-instead-.patch @@ -0,0 +1,148 @@ +From 9628ef39a4866417b7c2dc5af81ba12bfeb33630 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:51 +0200 +Subject: [PATCH 13/20] block: vdi - use block layer ops in vdi_create, instead of posix calls + +Message-id: +Patchwork-id: 61217 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 12/15] block: vdi - use block layer ops in vdi_create, instead of posix calls +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +Use the block layer to create, and write to, the image file in the +VDI .bdrv_create() operation. + +This has a couple of benefits: Images can now be created over protocols, +and hacks such as NOCOW are not needed in the image format driver, and +the underlying file protocol appropriate for the host OS can be relied +upon. + +Also some minor cleanup for error handling. + +Reviewed-by: Max Reitz +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit 70747862f129ea0af5e3910f204cc93174c549e4) + +Conflicts: + block/vdi.c + +RHEL7 notes: conflicts due to not having the 'nocow' commit, as + well as not using QemuOpts yet. Arguments for bdrv_open() + are different, and downstream does not have + BDRV_O_PROTOCOL. In addition, bdrv_file_open() must be + used instead of just bdrv_open(). + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 52 +++++++++++++++++++++++++++++----------------------- + 1 files changed, 29 insertions(+), 23 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index fb25424..1f4491f 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -673,7 +673,6 @@ static int vdi_co_write(BlockDriverState *bs, + static int vdi_create(const char *filename, QEMUOptionParameter *options, + Error **errp) + { +- int fd; + int result = 0; + uint64_t bytes = 0; + uint32_t blocks; +@@ -682,6 +681,10 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + VdiHeader header; + size_t i; + size_t bmap_size; ++ int64_t offset = 0; ++ Error *local_err = NULL; ++ BlockDriverState *bs = NULL; ++ uint32_t *bmap = NULL; + + logout("\n"); + +@@ -714,11 +717,14 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + goto exit; + } + +- fd = qemu_open(filename, +- O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, +- 0644); +- if (fd < 0) { +- result = -errno; ++ result = bdrv_create_file(filename, options, &local_err); ++ if (result < 0) { ++ error_propagate(errp, local_err); ++ goto exit; ++ } ++ result = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err); ++ if (result < 0) { ++ error_propagate(errp, local_err); + goto exit; + } + +@@ -751,13 +757,15 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + vdi_header_print(&header); + #endif + vdi_header_to_le(&header); +- if (write(fd, &header, sizeof(header)) < 0) { +- result = -errno; +- goto close_and_exit; ++ result = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); ++ if (result < 0) { ++ error_setg(errp, "Error writing header to %s", filename); ++ goto exit; + } ++ offset += sizeof(header); + + if (bmap_size > 0) { +- uint32_t *bmap = g_malloc0(bmap_size); ++ bmap = g_malloc0(bmap_size); + for (i = 0; i < blocks; i++) { + if (image_type == VDI_TYPE_STATIC) { + bmap[i] = i; +@@ -765,27 +773,25 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options, + bmap[i] = VDI_UNALLOCATED; + } + } +- if (write(fd, bmap, bmap_size) < 0) { +- result = -errno; +- g_free(bmap); +- goto close_and_exit; ++ result = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); ++ if (result < 0) { ++ error_setg(errp, "Error writing bmap to %s", filename); ++ goto exit; + } +- g_free(bmap); ++ offset += bmap_size; + } + + if (image_type == VDI_TYPE_STATIC) { +- if (ftruncate(fd, sizeof(header) + bmap_size + blocks * block_size)) { +- result = -errno; +- goto close_and_exit; ++ result = bdrv_truncate(bs, offset + blocks * block_size); ++ if (result < 0) { ++ error_setg(errp, "Failed to statically allocate %s", filename); ++ goto exit; + } + } + +-close_and_exit: +- if ((close(fd) < 0) && !result) { +- result = -errno; +- } +- + exit: ++ bdrv_unref(bs); ++ g_free(bmap); + return result; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-block-vhdx-account-for-identical-header-sections.patch b/SOURCES/kvm-block-vhdx-account-for-identical-header-sections.patch new file mode 100644 index 0000000..ac50c5d --- /dev/null +++ b/SOURCES/kvm-block-vhdx-account-for-identical-header-sections.patch @@ -0,0 +1,86 @@ +From 6fb76589c86264784014d8b555dc9c479c534898 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 27 May 2014 19:05:11 +0200 +Subject: [PATCH 07/13] block: vhdx - account for identical header sections +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Jeffrey Cody +Message-id: <6a956eaa23796489845aaf8b0ef8aa390014e98b.1401217451.git.jcody@redhat.com> +Patchwork-id: 59040 +O-Subject: [PATCH qemu-kvm RHEL7.1] block: vhdx - account for identical header sections +Bugzilla: 1097020 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Kevin Wolf + +The VHDX spec v1.00 declares that "a header is current if it is the only +valid header or if it is valid and its SequenceNumber field is greater +than the other header’s SequenceNumber field. The parser must only use +data from the current header. If there is no current header, then the +VHDX file is corrupt." + +However, the Disk2VHD tool from Microsoft creates a VHDX image file that +has 2 identical headers, including matching checksums and matching +sequence numbers. Likely, as a shortcut the tool is just writing the +header twice, for the active and inactive headers, during the image +creation. Technically, this should be considered a corrupt VHDX file +(at least per the 1.00 spec, and that is how we currently treat it). + +But in order to accomodate images created with Disk2VHD, we can safely +create an exception for this case. If we find identical sequence +numbers, then we check the VHDXHeader-sized chunks of each 64KB header +sections (we won't rely just on the crc32c to indicate the headers are +the same). If they are identical, then we go ahead and use the first +one. + +Reported-by: Nerijus BaliĹ«nas +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit 6906046169ffa9d829beeeaafe1fadeba51669fb) + +Conflicts: + block/vhdx.c + +Signed-off-by: Jeff Cody +--- +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7505809 +BZ: 1097020 + +Conflict notes: the conflict was with the ret value; current upstream + removed that in favor of passing in errp to the function + + block/vhdx.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + block/vhdx.c | 11 +++++++++-- + 1 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/block/vhdx.c b/block/vhdx.c +index 66a25c9..21ad6ad 100644 +--- a/block/vhdx.c ++++ b/block/vhdx.c +@@ -473,8 +473,15 @@ static int vhdx_parse_header(BlockDriverState *bs, BDRVVHDXState *s) + } else if (h2_seq > h1_seq) { + s->curr_header = 1; + } else { +- ret = -EINVAL; +- goto fail; ++ /* The Microsoft Disk2VHD tool will create 2 identical ++ * headers, with identical sequence numbers. If the headers are ++ * identical, don't consider the file corrupt */ ++ if (!memcmp(header1, header2, sizeof(VHDXHeader))) { ++ s->curr_header = 0; ++ } else { ++ ret = -EINVAL; ++ goto fail; ++ } + } + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-block-vmdk-add-basic-.bdrv_check-support.patch b/SOURCES/kvm-block-vmdk-add-basic-.bdrv_check-support.patch new file mode 100644 index 0000000..33b6b6c --- /dev/null +++ b/SOURCES/kvm-block-vmdk-add-basic-.bdrv_check-support.patch @@ -0,0 +1,103 @@ +From d78a26ac572e339d115c3485d3a19ead0e9d4dcf Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:02 -0600 +Subject: [CHANGE 08/31] block/vmdk: add basic .bdrv_check support +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-9-git-send-email-famz@redhat.com> +Patchwork-id: 62681 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 08/30] block/vmdk: add basic .bdrv_check support +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Peter Lieven + +this adds a basic vmdk corruption check. it should detect severe +table corruptions and file truncation. + +Signed-off-by: Peter Lieven +Reviewed-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit f43aa8e18ad83508c2786403e7230a584d357c8e) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 7ea3aef..eda2962 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1944,6 +1944,53 @@ static ImageInfo *vmdk_get_extent_info(VmdkExtent *extent) + return info; + } + ++static int vmdk_check(BlockDriverState *bs, BdrvCheckResult *result, ++ BdrvCheckMode fix) ++{ ++ BDRVVmdkState *s = bs->opaque; ++ VmdkExtent *extent = NULL; ++ int64_t sector_num = 0; ++ int64_t total_sectors = bdrv_getlength(bs) / BDRV_SECTOR_SIZE; ++ int ret; ++ uint64_t cluster_offset; ++ ++ if (fix) { ++ return -ENOTSUP; ++ } ++ ++ for (;;) { ++ if (sector_num >= total_sectors) { ++ return 0; ++ } ++ extent = find_extent(s, sector_num, extent); ++ if (!extent) { ++ fprintf(stderr, ++ "ERROR: could not find extent for sector %" PRId64 "\n", ++ sector_num); ++ break; ++ } ++ ret = get_cluster_offset(bs, extent, NULL, ++ sector_num << BDRV_SECTOR_BITS, ++ 0, &cluster_offset); ++ if (ret == VMDK_ERROR) { ++ fprintf(stderr, ++ "ERROR: could not get cluster_offset for sector %" ++ PRId64 "\n", sector_num); ++ break; ++ } ++ if (ret == VMDK_OK && cluster_offset >= bdrv_getlength(extent->file)) { ++ fprintf(stderr, ++ "ERROR: cluster offset for sector %" ++ PRId64 " points after EOF\n", sector_num); ++ break; ++ } ++ sector_num += extent->cluster_sectors; ++ } ++ ++ result->corruptions++; ++ return 0; ++} ++ + static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) + { + int i; +@@ -2017,6 +2064,7 @@ static BlockDriver bdrv_vmdk = { + .instance_size = sizeof(BDRVVmdkState), + .bdrv_probe = vmdk_probe, + .bdrv_open = vmdk_open, ++ .bdrv_check = vmdk_check, + .bdrv_reopen_prepare = vmdk_reopen_prepare, + .bdrv_read = vmdk_co_read, + .bdrv_write = vmdk_co_write, +-- +2.1.0 + diff --git a/SOURCES/kvm-block-vmdk-do-not-report-file-offset-for-compressed-.patch b/SOURCES/kvm-block-vmdk-do-not-report-file-offset-for-compressed-.patch new file mode 100644 index 0000000..91c47ec --- /dev/null +++ b/SOURCES/kvm-block-vmdk-do-not-report-file-offset-for-compressed-.patch @@ -0,0 +1,48 @@ +From a03967321235d8ddf2cdf1db749a5a7109ab7451 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:09 -0600 +Subject: [CHANGE 15/31] block/vmdk: do not report file offset for compressed + extents +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-16-git-send-email-famz@redhat.com> +Patchwork-id: 62688 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 15/30] block/vmdk: do not report file offset for compressed extents +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Peter Lieven + +Signed-off-by: Peter Lieven +Reviewed-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 3eba13ec25341ce473591ff338eab3196890a4eb) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index c7b930f..e78a184 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1183,7 +1183,7 @@ static int64_t coroutine_fn vmdk_co_get_block_status(BlockDriverState *bs, + break; + case VMDK_OK: + ret = BDRV_BLOCK_DATA; +- if (extent->file == bs->file) { ++ if (extent->file == bs->file && !extent->compressed) { + ret |= BDRV_BLOCK_OFFSET_VALID | offset; + } + +-- +2.1.0 + diff --git a/SOURCES/kvm-block-vpc-use-QEMU_PACKED-for-on-disk-structures.patch b/SOURCES/kvm-block-vpc-use-QEMU_PACKED-for-on-disk-structures.patch new file mode 100644 index 0000000..fd1de52 --- /dev/null +++ b/SOURCES/kvm-block-vpc-use-QEMU_PACKED-for-on-disk-structures.patch @@ -0,0 +1,144 @@ +From 18fbf10e53408ce0a74abb32490bacf077713e9a Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:49 +0200 +Subject: [PATCH 11/20] block: vpc - use QEMU_PACKED for on-disk structures + +Message-id: <924b119681bb117e6551215f16be3f38e80c1179.1410897407.git.jcody@redhat.com> +Patchwork-id: 61215 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 10/15] block: vpc - use QEMU_PACKED for on-disk structures +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +The VHD footer and header structs (vhd_footer and vhd_dyndisk_header) +are on-disk structures for the image format, and as such should be +packed. + +Go ahead and make these typedefs as well, with the preferred QEMU +naming convention, so that the packed attribute is used consistently +with the struct. + +Signed-off-by: Jeff Cody +Reviewed-by: Richard Henderson +Signed-off-by: Kevin Wolf +(cherry picked from commit e54835c06d1f4896941c1505a86532aa1403ebe8) + +Signed-off-by: Miroslav Rezanina +--- + block/vpc.c | 28 ++++++++++++++-------------- + 1 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/block/vpc.c b/block/vpc.c +index 2f3d4ac..ab74eb9 100644 +--- a/block/vpc.c ++++ b/block/vpc.c +@@ -48,7 +48,7 @@ enum vhd_type { + #define VHD_MAX_SECTORS (65535LL * 255 * 255) + + // always big-endian +-struct vhd_footer { ++typedef struct vhd_footer { + char creator[8]; // "conectix" + uint32_t features; + uint32_t version; +@@ -81,9 +81,9 @@ struct vhd_footer { + uint8_t uuid[16]; + + uint8_t in_saved_state; +-}; ++} QEMU_PACKED VHDFooter; + +-struct vhd_dyndisk_header { ++typedef struct vhd_dyndisk_header { + char magic[8]; // "cxsparse" + + // Offset of next header structure, 0xFFFFFFFF if none +@@ -113,7 +113,7 @@ struct vhd_dyndisk_header { + uint32_t reserved; + uint64_t data_offset; + } parent_locator[8]; +-}; ++} QEMU_PACKED VHDDynDiskHeader; + + typedef struct BDRVVPCState { + CoMutex lock; +@@ -162,8 +162,8 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, + { + BDRVVPCState *s = bs->opaque; + int i; +- struct vhd_footer* footer; +- struct vhd_dyndisk_header* dyndisk_header; ++ VHDFooter *footer; ++ VHDDynDiskHeader *dyndisk_header; + uint8_t buf[HEADER_SIZE]; + uint32_t checksum; + uint64_t computed_size; +@@ -175,7 +175,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, + goto fail; + } + +- footer = (struct vhd_footer*) s->footer_buf; ++ footer = (VHDFooter *) s->footer_buf; + if (strncmp(footer->creator, "conectix", 8)) { + int64_t offset = bdrv_getlength(bs->file); + if (offset < 0) { +@@ -228,7 +228,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, + goto fail; + } + +- dyndisk_header = (struct vhd_dyndisk_header *) buf; ++ dyndisk_header = (VHDDynDiskHeader *) buf; + + if (strncmp(dyndisk_header->magic, "cxsparse", 8)) { + ret = -EINVAL; +@@ -484,7 +484,7 @@ static int vpc_read(BlockDriverState *bs, int64_t sector_num, + int ret; + int64_t offset; + int64_t sectors, sectors_per_block; +- struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf; ++ VHDFooter *footer = (VHDFooter *) s->footer_buf; + + if (cpu_to_be32(footer->type) == VHD_FIXED) { + return bdrv_read(bs->file, sector_num, buf, nb_sectors); +@@ -533,7 +533,7 @@ static int vpc_write(BlockDriverState *bs, int64_t sector_num, + int64_t offset; + int64_t sectors, sectors_per_block; + int ret; +- struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf; ++ VHDFooter *footer = (VHDFooter *) s->footer_buf; + + if (cpu_to_be32(footer->type) == VHD_FIXED) { + return bdrv_write(bs->file, sector_num, buf, nb_sectors); +@@ -635,8 +635,8 @@ static int calculate_geometry(int64_t total_sectors, uint16_t* cyls, + + static int create_dynamic_disk(int fd, uint8_t *buf, int64_t total_sectors) + { +- struct vhd_dyndisk_header* dyndisk_header = +- (struct vhd_dyndisk_header*) buf; ++ VHDDynDiskHeader *dyndisk_header = ++ (VHDDynDiskHeader *) buf; + size_t block_size, num_bat_entries; + int i; + int ret = -EIO; +@@ -726,7 +726,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + Error **errp) + { + uint8_t buf[1024]; +- struct vhd_footer *footer = (struct vhd_footer *) buf; ++ VHDFooter *footer = (VHDFooter *) buf; + QEMUOptionParameter *disk_type_param; + int fd, i; + uint16_t cyls = 0; +@@ -829,7 +829,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + static int vpc_has_zero_init(BlockDriverState *bs) + { + BDRVVPCState *s = bs->opaque; +- struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf; ++ VHDFooter *footer = (VHDFooter *) s->footer_buf; + + if (cpu_to_be32(footer->type) == VHD_FIXED) { + return bdrv_has_zero_init(bs->file); +-- +1.7.1 + diff --git a/SOURCES/kvm-block-vpc-use-block-layer-ops-in-vpc_create-instead-.patch b/SOURCES/kvm-block-vpc-use-block-layer-ops-in-vpc_create-instead-.patch new file mode 100644 index 0000000..45063a5 --- /dev/null +++ b/SOURCES/kvm-block-vpc-use-block-layer-ops-in-vpc_create-instead-.patch @@ -0,0 +1,220 @@ +From 4df7179eae48f59406dbef4fc0fb0185a09e8289 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:53 +0200 +Subject: [PATCH 15/20] block: vpc - use block layer ops in vpc_create, instead of posix calls + +Message-id: +Patchwork-id: 61219 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 14/15] block: vpc - use block layer ops in vpc_create, instead of posix calls +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +Use the block layer to create, and write to, the image file in the VPC +.bdrv_create() operation. + +This has a couple of benefits: Images can now be created over protocols, +and hacks such as NOCOW are not needed in the image format driver, and +the underlying file protocol appropriate for the host OS can be relied +upon. + +Reviewed-by: Max Reitz +Signed-off-by: Jeff Cody +Signed-off-by: Kevin Wolf +(cherry picked from commit fef6070eff233400015cede968b0afe46c80bb0f) + +Conflicts: + block/vpc.c + +RHEL7 Notes: Conflict due to not having the 'nocow' commit + backported, as well as still using QEMUOptionParameter. + BDRV_O_PROTOCOL is also not downstream, and bdrv_open() + arguments are different. + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vpc.c | 85 +++++++++++++++++++++++++++++++--------------------------- + 1 files changed, 45 insertions(+), 40 deletions(-) + +diff --git a/block/vpc.c b/block/vpc.c +index ab74eb9..849501a 100644 +--- a/block/vpc.c ++++ b/block/vpc.c +@@ -633,39 +633,41 @@ static int calculate_geometry(int64_t total_sectors, uint16_t* cyls, + return 0; + } + +-static int create_dynamic_disk(int fd, uint8_t *buf, int64_t total_sectors) ++static int create_dynamic_disk(BlockDriverState *bs, uint8_t *buf, ++ int64_t total_sectors) + { + VHDDynDiskHeader *dyndisk_header = + (VHDDynDiskHeader *) buf; + size_t block_size, num_bat_entries; + int i; +- int ret = -EIO; ++ int ret; ++ int64_t offset = 0; + + // Write the footer (twice: at the beginning and at the end) + block_size = 0x200000; + num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512); + +- if (write(fd, buf, HEADER_SIZE) != HEADER_SIZE) { ++ ret = bdrv_pwrite_sync(bs, offset, buf, HEADER_SIZE); ++ if (ret) { + goto fail; + } + +- if (lseek(fd, 1536 + ((num_bat_entries * 4 + 511) & ~511), SEEK_SET) < 0) { +- goto fail; +- } +- if (write(fd, buf, HEADER_SIZE) != HEADER_SIZE) { ++ offset = 1536 + ((num_bat_entries * 4 + 511) & ~511); ++ ret = bdrv_pwrite_sync(bs, offset, buf, HEADER_SIZE); ++ if (ret < 0) { + goto fail; + } + + // Write the initial BAT +- if (lseek(fd, 3 * 512, SEEK_SET) < 0) { +- goto fail; +- } ++ offset = 3 * 512; + + memset(buf, 0xFF, 512); + for (i = 0; i < (num_bat_entries * 4 + 511) / 512; i++) { +- if (write(fd, buf, 512) != 512) { ++ ret = bdrv_pwrite_sync(bs, offset, buf, 512); ++ if (ret < 0) { + goto fail; + } ++ offset += 512; + } + + // Prepare the Dynamic Disk Header +@@ -686,39 +688,35 @@ static int create_dynamic_disk(int fd, uint8_t *buf, int64_t total_sectors) + dyndisk_header->checksum = be32_to_cpu(vpc_checksum(buf, 1024)); + + // Write the header +- if (lseek(fd, 512, SEEK_SET) < 0) { +- goto fail; +- } ++ offset = 512; + +- if (write(fd, buf, 1024) != 1024) { ++ ret = bdrv_pwrite_sync(bs, offset, buf, 1024); ++ if (ret < 0) { + goto fail; + } +- ret = 0; + + fail: + return ret; + } + +-static int create_fixed_disk(int fd, uint8_t *buf, int64_t total_size) ++static int create_fixed_disk(BlockDriverState *bs, uint8_t *buf, ++ int64_t total_size) + { +- int ret = -EIO; ++ int ret; + + /* Add footer to total size */ +- total_size += 512; +- if (ftruncate(fd, total_size) != 0) { +- ret = -errno; +- goto fail; +- } +- if (lseek(fd, -512, SEEK_END) < 0) { +- goto fail; +- } +- if (write(fd, buf, HEADER_SIZE) != HEADER_SIZE) { +- goto fail; ++ total_size += HEADER_SIZE; ++ ++ ret = bdrv_truncate(bs, total_size); ++ if (ret < 0) { ++ return ret; + } + +- ret = 0; ++ ret = bdrv_pwrite_sync(bs, total_size - HEADER_SIZE, buf, HEADER_SIZE); ++ if (ret < 0) { ++ return ret; ++ } + +- fail: + return ret; + } + +@@ -728,7 +726,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + uint8_t buf[1024]; + VHDFooter *footer = (VHDFooter *) buf; + QEMUOptionParameter *disk_type_param; +- int fd, i; ++ int i; + uint16_t cyls = 0; + uint8_t heads = 0; + uint8_t secs_per_cyl = 0; +@@ -736,6 +734,8 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + int64_t total_size; + int disk_type; + int ret = -EIO; ++ Error *local_err = NULL; ++ BlockDriverState *bs = NULL; + + /* Read out options */ + total_size = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n; +@@ -753,10 +753,15 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + disk_type = VHD_DYNAMIC; + } + +- /* Create the file */ +- fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); +- if (fd < 0) { +- return -EIO; ++ ret = bdrv_create_file(filename, options, &local_err); ++ if (ret < 0) { ++ error_propagate(errp, local_err); ++ goto out; ++ } ++ ret = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err); ++ if (ret < 0) { ++ error_propagate(errp, local_err); ++ goto out; + } + + /* +@@ -770,7 +775,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + &secs_per_cyl)) + { + ret = -EFBIG; +- goto fail; ++ goto out; + } + } + +@@ -816,13 +821,13 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + footer->checksum = be32_to_cpu(vpc_checksum(buf, HEADER_SIZE)); + + if (disk_type == VHD_DYNAMIC) { +- ret = create_dynamic_disk(fd, buf, total_sectors); ++ ret = create_dynamic_disk(bs, buf, total_sectors); + } else { +- ret = create_fixed_disk(fd, buf, total_size); ++ ret = create_fixed_disk(bs, buf, total_size); + } + +- fail: +- qemu_close(fd); ++out: ++ bdrv_unref(bs); + return ret; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-blockdev-Fail-blockdev-add-with-encrypted-images.patch b/SOURCES/kvm-blockdev-Fail-blockdev-add-with-encrypted-images.patch new file mode 100644 index 0000000..080ccc4 --- /dev/null +++ b/SOURCES/kvm-blockdev-Fail-blockdev-add-with-encrypted-images.patch @@ -0,0 +1,68 @@ +From b1e9937d355d28809635967f3ada98c2ecf8ae7f Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:08 +0200 +Subject: [PATCH 03/19] blockdev: Fail blockdev-add with encrypted images + +Message-id: <1414059011-15516-6-git-send-email-kwolf@redhat.com> +Patchwork-id: 61839 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 5/8] blockdev: Fail blockdev-add with encrypted images +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Encrypted images need a password before they can be used, and we don't +want blockdev-add to create BDSes that aren't fully initialised. So for +now simply forbid encrypted images; we can come back to it later if we +need the functionality. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +(cherry picked from commit 8ae8e904fcba484ff7c3f8f31339b56ebd88fbad) +Signed-off-by: Miroslav Rezanina + +Conflicts: + blockdev.c + +Trivial bonus bugfix so that the backported test 087 won't fail. + +Signed-off-by: Kevin Wolf +--- + blockdev.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/blockdev.c b/blockdev.c +index 7d4a53f..a2d5f02 100644 +--- a/blockdev.c ++++ b/blockdev.c +@@ -1793,6 +1793,7 @@ void qmp___com_redhat_change_backing_file(const char *device, + void qmp_blockdev_add(BlockdevOptions *options, Error **errp) + { + QmpOutputVisitor *ov = qmp_output_visitor_new(); ++ DriveInfo *dinfo; + QObject *obj; + QDict *qdict; + Error *local_err = NULL; +@@ -1828,12 +1829,18 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp) + + qdict_flatten(qdict); + +- blockdev_init(qdict, IF_NONE, &local_err); ++ dinfo = blockdev_init(qdict, IF_NONE, &local_err); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); + goto fail; + } + ++ if (bdrv_key_required(dinfo->bdrv)) { ++ drive_uninit(dinfo); ++ error_setg(errp, "blockdev-add doesn't support encrypted devices"); ++ goto fail; ++ } ++ + fail: + qmp_output_visitor_cleanup(ov); + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-blockdev-Fix-NULL-pointer-dereference-in-blockdev-ad.patch b/SOURCES/kvm-blockdev-Fix-NULL-pointer-dereference-in-blockdev-ad.patch new file mode 100644 index 0000000..7753dd8 --- /dev/null +++ b/SOURCES/kvm-blockdev-Fix-NULL-pointer-dereference-in-blockdev-ad.patch @@ -0,0 +1,53 @@ +From 55355b00b588e875583e2463beac3d5d1b53ac35 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:07 +0200 +Subject: [PATCH 04/19] blockdev: Fix NULL pointer dereference in blockdev-add + +Message-id: <1414059011-15516-5-git-send-email-kwolf@redhat.com> +Patchwork-id: 61838 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 4/8] blockdev: Fix NULL pointer dereference in blockdev-add +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +If aio=native, we check that cache.direct is set as well. If however +cache wasn't specified at all, qemu just segfaulted. + +The old condition didn't make any sense anyway because it effectively +only checked for the default cache mode case, but not for an explicitly +set cache.direct=off mode. + +Signed-off-by: Kevin Wolf +Reviewed-by: Benoit Canet +Reviewed-by: Eric Blake +(cherry picked from commit c6e0bd9b7037937aafeb1d34ec17975a7d685bb7) + +Trivial bonus bugfix so that the backported test 087 won't fail. + +Signed-off-by: Kevin Wolf +Signed-off-by: Miroslav Rezanina +--- + blockdev.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/blockdev.c b/blockdev.c +index a2d5f02..1ac8804 100644 +--- a/blockdev.c ++++ b/blockdev.c +@@ -1810,8 +1810,10 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp) + * + * For now, simply forbidding the combination for all drivers will do. */ + if (options->has_aio && options->aio == BLOCKDEV_AIO_OPTIONS_NATIVE) { +- bool direct = options->cache->has_direct && options->cache->direct; +- if (!options->has_cache && !direct) { ++ bool direct = options->has_cache && ++ options->cache->has_direct && ++ options->cache->direct; ++ if (!direct) { + error_setg(errp, "aio=native requires cache.direct=true"); + goto fail; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-blockjob-Add-block_job_yield.patch b/SOURCES/kvm-blockjob-Add-block_job_yield.patch index 92b267b..5d73919 100644 --- a/SOURCES/kvm-blockjob-Add-block_job_yield.patch +++ b/SOURCES/kvm-blockjob-Add-block_job_yield.patch @@ -1,12 +1,12 @@ -From c1c69c1b13d64f7d892c8b661714fe388b1a6047 Mon Sep 17 00:00:00 2001 +From 96f8c9bed66c9c910332d86368b7e0e94c190f62 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:09 +0200 -Subject: [PATCH 2/7] blockjob: Add block_job_yield() +Subject: [PATCH 06/11] blockjob: Add block_job_yield() Message-id: <1408552814-23031-3-git-send-email-eblake@redhat.com> Patchwork-id: 60644 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 2/7] blockjob: Add block_job_yield() -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-char-report-frontend-open-closed-state-in-query-char.patch b/SOURCES/kvm-char-report-frontend-open-closed-state-in-query-char.patch new file mode 100644 index 0000000..3a515e6 --- /dev/null +++ b/SOURCES/kvm-char-report-frontend-open-closed-state-in-query-char.patch @@ -0,0 +1,119 @@ +From e49b0dccdd8687fb269610c86381bdcc8ec42222 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Tue, 22 Jul 2014 18:31:23 +0200 +Subject: [PATCH 03/11] char: report frontend open/closed state in 'query-chardev' + +Message-id: <1406053883-21237-3-git-send-email-lersek@redhat.com> +Patchwork-id: 60230 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] char: report frontend open/closed state in 'query-chardev' +Bugzilla: 1122151 +RH-Acked-by: Luiz Capitulino +RH-Acked-by: Amit Shah +RH-Acked-by: Eric Blake + +In addition to the on-line reporting added in the previous patch, allow +libvirt to query frontend state independently of events. + +Libvirt's path to identify the guest agent channel it cares about differs +between the event added in the previous patch and the QMP response field +added here. The event identifies the frontend device, by "id". The +'query-chardev' QMP command identifies the backend device (again by "id"). +The association is under libvirt's control. + +RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376 + +Reviewed-by: Amit Shah +Signed-off-by: Laszlo Ersek +Reviewed-by: Eric Blake +Signed-off-by: Luiz Capitulino +(cherry picked from commit 32a97ea1711f43388e178b7c43e02143a61e47ee) +--- + qapi-schema.json | 8 +++++++- + qemu-char.c | 1 + + qmp-commands.hx | 19 ++++++++++++++----- + 3 files changed, 22 insertions(+), 6 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + qapi-schema.json | 8 +++++++- + qemu-char.c | 1 + + qmp-commands.hx | 19 ++++++++++++++----- + 3 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/qapi-schema.json b/qapi-schema.json +index aaa86f5..604ec69 100644 +--- a/qapi-schema.json ++++ b/qapi-schema.json +@@ -418,12 +418,18 @@ + # + # @filename: the filename of the character device + # ++# @frontend-open: shows whether the frontend device attached to this backend ++# (eg. with the chardev=... option) is in open or closed state ++# (since 2.1) ++# + # Notes: @filename is encoded using the QEMU command line character device + # encoding. See the QEMU man page for details. + # + # Since: 0.14.0 + ## +-{ 'type': 'ChardevInfo', 'data': {'label': 'str', 'filename': 'str'} } ++{ 'type': 'ChardevInfo', 'data': {'label': 'str', ++ 'filename': 'str', ++ 'frontend-open': 'bool'} } + + ## + # @query-chardev: +diff --git a/qemu-char.c b/qemu-char.c +index 930f3d4..47ac55a 100644 +--- a/qemu-char.c ++++ b/qemu-char.c +@@ -3435,6 +3435,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp) + info->value = g_malloc0(sizeof(*info->value)); + info->value->label = g_strdup(chr->label); + info->value->filename = g_strdup(chr->filename); ++ info->value->frontend_open = chr->fe_open; + + info->next = chr_list; + chr_list = info; +diff --git a/qmp-commands.hx b/qmp-commands.hx +index 1d4be84..405275c 100644 +--- a/qmp-commands.hx ++++ b/qmp-commands.hx +@@ -1782,19 +1782,28 @@ Each json-object contain the following: + + - "label": device's label (json-string) + - "filename": device's file (json-string) ++- "frontend-open": open/closed state of the frontend device attached to this ++ backend (json-bool) + + Example: + + -> { "execute": "query-chardev" } + <- { +- "return":[ ++ "return": [ ++ { ++ "label": "charchannel0", ++ "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server", ++ "frontend-open": false ++ }, + { +- "label":"monitor", +- "filename":"stdio" ++ "label": "charmonitor", ++ "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server", ++ "frontend-open": true + }, + { +- "label":"serial0", +- "filename":"vc" ++ "label": "charserial0", ++ "filename": "pty:/dev/pts/2", ++ "frontend-open": true + } + ] + } +-- +1.7.1 + diff --git a/SOURCES/kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch b/SOURCES/kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch index e1c6c3d..90907b1 100644 --- a/SOURCES/kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch +++ b/SOURCES/kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch @@ -1,17 +1,18 @@ -From 3322e336871252ea0ff22920cfb13d302b07bd11 Mon Sep 17 00:00:00 2001 +From 9c6b84014b3650e478494d3c19b7461b947b3b14 Mon Sep 17 00:00:00 2001 From: Gal Hammer Date: Sun, 16 Mar 2014 09:57:09 +0100 -Subject: [PATCH 28/30] char: restore read callback on a reattached (hotplug) chardev +Subject: [PATCH 01/31] char: restore read callback on a reattached (hotplug) chardev RH-Author: Gal Hammer Message-id: <1394963829-5384-1-git-send-email-ghammer@redhat.com> Patchwork-id: 58105 O-Subject: [RHEL-7.0 qemu-kvm PATCH] char: restore read callback on a reattached (hotplug) chardev -Bugzilla: 1110219 +Bugzilla: 1038914 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Amit Shah RH-Acked-by: Amos Kong +Bugzilla: 1027181 Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7207613 Upstream: commit ac1b84dd1e020648db82a99260891aa982d1142c @@ -20,6 +21,8 @@ set the chr handlers to NULL. However when the device is plugged back, its read callback is not restored so data can't be transferred from the host to the guest (e.g. via the virtio-serial port). +https://bugzilla.redhat.com/show_bug.cgi?id=1027181 + Signed-off-by: Gal Hammer Signed-off-by: Gerd Hoffmann --- diff --git a/SOURCES/kvm-cirrus-don-t-overflow-CirrusVGAState-cirrus_bltbuf.patch b/SOURCES/kvm-cirrus-don-t-overflow-CirrusVGAState-cirrus_bltbuf.patch new file mode 100644 index 0000000..98e3b0d --- /dev/null +++ b/SOURCES/kvm-cirrus-don-t-overflow-CirrusVGAState-cirrus_bltbuf.patch @@ -0,0 +1,39 @@ +From b990e99b42e638a5719cf1cdc2881a6467886fcf Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 3 Dec 2014 09:17:56 +0100 +Subject: [PATCH 3/3] cirrus: don't overflow CirrusVGAState->cirrus_bltbuf + +RH-Author: Gerd Hoffmann +Message-id: <1417594676-5663-3-git-send-email-kraxel@redhat.com> +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] cirrus: don't overflow CirrusVGAState->cirrus_bltbuf +Bugzilla: 1169456 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert + +This is CVE-2014-8106. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit bf25983345ca44aec3dd92c57142be45452bd38a) +--- + hw/display/cirrus_vga.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c +index 9ae8313..717ecdb 100644 +--- a/hw/display/cirrus_vga.c ++++ b/hw/display/cirrus_vga.c +@@ -292,6 +292,10 @@ static bool blit_is_unsafe(struct CirrusVGAState *s) + assert(s->cirrus_blt_width > 0); + assert(s->cirrus_blt_height > 0); + ++ if (s->cirrus_blt_width > CIRRUS_BLTBUFSIZE) { ++ return true; ++ } ++ + if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch, + s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) { + return true; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-cirrus-fix-blit-region-check.patch b/SOURCES/kvm-cirrus-fix-blit-region-check.patch new file mode 100644 index 0000000..4ff7cf7 --- /dev/null +++ b/SOURCES/kvm-cirrus-fix-blit-region-check.patch @@ -0,0 +1,134 @@ +From 6febc393af5d81e2c3f6f0d2f0e5b7dd58d4974a Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 3 Dec 2014 09:17:55 +0100 +Subject: [PATCH 2/3] cirrus: fix blit region check + +RH-Author: Gerd Hoffmann +Message-id: <1417594676-5663-2-git-send-email-kraxel@redhat.com> +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/2] cirrus: fix blit region check +Bugzilla: 1169456 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert + +Issues: + * Doesn't check pitches correctly in case it is negative. + * Doesn't check width at all. + +Turn macro into functions while being at it, also factor out the check +for one region which we then can simply call twice for src + dst. + +This is CVE-2014-8106. + +Reported-by: Paolo Bonzini +Signed-off-by: Gerd Hoffmann +Reviewed-by: Paolo Bonzini +(cherry picked from commit d3532a0db02296e687711b8cdc7791924efccea0) +--- + hw/display/cirrus_vga.c | 61 +++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 44 insertions(+), 17 deletions(-) + +diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c +index bfaa0b0..9ae8313 100644 +--- a/hw/display/cirrus_vga.c ++++ b/hw/display/cirrus_vga.c +@@ -172,20 +172,6 @@ + + #define CIRRUS_PNPMMIO_SIZE 0x1000 + +-#define BLTUNSAFE(s) \ +- ( \ +- ( /* check dst is within bounds */ \ +- (s)->cirrus_blt_height * ABS((s)->cirrus_blt_dstpitch) \ +- + ((s)->cirrus_blt_dstaddr & (s)->cirrus_addr_mask) > \ +- (s)->vga.vram_size \ +- ) || \ +- ( /* check src is within bounds */ \ +- (s)->cirrus_blt_height * ABS((s)->cirrus_blt_srcpitch) \ +- + ((s)->cirrus_blt_srcaddr & (s)->cirrus_addr_mask) > \ +- (s)->vga.vram_size \ +- ) \ +- ) +- + struct CirrusVGAState; + typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s, + uint8_t * dst, const uint8_t * src, +@@ -278,6 +264,46 @@ static void cirrus_update_memory_access(CirrusVGAState *s); + * + ***************************************/ + ++static bool blit_region_is_unsafe(struct CirrusVGAState *s, ++ int32_t pitch, int32_t addr) ++{ ++ if (pitch < 0) { ++ int64_t min = addr ++ + ((int64_t)s->cirrus_blt_height-1) * pitch; ++ int32_t max = addr ++ + s->cirrus_blt_width; ++ if (min < 0 || max >= s->vga.vram_size) { ++ return true; ++ } ++ } else { ++ int64_t max = addr ++ + ((int64_t)s->cirrus_blt_height-1) * pitch ++ + s->cirrus_blt_width; ++ if (max >= s->vga.vram_size) { ++ return true; ++ } ++ } ++ return false; ++} ++ ++static bool blit_is_unsafe(struct CirrusVGAState *s) ++{ ++ /* should be the case, see cirrus_bitblt_start */ ++ assert(s->cirrus_blt_width > 0); ++ assert(s->cirrus_blt_height > 0); ++ ++ if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch, ++ s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) { ++ return true; ++ } ++ if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch, ++ s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) { ++ return true; ++ } ++ ++ return false; ++} ++ + static void cirrus_bitblt_rop_nop(CirrusVGAState *s, + uint8_t *dst,const uint8_t *src, + int dstpitch,int srcpitch, +@@ -635,7 +661,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s, + + dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask); + +- if (BLTUNSAFE(s)) ++ if (blit_is_unsafe(s)) + return 0; + + (*s->cirrus_rop) (s, dst, src, +@@ -653,8 +679,9 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop) + { + cirrus_fill_t rop_func; + +- if (BLTUNSAFE(s)) ++ if (blit_is_unsafe(s)) { + return 0; ++ } + rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; + rop_func(s, s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), + s->cirrus_blt_dstpitch, +@@ -751,7 +778,7 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h) + + static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s) + { +- if (BLTUNSAFE(s)) ++ if (blit_is_unsafe(s)) + return 0; + + cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr, +-- +1.8.3.1 + diff --git a/SOURCES/kvm-cow-correctly-propagate-errors.patch b/SOURCES/kvm-cow-correctly-propagate-errors.patch new file mode 100644 index 0000000..2a753e4 --- /dev/null +++ b/SOURCES/kvm-cow-correctly-propagate-errors.patch @@ -0,0 +1,60 @@ +From 96d707c999c6a64c843f0bf10c3b687ed91b92fa Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:44 +0200 +Subject: [PATCH 06/20] cow: correctly propagate errors + +Message-id: <974b27fc4f7aad8a056618cafcd4e31224709449.1410897407.git.jcody@redhat.com> +Patchwork-id: 61210 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 05/15] cow: correctly propagate errors +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit f8d924e48167ec14ec4556441ec7999a30ef6640) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/cow.c | 8 +++----- + 1 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/block/cow.c b/block/cow.c +index 46295d4..651bdff 100644 +--- a/block/cow.c ++++ b/block/cow.c +@@ -83,7 +83,7 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags, + char version[64]; + snprintf(version, sizeof(version), + "COW version %d", cow_header.version); +- qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, ++ error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, "cow", version); + ret = -ENOTSUP; + goto fail; +@@ -319,15 +319,13 @@ static int cow_create(const char *filename, QEMUOptionParameter *options, + + ret = bdrv_create_file(filename, options, &local_err); + if (ret < 0) { +- qerror_report_err(local_err); +- error_free(local_err); ++ error_propagate(errp, local_err); + return ret; + } + + ret = bdrv_file_open(&cow_bs, filename, NULL, BDRV_O_RDWR, &local_err); + if (ret < 0) { +- qerror_report_err(local_err); +- error_free(local_err); ++ error_propagate(errp, local_err); + return ret; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-dump-Drop-pointless-error_is_set-DumpState-member-er.patch b/SOURCES/kvm-dump-Drop-pointless-error_is_set-DumpState-member-er.patch new file mode 100644 index 0000000..370c51f --- /dev/null +++ b/SOURCES/kvm-dump-Drop-pointless-error_is_set-DumpState-member-er.patch @@ -0,0 +1,69 @@ +From 5b83dc5c849412b09a7e54ba7223ce5de8a3fd70 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:06 +0100 +Subject: [PATCH 19/41] dump: Drop pointless error_is_set(), DumpState member + errp + +Message-id: <1415380693-16593-20-git-send-email-lersek@redhat.com> +Patchwork-id: 62205 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 19/26] dump: Drop pointless error_is_set(), DumpState member errp +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: Markus Armbruster + +In qmp_dump_guest_memory(), the error must be clear on entry, and we +always bail out after setting it, directly or via dump_init(). +Therefore, both error_is_set() are always false. Drop them. + +DumpState member errp is now write-only. Drop it, too. + +Signed-off-by: Markus Armbruster +Reviewed-by: Eric Blake +Signed-off-by: Luiz Capitulino +(cherry picked from commit 66ef8bd9c16b547c985cbe7468dcf60280c993eb) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/dump.c b/dump.c +index 25bf8e6..9250594 100644 +--- a/dump.c ++++ b/dump.c +@@ -86,7 +86,6 @@ typedef struct DumpState { + bool has_filter; + int64_t begin; + int64_t length; +- Error **errp; + + uint8_t *note_buf; /* buffer for notes */ + size_t note_buf_offset; /* the writing place in note_buf */ +@@ -1576,7 +1575,6 @@ static int dump_init(DumpState *s, int fd, bool has_format, + nr_cpus++; + } + +- s->errp = errp; + s->fd = fd; + s->has_filter = has_filter; + s->begin = begin; +@@ -1786,11 +1784,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, + } + + if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { +- if (create_kdump_vmcore(s) < 0 && !error_is_set(s->errp)) { ++ if (create_kdump_vmcore(s) < 0) { + error_set(errp, QERR_IO_ERROR); + } + } else { +- if (create_vmcore(s) < 0 && !error_is_set(s->errp)) { ++ if (create_vmcore(s) < 0) { + error_set(errp, QERR_IO_ERROR); + } + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-Drop-qmp_dump_guest_memory-stub-and-build-for-a.patch b/SOURCES/kvm-dump-Drop-qmp_dump_guest_memory-stub-and-build-for-a.patch new file mode 100644 index 0000000..773e31d --- /dev/null +++ b/SOURCES/kvm-dump-Drop-qmp_dump_guest_memory-stub-and-build-for-a.patch @@ -0,0 +1,114 @@ +From bf8262fae14e0dd80ad8a9c302bd2317139d18a3 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:02 +0100 +Subject: [PATCH 15/41] dump: Drop qmp_dump_guest_memory() stub and build for + all targets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1415380693-16593-16-git-send-email-lersek@redhat.com> +Patchwork-id: 62201 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 15/26] dump: Drop qmp_dump_guest_memory() stub and build for all targets +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: Andreas Färber + +qmp_dump_guest_memory() calls dump_init() and returns an Error when +cpu_get_dump_info() returns an error, as done by the stub. +So there is no need to have a stub for qmp_dump_guest_memory(). + +Enable the documentation of the always-present dump-guest-memory command. + +That way we can drop CONFIG_HAVE_CORE_DUMP and leave configure +completely out of the picture for target CPU features. + +Signed-off-by: Andreas Färber +(cherry picked from commit 2a78636bd204e389068d203473ec76558083b44b) +Signed-off-by: Miroslav Rezanina + +Conflicts: + Makefile.target + stubs/dump.c + +Signed-off-by: Laszlo Ersek +--- + Makefile.target | 2 +- + configure | 4 ---- + hmp-commands.hx | 2 -- + stubs/dump.c | 8 -------- + 4 files changed, 1 insertion(+), 15 deletions(-) + +diff --git a/Makefile.target b/Makefile.target +index ca407d7..ea874c9 100644 +--- a/Makefile.target ++++ b/Makefile.target +@@ -119,7 +119,7 @@ obj-$(CONFIG_FDT) += device_tree.o + obj-$(CONFIG_KVM) += kvm-all.o + obj-y += memory.o savevm.o cputlb.o + obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o +-obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o ++obj-y += dump.o + obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o + LIBS+=$(libs_softmmu) + +diff --git a/configure b/configure +index 5373237..ca8b107 100755 +--- a/configure ++++ b/configure +@@ -4483,10 +4483,6 @@ if test "$target_bigendian" = "yes" ; then + fi + if test "$target_softmmu" = "yes" ; then + echo "CONFIG_SOFTMMU=y" >> $config_target_mak +- case "$target_arch2" in +- i386|x86_64) +- echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak +- esac + fi + if test "$target_user_only" = "yes" ; then + echo "CONFIG_USER_ONLY=y" >> $config_target_mak +diff --git a/hmp-commands.hx b/hmp-commands.hx +index 467dd70..58498f7 100644 +--- a/hmp-commands.hx ++++ b/hmp-commands.hx +@@ -1013,7 +1013,6 @@ server will ask the spice/vnc client to automatically reconnect using the + new parameters (if specified) once the vm migration finished successfully. + ETEXI + +-#if defined(CONFIG_HAVE_CORE_DUMP) + { + .name = "dump-guest-memory", + .args_type = "paging:-p,filename:F,begin:i?,length:i?", +@@ -1037,7 +1036,6 @@ gdb. + length: the memory size, in bytes. It's optional, and should be specified + with begin together. + ETEXI +-#endif + + #ifdef CONFIG_LIVE_BLOCK_OPS + { +diff --git a/stubs/dump.c b/stubs/dump.c +index 5749e2c..370cd96 100644 +--- a/stubs/dump.c ++++ b/stubs/dump.c +@@ -16,14 +16,6 @@ + #include "qapi/qmp/qerror.h" + #include "qmp-commands.h" + +-/* we need this function in hmp.c */ +-void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, +- int64_t begin, bool has_length, int64_t length, +- Error **errp) +-{ +- error_set(errp, QERR_UNSUPPORTED); +-} +- + int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks) + { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-RHEL-specific-fix-for-CPUState-bug-introduced-b.patch b/SOURCES/kvm-dump-RHEL-specific-fix-for-CPUState-bug-introduced-b.patch new file mode 100644 index 0000000..0856450 --- /dev/null +++ b/SOURCES/kvm-dump-RHEL-specific-fix-for-CPUState-bug-introduced-b.patch @@ -0,0 +1,126 @@ +From 2feb6c83f5f22cb4b5060d8224f42d25dcb21fe7 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:48 +0100 +Subject: [PATCH 01/41] dump: RHEL-specific fix for CPUState bug introduced by + upstream c72bf4682 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1415380693-16593-2-git-send-email-lersek@redhat.com> +Patchwork-id: 62187 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 01/26] dump: RHEL-specific fix for CPUState bug introduced by upstream c72bf4682 +Bugzilla: 1161563 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +In qemu-kvm-1.5.3-77.el7, the write_elf64_notes() and write_elf32_notes() +functions are broken due to upstream commit c72bf4682. + + commit c72bf468259935a80ea185f2cbe807c3da9c1bbd + Author: Jens Freimann + Date: Fri Apr 19 16:45:06 2013 +0200 + + cpu: Move cpu_write_elfXX_note() functions to CPUState + + Convert cpu_write_elfXX_note() functions to CPUClass methods and + pass CPUState as argument. Update target-i386 accordingly. + + Signed-off-by: Jens Freimann + [AF: Retain stubs as CPUClass' default method implementation; + style changes] + Signed-off-by: Andreas Färber + +This commit changed the signature of the following functions so that they +take CPUState rather than CPUArchState: +- cpu_write_elf64_note() +- cpu_write_elf64_qemunote() +- cpu_write_elf32_note() +- cpu_write_elf32_qemunote() + +The callers of these functions, write_elf64_notes() and +write_elf32_notes(), each iterate over CPUArchState objects (starting from +"first_cpu") *twice*, the first loop calling cpu_write_elfXX_note(), the +second loop calling cpu_write_elfXX_qemunote(). The loop variable is +called "env". When calling the above functions after c72bf468, "env" (of +type CPUArchState) needs to be converted to CPUState, with the +ENV_GET_CPU() macro. + +Now, even before c72bf468, the *first* loop in each of both callers used +to do the conversion already, because cpu_write_elfXX_note() needs a CPU +index, and that's only reachable via cpu_index(ENV_GET_CPU(env)). +Therefore the first loop in each caller already set the "cpu" local +variable correctly, for each "env" in question. + +However, the *second* loop in each caller had never done that, because +cpu_write_elfXX_qemunote() had never needed a CPUState for anything. + +Upstream commit c72bf4682 simply replaced "env" with "cpu" in both loop +bodies (in both callers). This was correct for the first loops (because +they already had set "cpu" correctly), but the commit missed to add + + cpu = ENV_GET_CPU(env); + +to the second loops. Hence cpu_write_elfXX_qemunote() is always called +with the last "cpu" value inherited from the first loop! (Which is why the +bug is invisible for single-VCPU guests.) + +Add the missing assignments. + +For upstream, this was silently fixed in + + commit 182735efaf956ccab50b6d74a4fed163e0f35660 + Author: Andreas Färber + Date: Wed May 29 22:29:20 2013 +0200 + + cpu: Make first_cpu and next_cpu CPUState + + Move next_cpu from CPU_COMMON to CPUState. + Move first_cpu variable to qom/cpu.h. + + gdbstub needs to use CPUState::env_ptr for now. + cpu_copy() no longer needs to save and restore cpu_next. + + Acked-by: Paolo Bonzini + [AF: Rebased, simplified cpu_copy()] + Signed-off-by: Andreas Färber + +because it obviated and eliminated the + + cpu = ENV_GET_CPU(env); + +conversions completely. The bug-introducing commit c72bf4682 had been +released in v1.5.0 (and it persisted even into 1.5.3, which is why we have +it in RHEL). The silent / unintended fix (182735ef) is part of v1.6.0 (and +we never backported that commit to RHEL-7.0). + +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dump.c b/dump.c +index b203a8d..a2b6e45 100644 +--- a/dump.c ++++ b/dump.c +@@ -289,6 +289,7 @@ static int write_elf64_notes(DumpState *s) + } + + for (env = first_cpu; env != NULL; env = env->next_cpu) { ++ cpu = ENV_GET_CPU(env); + ret = cpu_write_elf64_qemunote(fd_write_vmcore, cpu, s); + if (ret < 0) { + dump_error(s, "dump: failed to write CPU status.\n"); +@@ -341,6 +342,7 @@ static int write_elf32_notes(DumpState *s) + } + + for (env = first_cpu; env != NULL; env = env->next_cpu) { ++ cpu = ENV_GET_CPU(env); + ret = cpu_write_elf32_qemunote(fd_write_vmcore, cpu, s); + if (ret < 0) { + dump_error(s, "dump: failed to write CPU status.\n"); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-dump-header.patch b/SOURCES/kvm-dump-add-API-to-write-dump-header.patch new file mode 100644 index 0000000..91edaba --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-dump-header.patch @@ -0,0 +1,383 @@ +From 86459b009f0402a2cdf3ef6a944684b62ac2ea0a Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:58 +0100 +Subject: [PATCH 11/41] dump: add API to write dump header + +Message-id: <1415380693-16593-12-git-send-email-lersek@redhat.com> +Patchwork-id: 62197 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 11/26] dump: add API to write dump header +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +the functions are used to write header of kdump-compressed format to vmcore. +Header of kdump-compressed format includes: +1. common header: DiskDumpHeader32 / DiskDumpHeader64 +2. sub header: KdumpSubHeader32 / KdumpSubHeader64 +3. extra information: only elf notes here + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 298f116827405f37dde10a2a6cbc75d20f9ba99c) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++ + include/sysemu/dump.h | 96 ++++++++++++++++++++++ + 2 files changed, 319 insertions(+) + +diff --git a/dump.c b/dump.c +index 88e8cc0..4d135fd 100644 +--- a/dump.c ++++ b/dump.c +@@ -784,6 +784,229 @@ static int buf_write_note(const void *buf, size_t size, void *opaque) + return 0; + } + ++/* write common header, sub header and elf note to vmcore */ ++static int create_header32(DumpState *s) ++{ ++ int ret = 0; ++ DiskDumpHeader32 *dh = NULL; ++ KdumpSubHeader32 *kh = NULL; ++ size_t size; ++ int endian = s->dump_info.d_endian; ++ uint32_t block_size; ++ uint32_t sub_hdr_size; ++ uint32_t bitmap_blocks; ++ uint32_t status = 0; ++ uint64_t offset_note; ++ ++ /* write common header, the version of kdump-compressed format is 6th */ ++ size = sizeof(DiskDumpHeader32); ++ dh = g_malloc0(size); ++ ++ strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); ++ dh->header_version = cpu_convert_to_target32(6, endian); ++ block_size = s->page_size; ++ dh->block_size = cpu_convert_to_target32(block_size, endian); ++ sub_hdr_size = sizeof(struct KdumpSubHeader32) + s->note_size; ++ sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); ++ dh->sub_hdr_size = cpu_convert_to_target32(sub_hdr_size, endian); ++ /* dh->max_mapnr may be truncated, full 64bit is in kh.max_mapnr_64 */ ++ dh->max_mapnr = cpu_convert_to_target32(MIN(s->max_mapnr, UINT_MAX), ++ endian); ++ dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian); ++ bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; ++ dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian); ++ memcpy(&(dh->utsname.machine), "i686", 4); ++ ++ if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { ++ status |= DUMP_DH_COMPRESSED_ZLIB; ++ } ++#ifdef CONFIG_LZO ++ if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) { ++ status |= DUMP_DH_COMPRESSED_LZO; ++ } ++#endif ++#ifdef CONFIG_SNAPPY ++ if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) { ++ status |= DUMP_DH_COMPRESSED_SNAPPY; ++ } ++#endif ++ dh->status = cpu_convert_to_target32(status, endian); ++ ++ if (write_buffer(s->fd, 0, dh, size) < 0) { ++ dump_error(s, "dump: failed to write disk dump header.\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* write sub header */ ++ size = sizeof(KdumpSubHeader32); ++ kh = g_malloc0(size); ++ ++ /* 64bit max_mapnr_64 */ ++ kh->max_mapnr_64 = cpu_convert_to_target64(s->max_mapnr, endian); ++ kh->phys_base = cpu_convert_to_target32(PHYS_BASE, endian); ++ kh->dump_level = cpu_convert_to_target32(DUMP_LEVEL, endian); ++ ++ offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size; ++ kh->offset_note = cpu_convert_to_target64(offset_note, endian); ++ kh->note_size = cpu_convert_to_target32(s->note_size, endian); ++ ++ if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS * ++ block_size, kh, size) < 0) { ++ dump_error(s, "dump: failed to write kdump sub header.\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* write note */ ++ s->note_buf = g_malloc0(s->note_size); ++ s->note_buf_offset = 0; ++ ++ /* use s->note_buf to store notes temporarily */ ++ if (write_elf32_notes(buf_write_note, s) < 0) { ++ ret = -1; ++ goto out; ++ } ++ ++ if (write_buffer(s->fd, offset_note, s->note_buf, ++ s->note_size) < 0) { ++ dump_error(s, "dump: failed to write notes"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* get offset of dump_bitmap */ ++ s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) * ++ block_size; ++ ++ /* get offset of page */ ++ s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) * ++ block_size; ++ ++out: ++ g_free(dh); ++ g_free(kh); ++ g_free(s->note_buf); ++ ++ return ret; ++} ++ ++/* write common header, sub header and elf note to vmcore */ ++static int create_header64(DumpState *s) ++{ ++ int ret = 0; ++ DiskDumpHeader64 *dh = NULL; ++ KdumpSubHeader64 *kh = NULL; ++ size_t size; ++ int endian = s->dump_info.d_endian; ++ uint32_t block_size; ++ uint32_t sub_hdr_size; ++ uint32_t bitmap_blocks; ++ uint32_t status = 0; ++ uint64_t offset_note; ++ ++ /* write common header, the version of kdump-compressed format is 6th */ ++ size = sizeof(DiskDumpHeader64); ++ dh = g_malloc0(size); ++ ++ strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); ++ dh->header_version = cpu_convert_to_target32(6, endian); ++ block_size = s->page_size; ++ dh->block_size = cpu_convert_to_target32(block_size, endian); ++ sub_hdr_size = sizeof(struct KdumpSubHeader64) + s->note_size; ++ sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); ++ dh->sub_hdr_size = cpu_convert_to_target32(sub_hdr_size, endian); ++ /* dh->max_mapnr may be truncated, full 64bit is in kh.max_mapnr_64 */ ++ dh->max_mapnr = cpu_convert_to_target32(MIN(s->max_mapnr, UINT_MAX), ++ endian); ++ dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian); ++ bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2; ++ dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian); ++ memcpy(&(dh->utsname.machine), "x86_64", 6); ++ ++ if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) { ++ status |= DUMP_DH_COMPRESSED_ZLIB; ++ } ++#ifdef CONFIG_LZO ++ if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) { ++ status |= DUMP_DH_COMPRESSED_LZO; ++ } ++#endif ++#ifdef CONFIG_SNAPPY ++ if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) { ++ status |= DUMP_DH_COMPRESSED_SNAPPY; ++ } ++#endif ++ dh->status = cpu_convert_to_target32(status, endian); ++ ++ if (write_buffer(s->fd, 0, dh, size) < 0) { ++ dump_error(s, "dump: failed to write disk dump header.\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* write sub header */ ++ size = sizeof(KdumpSubHeader64); ++ kh = g_malloc0(size); ++ ++ /* 64bit max_mapnr_64 */ ++ kh->max_mapnr_64 = cpu_convert_to_target64(s->max_mapnr, endian); ++ kh->phys_base = cpu_convert_to_target64(PHYS_BASE, endian); ++ kh->dump_level = cpu_convert_to_target32(DUMP_LEVEL, endian); ++ ++ offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size; ++ kh->offset_note = cpu_convert_to_target64(offset_note, endian); ++ kh->note_size = cpu_convert_to_target64(s->note_size, endian); ++ ++ if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS * ++ block_size, kh, size) < 0) { ++ dump_error(s, "dump: failed to write kdump sub header.\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* write note */ ++ s->note_buf = g_malloc0(s->note_size); ++ s->note_buf_offset = 0; ++ ++ /* use s->note_buf to store notes temporarily */ ++ if (write_elf64_notes(buf_write_note, s) < 0) { ++ ret = -1; ++ goto out; ++ } ++ ++ if (write_buffer(s->fd, offset_note, s->note_buf, ++ s->note_size) < 0) { ++ dump_error(s, "dump: failed to write notes"); ++ ret = -1; ++ goto out; ++ } ++ ++ /* get offset of dump_bitmap */ ++ s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) * ++ block_size; ++ ++ /* get offset of page */ ++ s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) * ++ block_size; ++ ++out: ++ g_free(dh); ++ g_free(kh); ++ g_free(s->note_buf); ++ ++ return ret; ++} ++ ++static int write_dump_header(DumpState *s) ++{ ++ if (s->dump_info.d_machine == EM_386) { ++ return create_header32(s); ++ } else { ++ return create_header64(s); ++ } ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index 995bf47..dfee238 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -27,6 +27,19 @@ + #define pfn_to_paddr(X, page_shift) \ + (((unsigned long long)(X) + ARCH_PFN_OFFSET) << (page_shift)) + ++/* ++ * flag for compressed format ++ */ ++#define DUMP_DH_COMPRESSED_ZLIB (0x1) ++#define DUMP_DH_COMPRESSED_LZO (0x2) ++#define DUMP_DH_COMPRESSED_SNAPPY (0x4) ++ ++#define KDUMP_SIGNATURE "KDUMP " ++#define SIG_LEN (sizeof(KDUMP_SIGNATURE) - 1) ++#define PHYS_BASE (0) ++#define DUMP_LEVEL (1) ++#define DISKDUMP_HEADER_BLOCKS (1) ++ + typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ + int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ +@@ -44,6 +57,89 @@ typedef struct QEMU_PACKED MakedumpfileDataHeader { + int64_t buf_size; + } MakedumpfileDataHeader; + ++typedef struct QEMU_PACKED NewUtsname { ++ char sysname[65]; ++ char nodename[65]; ++ char release[65]; ++ char version[65]; ++ char machine[65]; ++ char domainname[65]; ++} NewUtsname; ++ ++typedef struct QEMU_PACKED DiskDumpHeader32 { ++ char signature[SIG_LEN]; /* = "KDUMP " */ ++ uint32_t header_version; /* Dump header version */ ++ NewUtsname utsname; /* copy of system_utsname */ ++ char timestamp[10]; /* Time stamp */ ++ uint32_t status; /* Above flags */ ++ uint32_t block_size; /* Size of a block in byte */ ++ uint32_t sub_hdr_size; /* Size of arch dependent header in block */ ++ uint32_t bitmap_blocks; /* Size of Memory bitmap in block */ ++ uint32_t max_mapnr; /* = max_mapnr , ++ obsoleted in header_version 6 */ ++ uint32_t total_ram_blocks; /* Number of blocks should be written */ ++ uint32_t device_blocks; /* Number of total blocks in dump device */ ++ uint32_t written_blocks; /* Number of written blocks */ ++ uint32_t current_cpu; /* CPU# which handles dump */ ++ uint32_t nr_cpus; /* Number of CPUs */ ++} DiskDumpHeader32; ++ ++typedef struct QEMU_PACKED DiskDumpHeader64 { ++ char signature[SIG_LEN]; /* = "KDUMP " */ ++ uint32_t header_version; /* Dump header version */ ++ NewUtsname utsname; /* copy of system_utsname */ ++ char timestamp[22]; /* Time stamp */ ++ uint32_t status; /* Above flags */ ++ uint32_t block_size; /* Size of a block in byte */ ++ uint32_t sub_hdr_size; /* Size of arch dependent header in block */ ++ uint32_t bitmap_blocks; /* Size of Memory bitmap in block */ ++ uint32_t max_mapnr; /* = max_mapnr, ++ obsoleted in header_version 6 */ ++ uint32_t total_ram_blocks; /* Number of blocks should be written */ ++ uint32_t device_blocks; /* Number of total blocks in dump device */ ++ uint32_t written_blocks; /* Number of written blocks */ ++ uint32_t current_cpu; /* CPU# which handles dump */ ++ uint32_t nr_cpus; /* Number of CPUs */ ++} DiskDumpHeader64; ++ ++typedef struct QEMU_PACKED KdumpSubHeader32 { ++ uint32_t phys_base; ++ uint32_t dump_level; /* header_version 1 and later */ ++ uint32_t split; /* header_version 2 and later */ ++ uint32_t start_pfn; /* header_version 2 and later, ++ obsoleted in header_version 6 */ ++ uint32_t end_pfn; /* header_version 2 and later, ++ obsoleted in header_version 6 */ ++ uint64_t offset_vmcoreinfo; /* header_version 3 and later */ ++ uint32_t size_vmcoreinfo; /* header_version 3 and later */ ++ uint64_t offset_note; /* header_version 4 and later */ ++ uint32_t note_size; /* header_version 4 and later */ ++ uint64_t offset_eraseinfo; /* header_version 5 and later */ ++ uint32_t size_eraseinfo; /* header_version 5 and later */ ++ uint64_t start_pfn_64; /* header_version 6 and later */ ++ uint64_t end_pfn_64; /* header_version 6 and later */ ++ uint64_t max_mapnr_64; /* header_version 6 and later */ ++} KdumpSubHeader32; ++ ++typedef struct QEMU_PACKED KdumpSubHeader64 { ++ uint64_t phys_base; ++ uint32_t dump_level; /* header_version 1 and later */ ++ uint32_t split; /* header_version 2 and later */ ++ uint64_t start_pfn; /* header_version 2 and later, ++ obsoleted in header_version 6 */ ++ uint64_t end_pfn; /* header_version 2 and later, ++ obsoleted in header_version 6 */ ++ uint64_t offset_vmcoreinfo; /* header_version 3 and later */ ++ uint64_t size_vmcoreinfo; /* header_version 3 and later */ ++ uint64_t offset_note; /* header_version 4 and later */ ++ uint64_t note_size; /* header_version 4 and later */ ++ uint64_t offset_eraseinfo; /* header_version 5 and later */ ++ uint64_t size_eraseinfo; /* header_version 5 and later */ ++ uint64_t start_pfn_64; /* header_version 6 and later */ ++ uint64_t end_pfn_64; /* header_version 6 and later */ ++ uint64_t max_mapnr_64; /* header_version 6 and later */ ++} KdumpSubHeader64; ++ + struct GuestPhysBlockList; /* memory_mapping.h */ + int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-dump-pages.patch b/SOURCES/kvm-dump-add-API-to-write-dump-pages.patch new file mode 100644 index 0000000..25312f3 --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-dump-pages.patch @@ -0,0 +1,300 @@ +From 55c524d38cafb5856220c76b9573efa6e22dd1f1 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:01 +0100 +Subject: [PATCH 14/41] dump: add API to write dump pages + +Message-id: <1415380693-16593-15-git-send-email-lersek@redhat.com> +Patchwork-id: 62200 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 14/26] dump: add API to write dump pages +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +functions are used to write page to vmcore. vmcore is written page by page. +page desc is used to store the information of a page, including a page's size, +offset, compression format, etc. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit d12f57ec6640d36e380367a0ab6ab9f3f29b6d51) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++ + include/sysemu/dump.h | 7 ++ + 2 files changed, 238 insertions(+) + +diff --git a/dump.c b/dump.c +index 926ab84..fc5530f 100644 +--- a/dump.c ++++ b/dump.c +@@ -25,6 +25,14 @@ + #include "qapi/error.h" + #include "qmp-commands.h" + ++#include ++#ifdef CONFIG_LZO ++#include ++#endif ++#ifdef CONFIG_SNAPPY ++#include ++#endif ++ + static uint16_t cpu_convert_to_target16(uint16_t val, int endian) + { + if (endian == ELFDATA2LSB) { +@@ -1218,6 +1226,229 @@ static void free_data_cache(DataCache *data_cache) + g_free(data_cache->buf); + } + ++static size_t get_len_buf_out(size_t page_size, uint32_t flag_compress) ++{ ++ size_t len_buf_out_zlib, len_buf_out_lzo, len_buf_out_snappy; ++ size_t len_buf_out; ++ ++ /* init buf_out */ ++ len_buf_out_zlib = len_buf_out_lzo = len_buf_out_snappy = 0; ++ ++ /* buf size for zlib */ ++ len_buf_out_zlib = compressBound(page_size); ++ ++ /* buf size for lzo */ ++#ifdef CONFIG_LZO ++ if (flag_compress & DUMP_DH_COMPRESSED_LZO) { ++ if (lzo_init() != LZO_E_OK) { ++ /* return 0 to indicate lzo is unavailable */ ++ return 0; ++ } ++ } ++ ++ /* ++ * LZO will expand incompressible data by a little amount. please check the ++ * following URL to see the expansion calculation: ++ * http://www.oberhumer.com/opensource/lzo/lzofaq.php ++ */ ++ len_buf_out_lzo = page_size + page_size / 16 + 64 + 3; ++#endif ++ ++#ifdef CONFIG_SNAPPY ++ /* buf size for snappy */ ++ len_buf_out_snappy = snappy_max_compressed_length(page_size); ++#endif ++ ++ /* get the biggest that can store all kinds of compressed page */ ++ len_buf_out = MAX(len_buf_out_zlib, ++ MAX(len_buf_out_lzo, len_buf_out_snappy)); ++ ++ return len_buf_out; ++} ++ ++/* ++ * check if the page is all 0 ++ */ ++static inline bool is_zero_page(const uint8_t *buf, size_t page_size) ++{ ++ return buffer_is_zero(buf, page_size); ++} ++ ++static int write_dump_pages(DumpState *s) ++{ ++ int ret = 0; ++ DataCache page_desc, page_data; ++ size_t len_buf_out, size_out; ++#ifdef CONFIG_LZO ++ lzo_bytep wrkmem = NULL; ++#endif ++ uint8_t *buf_out = NULL; ++ off_t offset_desc, offset_data; ++ PageDescriptor pd, pd_zero; ++ uint8_t *buf; ++ int endian = s->dump_info.d_endian; ++ GuestPhysBlock *block_iter = NULL; ++ uint64_t pfn_iter; ++ ++ /* get offset of page_desc and page_data in dump file */ ++ offset_desc = s->offset_page; ++ offset_data = offset_desc + sizeof(PageDescriptor) * s->num_dumpable; ++ ++ prepare_data_cache(&page_desc, s, offset_desc); ++ prepare_data_cache(&page_data, s, offset_data); ++ ++ /* prepare buffer to store compressed data */ ++ len_buf_out = get_len_buf_out(s->page_size, s->flag_compress); ++ if (len_buf_out == 0) { ++ dump_error(s, "dump: failed to get length of output buffer.\n"); ++ goto out; ++ } ++ ++#ifdef CONFIG_LZO ++ wrkmem = g_malloc(LZO1X_1_MEM_COMPRESS); ++#endif ++ ++ buf_out = g_malloc(len_buf_out); ++ ++ /* ++ * init zero page's page_desc and page_data, because every zero page ++ * uses the same page_data ++ */ ++ pd_zero.size = cpu_convert_to_target32(s->page_size, endian); ++ pd_zero.flags = cpu_convert_to_target32(0, endian); ++ pd_zero.offset = cpu_convert_to_target64(offset_data, endian); ++ pd_zero.page_flags = cpu_convert_to_target64(0, endian); ++ buf = g_malloc0(s->page_size); ++ ret = write_cache(&page_data, buf, s->page_size, false); ++ g_free(buf); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page data(zero page).\n"); ++ goto out; ++ } ++ ++ offset_data += s->page_size; ++ ++ /* ++ * dump memory to vmcore page by page. zero page will all be resided in the ++ * first page of page section ++ */ ++ while (get_next_page(&block_iter, &pfn_iter, &buf, s)) { ++ /* check zero page */ ++ if (is_zero_page(buf, s->page_size)) { ++ ret = write_cache(&page_desc, &pd_zero, sizeof(PageDescriptor), ++ false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page desc.\n"); ++ goto out; ++ } ++ } else { ++ /* ++ * not zero page, then: ++ * 1. compress the page ++ * 2. write the compressed page into the cache of page_data ++ * 3. get page desc of the compressed page and write it into the ++ * cache of page_desc ++ * ++ * only one compression format will be used here, for ++ * s->flag_compress is set. But when compression fails to work, ++ * we fall back to save in plaintext. ++ */ ++ size_out = len_buf_out; ++ if ((s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) && ++ (compress2(buf_out, (uLongf *)&size_out, buf, s->page_size, ++ Z_BEST_SPEED) == Z_OK) && (size_out < s->page_size)) { ++ pd.flags = cpu_convert_to_target32(DUMP_DH_COMPRESSED_ZLIB, ++ endian); ++ pd.size = cpu_convert_to_target32(size_out, endian); ++ ++ ret = write_cache(&page_data, buf_out, size_out, false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page data.\n"); ++ goto out; ++ } ++#ifdef CONFIG_LZO ++ } else if ((s->flag_compress & DUMP_DH_COMPRESSED_LZO) && ++ (lzo1x_1_compress(buf, s->page_size, buf_out, ++ (lzo_uint *)&size_out, wrkmem) == LZO_E_OK) && ++ (size_out < s->page_size)) { ++ pd.flags = cpu_convert_to_target32(DUMP_DH_COMPRESSED_LZO, ++ endian); ++ pd.size = cpu_convert_to_target32(size_out, endian); ++ ++ ret = write_cache(&page_data, buf_out, size_out, false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page data.\n"); ++ goto out; ++ } ++#endif ++#ifdef CONFIG_SNAPPY ++ } else if ((s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) && ++ (snappy_compress((char *)buf, s->page_size, ++ (char *)buf_out, &size_out) == SNAPPY_OK) && ++ (size_out < s->page_size)) { ++ pd.flags = cpu_convert_to_target32( ++ DUMP_DH_COMPRESSED_SNAPPY, endian); ++ pd.size = cpu_convert_to_target32(size_out, endian); ++ ++ ret = write_cache(&page_data, buf_out, size_out, false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page data.\n"); ++ goto out; ++ } ++#endif ++ } else { ++ /* ++ * fall back to save in plaintext, size_out should be ++ * assigned to s->page_size ++ */ ++ pd.flags = cpu_convert_to_target32(0, endian); ++ size_out = s->page_size; ++ pd.size = cpu_convert_to_target32(size_out, endian); ++ ++ ret = write_cache(&page_data, buf, s->page_size, false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page data.\n"); ++ goto out; ++ } ++ } ++ ++ /* get and write page desc here */ ++ pd.page_flags = cpu_convert_to_target64(0, endian); ++ pd.offset = cpu_convert_to_target64(offset_data, endian); ++ offset_data += size_out; ++ ++ ret = write_cache(&page_desc, &pd, sizeof(PageDescriptor), false); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write page desc.\n"); ++ goto out; ++ } ++ } ++ } ++ ++ ret = write_cache(&page_desc, NULL, 0, true); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to sync cache for page_desc.\n"); ++ goto out; ++ } ++ ret = write_cache(&page_data, NULL, 0, true); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to sync cache for page_data.\n"); ++ goto out; ++ } ++ ++out: ++ free_data_cache(&page_desc); ++ free_data_cache(&page_data); ++ ++#ifdef CONFIG_LZO ++ g_free(wrkmem); ++#endif ++ ++ g_free(buf_out); ++ ++ return ret; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index 92a95e4..efab7a3 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -151,6 +151,13 @@ typedef struct DataCache { + off_t offset; /* offset of the file */ + } DataCache; + ++typedef struct QEMU_PACKED PageDescriptor { ++ uint64_t offset; /* the offset of the page data*/ ++ uint32_t size; /* the size of this dump page */ ++ uint32_t flags; /* flags */ ++ uint64_t page_flags; /* page flags */ ++} PageDescriptor; ++ + struct GuestPhysBlockList; /* memory_mapping.h */ + int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-dump_bitmap.patch b/SOURCES/kvm-dump-add-API-to-write-dump_bitmap.patch new file mode 100644 index 0000000..5eab4b9 --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-dump_bitmap.patch @@ -0,0 +1,221 @@ +From 3555c9b0e05c410028022a1b1af34ad7a2e83e98 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:59 +0100 +Subject: [PATCH 12/41] dump: add API to write dump_bitmap + +Message-id: <1415380693-16593-13-git-send-email-lersek@redhat.com> +Patchwork-id: 62198 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 12/26] dump: add API to write dump_bitmap +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +functions are used to write 1st and 2nd dump_bitmap of kdump-compressed format, +which is used to indicate whether the corresponded page is existed in vmcore. +1st and 2nd dump_bitmap are same, because dump level is specified to 1 here. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit d0686c7291fe8f0210e7a666f80892fa71395510) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ + include/sysemu/dump.h | 2 + + 2 files changed, 166 insertions(+) + +diff --git a/dump.c b/dump.c +index 4d135fd..f416093 100644 +--- a/dump.c ++++ b/dump.c +@@ -1007,6 +1007,170 @@ static int write_dump_header(DumpState *s) + } + } + ++/* ++ * set dump_bitmap sequencely. the bit before last_pfn is not allowed to be ++ * rewritten, so if need to set the first bit, set last_pfn and pfn to 0. ++ * set_dump_bitmap will always leave the recently set bit un-sync. And setting ++ * (last bit + sizeof(buf) * 8) to 0 will do flushing the content in buf into ++ * vmcore, ie. synchronizing un-sync bit into vmcore. ++ */ ++static int set_dump_bitmap(uint64_t last_pfn, uint64_t pfn, bool value, ++ uint8_t *buf, DumpState *s) ++{ ++ off_t old_offset, new_offset; ++ off_t offset_bitmap1, offset_bitmap2; ++ uint32_t byte, bit; ++ ++ /* should not set the previous place */ ++ assert(last_pfn <= pfn); ++ ++ /* ++ * if the bit needed to be set is not cached in buf, flush the data in buf ++ * to vmcore firstly. ++ * making new_offset be bigger than old_offset can also sync remained data ++ * into vmcore. ++ */ ++ old_offset = BUFSIZE_BITMAP * (last_pfn / PFN_BUFBITMAP); ++ new_offset = BUFSIZE_BITMAP * (pfn / PFN_BUFBITMAP); ++ ++ while (old_offset < new_offset) { ++ /* calculate the offset and write dump_bitmap */ ++ offset_bitmap1 = s->offset_dump_bitmap + old_offset; ++ if (write_buffer(s->fd, offset_bitmap1, buf, ++ BUFSIZE_BITMAP) < 0) { ++ return -1; ++ } ++ ++ /* dump level 1 is chosen, so 1st and 2nd bitmap are same */ ++ offset_bitmap2 = s->offset_dump_bitmap + s->len_dump_bitmap + ++ old_offset; ++ if (write_buffer(s->fd, offset_bitmap2, buf, ++ BUFSIZE_BITMAP) < 0) { ++ return -1; ++ } ++ ++ memset(buf, 0, BUFSIZE_BITMAP); ++ old_offset += BUFSIZE_BITMAP; ++ } ++ ++ /* get the exact place of the bit in the buf, and set it */ ++ byte = (pfn % PFN_BUFBITMAP) / CHAR_BIT; ++ bit = (pfn % PFN_BUFBITMAP) % CHAR_BIT; ++ if (value) { ++ buf[byte] |= 1u << bit; ++ } else { ++ buf[byte] &= ~(1u << bit); ++ } ++ ++ return 0; ++} ++ ++/* ++ * exam every page and return the page frame number and the address of the page. ++ * bufptr can be NULL. note: the blocks here is supposed to reflect guest-phys ++ * blocks, so block->target_start and block->target_end should be interal ++ * multiples of the target page size. ++ */ ++static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, ++ uint8_t **bufptr, DumpState *s) ++{ ++ GuestPhysBlock *block = *blockptr; ++ hwaddr addr; ++ uint8_t *buf; ++ ++ /* block == NULL means the start of the iteration */ ++ if (!block) { ++ block = QTAILQ_FIRST(&s->guest_phys_blocks.head); ++ *blockptr = block; ++ assert(block->target_start % s->page_size == 0); ++ assert(block->target_end % s->page_size == 0); ++ *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); ++ if (bufptr) { ++ *bufptr = block->host_addr; ++ } ++ return true; ++ } ++ ++ *pfnptr = *pfnptr + 1; ++ addr = pfn_to_paddr(*pfnptr, s->page_shift); ++ ++ if ((addr >= block->target_start) && ++ (addr + s->page_size <= block->target_end)) { ++ buf = block->host_addr + (addr - block->target_start); ++ } else { ++ /* the next page is in the next block */ ++ block = QTAILQ_NEXT(block, next); ++ *blockptr = block; ++ if (!block) { ++ return false; ++ } ++ assert(block->target_start % s->page_size == 0); ++ assert(block->target_end % s->page_size == 0); ++ *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); ++ buf = block->host_addr; ++ } ++ ++ if (bufptr) { ++ *bufptr = buf; ++ } ++ ++ return true; ++} ++ ++static int write_dump_bitmap(DumpState *s) ++{ ++ int ret = 0; ++ uint64_t last_pfn, pfn; ++ void *dump_bitmap_buf; ++ size_t num_dumpable; ++ GuestPhysBlock *block_iter = NULL; ++ ++ /* dump_bitmap_buf is used to store dump_bitmap temporarily */ ++ dump_bitmap_buf = g_malloc0(BUFSIZE_BITMAP); ++ ++ num_dumpable = 0; ++ last_pfn = 0; ++ ++ /* ++ * exam memory page by page, and set the bit in dump_bitmap corresponded ++ * to the existing page. ++ */ ++ while (get_next_page(&block_iter, &pfn, NULL, s)) { ++ ret = set_dump_bitmap(last_pfn, pfn, true, dump_bitmap_buf, s); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to set dump_bitmap.\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ last_pfn = pfn; ++ num_dumpable++; ++ } ++ ++ /* ++ * set_dump_bitmap will always leave the recently set bit un-sync. Here we ++ * set last_pfn + PFN_BUFBITMAP to 0 and those set but un-sync bit will be ++ * synchronized into vmcore. ++ */ ++ if (num_dumpable > 0) { ++ ret = set_dump_bitmap(last_pfn, last_pfn + PFN_BUFBITMAP, false, ++ dump_bitmap_buf, s); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to sync dump_bitmap.\n"); ++ ret = -1; ++ goto out; ++ } ++ } ++ ++ /* number of dumpable pages that will be dumped later */ ++ s->num_dumpable = num_dumpable; ++ ++out: ++ g_free(dump_bitmap_buf); ++ ++ return ret; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index dfee238..6d4d0bc 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -39,6 +39,8 @@ + #define PHYS_BASE (0) + #define DUMP_LEVEL (1) + #define DISKDUMP_HEADER_BLOCKS (1) ++#define BUFSIZE_BITMAP (TARGET_PAGE_SIZE) ++#define PFN_BUFBITMAP (CHAR_BIT * BUFSIZE_BITMAP) + + typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-elf-notes-to-buffer.patch b/SOURCES/kvm-dump-add-API-to-write-elf-notes-to-buffer.patch new file mode 100644 index 0000000..49233ee --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-elf-notes-to-buffer.patch @@ -0,0 +1,70 @@ +From 251ac1dcd456c524eb7b79507c4a8a1bf4a4fa32 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:54 +0100 +Subject: [PATCH 07/41] dump: add API to write elf notes to buffer + +Message-id: <1415380693-16593-8-git-send-email-lersek@redhat.com> +Patchwork-id: 62193 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 07/26] dump: add API to write elf notes to buffer +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +the function can be used by write_elf32_notes/write_elf64_notes to write notes +to a buffer. If fd_write_vmcore is used, write_elf32_notes/write_elf64_notes +will write elf notes to vmcore directly. Instead, if buf_write_note is used, +elf notes will be written to opaque->note_buf at first. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 4835ef7784502c231f243c3133054850d23dd837) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/dump.c b/dump.c +index 710893f..3c6d526 100644 +--- a/dump.c ++++ b/dump.c +@@ -76,6 +76,9 @@ typedef struct DumpState { + int64_t begin; + int64_t length; + Error **errp; ++ ++ uint8_t *note_buf; /* buffer for notes */ ++ size_t note_buf_offset; /* the writing place in note_buf */ + } DumpState; + + static int dump_cleanup(DumpState *s) +@@ -755,6 +758,22 @@ static int write_buffer(int fd, off_t offset, const void *buf, size_t size) + return 0; + } + ++static int buf_write_note(const void *buf, size_t size, void *opaque) ++{ ++ DumpState *s = opaque; ++ ++ /* note_buf is not enough */ ++ if (s->note_buf_offset + size > s->note_size) { ++ return -1; ++ } ++ ++ memcpy(s->note_buf + s->note_buf_offset, buf, size); ++ ++ s->note_buf_offset += size; ++ ++ return 0; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-header-of-flatten-format.patch b/SOURCES/kvm-dump-add-API-to-write-header-of-flatten-format.patch new file mode 100644 index 0000000..eb60eab --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-header-of-flatten-format.patch @@ -0,0 +1,141 @@ +From faa6207ac40f548cb7f033e07717e98c9bfb1249 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:52 +0100 +Subject: [PATCH 05/41] dump: add API to write header of flatten format + +Message-id: <1415380693-16593-6-git-send-email-lersek@redhat.com> +Patchwork-id: 62191 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 05/26] dump: add API to write header of flatten format +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +flatten format will be used when writing kdump-compressed format. The format is +also used by makedumpfile, you can refer to the following URL to get more +detailed information about flatten format of kdump-compressed format: +http://sourceforge.net/projects/makedumpfile/ + +The two functions here are used to write start flat header and end flat header +to vmcore, and they will be called later when flatten format is used. + +struct MakedumpfileHeader stored at the head of vmcore is used to indicate the +vmcore is in flatten format. + +struct MakedumpfileHeader { + char signature[16]; /* = "makedumpfile" */ + int64_t type; /* = 1 */ + int64_t version; /* = 1 */ +}; + +And struct MakedumpfileDataHeader, with offset and buf_size set to -1, is used +to indicate the end of vmcore in flatten format. + +struct MakedumpfileDataHeader { + int64_t offset; /* = -1 */ + int64_t buf_size; /* = -1 */ +}; + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit fda053875e69120b2fde5fb34975ef5a49290f12) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + include/sysemu/dump.h | 17 +++++++++++++++++ + 2 files changed, 59 insertions(+) + +diff --git a/dump.c b/dump.c +index fed8bd6..6c902e5 100644 +--- a/dump.c ++++ b/dump.c +@@ -692,6 +692,48 @@ static int create_vmcore(DumpState *s) + return 0; + } + ++static int write_start_flat_header(int fd) ++{ ++ uint8_t *buf; ++ MakedumpfileHeader mh; ++ int ret = 0; ++ ++ memset(&mh, 0, sizeof(mh)); ++ strncpy(mh.signature, MAKEDUMPFILE_SIGNATURE, ++ strlen(MAKEDUMPFILE_SIGNATURE)); ++ ++ mh.type = cpu_to_be64(TYPE_FLAT_HEADER); ++ mh.version = cpu_to_be64(VERSION_FLAT_HEADER); ++ ++ buf = g_malloc0(MAX_SIZE_MDF_HEADER); ++ memcpy(buf, &mh, sizeof(mh)); ++ ++ size_t written_size; ++ written_size = qemu_write_full(fd, buf, MAX_SIZE_MDF_HEADER); ++ if (written_size != MAX_SIZE_MDF_HEADER) { ++ ret = -1; ++ } ++ ++ g_free(buf); ++ return ret; ++} ++ ++static int write_end_flat_header(int fd) ++{ ++ MakedumpfileDataHeader mdh; ++ ++ mdh.offset = END_FLAG_FLAT_HEADER; ++ mdh.buf_size = END_FLAG_FLAT_HEADER; ++ ++ size_t written_size; ++ written_size = qemu_write_full(fd, &mdh, sizeof(mdh)); ++ if (written_size != sizeof(mdh)) { ++ return -1; ++ } ++ ++ return 0; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index 19fafb2..b32b390 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -14,12 +14,29 @@ + #ifndef DUMP_H + #define DUMP_H + ++#define MAKEDUMPFILE_SIGNATURE "makedumpfile" ++#define MAX_SIZE_MDF_HEADER (4096) /* max size of makedumpfile_header */ ++#define TYPE_FLAT_HEADER (1) /* type of flattened format */ ++#define VERSION_FLAT_HEADER (1) /* version of flattened format */ ++#define END_FLAG_FLAT_HEADER (-1) ++ + typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ + int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ + int d_class; /* ELFCLASS32 or ELFCLASS64 */ + } ArchDumpInfo; + ++typedef struct QEMU_PACKED MakedumpfileHeader { ++ char signature[16]; /* = "makedumpfile" */ ++ int64_t type; ++ int64_t version; ++} MakedumpfileHeader; ++ ++typedef struct QEMU_PACKED MakedumpfileDataHeader { ++ int64_t offset; ++ int64_t buf_size; ++} MakedumpfileDataHeader; ++ + struct GuestPhysBlockList; /* memory_mapping.h */ + int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-API-to-write-vmcore.patch b/SOURCES/kvm-dump-add-API-to-write-vmcore.patch new file mode 100644 index 0000000..177680d --- /dev/null +++ b/SOURCES/kvm-dump-add-API-to-write-vmcore.patch @@ -0,0 +1,70 @@ +From f1155542d2e8ce5192a4001b1156b9d3bff4a398 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:53 +0100 +Subject: [PATCH 06/41] dump: add API to write vmcore + +Message-id: <1415380693-16593-7-git-send-email-lersek@redhat.com> +Patchwork-id: 62192 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 06/26] dump: add API to write vmcore +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +Function is used to write vmcore in flatten format. In flatten format, data is +written block by block, and in front of each block, a struct +MakedumpfileDataHeader is stored there to indicate the offset and size of the +data block. + +struct MakedumpfileDataHeader { + int64_t offset; + int64_t buf_size; +}; + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 5d31babe5c7d854d6b8470bc9fa67a698926e65d) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/dump.c b/dump.c +index 6c902e5..710893f 100644 +--- a/dump.c ++++ b/dump.c +@@ -734,6 +734,27 @@ static int write_end_flat_header(int fd) + return 0; + } + ++static int write_buffer(int fd, off_t offset, const void *buf, size_t size) ++{ ++ size_t written_size; ++ MakedumpfileDataHeader mdh; ++ ++ mdh.offset = cpu_to_be64(offset); ++ mdh.buf_size = cpu_to_be64(size); ++ ++ written_size = qemu_write_full(fd, &mdh, sizeof(mdh)); ++ if (written_size != sizeof(mdh)) { ++ return -1; ++ } ++ ++ written_size = qemu_write_full(fd, buf, size); ++ if (written_size != size) { ++ return -1; ++ } ++ ++ return 0; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-APIs-to-operate-DataCache.patch b/SOURCES/kvm-dump-add-APIs-to-operate-DataCache.patch new file mode 100644 index 0000000..299f37f --- /dev/null +++ b/SOURCES/kvm-dump-add-APIs-to-operate-DataCache.patch @@ -0,0 +1,118 @@ +From 33af2fc0d1fd87e26c9ed15a3ce07a61cbbaa490 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:00 +0100 +Subject: [PATCH 13/41] dump: add APIs to operate DataCache + +Message-id: <1415380693-16593-14-git-send-email-lersek@redhat.com> +Patchwork-id: 62199 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 13/26] dump: add APIs to operate DataCache +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +DataCache is used to store data temporarily, then the data will be written to +vmcore. These functions will be called later when writing data of page to +vmcore. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 64cfba6a47411092c941c8d17256fb5673cc8cbf) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + include/sysemu/dump.h | 9 +++++++++ + 2 files changed, 56 insertions(+) + +diff --git a/dump.c b/dump.c +index f416093..926ab84 100644 +--- a/dump.c ++++ b/dump.c +@@ -1171,6 +1171,53 @@ out: + return ret; + } + ++static void prepare_data_cache(DataCache *data_cache, DumpState *s, ++ off_t offset) ++{ ++ data_cache->fd = s->fd; ++ data_cache->data_size = 0; ++ data_cache->buf_size = BUFSIZE_DATA_CACHE; ++ data_cache->buf = g_malloc0(BUFSIZE_DATA_CACHE); ++ data_cache->offset = offset; ++} ++ ++static int write_cache(DataCache *dc, const void *buf, size_t size, ++ bool flag_sync) ++{ ++ /* ++ * dc->buf_size should not be less than size, otherwise dc will never be ++ * enough ++ */ ++ assert(size <= dc->buf_size); ++ ++ /* ++ * if flag_sync is set, synchronize data in dc->buf into vmcore. ++ * otherwise check if the space is enough for caching data in buf, if not, ++ * write the data in dc->buf to dc->fd and reset dc->buf ++ */ ++ if ((!flag_sync && dc->data_size + size > dc->buf_size) || ++ (flag_sync && dc->data_size > 0)) { ++ if (write_buffer(dc->fd, dc->offset, dc->buf, dc->data_size) < 0) { ++ return -1; ++ } ++ ++ dc->offset += dc->data_size; ++ dc->data_size = 0; ++ } ++ ++ if (!flag_sync) { ++ memcpy(dc->buf + dc->data_size, buf, size); ++ dc->data_size += size; ++ } ++ ++ return 0; ++} ++ ++static void free_data_cache(DataCache *data_cache) ++{ ++ g_free(data_cache->buf); ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index 6d4d0bc..92a95e4 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -41,6 +41,7 @@ + #define DISKDUMP_HEADER_BLOCKS (1) + #define BUFSIZE_BITMAP (TARGET_PAGE_SIZE) + #define PFN_BUFBITMAP (CHAR_BIT * BUFSIZE_BITMAP) ++#define BUFSIZE_DATA_CACHE (TARGET_PAGE_SIZE * 4) + + typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ +@@ -142,6 +143,14 @@ typedef struct QEMU_PACKED KdumpSubHeader64 { + uint64_t max_mapnr_64; /* header_version 6 and later */ + } KdumpSubHeader64; + ++typedef struct DataCache { ++ int fd; /* fd of the file where to write the cached data */ ++ uint8_t *buf; /* buffer for cached data */ ++ size_t buf_size; /* size of the buf */ ++ size_t data_size; /* size of cached data in buf */ ++ off_t offset; /* offset of the file */ ++} DataCache; ++ + struct GuestPhysBlockList; /* memory_mapping.h */ + int cpu_get_dump_info(ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-argument-to-write_elfxx_notes.patch b/SOURCES/kvm-dump-add-argument-to-write_elfxx_notes.patch new file mode 100644 index 0000000..efb4741 --- /dev/null +++ b/SOURCES/kvm-dump-add-argument-to-write_elfxx_notes.patch @@ -0,0 +1,115 @@ +From 1f9d175ded89c7d1e3d3b76b32d107c565887e81 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:51 +0100 +Subject: [PATCH 04/41] dump: add argument to write_elfxx_notes + +Message-id: <1415380693-16593-5-git-send-email-lersek@redhat.com> +Patchwork-id: 62190 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 04/26] dump: add argument to write_elfxx_notes +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +write_elf32_notes/wirte_elf64_notes use fd_write_vmcore to write elf notes to +vmcore. Adding parameter "WriteCoreDumpFunction f" makes it available to choose +the method of writing elf notes + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 6a519918b3f666759e20bcd0bb88378f3e4ffb57) +Signed-off-by: Miroslav Rezanina + +Conflicts: + dump.c + +Conflicts are due to our not having upstream commit 182735ef ("cpu: Make +first_cpu and next_cpu CPUState"). + +Signed-off-by: Laszlo Ersek +--- + dump.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/dump.c b/dump.c +index aa56aba..fed8bd6 100644 +--- a/dump.c ++++ b/dump.c +@@ -271,7 +271,7 @@ static inline int cpu_index(CPUState *cpu) + return cpu->cpu_index + 1; + } + +-static int write_elf64_notes(DumpState *s) ++static int write_elf64_notes(WriteCoreDumpFunction f, DumpState *s) + { + CPUArchState *env; + CPUState *cpu; +@@ -281,7 +281,7 @@ static int write_elf64_notes(DumpState *s) + for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); + id = cpu_index(cpu); +- ret = cpu_write_elf64_note(fd_write_vmcore, cpu, id, s); ++ ret = cpu_write_elf64_note(f, cpu, id, s); + if (ret < 0) { + dump_error(s, "dump: failed to write elf notes.\n"); + return -1; +@@ -290,7 +290,7 @@ static int write_elf64_notes(DumpState *s) + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); +- ret = cpu_write_elf64_qemunote(fd_write_vmcore, cpu, s); ++ ret = cpu_write_elf64_qemunote(f, cpu, s); + if (ret < 0) { + dump_error(s, "dump: failed to write CPU status.\n"); + return -1; +@@ -324,7 +324,7 @@ static int write_elf32_note(DumpState *s) + return 0; + } + +-static int write_elf32_notes(DumpState *s) ++static int write_elf32_notes(WriteCoreDumpFunction f, DumpState *s) + { + CPUArchState *env; + CPUState *cpu; +@@ -334,7 +334,7 @@ static int write_elf32_notes(DumpState *s) + for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); + id = cpu_index(cpu); +- ret = cpu_write_elf32_note(fd_write_vmcore, cpu, id, s); ++ ret = cpu_write_elf32_note(f, cpu, id, s); + if (ret < 0) { + dump_error(s, "dump: failed to write elf notes.\n"); + return -1; +@@ -343,7 +343,7 @@ static int write_elf32_notes(DumpState *s) + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); +- ret = cpu_write_elf32_qemunote(fd_write_vmcore, cpu, s); ++ ret = cpu_write_elf32_qemunote(f, cpu, s); + if (ret < 0) { + dump_error(s, "dump: failed to write CPU status.\n"); + return -1; +@@ -580,7 +580,7 @@ static int dump_begin(DumpState *s) + } + + /* write notes to vmcore */ +- if (write_elf64_notes(s) < 0) { ++ if (write_elf64_notes(fd_write_vmcore, s) < 0) { + return -1; + } + +@@ -603,7 +603,7 @@ static int dump_begin(DumpState *s) + } + + /* write notes to vmcore */ +- if (write_elf32_notes(s) < 0) { ++ if (write_elf32_notes(fd_write_vmcore, s) < 0) { + return -1; + } + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-members-to-DumpState-and-init-some-of-them.patch b/SOURCES/kvm-dump-add-members-to-DumpState-and-init-some-of-them.patch new file mode 100644 index 0000000..3c266bf --- /dev/null +++ b/SOURCES/kvm-dump-add-members-to-DumpState-and-init-some-of-them.patch @@ -0,0 +1,104 @@ +From 1f333717698aecbd70732d4dac609db8eda895d5 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:57 +0100 +Subject: [PATCH 10/41] dump: add members to DumpState and init some of them + +Message-id: <1415380693-16593-11-git-send-email-lersek@redhat.com> +Patchwork-id: 62196 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 10/26] dump: add members to DumpState and init some of them +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +add some members to DumpState that will be used in writing vmcore in +kdump-compressed format. some of them, like page_size, will be initialized +in the patch. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 7aad248d3596a1fb94778f2cd215f86a802b3abb) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 28 ++++++++++++++++++++++++++++ + include/sysemu/dump.h | 7 +++++++ + 2 files changed, 35 insertions(+) + +diff --git a/dump.c b/dump.c +index 3c6d526..88e8cc0 100644 +--- a/dump.c ++++ b/dump.c +@@ -79,6 +79,16 @@ typedef struct DumpState { + + uint8_t *note_buf; /* buffer for notes */ + size_t note_buf_offset; /* the writing place in note_buf */ ++ uint32_t nr_cpus; /* number of guest's cpu */ ++ size_t page_size; /* guest's page size */ ++ uint32_t page_shift; /* guest's page shift */ ++ uint64_t max_mapnr; /* the biggest guest's phys-mem's number */ ++ size_t len_dump_bitmap; /* the size of the place used to store ++ dump_bitmap in vmcore */ ++ off_t offset_dump_bitmap; /* offset of dump_bitmap part in vmcore */ ++ off_t offset_page; /* offset of page part in vmcore */ ++ size_t num_dumpable; /* number of page that can be dumped */ ++ uint32_t flag_compress; /* indicate the compression format */ + } DumpState; + + static int dump_cleanup(DumpState *s) +@@ -802,6 +812,14 @@ static ram_addr_t get_start_block(DumpState *s) + return -1; + } + ++static void get_max_mapnr(DumpState *s) ++{ ++ GuestPhysBlock *last_block; ++ ++ last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead); ++ s->max_mapnr = paddr_to_pfn(last_block->target_end, s->page_shift); ++} ++ + static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, + int64_t begin, int64_t length, Error **errp) + { +@@ -870,6 +888,16 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, + qemu_get_guest_simple_memory_mapping(&s->list, &s->guest_phys_blocks); + } + ++ s->nr_cpus = nr_cpus; ++ s->page_size = TARGET_PAGE_SIZE; ++ s->page_shift = ffs(s->page_size) - 1; ++ ++ get_max_mapnr(s); ++ ++ uint64_t tmp; ++ tmp = DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size); ++ s->len_dump_bitmap = tmp * s->page_size; ++ + if (s->has_filter) { + memory_mapping_filter(&s->list, s->begin, s->length); + } +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index b32b390..995bf47 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -20,6 +20,13 @@ + #define VERSION_FLAT_HEADER (1) /* version of flattened format */ + #define END_FLAG_FLAT_HEADER (-1) + ++#define ARCH_PFN_OFFSET (0) ++ ++#define paddr_to_pfn(X, page_shift) \ ++ (((unsigned long long)(X) >> (page_shift)) - ARCH_PFN_OFFSET) ++#define pfn_to_paddr(X, page_shift) \ ++ (((unsigned long long)(X) + ARCH_PFN_OFFSET) << (page_shift)) ++ + typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ + int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-query-dump-guest-memory-capability-command.patch b/SOURCES/kvm-dump-add-query-dump-guest-memory-capability-command.patch new file mode 100644 index 0000000..7c198e1 --- /dev/null +++ b/SOURCES/kvm-dump-add-query-dump-guest-memory-capability-command.patch @@ -0,0 +1,144 @@ +From 1b2628fe2375d602a6f123a0aa4a5cd190e72d3e Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:05 +0100 +Subject: [PATCH 18/41] dump: add 'query-dump-guest-memory-capability' command + +Message-id: <1415380693-16593-19-git-send-email-lersek@redhat.com> +Patchwork-id: 62204 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 18/26] dump: add 'query-dump-guest-memory-capability' command +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +'query-dump-guest-memory-capability' is used to query the available formats for +'dump-guest-memory'. The output of the command will be like: + +-> { "execute": "query-dump-guest-memory-capability" } +<- { "return": { "formats": + ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } + +Signed-off-by: Qiao Nuohan +Reviewed-by: Eric Blake +Signed-off-by: Luiz Capitulino +(cherry picked from commit 7d6dc7f30c4781857ce230333da6ddd21fe0dcde) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 33 +++++++++++++++++++++++++++++++++ + qapi-schema.json | 24 ++++++++++++++++++++++++ + qmp-commands.hx | 20 ++++++++++++++++++++ + 3 files changed, 77 insertions(+) + +diff --git a/dump.c b/dump.c +index 507a250..25bf8e6 100644 +--- a/dump.c ++++ b/dump.c +@@ -1797,3 +1797,36 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, + + g_free(s); + } ++ ++DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp) ++{ ++ DumpGuestMemoryFormatList *item; ++ DumpGuestMemoryCapability *cap = ++ g_malloc0(sizeof(DumpGuestMemoryCapability)); ++ ++ /* elf is always available */ ++ item = g_malloc0(sizeof(DumpGuestMemoryFormatList)); ++ cap->formats = item; ++ item->value = DUMP_GUEST_MEMORY_FORMAT_ELF; ++ ++ /* kdump-zlib is always available */ ++ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList)); ++ item = item->next; ++ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB; ++ ++ /* add new item if kdump-lzo is available */ ++#ifdef CONFIG_LZO ++ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList)); ++ item = item->next; ++ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO; ++#endif ++ ++ /* add new item if kdump-snappy is available */ ++#ifdef CONFIG_SNAPPY ++ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList)); ++ item = item->next; ++ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY; ++#endif ++ ++ return cap; ++} +diff --git a/qapi-schema.json b/qapi-schema.json +index 8f81c76..31ac5c5 100644 +--- a/qapi-schema.json ++++ b/qapi-schema.json +@@ -2645,6 +2645,30 @@ + '*length': 'int', '*format': 'DumpGuestMemoryFormat' } } + + ## ++# @DumpGuestMemoryCapability: ++# ++# A list of the available formats for dump-guest-memory ++# ++# Since: 2.0 ++## ++{ 'type': 'DumpGuestMemoryCapability', ++ 'data': { ++ 'formats': ['DumpGuestMemoryFormat'] } } ++ ++## ++# @query-dump-guest-memory-capability: ++# ++# Returns the available formats for dump-guest-memory ++# ++# Returns: A @DumpGuestMemoryCapability object listing available formats for ++# dump-guest-memory ++# ++# Since: 2.0 ++## ++{ 'command': 'query-dump-guest-memory-capability', ++ 'returns': 'DumpGuestMemoryCapability' } ++ ++## + # @netdev_add: + # + # Add a network backend. +diff --git a/qmp-commands.hx b/qmp-commands.hx +index 61aa3bf..9c11213 100644 +--- a/qmp-commands.hx ++++ b/qmp-commands.hx +@@ -923,6 +923,26 @@ Notes: + EQMP + + { ++ .name = "query-dump-guest-memory-capability", ++ .args_type = "", ++ .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability, ++ }, ++ ++SQMP ++query-dump-guest-memory-capability ++---------- ++ ++Show available formats for 'dump-guest-memory' ++ ++Example: ++ ++-> { "execute": "query-dump-guest-memory-capability" } ++<- { "return": { "formats": ++ ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } ++ ++EQMP ++ ++ { + .name = "netdev_add", + .args_type = "netdev:O", + .mhandler.cmd_new = qmp_netdev_add, +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-add-support-for-lzo-snappy.patch b/SOURCES/kvm-dump-add-support-for-lzo-snappy.patch new file mode 100644 index 0000000..a108f37 --- /dev/null +++ b/SOURCES/kvm-dump-add-support-for-lzo-snappy.patch @@ -0,0 +1,137 @@ +From 018133d4217c5aebaa09a43b341b0765075f4254 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:55 +0100 +Subject: [PATCH 08/41] dump: add support for lzo/snappy + +Message-id: <1415380693-16593-9-git-send-email-lersek@redhat.com> +Patchwork-id: 62194 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 08/26] dump: add support for lzo/snappy +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +kdump-compressed format supports three compression format, zlib/lzo/snappy. +Currently, only zlib is available. This patch is used to support lzo/snappy. +'--enable-lzo/--enable-snappy' is needed to be specified with configure to make +lzo/snappy available for qemu + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit 607dacd0a082a4ea73a7a16a1c70406f37ebacdb) +Signed-off-by: Miroslav Rezanina + +Conflicts: + configure + +Signed-off-by: Laszlo Ersek +--- + configure | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +diff --git a/configure b/configure +index fb0c839..5373237 100755 +--- a/configure ++++ b/configure +@@ -232,6 +232,8 @@ libusb="" + usb_redir="" + glx="" + zlib="yes" ++lzo="no" ++snappy="no" + guest_agent="yes" + want_tools="yes" + libiscsi="" +@@ -909,6 +911,10 @@ for opt do + ;; + --disable-zlib-test) zlib="no" + ;; ++ --enable-lzo) lzo="yes" ++ ;; ++ --enable-snappy) snappy="yes" ++ ;; + --enable-guest-agent) guest_agent="yes" + ;; + --disable-guest-agent) guest_agent="no" +@@ -1220,6 +1226,8 @@ echo " --disable-libusb disable libusb (for usb passthrough)" + echo " --enable-libusb enable libusb (for usb passthrough)" + echo " --disable-usb-redir disable usb network redirection support" + echo " --enable-usb-redir enable usb network redirection support" ++echo " --enable-lzo enable the support of lzo compression library" ++echo " --enable-snappy enable the support of snappy compression library" + echo " --disable-guest-agent disable building of the QEMU Guest Agent" + echo " --enable-guest-agent enable building of the QEMU Guest Agent" + echo " --disable-seccomp disable seccomp support" +@@ -1554,6 +1562,42 @@ fi + libs_softmmu="$libs_softmmu -lz" + + ########################################## ++# lzo check ++ ++if test "$lzo" != "no" ; then ++ cat > $TMPC << EOF ++#include ++int main(void) { lzo_version(); return 0; } ++EOF ++ if compile_prog "" "-llzo2" ; then ++ : ++ else ++ error_exit "lzo check failed" \ ++ "Make sure to have the lzo libs and headers installed." ++ fi ++ ++ libs_softmmu="$libs_softmmu -llzo2" ++fi ++ ++########################################## ++# snappy check ++ ++if test "$snappy" != "no" ; then ++ cat > $TMPC << EOF ++#include ++int main(void) { snappy_max_compressed_length(4096); return 0; } ++EOF ++ if compile_prog "" "-lsnappy" ; then ++ : ++ else ++ error_exit "snappy check failed" \ ++ "Make sure to have the snappy libs and headers installed." ++ fi ++ ++ libs_softmmu="$libs_softmmu -lsnappy" ++fi ++ ++########################################## + # libseccomp check + + if test "$seccomp" != "no" ; then +@@ -3648,6 +3692,8 @@ echo "QOM debugging $qom_cast_debug" + echo "Live block operations $live_block_ops" + echo "Live block migration $live_block_migration" + echo "vhdx $vhdx" ++echo "lzo support $lzo" ++echo "snappy support $snappy" + + if test "$sdl_too_old" = "yes"; then + echo "-> Your SDL version is too old - please upgrade to have SDL support" +@@ -3965,6 +4011,14 @@ if test "$glx" = "yes" ; then + echo "GLX_LIBS=$glx_libs" >> $config_host_mak + fi + ++if test "$lzo" = "yes" ; then ++ echo "CONFIG_LZO=y" >> $config_host_mak ++fi ++ ++if test "$snappy" = "yes" ; then ++ echo "CONFIG_SNAPPY=y" >> $config_host_mak ++fi ++ + if test "$libiscsi" = "yes" ; then + echo "CONFIG_LIBISCSI=y" >> $config_host_mak + echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-const-qualify-the-buf-of-WriteCoreDumpFunction.patch b/SOURCES/kvm-dump-const-qualify-the-buf-of-WriteCoreDumpFunction.patch new file mode 100644 index 0000000..0476cd6 --- /dev/null +++ b/SOURCES/kvm-dump-const-qualify-the-buf-of-WriteCoreDumpFunction.patch @@ -0,0 +1,59 @@ +From 4e72a97c81c6fe61fe051bfe41e9b53425bcd7af Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:50 +0100 +Subject: [PATCH 03/41] dump: const-qualify the buf of WriteCoreDumpFunction + +Message-id: <1415380693-16593-4-git-send-email-lersek@redhat.com> +Patchwork-id: 62189 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 03/26] dump: const-qualify the buf of WriteCoreDumpFunction +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +WriteCoreDumpFunction is a function pointer that points to the function used to +write content in "buf" into core file, so "buf" should be const-qualify. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit b5ba1cc6260917926781fb79fbb05d53bf586d53) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 2 +- + include/qom/cpu.h | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/dump.c b/dump.c +index 8c31386..aa56aba 100644 +--- a/dump.c ++++ b/dump.c +@@ -99,7 +99,7 @@ static void dump_error(DumpState *s, const char *reason) + dump_cleanup(s); + } + +-static int fd_write_vmcore(void *buf, size_t size, void *opaque) ++static int fd_write_vmcore(const void *buf, size_t size, void *opaque) + { + DumpState *s = opaque; + size_t written_size; +diff --git a/include/qom/cpu.h b/include/qom/cpu.h +index b555c22..a5cc6c3 100644 +--- a/include/qom/cpu.h ++++ b/include/qom/cpu.h +@@ -25,7 +25,8 @@ + #include "qemu/thread.h" + #include "qemu/typedefs.h" + +-typedef int (*WriteCoreDumpFunction)(void *buf, size_t size, void *opaque); ++typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size, ++ void *opaque); + + /** + * SECTION:cpu +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-eliminate-DumpState.page_shift-guest-s-page-shi.patch b/SOURCES/kvm-dump-eliminate-DumpState.page_shift-guest-s-page-shi.patch new file mode 100644 index 0000000..fc2fd68 --- /dev/null +++ b/SOURCES/kvm-dump-eliminate-DumpState.page_shift-guest-s-page-shi.patch @@ -0,0 +1,110 @@ +From 8bc06ed35e121131f16d08b9c2ecaa0b122d7ad3 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:09 +0100 +Subject: [PATCH 22/41] dump: eliminate DumpState.page_shift ("guest's page + shift") + +Message-id: <1415380693-16593-23-git-send-email-lersek@redhat.com> +Patchwork-id: 62210 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 22/26] dump: eliminate DumpState.page_shift ("guest's page shift") +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +Just use TARGET_PAGE_BITS. + +"DumpState.page_shift" used to have type "uint32_t", while the replacement +TARGET_PAGE_BITS has type "int". Since "DumpState.page_shift" was only +used as bit shift counts in the paddr_to_pfn() and pfn_to_paddr() macros, +this is safe. + +Suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit 22227f121bddb038a0335cf83a3c24f451e2e836) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 10 ++++------ + include/sysemu/dump.h | 8 ++++---- + 2 files changed, 8 insertions(+), 10 deletions(-) + +diff --git a/dump.c b/dump.c +index ee28777..bc82b55 100644 +--- a/dump.c ++++ b/dump.c +@@ -91,7 +91,6 @@ typedef struct DumpState { + size_t note_buf_offset; /* the writing place in note_buf */ + uint32_t nr_cpus; /* number of guest's cpu */ + size_t page_size; /* guest's page size */ +- uint32_t page_shift; /* guest's page shift */ + uint64_t max_mapnr; /* the biggest guest's phys-mem's number */ + size_t len_dump_bitmap; /* the size of the place used to store + dump_bitmap in vmcore */ +@@ -1092,7 +1091,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + *blockptr = block; + assert(block->target_start % s->page_size == 0); + assert(block->target_end % s->page_size == 0); +- *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); ++ *pfnptr = paddr_to_pfn(block->target_start); + if (bufptr) { + *bufptr = block->host_addr; + } +@@ -1100,7 +1099,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + } + + *pfnptr = *pfnptr + 1; +- addr = pfn_to_paddr(*pfnptr, s->page_shift); ++ addr = pfn_to_paddr(*pfnptr); + + if ((addr >= block->target_start) && + (addr + s->page_size <= block->target_end)) { +@@ -1114,7 +1113,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + } + assert(block->target_start % s->page_size == 0); + assert(block->target_end % s->page_size == 0); +- *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); ++ *pfnptr = paddr_to_pfn(block->target_start); + buf = block->host_addr; + } + +@@ -1540,7 +1539,7 @@ static void get_max_mapnr(DumpState *s) + GuestPhysBlock *last_block; + + last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead); +- s->max_mapnr = paddr_to_pfn(last_block->target_end, s->page_shift); ++ s->max_mapnr = paddr_to_pfn(last_block->target_end); + } + + static int dump_init(DumpState *s, int fd, bool has_format, +@@ -1618,7 +1617,6 @@ static int dump_init(DumpState *s, int fd, bool has_format, + + s->nr_cpus = nr_cpus; + s->page_size = TARGET_PAGE_SIZE; +- s->page_shift = ffs(s->page_size) - 1; + + get_max_mapnr(s); + +diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h +index efab7a3..12af557 100644 +--- a/include/sysemu/dump.h ++++ b/include/sysemu/dump.h +@@ -22,10 +22,10 @@ + + #define ARCH_PFN_OFFSET (0) + +-#define paddr_to_pfn(X, page_shift) \ +- (((unsigned long long)(X) >> (page_shift)) - ARCH_PFN_OFFSET) +-#define pfn_to_paddr(X, page_shift) \ +- (((unsigned long long)(X) + ARCH_PFN_OFFSET) << (page_shift)) ++#define paddr_to_pfn(X) \ ++ (((unsigned long long)(X) >> TARGET_PAGE_BITS) - ARCH_PFN_OFFSET) ++#define pfn_to_paddr(X) \ ++ (((unsigned long long)(X) + ARCH_PFN_OFFSET) << TARGET_PAGE_BITS) + + /* + * flag for compressed format +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-eliminate-DumpState.page_size-guest-s-page-size.patch b/SOURCES/kvm-dump-eliminate-DumpState.page_size-guest-s-page-size.patch new file mode 100644 index 0000000..103984e --- /dev/null +++ b/SOURCES/kvm-dump-eliminate-DumpState.page_size-guest-s-page-size.patch @@ -0,0 +1,265 @@ +From e660f3651e349f658fe393917bab3ef8da44448c Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:10 +0100 +Subject: [PATCH 23/41] dump: eliminate DumpState.page_size ("guest's page + size") + +Message-id: <1415380693-16593-24-git-send-email-lersek@redhat.com> +Patchwork-id: 62211 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 23/26] dump: eliminate DumpState.page_size ("guest's page size") +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +Use TARGET_PAGE_SIZE and ~TARGET_PAGE_MASK instead. + +"DumpState.page_size" has type "size_t", whereas TARGET_PAGE_SIZE has type +"int". TARGET_PAGE_MASK is of type "int" and has negative value. The patch +affects the implicit type conversions as follows: + +- create_header32() and create_header64(): assigned to "block_size", which + has type "uint32_t". No change. + +- get_next_page(): "block->target_start", "block->target_end" and "addr" + have type "hwaddr" (uint64_t). + + Before the patch, + - if "size_t" was "uint64_t", then no additional conversion was done as + part of the usual arithmetic conversions, + - If "size_t" was "uint32_t", then it was widened to uint64_t as part of + the usual arithmetic conversions, + for the remainder and addition operators. + + After the patch, + - "~TARGET_PAGE_MASK" expands to ~~((1 << TARGET_PAGE_BITS) - 1). It + has type "int" and positive value (only least significant bits set). + That's converted (widened) to "uint64_t" for the bit-ands. No visible + change. + - The same holds for the (addr + TARGET_PAGE_SIZE) addition. + +- write_dump_pages(): + - TARGET_PAGE_SIZE passed as argument to a bunch of functions that all + have prototypes. No change. + + - When incrementing "offset_data" (of type "off_t"): given that we never + build for ILP32_OFF32 (see "-D_FILE_OFFSET_BITS=64" in configure), + "off_t" is always "int64_t", and we only need to consider: + - ILP32_OFFBIG: "size_t" is "uint32_t". + - before: int64_t += uint32_t. Page size converted to int64_t for + the addition. + - after: int64_t += int32_t. No change. + - LP64_OFF64: "size_t" is "uint64_t". + - before: int64_t += uint64_t. Offset converted to uint64_t for the + addition, then the uint64_t result is converted to int64_t for + storage. + - after: int64_t += int32_t. Same as the ILP32_OFFBIG/after case. + No visible change. + + - (size_out < s->page_size) comparisons, and (size_out = s->page_size) + assignment: + - before: "size_out" is of type "size_t", no implicit conversion for + either operator. + - after: TARGET_PAGE_SIZE (of type "int" and positive value) is + converted to "size_t" (for the relop because the latter is + one of "uint32_t" and "uint64_t"). No visible change. + +- dump_init(): + - DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size): The + innermost "DumpState.max_mapnr" field has type uint64_t, which + propagates through all implicit conversions at hand: + + #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + + regardless of the page size macro argument's type. In the outer macro + replacement, the page size is converted from uint32_t and int32_t + alike to uint64_t. + + - (tmp * s->page_size) multiplication: "tmp" has size "uint64_t"; the + RHS is converted to that type from uint32_t and int32_t just the same + if it's not uint64_t to begin with. + +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit 2f859f80c2077e00237ea1dfae2523ebd8377f5f) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 51 +++++++++++++++++++++++++-------------------------- + 1 file changed, 25 insertions(+), 26 deletions(-) + +diff --git a/dump.c b/dump.c +index bc82b55..f8e0fd7 100644 +--- a/dump.c ++++ b/dump.c +@@ -90,7 +90,6 @@ typedef struct DumpState { + uint8_t *note_buf; /* buffer for notes */ + size_t note_buf_offset; /* the writing place in note_buf */ + uint32_t nr_cpus; /* number of guest's cpu */ +- size_t page_size; /* guest's page size */ + uint64_t max_mapnr; /* the biggest guest's phys-mem's number */ + size_t len_dump_bitmap; /* the size of the place used to store + dump_bitmap in vmcore */ +@@ -811,7 +810,7 @@ static int create_header32(DumpState *s) + + strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); + dh->header_version = cpu_convert_to_target32(6, endian); +- block_size = s->page_size; ++ block_size = TARGET_PAGE_SIZE; + dh->block_size = cpu_convert_to_target32(block_size, endian); + sub_hdr_size = sizeof(struct KdumpSubHeader32) + s->note_size; + sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); +@@ -918,7 +917,7 @@ static int create_header64(DumpState *s) + + strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); + dh->header_version = cpu_convert_to_target32(6, endian); +- block_size = s->page_size; ++ block_size = TARGET_PAGE_SIZE; + dh->block_size = cpu_convert_to_target32(block_size, endian); + sub_hdr_size = sizeof(struct KdumpSubHeader64) + s->note_size; + sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size); +@@ -1089,8 +1088,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + if (!block) { + block = QTAILQ_FIRST(&s->guest_phys_blocks.head); + *blockptr = block; +- assert(block->target_start % s->page_size == 0); +- assert(block->target_end % s->page_size == 0); ++ assert((block->target_start & ~TARGET_PAGE_MASK) == 0); ++ assert((block->target_end & ~TARGET_PAGE_MASK) == 0); + *pfnptr = paddr_to_pfn(block->target_start); + if (bufptr) { + *bufptr = block->host_addr; +@@ -1102,7 +1101,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + addr = pfn_to_paddr(*pfnptr); + + if ((addr >= block->target_start) && +- (addr + s->page_size <= block->target_end)) { ++ (addr + TARGET_PAGE_SIZE <= block->target_end)) { + buf = block->host_addr + (addr - block->target_start); + } else { + /* the next page is in the next block */ +@@ -1111,8 +1110,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, + if (!block) { + return false; + } +- assert(block->target_start % s->page_size == 0); +- assert(block->target_end % s->page_size == 0); ++ assert((block->target_start & ~TARGET_PAGE_MASK) == 0); ++ assert((block->target_end & ~TARGET_PAGE_MASK) == 0); + *pfnptr = paddr_to_pfn(block->target_start); + buf = block->host_addr; + } +@@ -1297,7 +1296,7 @@ static int write_dump_pages(DumpState *s) + prepare_data_cache(&page_data, s, offset_data); + + /* prepare buffer to store compressed data */ +- len_buf_out = get_len_buf_out(s->page_size, s->flag_compress); ++ len_buf_out = get_len_buf_out(TARGET_PAGE_SIZE, s->flag_compress); + if (len_buf_out == 0) { + dump_error(s, "dump: failed to get length of output buffer.\n"); + goto out; +@@ -1313,19 +1312,19 @@ static int write_dump_pages(DumpState *s) + * init zero page's page_desc and page_data, because every zero page + * uses the same page_data + */ +- pd_zero.size = cpu_convert_to_target32(s->page_size, endian); ++ pd_zero.size = cpu_convert_to_target32(TARGET_PAGE_SIZE, endian); + pd_zero.flags = cpu_convert_to_target32(0, endian); + pd_zero.offset = cpu_convert_to_target64(offset_data, endian); + pd_zero.page_flags = cpu_convert_to_target64(0, endian); +- buf = g_malloc0(s->page_size); +- ret = write_cache(&page_data, buf, s->page_size, false); ++ buf = g_malloc0(TARGET_PAGE_SIZE); ++ ret = write_cache(&page_data, buf, TARGET_PAGE_SIZE, false); + g_free(buf); + if (ret < 0) { + dump_error(s, "dump: failed to write page data(zero page).\n"); + goto out; + } + +- offset_data += s->page_size; ++ offset_data += TARGET_PAGE_SIZE; + + /* + * dump memory to vmcore page by page. zero page will all be resided in the +@@ -1333,7 +1332,7 @@ static int write_dump_pages(DumpState *s) + */ + while (get_next_page(&block_iter, &pfn_iter, &buf, s)) { + /* check zero page */ +- if (is_zero_page(buf, s->page_size)) { ++ if (is_zero_page(buf, TARGET_PAGE_SIZE)) { + ret = write_cache(&page_desc, &pd_zero, sizeof(PageDescriptor), + false); + if (ret < 0) { +@@ -1354,8 +1353,9 @@ static int write_dump_pages(DumpState *s) + */ + size_out = len_buf_out; + if ((s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) && +- (compress2(buf_out, (uLongf *)&size_out, buf, s->page_size, +- Z_BEST_SPEED) == Z_OK) && (size_out < s->page_size)) { ++ (compress2(buf_out, (uLongf *)&size_out, buf, ++ TARGET_PAGE_SIZE, Z_BEST_SPEED) == Z_OK) && ++ (size_out < TARGET_PAGE_SIZE)) { + pd.flags = cpu_convert_to_target32(DUMP_DH_COMPRESSED_ZLIB, + endian); + pd.size = cpu_convert_to_target32(size_out, endian); +@@ -1367,9 +1367,9 @@ static int write_dump_pages(DumpState *s) + } + #ifdef CONFIG_LZO + } else if ((s->flag_compress & DUMP_DH_COMPRESSED_LZO) && +- (lzo1x_1_compress(buf, s->page_size, buf_out, ++ (lzo1x_1_compress(buf, TARGET_PAGE_SIZE, buf_out, + (lzo_uint *)&size_out, wrkmem) == LZO_E_OK) && +- (size_out < s->page_size)) { ++ (size_out < TARGET_PAGE_SIZE)) { + pd.flags = cpu_convert_to_target32(DUMP_DH_COMPRESSED_LZO, + endian); + pd.size = cpu_convert_to_target32(size_out, endian); +@@ -1382,9 +1382,9 @@ static int write_dump_pages(DumpState *s) + #endif + #ifdef CONFIG_SNAPPY + } else if ((s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) && +- (snappy_compress((char *)buf, s->page_size, ++ (snappy_compress((char *)buf, TARGET_PAGE_SIZE, + (char *)buf_out, &size_out) == SNAPPY_OK) && +- (size_out < s->page_size)) { ++ (size_out < TARGET_PAGE_SIZE)) { + pd.flags = cpu_convert_to_target32( + DUMP_DH_COMPRESSED_SNAPPY, endian); + pd.size = cpu_convert_to_target32(size_out, endian); +@@ -1398,13 +1398,13 @@ static int write_dump_pages(DumpState *s) + } else { + /* + * fall back to save in plaintext, size_out should be +- * assigned to s->page_size ++ * assigned TARGET_PAGE_SIZE + */ + pd.flags = cpu_convert_to_target32(0, endian); +- size_out = s->page_size; ++ size_out = TARGET_PAGE_SIZE; + pd.size = cpu_convert_to_target32(size_out, endian); + +- ret = write_cache(&page_data, buf, s->page_size, false); ++ ret = write_cache(&page_data, buf, TARGET_PAGE_SIZE, false); + if (ret < 0) { + dump_error(s, "dump: failed to write page data.\n"); + goto out; +@@ -1616,13 +1616,12 @@ static int dump_init(DumpState *s, int fd, bool has_format, + } + + s->nr_cpus = nr_cpus; +- s->page_size = TARGET_PAGE_SIZE; + + get_max_mapnr(s); + + uint64_t tmp; +- tmp = DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size); +- s->len_dump_bitmap = tmp * s->page_size; ++ tmp = DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), TARGET_PAGE_SIZE); ++ s->len_dump_bitmap = tmp * TARGET_PAGE_SIZE; + + /* init for kdump-compressed format */ + if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-fill-in-the-flat-header-signature-more-pleasing.patch b/SOURCES/kvm-dump-fill-in-the-flat-header-signature-more-pleasing.patch new file mode 100644 index 0000000..7c06a42 --- /dev/null +++ b/SOURCES/kvm-dump-fill-in-the-flat-header-signature-more-pleasing.patch @@ -0,0 +1,51 @@ +From e40ba375b6007ff227d18aa55be7f1070145ccac Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:07 +0100 +Subject: [PATCH 20/41] dump: fill in the flat header signature more pleasingly + to the eye + +Message-id: <1415380693-16593-21-git-send-email-lersek@redhat.com> +Patchwork-id: 62206 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 20/26] dump: fill in the flat header signature more pleasingly to the eye +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +The "mh.signature" array field has size 16, and is zeroed by the preceding +memset(). MAKEDUMPFILE_SIGNATURE expands to a string literal with string +length 12 (size 13). There's no need to measure the length of +MAKEDUMPFILE_SIGNATURE at runtime, nor for the extra zero-filling of +"mh.signature" with strncpy(). + +Use memcpy() with MIN(sizeof, sizeof) for robustness (which is an integer +constant expression, evaluable at compile time.) + +Approximately-suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit ae3f88f60fb9f42bb3679311c2fbff8e1868ea47) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dump.c b/dump.c +index 9250594..533b914 100644 +--- a/dump.c ++++ b/dump.c +@@ -722,8 +722,8 @@ static int write_start_flat_header(int fd) + int ret = 0; + + memset(&mh, 0, sizeof(mh)); +- strncpy(mh.signature, MAKEDUMPFILE_SIGNATURE, +- strlen(MAKEDUMPFILE_SIGNATURE)); ++ memcpy(mh.signature, MAKEDUMPFILE_SIGNATURE, ++ MIN(sizeof mh.signature, sizeof MAKEDUMPFILE_SIGNATURE)); + + mh.type = cpu_to_be64(TYPE_FLAT_HEADER); + mh.version = cpu_to_be64(VERSION_FLAT_HEADER); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-guest-memory-Check-for-the-correct-return-value.patch b/SOURCES/kvm-dump-guest-memory-Check-for-the-correct-return-value.patch new file mode 100644 index 0000000..b223f37 --- /dev/null +++ b/SOURCES/kvm-dump-guest-memory-Check-for-the-correct-return-value.patch @@ -0,0 +1,51 @@ +From 9c1134e8923157059587541b4f318e63ad8c39fe Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:17:49 +0100 +Subject: [PATCH 02/41] dump-guest-memory: Check for the correct return value + +Message-id: <1415380693-16593-3-git-send-email-lersek@redhat.com> +Patchwork-id: 62188 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 02/26] dump-guest-memory: Check for the correct return value +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: "Aneesh Kumar K.V" + +We should check for error with s->note_size + +Signed-off-by: Aneesh Kumar K.V +Signed-off-by: Alexander Graf +(cherry picked from commit bb6b684363e83586c90d20127b0d0a79793ab1e2) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dump.c b/dump.c +index a2b6e45..8c31386 100644 +--- a/dump.c ++++ b/dump.c +@@ -66,7 +66,7 @@ typedef struct DumpState { + uint32_t sh_info; + bool have_section; + bool resume; +- size_t note_size; ++ ssize_t note_size; + hwaddr memory_offset; + int fd; + +@@ -771,7 +771,7 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, + + s->note_size = cpu_get_note_size(s->dump_info.d_class, + s->dump_info.d_machine, nr_cpus); +- if (ret < 0) { ++ if (s->note_size < 0) { + error_set(errp, QERR_UNSUPPORTED); + goto cleanup; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-hoist-lzo_init-from-get_len_buf_out-to-dump_ini.patch b/SOURCES/kvm-dump-hoist-lzo_init-from-get_len_buf_out-to-dump_ini.patch new file mode 100644 index 0000000..065c246 --- /dev/null +++ b/SOURCES/kvm-dump-hoist-lzo_init-from-get_len_buf_out-to-dump_ini.patch @@ -0,0 +1,70 @@ +From 83178d872394db83d8e4cc91f34edd7c2af43bc2 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:12 +0100 +Subject: [PATCH 25/41] dump: hoist lzo_init() from get_len_buf_out() to + dump_init() + +Message-id: <1415380693-16593-26-git-send-email-lersek@redhat.com> +Patchwork-id: 62208 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 25/26] dump: hoist lzo_init() from get_len_buf_out() to dump_init() +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +qmp_dump_guest_memory() + dump_init() + lzo_init() <---------+ + create_kdump_vmcore() | + write_dump_pages() | + get_len_buf_out() | + lzo_init() ------+ + +This patch doesn't change the fact that lzo_init() is called for every +LZO-compressed dump, but it makes get_len_buf_out() more focused (single +responsibility). + +Suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit c998acb03df614ddf2f3e206582586f191d07fff) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/dump.c b/dump.c +index 450f658..f980354 100644 +--- a/dump.c ++++ b/dump.c +@@ -1237,13 +1237,6 @@ static size_t get_len_buf_out(size_t page_size, uint32_t flag_compress) + + /* buf size for lzo */ + #ifdef CONFIG_LZO +- if (flag_compress & DUMP_DH_COMPRESSED_LZO) { +- if (lzo_init() != LZO_E_OK) { +- /* return 0 to indicate lzo is unavailable */ +- return 0; +- } +- } +- + /* + * LZO will expand incompressible data by a little amount. please check the + * following URL to see the expansion calculation: +@@ -1631,6 +1624,12 @@ static int dump_init(DumpState *s, int fd, bool has_format, + break; + + case DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO: ++#ifdef CONFIG_LZO ++ if (lzo_init() != LZO_E_OK) { ++ error_setg(errp, "failed to initialize the LZO library"); ++ goto cleanup; ++ } ++#endif + s->flag_compress = DUMP_DH_COMPRESSED_LZO; + break; + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-make-kdump-compressed-format-available-for-dump.patch b/SOURCES/kvm-dump-make-kdump-compressed-format-available-for-dump.patch new file mode 100644 index 0000000..773ad3a --- /dev/null +++ b/SOURCES/kvm-dump-make-kdump-compressed-format-available-for-dump.patch @@ -0,0 +1,345 @@ +From 7cc714c354fc4dbfaeca66156ca331f57bf9653e Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:03 +0100 +Subject: [PATCH 16/41] dump: make kdump-compressed format available for + 'dump-guest-memory' + +Message-id: <1415380693-16593-17-git-send-email-lersek@redhat.com> +Patchwork-id: 62202 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 16/26] dump: make kdump-compressed format available for 'dump-guest-memory' +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +From: qiaonuohan + +Make monitor command 'dump-guest-memory' be able to dump in kdump-compressed +format. The command's usage: + + dump [-p] protocol [begin] [length] [format] + +'format' is used to specified the format of vmcore and can be: +1. 'elf': ELF format, without compression +2. 'kdump-zlib': kdump-compressed format, with zlib-compressed +3. 'kdump-lzo': kdump-compressed format, with lzo-compressed +4. 'kdump-snappy': kdump-compressed format, with snappy-compressed +Without 'format' being set, it is same as 'elf'. And if non-elf format is +specified, paging and filter is not allowed. + +Note: + 1. The kdump-compressed format is readable only with the crash utility and + makedumpfile, and it can be smaller than the ELF format because of the + compression support. + 2. The kdump-compressed format is the 6th edition. + +Signed-off-by: Qiao Nuohan +Reviewed-by: Laszlo Ersek +Signed-off-by: Luiz Capitulino +(cherry picked from commit b53ccc30c40df52d192e469a86c188a8649c6df3) +Signed-off-by: Laszlo Ersek +Signed-off-by: Miroslav Rezanina +--- + dump.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- + hmp.c | 5 ++- + qapi-schema.json | 25 ++++++++++- + qmp-commands.hx | 7 ++- + 4 files changed, 158 insertions(+), 10 deletions(-) + +diff --git a/dump.c b/dump.c +index fc5530f..c0d5877 100644 +--- a/dump.c ++++ b/dump.c +@@ -1449,6 +1449,64 @@ out: + return ret; + } + ++static int create_kdump_vmcore(DumpState *s) ++{ ++ int ret; ++ ++ /* ++ * the kdump-compressed format is: ++ * File offset ++ * +------------------------------------------+ 0x0 ++ * | main header (struct disk_dump_header) | ++ * |------------------------------------------+ block 1 ++ * | sub header (struct kdump_sub_header) | ++ * |------------------------------------------+ block 2 ++ * | 1st-dump_bitmap | ++ * |------------------------------------------+ block 2 + X blocks ++ * | 2nd-dump_bitmap | (aligned by block) ++ * |------------------------------------------+ block 2 + 2 * X blocks ++ * | page desc for pfn 0 (struct page_desc) | (aligned by block) ++ * | page desc for pfn 1 (struct page_desc) | ++ * | : | ++ * |------------------------------------------| (not aligned by block) ++ * | page data (pfn 0) | ++ * | page data (pfn 1) | ++ * | : | ++ * +------------------------------------------+ ++ */ ++ ++ ret = write_start_flat_header(s->fd); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write start flat header.\n"); ++ return -1; ++ } ++ ++ ret = write_dump_header(s); ++ if (ret < 0) { ++ return -1; ++ } ++ ++ ret = write_dump_bitmap(s); ++ if (ret < 0) { ++ return -1; ++ } ++ ++ ret = write_dump_pages(s); ++ if (ret < 0) { ++ return -1; ++ } ++ ++ ret = write_end_flat_header(s->fd); ++ if (ret < 0) { ++ dump_error(s, "dump: failed to write end flat header.\n"); ++ return -1; ++ } ++ ++ dump_completed(s); ++ ++ return 0; ++} ++ + static ram_addr_t get_start_block(DumpState *s) + { + GuestPhysBlock *block; +@@ -1485,7 +1543,8 @@ static void get_max_mapnr(DumpState *s) + s->max_mapnr = paddr_to_pfn(last_block->target_end, s->page_shift); + } + +-static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, ++static int dump_init(DumpState *s, int fd, bool has_format, ++ DumpGuestMemoryFormat format, bool paging, bool has_filter, + int64_t begin, int64_t length, Error **errp) + { + CPUArchState *env; +@@ -1493,6 +1552,11 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, + Error *err = NULL; + int ret; + ++ /* kdump-compressed is conflict with paging and filter */ ++ if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { ++ assert(!paging && !has_filter); ++ } ++ + if (runstate_is_running()) { + vm_stop(RUN_STATE_SAVE_VM); + s->resume = true; +@@ -1563,6 +1627,28 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, + tmp = DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size); + s->len_dump_bitmap = tmp * s->page_size; + ++ /* init for kdump-compressed format */ ++ if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { ++ switch (format) { ++ case DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB: ++ s->flag_compress = DUMP_DH_COMPRESSED_ZLIB; ++ break; ++ ++ case DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO: ++ s->flag_compress = DUMP_DH_COMPRESSED_LZO; ++ break; ++ ++ case DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY: ++ s->flag_compress = DUMP_DH_COMPRESSED_SNAPPY; ++ break; ++ ++ default: ++ s->flag_compress = 0; ++ } ++ ++ return 0; ++ } ++ + if (s->has_filter) { + memory_mapping_filter(&s->list, s->begin, s->length); + } +@@ -1622,14 +1708,25 @@ cleanup: + } + + void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, +- int64_t begin, bool has_length, int64_t length, +- Error **errp) ++ int64_t begin, bool has_length, ++ int64_t length, bool has_format, ++ DumpGuestMemoryFormat format, Error **errp) + { + const char *p; + int fd = -1; + DumpState *s; + int ret; + ++ /* ++ * kdump-compressed format need the whole memory dumped, so paging or ++ * filter is not supported here. ++ */ ++ if ((has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) && ++ (paging || has_begin || has_length)) { ++ error_setg(errp, "kdump-compressed format doesn't support paging or " ++ "filter"); ++ return; ++ } + if (has_begin && !has_length) { + error_set(errp, QERR_MISSING_PARAMETER, "length"); + return; +@@ -1639,6 +1736,21 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, + return; + } + ++ /* check whether lzo/snappy is supported */ ++#ifndef CONFIG_LZO ++ if (has_format && format == DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO) { ++ error_setg(errp, "kdump-lzo is not available now"); ++ return; ++ } ++#endif ++ ++#ifndef CONFIG_SNAPPY ++ if (has_format && format == DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY) { ++ error_setg(errp, "kdump-snappy is not available now"); ++ return; ++ } ++#endif ++ + #if !defined(WIN32) + if (strstart(file, "fd:", &p)) { + fd = monitor_get_fd(cur_mon, p, errp); +@@ -1663,14 +1775,21 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, + + s = g_malloc0(sizeof(DumpState)); + +- ret = dump_init(s, fd, paging, has_begin, begin, length, errp); ++ ret = dump_init(s, fd, has_format, format, paging, has_begin, ++ begin, length, errp); + if (ret < 0) { + g_free(s); + return; + } + +- if (create_vmcore(s) < 0 && !error_is_set(s->errp)) { +- error_set(errp, QERR_IO_ERROR); ++ if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { ++ if (create_kdump_vmcore(s) < 0 && !error_is_set(s->errp)) { ++ error_set(errp, QERR_IO_ERROR); ++ } ++ } else { ++ if (create_vmcore(s) < 0 && !error_is_set(s->errp)) { ++ error_set(errp, QERR_IO_ERROR); ++ } + } + + g_free(s); +diff --git a/hmp.c b/hmp.c +index b723b26..1805926 100644 +--- a/hmp.c ++++ b/hmp.c +@@ -1195,8 +1195,11 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) + const char *file = qdict_get_str(qdict, "filename"); + bool has_begin = qdict_haskey(qdict, "begin"); + bool has_length = qdict_haskey(qdict, "length"); ++ /* kdump-compressed format is not supported for HMP */ ++ bool has_format = false; + int64_t begin = 0; + int64_t length = 0; ++ enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF; + char *prot; + + if (has_begin) { +@@ -1209,7 +1212,7 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) + prot = g_strconcat("file:", file, NULL); + + qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length, +- &errp); ++ has_format, dump_format, &errp); + hmp_handle_error(mon, &errp); + g_free(prot); + } +diff --git a/qapi-schema.json b/qapi-schema.json +index d3d4e57..8f81c76 100644 +--- a/qapi-schema.json ++++ b/qapi-schema.json +@@ -2578,6 +2578,24 @@ + { 'command': 'device_del', 'data': {'id': 'str'} } + + ## ++# @DumpGuestMemoryFormat: ++# ++# An enumeration of guest-memory-dump's format. ++# ++# @elf: elf format ++# ++# @kdump-zlib: kdump-compressed format with zlib-compressed ++# ++# @kdump-lzo: kdump-compressed format with lzo-compressed ++# ++# @kdump-snappy: kdump-compressed format with snappy-compressed ++# ++# Since: 2.0 ++## ++{ 'enum': 'DumpGuestMemoryFormat', ++ 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy' ] } ++ ++## + # @dump-guest-memory + # + # Dump guest's memory to vmcore. It is a synchronous operation that can take +@@ -2613,13 +2631,18 @@ + # want to dump all guest's memory, please specify the start @begin + # and @length + # ++# @format: #optional if specified, the format of guest memory dump. But non-elf ++# format is conflict with paging and filter, ie. @paging, @begin and ++# @length is not allowed to be specified with non-elf @format at the ++# same time (since 2.0) ++# + # Returns: nothing on success + # + # Since: 1.2 + ## + { 'command': 'dump-guest-memory', + 'data': { 'paging': 'bool', 'protocol': 'str', '*begin': 'int', +- '*length': 'int' } } ++ '*length': 'int', '*format': 'DumpGuestMemoryFormat' } } + + ## + # @netdev_add: +diff --git a/qmp-commands.hx b/qmp-commands.hx +index e164ff8..61aa3bf 100644 +--- a/qmp-commands.hx ++++ b/qmp-commands.hx +@@ -885,8 +885,8 @@ EQMP + + { + .name = "dump-guest-memory", +- .args_type = "paging:b,protocol:s,begin:i?,end:i?", +- .params = "-p protocol [begin] [length]", ++ .args_type = "paging:b,protocol:s,begin:i?,end:i?,format:s?", ++ .params = "-p protocol [begin] [length] [format]", + .help = "dump guest memory to file", + .user_print = monitor_user_noop, + .mhandler.cmd_new = qmp_marshal_input_dump_guest_memory, +@@ -907,6 +907,9 @@ Arguments: + with length together (json-int) + - "length": the memory size, in bytes. It's optional, and should be specified + with begin together (json-int) ++- "format": the format of guest memory dump. It's optional, and can be ++ elf|kdump-zlib|kdump-lzo|kdump-snappy, but non-elf formats will ++ conflict with paging and filter, ie. begin and length (json-string) + + Example: + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch b/SOURCES/kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch new file mode 100644 index 0000000..5e27e48 --- /dev/null +++ b/SOURCES/kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch @@ -0,0 +1,56 @@ +From c4249cf0d89f6a5ba4448eb1ff22f496387d0e50 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:11 +0100 +Subject: [PATCH 24/41] dump: select header bitness based on ELF class, not ELF + architecture + +Message-id: <1415380693-16593-25-git-send-email-lersek@redhat.com> +Patchwork-id: 62212 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 24/26] dump: select header bitness based on ELF class, not ELF architecture +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +The specific ELF architecture (d_machine) carries Too Much Information +(TM) for deciding between create_header32() and create_header64(), use +"d_class" instead (ELFCLASS32 vs. ELFCLASS64). + +This change adapts write_dump_header() to write_elf_loads(), dump_begin() +etc. that also rely on the ELF class of the target for bitness selection. + +Considering the current targets that support dumping, cpu_get_dump_info() +works as follows: +- target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only +- target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only +- target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386, + ELFCLASS32) keying off the same Long Mode Active flag. + +Hence no observable change. + +Approximately-suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit 24aeeace7a9f264688e9eda77b6c04db607cbdfd) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dump.c b/dump.c +index f8e0fd7..450f658 100644 +--- a/dump.c ++++ b/dump.c +@@ -1006,7 +1006,7 @@ out: + + static int write_dump_header(DumpState *s) + { +- if (s->dump_info.d_machine == EM_386) { ++ if (s->dump_info.d_class == ELFCLASS32) { + return create_header32(s); + } else { + return create_header64(s); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-simplify-get_len_buf_out.patch b/SOURCES/kvm-dump-simplify-get_len_buf_out.patch new file mode 100644 index 0000000..153eb72 --- /dev/null +++ b/SOURCES/kvm-dump-simplify-get_len_buf_out.patch @@ -0,0 +1,99 @@ +From 82282810cd1209496183ccadfdaf0dba7d7621e8 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:13 +0100 +Subject: [PATCH 26/41] dump: simplify get_len_buf_out() + +Message-id: <1415380693-16593-27-git-send-email-lersek@redhat.com> +Patchwork-id: 62209 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 26/26] dump: simplify get_len_buf_out() +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +We can (and should) rely on the fact that s->flag_compress is exactly one +of DUMP_DH_COMPRESSED_ZLIB, DUMP_DH_COMPRESSED_LZO, and +DUMP_DH_COMPRESSED_SNAPPY. + +This is ensured by the QMP schema and dump_init() in combination. + +Suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit b87ef3518b2eeb9a57ee0d06d7e82a07ab5e4ffd) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 46 ++++++++++++++++------------------------------ + 1 file changed, 16 insertions(+), 30 deletions(-) + +diff --git a/dump.c b/dump.c +index f980354..e9bd237 100644 +--- a/dump.c ++++ b/dump.c +@@ -1226,35 +1226,24 @@ static void free_data_cache(DataCache *data_cache) + + static size_t get_len_buf_out(size_t page_size, uint32_t flag_compress) + { +- size_t len_buf_out_zlib, len_buf_out_lzo, len_buf_out_snappy; +- size_t len_buf_out; +- +- /* init buf_out */ +- len_buf_out_zlib = len_buf_out_lzo = len_buf_out_snappy = 0; +- +- /* buf size for zlib */ +- len_buf_out_zlib = compressBound(page_size); +- +- /* buf size for lzo */ +-#ifdef CONFIG_LZO +- /* +- * LZO will expand incompressible data by a little amount. please check the +- * following URL to see the expansion calculation: +- * http://www.oberhumer.com/opensource/lzo/lzofaq.php +- */ +- len_buf_out_lzo = page_size + page_size / 16 + 64 + 3; +-#endif ++ switch (flag_compress) { ++ case DUMP_DH_COMPRESSED_ZLIB: ++ return compressBound(page_size); ++ ++ case DUMP_DH_COMPRESSED_LZO: ++ /* ++ * LZO will expand incompressible data by a little amount. Please check ++ * the following URL to see the expansion calculation: ++ * http://www.oberhumer.com/opensource/lzo/lzofaq.php ++ */ ++ return page_size + page_size / 16 + 64 + 3; + + #ifdef CONFIG_SNAPPY +- /* buf size for snappy */ +- len_buf_out_snappy = snappy_max_compressed_length(page_size); ++ case DUMP_DH_COMPRESSED_SNAPPY: ++ return snappy_max_compressed_length(page_size); + #endif +- +- /* get the biggest that can store all kinds of compressed page */ +- len_buf_out = MAX(len_buf_out_zlib, +- MAX(len_buf_out_lzo, len_buf_out_snappy)); +- +- return len_buf_out; ++ } ++ return 0; + } + + /* +@@ -1290,10 +1279,7 @@ static int write_dump_pages(DumpState *s) + + /* prepare buffer to store compressed data */ + len_buf_out = get_len_buf_out(TARGET_PAGE_SIZE, s->flag_compress); +- if (len_buf_out == 0) { +- dump_error(s, "dump: failed to get length of output buffer.\n"); +- goto out; +- } ++ assert(len_buf_out != 0); + + #ifdef CONFIG_LZO + wrkmem = g_malloc(LZO1X_1_MEM_COMPRESS); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-dump-simplify-write_start_flat_header.patch b/SOURCES/kvm-dump-simplify-write_start_flat_header.patch new file mode 100644 index 0000000..016959c --- /dev/null +++ b/SOURCES/kvm-dump-simplify-write_start_flat_header.patch @@ -0,0 +1,76 @@ +From b170e55f6dff27d44e32667af0f79a4c2704711b Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Nov 2014 17:18:08 +0100 +Subject: [PATCH 21/41] dump: simplify write_start_flat_header() + +Message-id: <1415380693-16593-22-git-send-email-lersek@redhat.com> +Patchwork-id: 62207 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 21/26] dump: simplify write_start_flat_header() +Bugzilla: 1157798 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Luiz Capitulino +RH-Acked-by: dgibson + +Currently, the function +- defines and populates an auto variable of type MakedumpfileHeader +- allocates and zeroes a buffer of size MAX_SIZE_MDF_HEADER (4096) +- copies the former into the latter (covering an initial portion of the + latter) + +Fill in the MakedumpfileHeader structure in its final place (the alignment +is OK because the structure lives at the address returned by g_malloc0()). + +Approximately-suggested-by: Luiz Capitulino +Signed-off-by: Laszlo Ersek +Reviewed-by: Paolo Bonzini +Signed-off-by: Luiz Capitulino +(cherry picked from commit 92ba1401e0f81ea170803045c1ae366bf5d9d87e) +Signed-off-by: Miroslav Rezanina +--- + dump.c | 20 +++++++++----------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +diff --git a/dump.c b/dump.c +index 533b914..ee28777 100644 +--- a/dump.c ++++ b/dump.c +@@ -717,27 +717,25 @@ static int create_vmcore(DumpState *s) + + static int write_start_flat_header(int fd) + { +- uint8_t *buf; +- MakedumpfileHeader mh; ++ MakedumpfileHeader *mh; + int ret = 0; + +- memset(&mh, 0, sizeof(mh)); +- memcpy(mh.signature, MAKEDUMPFILE_SIGNATURE, +- MIN(sizeof mh.signature, sizeof MAKEDUMPFILE_SIGNATURE)); ++ QEMU_BUILD_BUG_ON(sizeof *mh > MAX_SIZE_MDF_HEADER); ++ mh = g_malloc0(MAX_SIZE_MDF_HEADER); + +- mh.type = cpu_to_be64(TYPE_FLAT_HEADER); +- mh.version = cpu_to_be64(VERSION_FLAT_HEADER); ++ memcpy(mh->signature, MAKEDUMPFILE_SIGNATURE, ++ MIN(sizeof mh->signature, sizeof MAKEDUMPFILE_SIGNATURE)); + +- buf = g_malloc0(MAX_SIZE_MDF_HEADER); +- memcpy(buf, &mh, sizeof(mh)); ++ mh->type = cpu_to_be64(TYPE_FLAT_HEADER); ++ mh->version = cpu_to_be64(VERSION_FLAT_HEADER); + + size_t written_size; +- written_size = qemu_write_full(fd, buf, MAX_SIZE_MDF_HEADER); ++ written_size = qemu_write_full(fd, mh, MAX_SIZE_MDF_HEADER); + if (written_size != MAX_SIZE_MDF_HEADER) { + ret = -1; + } + +- g_free(buf); ++ g_free(mh); + return ret; + } + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-error-Add-error_abort.patch b/SOURCES/kvm-error-Add-error_abort.patch new file mode 100644 index 0000000..27e8236 --- /dev/null +++ b/SOURCES/kvm-error-Add-error_abort.patch @@ -0,0 +1,123 @@ +From 2112c4a8297592045ac8ed8b0677e81208296364 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:05 +0200 +Subject: [PATCH 02/19] error: Add error_abort + +Message-id: <1414059011-15516-3-git-send-email-kwolf@redhat.com> +Patchwork-id: 61836 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 2/8] error: Add error_abort +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Peter Crosthwaite + +Add a special Error * that can be passed to error handling APIs to +signal that any errors are fatal and should abort QEMU. There are two +advantages to this: + +- allows for brevity when wishing to assert success of Error ** + accepting APIs. No need for this pattern: + Error * local_err = NULL; + api_call(foo, bar, &local_err); + assert_no_error(local_err); + This also removes the need for _nofail variants of APIs with + asserting call sites now reduced to 1LOC. +- SIGABRT happens from within the offending API. When a fatal error + occurs in an API call (when the caller is asserting sucess) failure + often means the API itself is broken. With the abort happening in the + API call now, the stack frames into the call are available at debug + time. In the assert_no_error scheme the abort happens after the fact. + +The exact semantic is that when an error is raised, if the argument +Error ** matches &error_abort, then the abort occurs immediately. The +error messaged is reported. + +For error_propagate, if the destination error is &error_abort, then +the abort happens at propagation time. + +Signed-off-by: Peter Crosthwaite +Reviewed-by: Markus Armbruster +Signed-off-by: Luiz Capitulino +(cherry picked from commit 5d24ee70bcbcf578614193526bcd5ed30a8eb16c) +Signed-off-by: Miroslav Rezanina + +Conflicts: + util/error.c + +Conflicts because RHEL 7 doesn't have error_set_win32(). + +Signed-off-by: Kevin Wolf +--- + include/qapi/error.h | 6 ++++++ + util/error.c | 17 ++++++++++++++++- + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/include/qapi/error.h b/include/qapi/error.h +index ffd1cea..fc7f44a 100644 +--- a/include/qapi/error.h ++++ b/include/qapi/error.h +@@ -82,4 +82,10 @@ void error_propagate(Error **dst_err, Error *local_err); + */ + void error_free(Error *err); + ++/** ++ * If passed to error_set and friends, abort(). ++ */ ++ ++extern Error *error_abort; ++ + #endif +diff --git a/util/error.c b/util/error.c +index 53b0435..82658bb 100644 +--- a/util/error.c ++++ b/util/error.c +@@ -23,6 +23,8 @@ struct Error + ErrorClass err_class; + }; + ++Error *error_abort; ++ + void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) + { + Error *err; +@@ -40,6 +42,11 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) + va_end(ap); + err->err_class = err_class; + ++ if (errp == &error_abort) { ++ error_report("%s", error_get_pretty(err)); ++ abort(); ++ } ++ + *errp = err; + } + +@@ -68,6 +75,11 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, + va_end(ap); + err->err_class = err_class; + ++ if (errp == &error_abort) { ++ error_report("%s", error_get_pretty(err)); ++ abort(); ++ } ++ + *errp = err; + } + +@@ -112,7 +124,10 @@ void error_free(Error *err) + + void error_propagate(Error **dst_err, Error *local_err) + { +- if (dst_err && !*dst_err) { ++ if (local_err && dst_err == &error_abort) { ++ error_report("%s", error_get_pretty(local_err)); ++ abort(); ++ } else if (dst_err && !*dst_err) { + *dst_err = local_err; + } else if (local_err) { + error_free(local_err); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-exit-when-no-kvm-and-vcpu-count-160.patch b/SOURCES/kvm-exit-when-no-kvm-and-vcpu-count-160.patch new file mode 100644 index 0000000..a112c50 --- /dev/null +++ b/SOURCES/kvm-exit-when-no-kvm-and-vcpu-count-160.patch @@ -0,0 +1,121 @@ +From bc949bc00c11f49ba6be7be5b4f1bfc7df93aad5 Mon Sep 17 00:00:00 2001 +From: Marcelo Tosatti +Date: Wed, 9 Jul 2014 13:17:15 +0200 +Subject: [PATCH 04/13] exit when -no-kvm and vcpu count > 160 + +Message-id: <20140506072044.GA25261@amt.cnet> +Patchwork-id: 58695 +O-Subject: [RHEL7 qemu-kvm PATCH] exit when -no-kvm and vcpu count > 160 +Bugzilla: 1076326 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Andrew Jones +RH-Acked-by: Markus Armbruster +RH-Acked-by: Eduardo Habkost + +Exit when booting with -no-kvm and number of vcpus is +larger than 160. + +Signed-off-by: Marcelo Tosatti +BZ: 1076326 +--- + hw/i386/pc_piix.c | 14 +++++++------- + hw/i386/pc_q35.c | 2 +- + include/hw/i386/pc.h | 2 ++ + 3 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index aeec6f2..550acd8 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -788,7 +788,7 @@ static QEMUMachine pc_machine_rhel700 = { + .desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)", + .init = pc_init_rhel700, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .is_default = 1, + .default_machine_opts = "firmware=bios-256k.bin", + DEFAULT_MACHINE_OPTIONS, +@@ -969,7 +969,7 @@ static QEMUMachine pc_machine_rhel650 = { + .desc = "RHEL 6.5.0 PC", + .init = pc_init_rhel650, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_5_COMPAT, + { /* end of list */ } +@@ -1018,7 +1018,7 @@ static QEMUMachine pc_machine_rhel640 = { + .desc = "RHEL 6.4.0 PC", + .init = pc_init_rhel640, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_4_COMPAT, + { /* end of list */ } +@@ -1094,7 +1094,7 @@ static QEMUMachine pc_machine_rhel630 = { + .desc = "RHEL 6.3.0 PC", + .init = pc_init_rhel630, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_3_COMPAT, + { /* end of list */ } +@@ -1126,7 +1126,7 @@ static QEMUMachine pc_machine_rhel620 = { + .desc = "RHEL 6.2.0 PC", + .init = pc_init_rhel620, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_2_COMPAT, + { /* end of list */ } +@@ -1199,7 +1199,7 @@ static QEMUMachine pc_machine_rhel610 = { + .desc = "RHEL 6.1.0 PC", + .init = pc_init_rhel610, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_1_COMPAT, + { /* end of list */ } +@@ -1239,7 +1239,7 @@ static QEMUMachine pc_machine_rhel600 = { + .desc = "RHEL 6.0.0 PC", + .init = pc_init_rhel600, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .compat_props = (GlobalProperty[]) { + PC_RHEL6_0_COMPAT, + { /* end of list */ } +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 1aa8bde..4534539 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -311,7 +311,7 @@ static QEMUMachine pc_q35_machine_rhel700 = { + .desc = "RHEL-7.0.0 PC (Q35 + ICH9, 2009)", + .init = pc_q35_init_rhel700, + .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = 255, ++ .max_cpus = RHEL_MAX_CPUS, + .default_machine_opts = "firmware=bios-256k.bin", + DEFAULT_MACHINE_OPTIONS, + }; +diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h +index 8a69347..57e2f93 100644 +--- a/include/hw/i386/pc.h ++++ b/include/hw/i386/pc.h +@@ -15,6 +15,8 @@ + #include "sysemu/sysemu.h" + #include "hw/pci/pci.h" + ++#define RHEL_MAX_CPUS 160 ++ + /* PC-style peripherals (also used by other machines). */ + + typedef struct PcPciInfo { +-- +1.7.1 + diff --git a/SOURCES/kvm-fpu-softfloat-drop-INLINE-macro.patch b/SOURCES/kvm-fpu-softfloat-drop-INLINE-macro.patch new file mode 100644 index 0000000..1eb37bd --- /dev/null +++ b/SOURCES/kvm-fpu-softfloat-drop-INLINE-macro.patch @@ -0,0 +1,704 @@ +From 05ea4eb9e64508f25f806683a470b68fb286770e Mon Sep 17 00:00:00 2001 +Message-Id: <05ea4eb9e64508f25f806683a470b68fb286770e.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:17 -0600 +Subject: [CHANGE 23/31] fpu: softfloat: drop INLINE macro +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-24-git-send-email-famz@redhat.com> +Patchwork-id: 62696 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 23/30] fpu: softfloat: drop INLINE macro +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Luiz Capitulino + +This commit expands all uses of the INLINE macro and drop it. + +The reason for this is to avoid clashes with external libraries with +bad name conventions and also because renaming keywords is not a good +practice. + +PS: I'm fine with this change to be licensed under softfloat-2a or +softfloat-2b. + +Signed-off-by: Luiz Capitulino +(cherry picked from commit a49db98d1f85ada0c4e5bb22bd93d541e7159c43) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson + +Conflicts: + fpu/softfloat.c + include/fpu/softfloat.h +The code that uses "INLINE" is different, but the conflict resolution is +trivially expand "INLINE" to "static inline". + +Signed-off-by: Jeff E. Nelson +--- + fpu/softfloat-macros.h | 38 ++++++++++++------------- + fpu/softfloat.c | 48 ++++++++++++++++---------------- + include/fpu/softfloat.h | 73 ++++++++++++++++++++++++------------------------- + 3 files changed, 79 insertions(+), 80 deletions(-) + +diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h +index b5164af..24ec452 100644 +--- a/fpu/softfloat-macros.h ++++ b/fpu/softfloat-macros.h +@@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained. + | The result is stored in the location pointed to by `zPtr'. + *----------------------------------------------------------------------------*/ + +-INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr) ++static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr) + { + uint32_t z; + +@@ -81,7 +81,7 @@ INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr) + | The result is stored in the location pointed to by `zPtr'. + *----------------------------------------------------------------------------*/ + +-INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr) ++static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr) + { + uint64_t z; + +@@ -115,7 +115,7 @@ INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr) + | described above, and is returned at the location pointed to by `z1Ptr'.) + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shift64ExtraRightJamming( + uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) + { +@@ -152,7 +152,7 @@ INLINE void + | which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shift128Right( + uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) + { +@@ -187,7 +187,7 @@ INLINE void + | the locations pointed to by `z0Ptr' and `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shift128RightJamming( + uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) + { +@@ -238,7 +238,7 @@ INLINE void + | `z2Ptr'.) + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shift128ExtraRightJamming( + uint64_t a0, + uint64_t a1, +@@ -296,7 +296,7 @@ INLINE void + | pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shortShift128Left( + uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) + { +@@ -315,7 +315,7 @@ INLINE void + | `z1Ptr', and `z2Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + shortShift192Left( + uint64_t a0, + uint64_t a1, +@@ -350,7 +350,7 @@ INLINE void + | are stored at the locations pointed to by `z0Ptr' and `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + add128( + uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr ) + { +@@ -370,7 +370,7 @@ INLINE void + | `z1Ptr', and `z2Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + add192( + uint64_t a0, + uint64_t a1, +@@ -408,7 +408,7 @@ INLINE void + | `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + sub128( + uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr ) + { +@@ -426,7 +426,7 @@ INLINE void + | pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + sub192( + uint64_t a0, + uint64_t a1, +@@ -462,7 +462,7 @@ INLINE void + | `z0Ptr' and `z1Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr ) ++static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr ) + { + uint32_t aHigh, aLow, bHigh, bLow; + uint64_t z0, zMiddleA, zMiddleB, z1; +@@ -492,7 +492,7 @@ INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr + | `z2Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + mul128By64To192( + uint64_t a0, + uint64_t a1, +@@ -520,7 +520,7 @@ INLINE void + | the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'. + *----------------------------------------------------------------------------*/ + +-INLINE void ++static inline void + mul128To256( + uint64_t a0, + uint64_t a1, +@@ -702,7 +702,7 @@ static int8 countLeadingZeros64( uint64_t a ) + | Otherwise, returns 0. + *----------------------------------------------------------------------------*/ + +-INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) ++static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + { + + return ( a0 == b0 ) && ( a1 == b1 ); +@@ -715,7 +715,7 @@ INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + | Otherwise, returns 0. + *----------------------------------------------------------------------------*/ + +-INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) ++static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + { + + return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) ); +@@ -728,7 +728,7 @@ INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + | returns 0. + *----------------------------------------------------------------------------*/ + +-INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) ++static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + { + + return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) ); +@@ -741,7 +741,7 @@ INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + | Otherwise, returns 0. + *----------------------------------------------------------------------------*/ + +-INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) ++static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 ) + { + + return ( a0 != b0 ) || ( a1 != b1 ); +diff --git a/fpu/softfloat.c b/fpu/softfloat.c +index 7ba51b6..30623cb 100644 +--- a/fpu/softfloat.c ++++ b/fpu/softfloat.c +@@ -78,7 +78,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM) + | Returns the fraction bits of the half-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint32_t extractFloat16Frac(float16 a) ++static inline uint32_t extractFloat16Frac(float16 a) + { + return float16_val(a) & 0x3ff; + } +@@ -87,7 +87,7 @@ INLINE uint32_t extractFloat16Frac(float16 a) + | Returns the exponent bits of the half-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE int_fast16_t extractFloat16Exp(float16 a) ++static inline int_fast16_t extractFloat16Exp(float16 a) + { + return (float16_val(a) >> 10) & 0x1f; + } +@@ -96,7 +96,7 @@ INLINE int_fast16_t extractFloat16Exp(float16 a) + | Returns the sign bit of the single-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE flag extractFloat16Sign(float16 a) ++static inline flag extractFloat16Sign(float16 a) + { + return float16_val(a)>>15; + } +@@ -207,7 +207,7 @@ static int64 roundAndPackInt64( flag zSign, uint64_t absZ0, uint64_t absZ1 STATU + | Returns the fraction bits of the single-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint32_t extractFloat32Frac( float32 a ) ++static inline uint32_t extractFloat32Frac( float32 a ) + { + + return float32_val(a) & 0x007FFFFF; +@@ -218,7 +218,7 @@ INLINE uint32_t extractFloat32Frac( float32 a ) + | Returns the exponent bits of the single-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE int_fast16_t extractFloat32Exp(float32 a) ++static inline int_fast16_t extractFloat32Exp(float32 a) + { + + return ( float32_val(a)>>23 ) & 0xFF; +@@ -229,7 +229,7 @@ INLINE int_fast16_t extractFloat32Exp(float32 a) + | Returns the sign bit of the single-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE flag extractFloat32Sign( float32 a ) ++static inline flag extractFloat32Sign( float32 a ) + { + + return float32_val(a)>>31; +@@ -280,7 +280,7 @@ static void + | significand. + *----------------------------------------------------------------------------*/ + +-INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig) ++static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig) + { + + return make_float32( +@@ -389,7 +389,7 @@ static float32 + | Returns the fraction bits of the double-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint64_t extractFloat64Frac( float64 a ) ++static inline uint64_t extractFloat64Frac( float64 a ) + { + + return float64_val(a) & LIT64( 0x000FFFFFFFFFFFFF ); +@@ -400,7 +400,7 @@ INLINE uint64_t extractFloat64Frac( float64 a ) + | Returns the exponent bits of the double-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE int_fast16_t extractFloat64Exp(float64 a) ++static inline int_fast16_t extractFloat64Exp(float64 a) + { + + return ( float64_val(a)>>52 ) & 0x7FF; +@@ -411,7 +411,7 @@ INLINE int_fast16_t extractFloat64Exp(float64 a) + | Returns the sign bit of the double-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE flag extractFloat64Sign( float64 a ) ++static inline flag extractFloat64Sign( float64 a ) + { + + return float64_val(a)>>63; +@@ -462,7 +462,7 @@ static void + | significand. + *----------------------------------------------------------------------------*/ + +-INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig) ++static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig) + { + + return make_float64( +@@ -572,7 +572,7 @@ static float64 + | value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint64_t extractFloatx80Frac( floatx80 a ) ++static inline uint64_t extractFloatx80Frac( floatx80 a ) + { + + return a.low; +@@ -584,7 +584,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a ) + | value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE int32 extractFloatx80Exp( floatx80 a ) ++static inline int32 extractFloatx80Exp( floatx80 a ) + { + + return a.high & 0x7FFF; +@@ -596,7 +596,7 @@ INLINE int32 extractFloatx80Exp( floatx80 a ) + | `a'. + *----------------------------------------------------------------------------*/ + +-INLINE flag extractFloatx80Sign( floatx80 a ) ++static inline flag extractFloatx80Sign( floatx80 a ) + { + + return a.high>>15; +@@ -626,7 +626,7 @@ static void + | extended double-precision floating-point value, returning the result. + *----------------------------------------------------------------------------*/ + +-INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) ++static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) + { + floatx80 z; + +@@ -857,7 +857,7 @@ static floatx80 + | floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint64_t extractFloat128Frac1( float128 a ) ++static inline uint64_t extractFloat128Frac1( float128 a ) + { + + return a.low; +@@ -869,7 +869,7 @@ INLINE uint64_t extractFloat128Frac1( float128 a ) + | floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE uint64_t extractFloat128Frac0( float128 a ) ++static inline uint64_t extractFloat128Frac0( float128 a ) + { + + return a.high & LIT64( 0x0000FFFFFFFFFFFF ); +@@ -881,7 +881,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a ) + | `a'. + *----------------------------------------------------------------------------*/ + +-INLINE int32 extractFloat128Exp( float128 a ) ++static inline int32 extractFloat128Exp( float128 a ) + { + + return ( a.high>>48 ) & 0x7FFF; +@@ -892,7 +892,7 @@ INLINE int32 extractFloat128Exp( float128 a ) + | Returns the sign bit of the quadruple-precision floating-point value `a'. + *----------------------------------------------------------------------------*/ + +-INLINE flag extractFloat128Sign( float128 a ) ++static inline flag extractFloat128Sign( float128 a ) + { + + return a.high>>63; +@@ -953,7 +953,7 @@ static void + | significand. + *----------------------------------------------------------------------------*/ + +-INLINE float128 ++static inline float128 + packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 ) + { + float128 z; +@@ -6560,7 +6560,7 @@ uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM) + } + + #define COMPARE(s, nan_exp) \ +-INLINE int float ## s ## _compare_internal( float ## s a, float ## s b, \ ++static inline int float ## s ## _compare_internal( float ## s a, float ## s b, \ + int is_quiet STATUS_PARAM ) \ + { \ + flag aSign, bSign; \ +@@ -6612,7 +6612,7 @@ int float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM ) \ + COMPARE(32, 0xff) + COMPARE(64, 0x7ff) + +-INLINE int floatx80_compare_internal( floatx80 a, floatx80 b, ++static inline int floatx80_compare_internal( floatx80 a, floatx80 b, + int is_quiet STATUS_PARAM ) + { + flag aSign, bSign; +@@ -6658,7 +6658,7 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM ) + return floatx80_compare_internal(a, b, 1 STATUS_VAR); + } + +-INLINE int float128_compare_internal( float128 a, float128 b, ++static inline int float128_compare_internal( float128 a, float128 b, + int is_quiet STATUS_PARAM ) + { + flag aSign, bSign; +@@ -6707,7 +6707,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM ) + * NaNs and +0 vs -0. + */ + #define MINMAX(s, nan_exp) \ +-INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \ ++static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ + int ismin STATUS_PARAM ) \ + { \ + flag aSign, bSign; \ +diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h +index f3927e2..de4940c 100644 +--- a/include/fpu/softfloat.h ++++ b/include/fpu/softfloat.h +@@ -63,7 +63,6 @@ typedef uint64_t uint64; + typedef int64_t int64; + + #define LIT64( a ) a##LL +-#define INLINE static inline + + #define STATUS_PARAM , float_status *status + #define STATUS(field) status->field +@@ -182,23 +181,23 @@ typedef struct float_status { + + void set_float_rounding_mode(int val STATUS_PARAM); + void set_float_exception_flags(int val STATUS_PARAM); +-INLINE void set_float_detect_tininess(int val STATUS_PARAM) ++static inline void set_float_detect_tininess(int val STATUS_PARAM) + { + STATUS(float_detect_tininess) = val; + } +-INLINE void set_flush_to_zero(flag val STATUS_PARAM) ++static inline void set_flush_to_zero(flag val STATUS_PARAM) + { + STATUS(flush_to_zero) = val; + } +-INLINE void set_flush_inputs_to_zero(flag val STATUS_PARAM) ++static inline void set_flush_inputs_to_zero(flag val STATUS_PARAM) + { + STATUS(flush_inputs_to_zero) = val; + } +-INLINE void set_default_nan_mode(flag val STATUS_PARAM) ++static inline void set_default_nan_mode(flag val STATUS_PARAM) + { + STATUS(default_nan_mode) = val; + } +-INLINE int get_float_exception_flags(float_status *status) ++static inline int get_float_exception_flags(float_status *status) + { + return STATUS(float_exception_flags); + } +@@ -252,7 +251,7 @@ int float16_is_quiet_nan( float16 ); + int float16_is_signaling_nan( float16 ); + float16 float16_maybe_silence_nan( float16 ); + +-INLINE int float16_is_any_nan(float16 a) ++static inline int float16_is_any_nan(float16 a) + { + return ((float16_val(a) & ~0x8000) > 0x7c00); + } +@@ -307,7 +306,7 @@ int float32_is_signaling_nan( float32 ); + float32 float32_maybe_silence_nan( float32 ); + float32 float32_scalbn( float32, int STATUS_PARAM ); + +-INLINE float32 float32_abs(float32 a) ++static inline float32 float32_abs(float32 a) + { + /* Note that abs does *not* handle NaN specially, nor does + * it flush denormal inputs to zero. +@@ -315,7 +314,7 @@ INLINE float32 float32_abs(float32 a) + return make_float32(float32_val(a) & 0x7fffffff); + } + +-INLINE float32 float32_chs(float32 a) ++static inline float32 float32_chs(float32 a) + { + /* Note that chs does *not* handle NaN specially, nor does + * it flush denormal inputs to zero. +@@ -323,32 +322,32 @@ INLINE float32 float32_chs(float32 a) + return make_float32(float32_val(a) ^ 0x80000000); + } + +-INLINE int float32_is_infinity(float32 a) ++static inline int float32_is_infinity(float32 a) + { + return (float32_val(a) & 0x7fffffff) == 0x7f800000; + } + +-INLINE int float32_is_neg(float32 a) ++static inline int float32_is_neg(float32 a) + { + return float32_val(a) >> 31; + } + +-INLINE int float32_is_zero(float32 a) ++static inline int float32_is_zero(float32 a) + { + return (float32_val(a) & 0x7fffffff) == 0; + } + +-INLINE int float32_is_any_nan(float32 a) ++static inline int float32_is_any_nan(float32 a) + { + return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL); + } + +-INLINE int float32_is_zero_or_denormal(float32 a) ++static inline int float32_is_zero_or_denormal(float32 a) + { + return (float32_val(a) & 0x7f800000) == 0; + } + +-INLINE float32 float32_set_sign(float32 a, int sign) ++static inline float32 float32_set_sign(float32 a, int sign) + { + return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); + } +@@ -413,7 +412,7 @@ int float64_is_signaling_nan( float64 ); + float64 float64_maybe_silence_nan( float64 ); + float64 float64_scalbn( float64, int STATUS_PARAM ); + +-INLINE float64 float64_abs(float64 a) ++static inline float64 float64_abs(float64 a) + { + /* Note that abs does *not* handle NaN specially, nor does + * it flush denormal inputs to zero. +@@ -421,7 +420,7 @@ INLINE float64 float64_abs(float64 a) + return make_float64(float64_val(a) & 0x7fffffffffffffffLL); + } + +-INLINE float64 float64_chs(float64 a) ++static inline float64 float64_chs(float64 a) + { + /* Note that chs does *not* handle NaN specially, nor does + * it flush denormal inputs to zero. +@@ -429,32 +428,32 @@ INLINE float64 float64_chs(float64 a) + return make_float64(float64_val(a) ^ 0x8000000000000000LL); + } + +-INLINE int float64_is_infinity(float64 a) ++static inline int float64_is_infinity(float64 a) + { + return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL; + } + +-INLINE int float64_is_neg(float64 a) ++static inline int float64_is_neg(float64 a) + { + return float64_val(a) >> 63; + } + +-INLINE int float64_is_zero(float64 a) ++static inline int float64_is_zero(float64 a) + { + return (float64_val(a) & 0x7fffffffffffffffLL) == 0; + } + +-INLINE int float64_is_any_nan(float64 a) ++static inline int float64_is_any_nan(float64 a) + { + return ((float64_val(a) & ~(1ULL << 63)) > 0x7ff0000000000000ULL); + } + +-INLINE int float64_is_zero_or_denormal(float64 a) ++static inline int float64_is_zero_or_denormal(float64 a) + { + return (float64_val(a) & 0x7ff0000000000000LL) == 0; + } + +-INLINE float64 float64_set_sign(float64 a, int sign) ++static inline float64 float64_set_sign(float64 a, int sign) + { + return make_float64((float64_val(a) & 0x7fffffffffffffffULL) + | ((int64_t)sign << 63)); +@@ -508,39 +507,39 @@ int floatx80_is_signaling_nan( floatx80 ); + floatx80 floatx80_maybe_silence_nan( floatx80 ); + floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM ); + +-INLINE floatx80 floatx80_abs(floatx80 a) ++static inline floatx80 floatx80_abs(floatx80 a) + { + a.high &= 0x7fff; + return a; + } + +-INLINE floatx80 floatx80_chs(floatx80 a) ++static inline floatx80 floatx80_chs(floatx80 a) + { + a.high ^= 0x8000; + return a; + } + +-INLINE int floatx80_is_infinity(floatx80 a) ++static inline int floatx80_is_infinity(floatx80 a) + { + return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL; + } + +-INLINE int floatx80_is_neg(floatx80 a) ++static inline int floatx80_is_neg(floatx80 a) + { + return a.high >> 15; + } + +-INLINE int floatx80_is_zero(floatx80 a) ++static inline int floatx80_is_zero(floatx80 a) + { + return (a.high & 0x7fff) == 0 && a.low == 0; + } + +-INLINE int floatx80_is_zero_or_denormal(floatx80 a) ++static inline int floatx80_is_zero_or_denormal(floatx80 a) + { + return (a.high & 0x7fff) == 0; + } + +-INLINE int floatx80_is_any_nan(floatx80 a) ++static inline int floatx80_is_any_nan(floatx80 a) + { + return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); + } +@@ -593,39 +592,39 @@ int float128_is_signaling_nan( float128 ); + float128 float128_maybe_silence_nan( float128 ); + float128 float128_scalbn( float128, int STATUS_PARAM ); + +-INLINE float128 float128_abs(float128 a) ++static inline float128 float128_abs(float128 a) + { + a.high &= 0x7fffffffffffffffLL; + return a; + } + +-INLINE float128 float128_chs(float128 a) ++static inline float128 float128_chs(float128 a) + { + a.high ^= 0x8000000000000000LL; + return a; + } + +-INLINE int float128_is_infinity(float128 a) ++static inline int float128_is_infinity(float128 a) + { + return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0; + } + +-INLINE int float128_is_neg(float128 a) ++static inline int float128_is_neg(float128 a) + { + return a.high >> 63; + } + +-INLINE int float128_is_zero(float128 a) ++static inline int float128_is_zero(float128 a) + { + return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; + } + +-INLINE int float128_is_zero_or_denormal(float128 a) ++static inline int float128_is_zero_or_denormal(float128 a) + { + return (a.high & 0x7fff000000000000LL) == 0; + } + +-INLINE int float128_is_any_nan(float128 a) ++static inline int float128_is_any_nan(float128 a) + { + return ((a.high >> 48) & 0x7fff) == 0x7fff && + ((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0)); +-- +2.1.0 + diff --git a/SOURCES/kvm-gluster-Add-discard-support-for-GlusterFS-block-driv.patch b/SOURCES/kvm-gluster-Add-discard-support-for-GlusterFS-block-driv.patch new file mode 100644 index 0000000..460f00b --- /dev/null +++ b/SOURCES/kvm-gluster-Add-discard-support-for-GlusterFS-block-driv.patch @@ -0,0 +1,149 @@ +From d4ddb41fc6868d41f38d9a4bec0f4ad7d332add9 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 2 Sep 2014 19:34:06 +0200 +Subject: [PATCH 3/6] gluster: Add discard support for GlusterFS block driver. + +Message-id: <6b5e10e9b95a3030bb19540324915e0b774bd5bb.1409686386.git.jcody@redhat.com> +Patchwork-id: 60815 +O-Subject: [PATCH qemu-kvm-rhev RHEL7.1] gluster: Add discard support for GlusterFS block driver. +Bugzilla: 1136534 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Fam Zheng + +From: Bharata B Rao + +Implement bdrv_aio_discard for gluster. + +Signed-off-by: Bharata B Rao +Reviewed-by: Kevin Wolf +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 0c14fb47ece5ef42d7a0a4b3e8e43e022b375720) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/gluster.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ + configure | 8 ++++++++ + 2 files changed, 53 insertions(+), 0 deletions(-) + +diff --git a/block/gluster.c b/block/gluster.c +index f43d3a6..da43d0c 100644 +--- a/block/gluster.c ++++ b/block/gluster.c +@@ -633,6 +633,39 @@ out: + return NULL; + } + ++#ifdef CONFIG_GLUSTERFS_DISCARD ++static BlockDriverAIOCB *qemu_gluster_aio_discard(BlockDriverState *bs, ++ int64_t sector_num, int nb_sectors, BlockDriverCompletionFunc *cb, ++ void *opaque) ++{ ++ int ret; ++ GlusterAIOCB *acb; ++ BDRVGlusterState *s = bs->opaque; ++ size_t size; ++ off_t offset; ++ ++ offset = sector_num * BDRV_SECTOR_SIZE; ++ size = nb_sectors * BDRV_SECTOR_SIZE; ++ ++ acb = qemu_aio_get(&gluster_aiocb_info, bs, cb, opaque); ++ acb->size = 0; ++ acb->ret = 0; ++ acb->finished = NULL; ++ s->qemu_aio_count++; ++ ++ ret = glfs_discard_async(s->fd, offset, size, &gluster_finish_aiocb, acb); ++ if (ret < 0) { ++ goto out; ++ } ++ return &acb->common; ++ ++out: ++ s->qemu_aio_count--; ++ qemu_aio_release(acb); ++ return NULL; ++} ++#endif ++ + static int64_t qemu_gluster_getlength(BlockDriverState *bs) + { + BDRVGlusterState *s = bs->opaque; +@@ -707,6 +740,9 @@ static BlockDriver bdrv_gluster = { + .bdrv_aio_writev = qemu_gluster_aio_writev, + .bdrv_aio_flush = qemu_gluster_aio_flush, + .bdrv_has_zero_init = qemu_gluster_has_zero_init, ++#ifdef CONFIG_GLUSTERFS_DISCARD ++ .bdrv_aio_discard = qemu_gluster_aio_discard, ++#endif + .create_options = qemu_gluster_create_options, + }; + +@@ -727,6 +763,9 @@ static BlockDriver bdrv_gluster_tcp = { + .bdrv_aio_writev = qemu_gluster_aio_writev, + .bdrv_aio_flush = qemu_gluster_aio_flush, + .bdrv_has_zero_init = qemu_gluster_has_zero_init, ++#ifdef CONFIG_GLUSTERFS_DISCARD ++ .bdrv_aio_discard = qemu_gluster_aio_discard, ++#endif + .create_options = qemu_gluster_create_options, + }; + +@@ -747,6 +786,9 @@ static BlockDriver bdrv_gluster_unix = { + .bdrv_aio_writev = qemu_gluster_aio_writev, + .bdrv_aio_flush = qemu_gluster_aio_flush, + .bdrv_has_zero_init = qemu_gluster_has_zero_init, ++#ifdef CONFIG_GLUSTERFS_DISCARD ++ .bdrv_aio_discard = qemu_gluster_aio_discard, ++#endif + .create_options = qemu_gluster_create_options, + }; + +@@ -767,6 +809,9 @@ static BlockDriver bdrv_gluster_rdma = { + .bdrv_aio_writev = qemu_gluster_aio_writev, + .bdrv_aio_flush = qemu_gluster_aio_flush, + .bdrv_has_zero_init = qemu_gluster_has_zero_init, ++#ifdef CONFIG_GLUSTERFS_DISCARD ++ .bdrv_aio_discard = qemu_gluster_aio_discard, ++#endif + .create_options = qemu_gluster_create_options, + }; + +diff --git a/configure b/configure +index 0c666e5..fb0c839 100755 +--- a/configure ++++ b/configure +@@ -238,6 +238,7 @@ libiscsi="" + coroutine="" + seccomp="" + glusterfs="" ++glusterfs_discard="no" + virtio_blk_data_plane="" + gtk="" + gtkabi="2.0" +@@ -2644,6 +2645,9 @@ EOF + glusterfs_libs="-lgfapi -lgfrpc -lgfxdr" + if compile_prog "" "$glusterfs_libs" ; then + glusterfs=yes ++ if $pkg_config --atleast-version=5 glusterfs-api >/dev/null 2>&1; then ++ glusterfs_discard="yes" ++ fi + else + if test "$glusterfs" = "yes" ; then + feature_not_found "GlusterFS backend support" +@@ -4025,6 +4029,10 @@ if test "$glusterfs" = "yes" ; then + echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak + fi + ++if test "$glusterfs_discard" = "yes" ; then ++ echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak ++fi ++ + if test "$libssh2" = "yes" ; then + echo "CONFIG_LIBSSH2=y" >> $config_host_mak + echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak +-- +1.7.1 + diff --git a/SOURCES/kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch b/SOURCES/kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch new file mode 100644 index 0000000..828acd7 --- /dev/null +++ b/SOURCES/kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch @@ -0,0 +1,58 @@ +From a5dba057d87136b90802c822f296164b52266273 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 2 Sep 2014 19:26:26 +0200 +Subject: [PATCH 4/6] gluster: default scheme to gluster:// and host to localhost. + +Message-id: +Patchwork-id: 60813 +O-Subject: [PATCH qemu-kvm-rhev RHEL7.1] gluster: default scheme to gluster:// and host to localhost. +Bugzilla: 1088150 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Fam Zheng + +From: Paolo Bonzini + +Currently, "gluster:///volname/img" and (using file. options) +"file.driver=gluster,file.filename=foo" will segfault. Also, +"//host/volname/img" will be rejected, but it is a valid URL +that should be accepted just fine with "file.driver=gluster". +Accept all of these, by inferring missing transport and host +as TCP and localhost respectively. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 24897a767bd778fc6a050537d024565f9272cd06) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/gluster.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/block/gluster.c b/block/gluster.c +index da43d0c..5f85799 100644 +--- a/block/gluster.c ++++ b/block/gluster.c +@@ -134,7 +134,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) + } + + /* transport */ +- if (!strcmp(uri->scheme, "gluster")) { ++ if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { + gconf->transport = g_strdup("tcp"); + } else if (!strcmp(uri->scheme, "gluster+tcp")) { + gconf->transport = g_strdup("tcp"); +@@ -170,7 +170,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) + } + gconf->server = g_strdup(qp->p[0].value); + } else { +- gconf->server = g_strdup(uri->server); ++ gconf->server = g_strdup(uri->server ? uri->server : "localhost"); + gconf->port = uri->port; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch b/SOURCES/kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch index 8c36dc8..0179ece 100644 --- a/SOURCES/kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch +++ b/SOURCES/kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch @@ -1,13 +1,13 @@ -From 53cea58f1e2ed721356a705ec22751083f9e23b5 Mon Sep 17 00:00:00 2001 +From 4b41911968cb53458b86b027f0d028e38618df46 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:24:37 +0200 -Subject: [PATCH 12/30] hpet: fix buffer overrun on invalid state load +Date: Wed, 14 May 2014 08:52:54 +0200 +Subject: [PATCH 23/31] hpet: fix buffer overrun on invalid state load RH-Author: Michael S. Tsirkin -Message-id: <1400055633-6261-4-git-send-email-mst@redhat.com> -Patchwork-id: 58851 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 4/5] hpet: fix buffer overrun on invalid state load -Bugzilla: 1095706 +Message-id: <1400057538-6975-5-git-send-email-mst@redhat.com> +Patchwork-id: 58871 +O-Subject: [PATCH qemu-kvm RHEL7.1 4/5] hpet: fix buffer overrun on invalid state load +Bugzilla: 1095707 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini @@ -26,8 +26,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit 3f1c49e2136fa08ab1ef3183fd55def308829584) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095706 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095707 --- hw/timer/hpet.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/SOURCES/kvm-hw-pci-fix-error-flow-in-pci-multifunction-init.patch b/SOURCES/kvm-hw-pci-fix-error-flow-in-pci-multifunction-init.patch new file mode 100644 index 0000000..297706c --- /dev/null +++ b/SOURCES/kvm-hw-pci-fix-error-flow-in-pci-multifunction-init.patch @@ -0,0 +1,113 @@ +From e346f15b5c72e3cf58fbf1af4a89c929dea783ad Mon Sep 17 00:00:00 2001 +From: Marcel Apfelbaum +Date: Tue, 28 Oct 2014 14:13:15 +0100 +Subject: [PATCH 2/9] hw/pci: fix error flow in pci multifunction init + +Message-id: <1414505595-17009-1-git-send-email-marcel.a@redhat.com> +Patchwork-id: 61953 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] hw/pci: fix error flow in pci multifunction init +Bugzilla: 1049734 +RH-Acked-by: Amos Kong +RH-Acked-by: Markus Armbruster +RH-Acked-by: Michael S. Tsirkin + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1049734 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=8164686 +Upstream-status: 306077640a652e090779498aadbeb0c605feaacd + +Scenario: + - There is a non multifunction pci device A on 00:0X.0. + - Hot-plug another multifunction pci device B at 00:0X.1. + - The operation will fail of course. + - Try to hot-plug the B device 2-3 more times, qemu will crash. + +Reason: The error flow leaves the B's address space into global address spaces +list, but the device object is freed. Fixed that. + +Signed-off-by: Marcel Apfelbaum +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +(cherry picked from commit 306077640a652e090779498aadbeb0c605feaacd) +Signed-off-by: Marcel Apfelbaum +Signed-off-by: Miroslav Rezanina + +Conflicts: + hw/pci/pci.c + - The patch moves a function within a file and the function's + content is different from upstream. + - The upstream does not call anymore to qemu_free_irqs, but + the downstream version still does. We need to check that + the irq is allocated before calling it. + +scripts/git-backport-diff: + 001/1:[0021] [FC] 'hw/pci: fix error flow in pci multifunction init' + +Signed-off-by: Marcel Apfelbaum +--- + hw/pci/pci.c | 33 ++++++++++++++++++--------------- + 1 file changed, 18 insertions(+), 15 deletions(-) +--- + hw/pci/pci.c | 33 ++++++++++++++++++--------------- + 1 file changed, 18 insertions(+), 15 deletions(-) + +diff --git a/hw/pci/pci.c b/hw/pci/pci.c +index d166ab0..703b111 100644 +--- a/hw/pci/pci.c ++++ b/hw/pci/pci.c +@@ -784,6 +784,23 @@ static void pci_config_free(PCIDevice *pci_dev) + g_free(pci_dev->used); + } + ++static void do_pci_unregister_device(PCIDevice *pci_dev) ++{ ++ if (pci_dev->irq) { ++ qemu_free_irqs(pci_dev->irq); ++ } ++ ++ pci_dev->bus->devices[pci_dev->devfn] = NULL; ++ pci_config_free(pci_dev); ++ ++ if (!pci_dev->bus->dma_context_fn) { ++ address_space_destroy(&pci_dev->bus_master_as); ++ memory_region_destroy(&pci_dev->bus_master_enable_region); ++ g_free(pci_dev->dma); ++ pci_dev->dma = NULL; ++ } ++} ++ + /* -1 for devfn means auto assign */ + static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, + const char *name, int devfn) +@@ -852,7 +869,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, + pci_init_mask_bridge(pci_dev); + } + if (pci_init_multifunction(bus, pci_dev)) { +- pci_config_free(pci_dev); ++ do_pci_unregister_device(pci_dev); + return NULL; + } + +@@ -868,20 +885,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, + return pci_dev; + } + +-static void do_pci_unregister_device(PCIDevice *pci_dev) +-{ +- qemu_free_irqs(pci_dev->irq); +- pci_dev->bus->devices[pci_dev->devfn] = NULL; +- pci_config_free(pci_dev); +- +- if (!pci_dev->bus->dma_context_fn) { +- address_space_destroy(&pci_dev->bus_master_as); +- memory_region_destroy(&pci_dev->bus_master_enable_region); +- g_free(pci_dev->dma); +- pci_dev->dma = NULL; +- } +-} +- + static void pci_unregister_io_regions(PCIDevice *pci_dev) + { + PCIIORegion *r; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-hw-pci-fixed-error-flow-in-pci_qdev_init.patch b/SOURCES/kvm-hw-pci-fixed-error-flow-in-pci_qdev_init.patch new file mode 100644 index 0000000..37797e0 --- /dev/null +++ b/SOURCES/kvm-hw-pci-fixed-error-flow-in-pci_qdev_init.patch @@ -0,0 +1,48 @@ +From 041c25ce0ca658d4426ec18a116a464e4bac9862 Mon Sep 17 00:00:00 2001 +From: Marcel Apfelbaum +Date: Thu, 20 Nov 2014 10:33:13 +0100 +Subject: [PATCH 1/2] hw/pci: fixed error flow in pci_qdev_init + +Message-id: <1416479594-22022-2-git-send-email-marcel.a@redhat.com> +Patchwork-id: 62484 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/2] hw/pci: fixed error flow in pci_qdev_init +Bugzilla: 1046007 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Amos Kong +RH-Acked-by: Eric Blake +RH-Acked-by: Markus Armbruster + +Verify return code for pci_add_option_rom. + +Signed-off-by: Marcel Apfelbaum +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Markus Armbruster +(cherry picked from commit 178e785fb4507ec3462dc772bbe08303416ece47) +Signed-off-by: Marcel Apfelbaum +Signed-off-by: Miroslav Rezanina +--- + hw/pci/pci.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/hw/pci/pci.c b/hw/pci/pci.c +index 703b111..0918f4e 100644 +--- a/hw/pci/pci.c ++++ b/hw/pci/pci.c +@@ -1733,7 +1733,12 @@ static int pci_qdev_init(DeviceState *qdev) + pci_dev->romfile = g_strdup(pc->romfile); + is_default_rom = true; + } +- pci_add_option_rom(pci_dev, is_default_rom); ++ ++ rc = pci_add_option_rom(pci_dev, is_default_rom); ++ if (rc != 0) { ++ pci_unregister_device(DEVICE(pci_dev)); ++ return rc; ++ } + + if (bus->hotplug) { + /* Let buses differentiate between hotplug and when device is +-- +1.8.3.1 + diff --git a/SOURCES/kvm-hw-pci-fixed-hotplug-crash-when-using-rombar-0-with-.patch b/SOURCES/kvm-hw-pci-fixed-hotplug-crash-when-using-rombar-0-with-.patch new file mode 100644 index 0000000..04f3711 --- /dev/null +++ b/SOURCES/kvm-hw-pci-fixed-hotplug-crash-when-using-rombar-0-with-.patch @@ -0,0 +1,52 @@ +From bdd21901f9f1f10de38611d3b2b36e6e3d20fbd4 Mon Sep 17 00:00:00 2001 +From: Marcel Apfelbaum +Date: Thu, 20 Nov 2014 10:33:14 +0100 +Subject: [PATCH 2/2] hw/pci: fixed hotplug crash when using rombar=0 with + devices having romfile + +Message-id: <1416479594-22022-3-git-send-email-marcel.a@redhat.com> +Patchwork-id: 62485 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile +Bugzilla: 1046007 +RH-Acked-by: Amos Kong +RH-Acked-by: Eric Blake +RH-Acked-by: Markus Armbruster + +Hot-plugging a device that has a romfile (either supplied by user +or built-in) using rombar=0 option is a user error, +do not allow the device to be hot-plugged. + +Reviewed-by: Eric Blake +Signed-off-by: Marcel Apfelbaum +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +(cherry picked from commit db80c7b974f4ccab56bd5e8ff2248c7339b00c73) +Signed-off-by: Marcel Apfelbaum +Signed-off-by: Miroslav Rezanina +--- + hw/pci/pci.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/hw/pci/pci.c b/hw/pci/pci.c +index 0918f4e..18773fe 100644 +--- a/hw/pci/pci.c ++++ b/hw/pci/pci.c +@@ -1924,6 +1924,15 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom) + * for 0.11 compatibility. + */ + int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE); ++ ++ /* ++ * Hot-plugged devices can't use the option ROM ++ * if the rom bar is disabled. ++ */ ++ if (DEVICE(pdev)->hotplugged) { ++ return -1; ++ } ++ + if (class == 0x0300) { + rom_add_vga(pdev->romfile); + } else { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch b/SOURCES/kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch index a9d836a..2df11d6 100644 --- a/SOURCES/kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch +++ b/SOURCES/kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch @@ -1,13 +1,13 @@ -From ed30bd1d0e45463cc48aeb839b4ae3c65009ce79 Mon Sep 17 00:00:00 2001 +From 546f9e97d193307a2ca26c11bf1162d07cc2d31f Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:24:43 +0200 -Subject: [PATCH 13/30] hw/pci/pcie_aer.c: fix buffer overruns on invalid state load +Date: Wed, 14 May 2014 08:52:59 +0200 +Subject: [PATCH 24/31] hw/pci/pcie_aer.c: fix buffer overruns on invalid state load RH-Author: Michael S. Tsirkin -Message-id: <1400055633-6261-5-git-send-email-mst@redhat.com> -Patchwork-id: 58852 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 5/5] hw/pci/pcie_aer.c: fix buffer overruns on invalid state load -Bugzilla: 1095714 +Message-id: <1400057538-6975-6-git-send-email-mst@redhat.com> +Patchwork-id: 58872 +O-Subject: [PATCH qemu-kvm RHEL7.1 5/5] hw/pci/pcie_aer.c: fix buffer overruns on invalid state load +Bugzilla: 1095716 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini @@ -33,8 +33,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit 5f691ff91d323b6f97c6600405a7f9dc115a0ad1) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095714 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095716 --- hw/pci/pcie_aer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SOURCES/kvm-ide-Add-wwn-support-to-IDE-ATAPI-drive.patch b/SOURCES/kvm-ide-Add-wwn-support-to-IDE-ATAPI-drive.patch new file mode 100644 index 0000000..8fe4e66 --- /dev/null +++ b/SOURCES/kvm-ide-Add-wwn-support-to-IDE-ATAPI-drive.patch @@ -0,0 +1,67 @@ +From e67d424de7c9f4ab359757195e8d3319c03b70a0 Mon Sep 17 00:00:00 2001 +From: John Snow +Date: Mon, 8 Sep 2014 22:34:25 +0200 +Subject: [PATCH 01/20] ide: Add wwn support to IDE-ATAPI drive + +Message-id: <1410215665-27240-2-git-send-email-jsnow@redhat.com> +Patchwork-id: 60913 +O-Subject: [RHEL7.1 qemu-kvm PATCH] ide: Add wwn support to IDE-ATAPI drive +Bugzilla: 1131316 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +Although it is possible to specify the wwn +property for cdrom devices on the command line, +the underlying driver fails to relay this information +to the guest operating system via IDENTIFY. + +This is a simple patch to correct that. + +See ATA8-ACS, Table 22 parts 5, 6, and 9. + +Signed-off-by: John Snow +Reviewed-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit c5fe97e359bf03db9a005433092f25d27d57398f) +Signed-off-by: John Snow +--- + hw/ide/core.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/ide/core.c | 14 ++++++++++++++ + 1 files changed, 14 insertions(+), 0 deletions(-) + +diff --git a/hw/ide/core.c b/hw/ide/core.c +index a2947a9..98128fb 100644 +--- a/hw/ide/core.c ++++ b/hw/ide/core.c +@@ -230,9 +230,23 @@ static void ide_atapi_identify(IDEState *s) + } + + put_le16(p + 80, 0x1e); /* support up to ATA/ATAPI-4 */ ++ if (s->wwn) { ++ put_le16(p + 84, (1 << 8)); /* supports WWN for words 108-111 */ ++ put_le16(p + 87, (1 << 8)); /* WWN enabled */ ++ } ++ + #ifdef USE_DMA_CDROM + put_le16(p + 88, 0x3f | (1 << 13)); /* udma5 set and supported */ + #endif ++ ++ if (s->wwn) { ++ /* LE 16-bit words 111-108 contain 64-bit World Wide Name */ ++ put_le16(p + 108, s->wwn >> 48); ++ put_le16(p + 109, s->wwn >> 32); ++ put_le16(p + 110, s->wwn >> 16); ++ put_le16(p + 111, s->wwn); ++ } ++ + memcpy(s->identify_data, p, sizeof(s->identify_data)); + s->identify_set = 1; + } +-- +1.7.1 + diff --git a/SOURCES/kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch b/SOURCES/kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch index f68e85c..a8edf87 100644 --- a/SOURCES/kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch +++ b/SOURCES/kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch @@ -1,4 +1,4 @@ -From 547c264f28ee2fb34a0f2ef60ca880745229a41d Mon Sep 17 00:00:00 2001 +From 1958d41c7db1f415f84cb3ef316708ca83e6e72f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 25 Apr 2014 17:54:05 +0200 Subject: [PATCH 12/12] ide: Correct improper smart self test counter reset in ide core. @@ -10,7 +10,7 @@ RH-Author: Markus Armbruster Message-id: <1398448445-17245-2-git-send-email-armbru@redhat.com> Patchwork-id: 58568 O-Subject: [PATCH 7.0 qemu-kvm 1/1] ide: Correct improper smart self test counter reset in ide core. -Bugzilla: 1093612 +Bugzilla: 1087980 RH-Acked-by: Laszlo Ersek RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-ide-Fix-segfault-when-flushing-a-device-that-doesn-t.patch b/SOURCES/kvm-ide-Fix-segfault-when-flushing-a-device-that-doesn-t.patch new file mode 100644 index 0000000..904f973 --- /dev/null +++ b/SOURCES/kvm-ide-Fix-segfault-when-flushing-a-device-that-doesn-t.patch @@ -0,0 +1,74 @@ +From 3272771d5dd899876eb8d7ea3af3ed1d2b2472d2 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Wed, 10 Sep 2014 11:06:09 +0200 +Subject: [PATCH 10/12] ide: Fix segfault when flushing a device that doesn't exist + +Message-id: <1410347169-4368-4-git-send-email-kwolf@redhat.com> +Patchwork-id: 60955 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 3/3] ide: Fix segfault when flushing a device that doesn't exist +Bugzilla: 1123372 +RH-Acked-by: Max Reitz +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +Signed-off-by: Kevin Wolf +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit f7f3ff1da0c451befc8d32f977f9c352d1303f40) +Signed-off-by: Kevin Wolf + +Signed-off-by: Miroslav Rezanina +--- + hw/ide/core.c | 4 +++- + tests/ide-test.c | 14 ++++++++++++++ + 2 files changed, 17 insertions(+), 1 deletions(-) + +diff --git a/hw/ide/core.c b/hw/ide/core.c +index 0313250..a2947a9 100644 +--- a/hw/ide/core.c ++++ b/hw/ide/core.c +@@ -810,7 +810,9 @@ static void ide_flush_cb(void *opaque, int ret) + } + } + +- bdrv_acct_done(s->bs, &s->acct); ++ if (s->bs) { ++ bdrv_acct_done(s->bs, &s->acct); ++ } + s->status = READY_STAT | SEEK_STAT; + ide_async_cmd_done(s); + ide_set_irq(s->bus); +diff --git a/tests/ide-test.c b/tests/ide-test.c +index 739d2bf..51f9239 100644 +--- a/tests/ide-test.c ++++ b/tests/ide-test.c +@@ -462,6 +462,19 @@ static void test_flush(void) + ide_test_quit(); + } + ++static void test_flush_nodev(void) ++{ ++ ide_test_start(""); ++ ++ /* FLUSH CACHE command on device 0*/ ++ outb(IDE_BASE + reg_device, 0); ++ outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE); ++ ++ /* Just testing that qemu doesn't crash... */ ++ ++ ide_test_quit(); ++} ++ + int main(int argc, char **argv) + { + const char *arch = qtest_get_arch(); +@@ -493,6 +506,7 @@ int main(int argc, char **argv) + qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown); + + qtest_add_func("/ide/flush", test_flush); ++ qtest_add_func("/ide/flush_nodev", test_flush_nodev); + + ret = g_test_run(); + +-- +1.7.1 + diff --git a/SOURCES/kvm-ide-Treat-read-write-beyond-end-as-invalid.patch b/SOURCES/kvm-ide-Treat-read-write-beyond-end-as-invalid.patch new file mode 100644 index 0000000..a6abb27 --- /dev/null +++ b/SOURCES/kvm-ide-Treat-read-write-beyond-end-as-invalid.patch @@ -0,0 +1,94 @@ +From 7262d3c7280343601ab3b0be0d469ffb867b86d7 Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 16:29:55 +0100 +Subject: [PATCH 18/19] ide: Treat read/write beyond end as invalid + +Message-id: <1414772996-17272-5-git-send-email-armbru@redhat.com> +Patchwork-id: 62015 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 4/5] ide: Treat read/write beyond end as invalid +Bugzilla: 1085232 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Fam Zheng + +The block layer fails such reads and writes just fine. However, they +then get treated like valid operations that fail: the error action +gets executed. Unwanted; reporting the error to the guest is the only +sensible action. + +Reject them before passing them to the block layer. This bypasses the +error action and I/O accounting. Not quite correct for DMA, because +DMA can fail after some success, and when that happens, the part that +succeeded isn't counted. Tolerable, because I/O accounting is an +inconsistent mess anyway. + +Signed-off-by: Markus Armbruster +Signed-off-by: Kevin Wolf +(cherry picked from commit 58ac321135af890b503ebe56d0d00e184779918f) +Signed-off-by: Miroslav Rezanina +--- + hw/ide/core.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/hw/ide/core.c b/hw/ide/core.c +index 98128fb..4c36f52 100644 +--- a/hw/ide/core.c ++++ b/hw/ide/core.c +@@ -513,6 +513,18 @@ static void ide_rw_error(IDEState *s) { + ide_set_irq(s->bus); + } + ++static bool ide_sect_range_ok(IDEState *s, ++ uint64_t sector, uint64_t nb_sectors) ++{ ++ uint64_t total_sectors; ++ ++ bdrv_get_geometry(s->bs, &total_sectors); ++ if (sector > total_sectors || nb_sectors > total_sectors - sector) { ++ return false; ++ } ++ return true; ++} ++ + static void ide_sector_read_cb(void *opaque, int ret) + { + IDEState *s = opaque; +@@ -568,6 +580,11 @@ void ide_sector_read(IDEState *s) + printf("sector=%" PRId64 "\n", sector_num); + #endif + ++ if (!ide_sect_range_ok(s, sector_num, n)) { ++ ide_rw_error(s); ++ return; ++ } ++ + s->iov.iov_base = s->io_buffer; + s->iov.iov_len = n * BDRV_SECTOR_SIZE; + qemu_iovec_init_external(&s->qiov, &s->iov, 1); +@@ -685,6 +702,12 @@ void ide_dma_cb(void *opaque, int ret) + sector_num, n, s->dma_cmd); + #endif + ++ if (!ide_sect_range_ok(s, sector_num, n)) { ++ dma_buf_commit(s); ++ ide_dma_error(s); ++ return; ++ } ++ + switch (s->dma_cmd) { + case IDE_DMA_READ: + s->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num, +@@ -804,6 +827,11 @@ void ide_sector_write(IDEState *s) + n = s->req_nb_sectors; + } + ++ if (!ide_sect_range_ok(s, sector_num, n)) { ++ ide_rw_error(s); ++ return; ++ } ++ + s->iov.iov_base = s->io_buffer; + s->iov.iov_len = n * BDRV_SECTOR_SIZE; + qemu_iovec_init_external(&s->qiov, &s->iov, 1); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-ide-only-constrain-read-write-requests-to-drive-size.patch b/SOURCES/kvm-ide-only-constrain-read-write-requests-to-drive-size.patch new file mode 100644 index 0000000..1dfe671 --- /dev/null +++ b/SOURCES/kvm-ide-only-constrain-read-write-requests-to-drive-size.patch @@ -0,0 +1,47 @@ +From 466d66e193341115f2a48e27997d61d8fddc811e Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 16:29:56 +0100 +Subject: [PATCH 19/19] ide: only constrain read/write requests to drive size, + not other types + +Message-id: <1414772996-17272-6-git-send-email-armbru@redhat.com> +Patchwork-id: 62017 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 5/5] ide: only constrain read/write requests to drive size, not other types +Bugzilla: 1085232 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Fam Zheng + +From: Michael Tokarev + +Commit 58ac321135a introduced a check to ide dma processing which +constrains all requests to drive size. However, apparently, some +valid requests (like TRIM) does not fit in this constraint, and +fails in 2.1. So check the range only for reads and writes. + +Cc: qemu-stable@nongnu.org +Signed-off-by: Michael Tokarev +Signed-off-by: Markus Armbruster +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit d66168ed687325aa6d338ce3a3cff18ce3098ed6) +Signed-off-by: Miroslav Rezanina +--- + hw/ide/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/hw/ide/core.c b/hw/ide/core.c +index 4c36f52..24a1708 100644 +--- a/hw/ide/core.c ++++ b/hw/ide/core.c +@@ -702,7 +702,8 @@ void ide_dma_cb(void *opaque, int ret) + sector_num, n, s->dma_cmd); + #endif + +- if (!ide_sect_range_ok(s, sector_num, n)) { ++ if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && ++ !ide_sect_range_ok(s, sector_num, n)) { + dma_buf_commit(s); + ide_dma_error(s); + return; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-ide-test-Add-FLUSH-CACHE-test-case.patch b/SOURCES/kvm-ide-test-Add-FLUSH-CACHE-test-case.patch new file mode 100644 index 0000000..8e59d66 --- /dev/null +++ b/SOURCES/kvm-ide-test-Add-FLUSH-CACHE-test-case.patch @@ -0,0 +1,97 @@ +From d1c34ff41de0ece966991adb6aef6f2bce2ccfc4 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Wed, 10 Sep 2014 11:06:08 +0200 +Subject: [PATCH 09/12] ide-test: Add FLUSH CACHE test case + +Message-id: <1410347169-4368-3-git-send-email-kwolf@redhat.com> +Patchwork-id: 60954 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/3] ide-test: Add FLUSH CACHE test case +Bugzilla: 1123372 +RH-Acked-by: Max Reitz +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +This checks in particular that BSY is set while the flush request is in +flight. + +Signed-off-by: Kevin Wolf +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit bd07684aacfb61668ae2c25b7dd00b64f3d7c7f3) + +RHEL: Whitelist the blkdebug driver so that the new qtest can succeed. + +Signed-off-by: Kevin Wolf +Signed-off-by: Miroslav Rezanina +--- + redhat/qemu-kvm.spec.template | 4 ++-- + tests/ide-test.c | 40 ++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 42 insertions(+), 2 deletions(-) + +diff --git a/tests/ide-test.c b/tests/ide-test.c +index ac59259..739d2bf 100644 +--- a/tests/ide-test.c ++++ b/tests/ide-test.c +@@ -77,6 +77,7 @@ enum { + enum { + CMD_READ_DMA = 0xc8, + CMD_WRITE_DMA = 0xca, ++ CMD_FLUSH_CACHE = 0xe7, + CMD_IDENTIFY = 0xec, + + CMDF_ABORT = 0x100, +@@ -424,6 +425,43 @@ static void test_identify(void) + ide_test_quit(); + } + ++static void test_flush(void) ++{ ++ uint8_t data; ++ ++ ide_test_start( ++ "-vnc none " ++ "-drive file=blkdebug::%s,if=ide,cache=writeback", ++ tmp_path); ++ ++ /* Delay the completion of the flush request until we explicitly do it */ ++ qmp("{'execute':'human-monitor-command', 'arguments': { " ++ "'command-line': 'qemu-io ide0-hd0 \"break flush_to_os A\"'} }"); ++ ++ /* FLUSH CACHE command on device 0*/ ++ outb(IDE_BASE + reg_device, 0); ++ outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE); ++ ++ /* Check status while request is in flight*/ ++ data = inb(IDE_BASE + reg_status); ++ assert_bit_set(data, BSY | DRDY); ++ assert_bit_clear(data, DF | ERR | DRQ); ++ ++ /* Complete the command */ ++ qmp("{'execute':'human-monitor-command', 'arguments': { " ++ "'command-line': 'qemu-io ide0-hd0 \"resume A\"'} }"); ++ ++ /* Check registers */ ++ data = inb(IDE_BASE + reg_device); ++ g_assert_cmpint(data & DEV, ==, 0); ++ ++ data = inb(IDE_BASE + reg_status); ++ assert_bit_set(data, DRDY); ++ assert_bit_clear(data, BSY | DF | ERR | DRQ); ++ ++ ide_test_quit(); ++} ++ + int main(int argc, char **argv) + { + const char *arch = qtest_get_arch(); +@@ -454,6 +492,8 @@ int main(int argc, char **argv) + qtest_add_func("/ide/bmdma/long_prdt", test_bmdma_long_prdt); + qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown); + ++ qtest_add_func("/ide/flush", test_flush); ++ + ret = g_test_run(); + + /* Cleanup */ +-- +1.7.1 + diff --git a/SOURCES/kvm-ide-test-Add-enum-value-for-DEV.patch b/SOURCES/kvm-ide-test-Add-enum-value-for-DEV.patch new file mode 100644 index 0000000..e32e8d8 --- /dev/null +++ b/SOURCES/kvm-ide-test-Add-enum-value-for-DEV.patch @@ -0,0 +1,49 @@ +From bfc4f8a432d111a63ae2a5bf9846b2b3413c2479 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Wed, 10 Sep 2014 11:06:07 +0200 +Subject: [PATCH 08/12] ide-test: Add enum value for DEV + +Message-id: <1410347169-4368-2-git-send-email-kwolf@redhat.com> +Patchwork-id: 60953 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/3] ide-test: Add enum value for DEV +Bugzilla: 1123372 +RH-Acked-by: Max Reitz +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +Get rid of the magic number. + +Signed-off-by: Kevin Wolf +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit c27d565604038c1572b16dd1cd06e277e6ef02e2) +Signed-off-by: Kevin Wolf + +Signed-off-by: Miroslav Rezanina +--- + tests/ide-test.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/tests/ide-test.c b/tests/ide-test.c +index 177ab00..ac59259 100644 +--- a/tests/ide-test.c ++++ b/tests/ide-test.c +@@ -64,6 +64,7 @@ enum { + }; + + enum { ++ DEV = 0x10, + LBA = 0x40, + }; + +@@ -394,7 +395,7 @@ static void test_identify(void) + + /* Read in the IDENTIFY buffer and check registers */ + data = inb(IDE_BASE + reg_device); +- g_assert_cmpint(data & 0x10, ==, 0); ++ g_assert_cmpint(data & DEV, ==, 0); + + for (i = 0; i < 256; i++) { + data = inb(IDE_BASE + reg_status); +-- +1.7.1 + diff --git a/SOURCES/kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch b/SOURCES/kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch index 9d99b36..0b528b7 100644 --- a/SOURCES/kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch +++ b/SOURCES/kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch @@ -1,4 +1,4 @@ -From 157bc246bfb0a67c65e1cca823f8ec60d071ff97 Mon Sep 17 00:00:00 2001 +From 9085aa99ac8f2ac99440e23cfed4b80c44f89814 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Sun, 6 Apr 2014 01:10:17 +0200 Subject: [PATCH 08/12] iscsi: Don't set error if already set in iscsi_do_inquiry @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396746617-11978-1-git-send-email-famz@redhat.com> Patchwork-id: 58350 O-Subject: [RHEL-7 0day qemu-kvm PATCH 8/7] iscsi: Don't set error if already set in iscsi_do_inquiry -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf RH-Acked-by: Jeffrey Cody diff --git a/SOURCES/kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch b/SOURCES/kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch index 9406012..2147ea8 100644 --- a/SOURCES/kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch +++ b/SOURCES/kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch @@ -1,4 +1,4 @@ -From 3fdabff07bad6541ad6da731b23362a594433694 Mon Sep 17 00:00:00 2001 +From 20bb4af6d97719f250a0424e55b7342601a2b7ef Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 14 Apr 2014 02:05:19 +0200 Subject: [PATCH 09/12] iscsi: Remember to set ret for iscsi_open in error case @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1397441119-8563-1-git-send-email-famz@redhat.com> Patchwork-id: 58457 O-Subject: [RHEL-7 0day qemu-kvm PATCH 9/7] iscsi: Remember to set ret for iscsi_open in error case -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf RH-Acked-by: Jeffrey Cody diff --git a/SOURCES/kvm-iscsi-always-query-max-WRITE-SAME-length.patch b/SOURCES/kvm-iscsi-always-query-max-WRITE-SAME-length.patch index 55fa9b6..cf40190 100644 --- a/SOURCES/kvm-iscsi-always-query-max-WRITE-SAME-length.patch +++ b/SOURCES/kvm-iscsi-always-query-max-WRITE-SAME-length.patch @@ -1,4 +1,4 @@ -From 0be3bd54babffebdc68e274a926ccecb77b2537c Mon Sep 17 00:00:00 2001 +From 5ef7ecc30ffede5d4970165f471ae5d066488fcd Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:56:02 +0200 Subject: [PATCH 07/12] iscsi: always query max WRITE SAME length @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-8-git-send-email-famz@redhat.com> Patchwork-id: 58344 O-Subject: [RHEL-7 0day qemu-kvm PATCH 7/7] iscsi: always query max WRITE SAME length -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch b/SOURCES/kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch index 334615a..60af6b8 100644 --- a/SOURCES/kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch +++ b/SOURCES/kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch @@ -1,4 +1,4 @@ -From 3e977cc45393793cfaa17ed471e85953a9bab35a Mon Sep 17 00:00:00 2001 +From 9e46b4be497106cff27fd67c5c3cc79023e21762 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:55:57 +0200 Subject: [PATCH 02/12] iscsi: correctly propagate errors in iscsi_open @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-3-git-send-email-famz@redhat.com> Patchwork-id: 58339 O-Subject: [RHEL-7 0day qemu-kvm PATCH 2/7] iscsi: correctly propagate errors in iscsi_open -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-iscsi-fix-indentation.patch b/SOURCES/kvm-iscsi-fix-indentation.patch index ac91a1d..8b2bc64 100644 --- a/SOURCES/kvm-iscsi-fix-indentation.patch +++ b/SOURCES/kvm-iscsi-fix-indentation.patch @@ -1,4 +1,4 @@ -From aa310a9247019b3858150e48f41900105e6541cd Mon Sep 17 00:00:00 2001 +From 2f080efe2f5055117b1083c01618305dd08e4aa9 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:55:56 +0200 Subject: [PATCH 01/12] iscsi: fix indentation @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-2-git-send-email-famz@redhat.com> Patchwork-id: 58338 O-Subject: [RHEL-7 0day qemu-kvm PATCH 1/7] iscsi: fix indentation -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch b/SOURCES/kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch index 31815ac..e646d81 100644 --- a/SOURCES/kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch +++ b/SOURCES/kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch @@ -1,4 +1,4 @@ -From 90f24ff57d4861c6143176cba17e51f3a9bd7d50 Mon Sep 17 00:00:00 2001 +From ae4902714a5ff8e905e69c25d48652a7a5e930f0 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 14 Apr 2014 09:59:22 +0200 Subject: [PATCH 06/12] iscsi: ignore flushes on scsi-generic devices @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1397469562-5050-1-git-send-email-famz@redhat.com> Patchwork-id: 58458 O-Subject: [RHEL-7 0day qemu-kvm PATCH v2 6/7] iscsi: ignore flushes on scsi-generic devices -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf RH-Acked-by: Jeffrey Cody diff --git a/SOURCES/kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch b/SOURCES/kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch index d399e11..5c1e17f 100644 --- a/SOURCES/kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch +++ b/SOURCES/kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch @@ -1,4 +1,4 @@ -From 70ccfb3676918e20a2c83774d0242ad98b1f2f93 Mon Sep 17 00:00:00 2001 +From 8ba513a1fa324d87a412705d2ded64e2154e1f2a Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 4 Apr 2014 05:56:00 +0200 Subject: [PATCH 05/12] iscsi: recognize "invalid field" ASCQ from WRITE SAME command @@ -7,7 +7,7 @@ RH-Author: Fam Zheng Message-id: <1396590962-25815-6-git-send-email-famz@redhat.com> Patchwork-id: 58342 O-Subject: [RHEL-7 0day qemu-kvm PATCH 5/7] iscsi: recognize "invalid field" ASCQ from WRITE SAME command -Bugzilla: 1090978 +Bugzilla: 1083413 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf diff --git a/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock.v2.patch b/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock.v2.patch new file mode 100644 index 0000000..63fa6b4 --- /dev/null +++ b/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock.v2.patch @@ -0,0 +1,57 @@ +From e055a194315471312ae2a1d8da4b69c3a5e545a5 Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Wed, 22 Oct 2014 09:46:36 +0200 +Subject: [PATCH 5/6] kvmclock: Ensure proper env->tsc value for + kvmclock_current_nsec calculation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1413971197-4624-5-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61790 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 4/5] kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation +Bugzilla: 1098602 1130428 +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Paolo Bonzini + +From: Marcelo Tosatti + +Ensure proper env->tsc value for kvmclock_current_nsec calculation. + +Reported-by: Marcin GibuĹ‚a +Analyzed-by: Marcin GibuĹ‚a +Cc: qemu-stable@nongnu.org +Signed-off-by: Marcelo Tosatti +Signed-off-by: Paolo Bonzini +(cherry picked from commit 317b0a6d8ba44e9bf8f9c3dbd776c4536843d82c) +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index 6d6f3a7..53056d4 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -16,6 +16,7 @@ + #include "qemu-common.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" ++#include "sysemu/cpus.h" + #include "hw/sysbus.h" + #include "hw/kvm/clock.h" + +@@ -69,6 +70,9 @@ static void kvmclock_vm_state_change(void *opaque, int running, + if (s->clock_valid) { + return; + } ++ ++ cpu_synchronize_all_states(); ++ cpu_clean_all_dirty(); + ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data); + if (ret < 0) { + fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret)); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock_cu.patch b/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock_cu.patch new file mode 100644 index 0000000..53985ae --- /dev/null +++ b/SOURCES/kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock_cu.patch @@ -0,0 +1,69 @@ +From da4fe791cecafbec05395041c52cb545308b1b61 Mon Sep 17 00:00:00 2001 +From: Marcelo Tosatti +Date: Thu, 26 Jun 2014 15:06:15 +0200 +Subject: [PATCH 13/13] kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Marcelo Tosatti +Message-id: <20140626150716.639538444@amt.cnet> +Patchwork-id: 59386 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation +Bugzilla: 1098602 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Andrew Jones + +commit 9b1786829aefb83f37a8f3135e3ea91c56001b56 upstream + +Ensure proper env->tsc value for kvmclock_current_nsec calculation. + +Reported-by: Marcin GibuĹ‚a +Cc: qemu-stable@nongnu.org +Signed-off-by: Marcelo Tosatti +Signed-off-by: Paolo Bonzini + +BZ: 1098602 + +--- + hw/i386/kvm/clock.c | 4 ++++ + 1 file changed, 4 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index 1f2a26e..d52c2ea 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -17,6 +17,7 @@ + #include "qemu/host-utils.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" ++#include "sysemu/cpus.h" + #include "hw/sysbus.h" + #include "hw/kvm/clock.h" + +@@ -60,6 +61,7 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s) + + cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); + ++ assert(time.tsc_timestamp <= migration_tsc); + delta = migration_tsc - time.tsc_timestamp; + if (time.tsc_shift < 0) { + delta >>= -time.tsc_shift; +@@ -118,6 +120,8 @@ static void kvmclock_vm_state_change(void *opaque, int running, + if (s->clock_valid) { + return; + } ++ ++ cpu_synchronize_all_states(); + ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data); + if (ret < 0) { + fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret)); +-- +1.7.1 + diff --git a/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-back.v2.patch b/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-back.v2.patch new file mode 100644 index 0000000..2b58b84 --- /dev/null +++ b/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-back.v2.patch @@ -0,0 +1,117 @@ +From db50fd1dfca6131e29def9ed3cfd120b30894356 Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Wed, 22 Oct 2014 09:46:37 +0200 +Subject: [PATCH 6/6] kvmclock: Ensure time in migration never goes backward + +Message-id: <1413971197-4624-6-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61792 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 5/5] kvmclock: Ensure time in migration never goes backward +Bugzilla: 1098602 1130428 +RH-Acked-by: Marcelo Tosatti +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Paolo Bonzini + +From: Alexander Graf + +When we migrate we ask the kernel about its current belief on what the guest +time would be. However, I've seen cases where the kvmclock guest structure +indicates a time more recent than the kvm returned time. + +To make sure we never go backwards, calculate what the guest would have seen as time at the point of migration and use that value instead of the kernel returned one when it's more recent. +This bases the view of the kvmclock after migration on the +same foundation in host as well as guest. + +Signed-off-by: Alexander Graf +Cc: qemu-stable@nongnu.org +Reviewed-by: Marcelo Tosatti +Signed-off-by: Paolo Bonzini +(cherry picked from commit 9a48bcd1b82494671c111109b0eefdb882581499) + +dgilbert: Rework kvmclock_current_nsec code to get 'env' since the types + have changed + +Signed-off-by: Dr. David Alan Gilbert +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index 53056d4..4bac13e 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -14,6 +14,7 @@ + */ + + #include "qemu-common.h" ++#include "qemu/host-utils.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" + #include "sysemu/cpus.h" +@@ -29,6 +30,47 @@ typedef struct KVMClockState { + bool clock_valid; + } KVMClockState; + ++struct pvclock_vcpu_time_info { ++ uint32_t version; ++ uint32_t pad0; ++ uint64_t tsc_timestamp; ++ uint64_t system_time; ++ uint32_t tsc_to_system_mul; ++ int8_t tsc_shift; ++ uint8_t flags; ++ uint8_t pad[2]; ++} __attribute__((__packed__)); /* 32 bytes */ ++ ++static uint64_t kvmclock_current_nsec(KVMClockState *s) ++{ ++ CPUX86State *env = first_cpu; ++ hwaddr kvmclock_struct_pa = env->system_time_msr & ~1ULL; ++ uint64_t migration_tsc = env->tsc; ++ struct pvclock_vcpu_time_info time; ++ uint64_t delta; ++ uint64_t nsec_lo; ++ uint64_t nsec_hi; ++ uint64_t nsec; ++ ++ if (!(env->system_time_msr & 1ULL)) { ++ /* KVM clock not active */ ++ return 0; ++ } ++ ++ cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); ++ ++ assert(time.tsc_timestamp <= migration_tsc); ++ delta = migration_tsc - time.tsc_timestamp; ++ if (time.tsc_shift < 0) { ++ delta >>= -time.tsc_shift; ++ } else { ++ delta <<= time.tsc_shift; ++ } ++ ++ mulu64(&nsec_lo, &nsec_hi, delta, time.tsc_to_system_mul); ++ nsec = (nsec_lo >> 32) | (nsec_hi << 32); ++ return nsec + time.system_time; ++} + + static void kvmclock_vm_state_change(void *opaque, int running, + RunState state) +@@ -40,9 +82,15 @@ static void kvmclock_vm_state_change(void *opaque, int running, + + if (running) { + struct kvm_clock_data data; ++ uint64_t time_at_migration = kvmclock_current_nsec(s); + + s->clock_valid = false; + ++ /* We can't rely on the migrated clock value, just discard it */ ++ if (time_at_migration) { ++ s->clock = time_at_migration; ++ } ++ + data.clock = s->clock; + data.flags = 0; + ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-backwar.patch b/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-backwar.patch new file mode 100644 index 0000000..0e0d8b5 --- /dev/null +++ b/SOURCES/kvm-kvmclock-Ensure-time-in-migration-never-goes-backwar.patch @@ -0,0 +1,122 @@ +From 4b6035c2a739bc4c086abbb36f0883a1178a8f1c Mon Sep 17 00:00:00 2001 +From: Marcelo Tosatti +Date: Thu, 26 Jun 2014 15:06:14 +0200 +Subject: [PATCH 12/13] kvmclock: Ensure time in migration never goes backward + +RH-Author: Marcelo Tosatti +Message-id: <20140626150716.560273759@amt.cnet> +Patchwork-id: 59388 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/2] kvmclock: Ensure time in migration never goes backward +Bugzilla: 1098602 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Andrew Jones + +commit a096b3a6732f846ec57dc28b47ee9435aa0609bf upstream +Author: Alexander Graf +Date: Fri May 16 17:15:21 2014 +0200 + +When we migrate we ask the kernel about its current belief on what the guest +time would be. However, I've seen cases where the kvmclock guest structure +indicates a time more recent than the kvm returned time. + +To make sure we never go backwards, calculate what the guest would have seen +as time at the point of migration and use that value instead of the kernel +returned one when it's more recent. This bases the view of the kvmclock +after migration on the same foundation in host as well as guest. + +Signed-off-by: Alexander Graf +Cc: qemu-stable@nongnu.org +Reviewed-by: Marcelo Tosatti +Signed-off-by: Paolo Bonzini +BZ: 1098602 + +--- + hw/i386/kvm/clock.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 49 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/i386/kvm/clock.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 49 insertions(+), 0 deletions(-) + +diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c +index 6d6f3a7..1f2a26e 100644 +--- a/hw/i386/kvm/clock.c ++++ b/hw/i386/kvm/clock.c +@@ -14,6 +14,7 @@ + */ + + #include "qemu-common.h" ++#include "qemu/host-utils.h" + #include "sysemu/sysemu.h" + #include "sysemu/kvm.h" + #include "hw/sysbus.h" +@@ -28,6 +29,48 @@ typedef struct KVMClockState { + bool clock_valid; + } KVMClockState; + ++struct pvclock_vcpu_time_info { ++ uint32_t version; ++ uint32_t pad0; ++ uint64_t tsc_timestamp; ++ uint64_t system_time; ++ uint32_t tsc_to_system_mul; ++ int8_t tsc_shift; ++ uint8_t flags; ++ uint8_t pad[2]; ++} __attribute__((__packed__)); /* 32 bytes */ ++ ++static uint64_t kvmclock_current_nsec(KVMClockState *s) ++{ ++ CPUArchState *acpu = first_cpu; ++ CPUState *cpu = ENV_GET_CPU(acpu); ++ CPUX86State *env = cpu->env_ptr; ++ hwaddr kvmclock_struct_pa = env->system_time_msr & ~1ULL; ++ uint64_t migration_tsc = env->tsc; ++ struct pvclock_vcpu_time_info time; ++ uint64_t delta; ++ uint64_t nsec_lo; ++ uint64_t nsec_hi; ++ uint64_t nsec; ++ ++ if (!(env->system_time_msr & 1ULL)) { ++ /* KVM clock not active */ ++ return 0; ++ } ++ ++ cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); ++ ++ delta = migration_tsc - time.tsc_timestamp; ++ if (time.tsc_shift < 0) { ++ delta >>= -time.tsc_shift; ++ } else { ++ delta <<= time.tsc_shift; ++ } ++ ++ mulu64(&nsec_lo, &nsec_hi, delta, time.tsc_to_system_mul); ++ nsec = (nsec_lo >> 32) | (nsec_hi << 32); ++ return nsec + time.system_time; ++} + + static void kvmclock_vm_state_change(void *opaque, int running, + RunState state) +@@ -39,9 +82,15 @@ static void kvmclock_vm_state_change(void *opaque, int running, + + if (running) { + struct kvm_clock_data data; ++ uint64_t time_at_migration = kvmclock_current_nsec(s); + + s->clock_valid = false; + ++ /* We can't rely on the migrated clock value, just discard it */ ++ if (time_at_migration) { ++ s->clock = time_at_migration; ++ } ++ + data.clock = s->clock; + data.flags = 0; + ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data); +-- +1.7.1 + diff --git a/SOURCES/kvm-libcacard-link-against-qemu-error.o-for-error_report.patch b/SOURCES/kvm-libcacard-link-against-qemu-error.o-for-error_report.patch new file mode 100644 index 0000000..146610e --- /dev/null +++ b/SOURCES/kvm-libcacard-link-against-qemu-error.o-for-error_report.patch @@ -0,0 +1,44 @@ +From 4117c536c678c75683236e48246d78aa87a6212d Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:04 +0200 +Subject: [PATCH 01/19] libcacard: link against qemu-error.o for error_report() + +Message-id: <1414059011-15516-2-git-send-email-kwolf@redhat.com> +Patchwork-id: 61835 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/8] libcacard: link against qemu-error.o for error_report() +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Stefan Hajnoczi + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 975a0015ee380f49a3be744279a6a06ab97e960a) +Signed-off-by: Miroslav Rezanina + +Conflicts: + libcacard/Makefile + +Signed-off-by: Kevin Wolf +--- + libcacard/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libcacard/Makefile b/libcacard/Makefile +index 6bdf0c4..c93cc6a 100644 +--- a/libcacard/Makefile ++++ b/libcacard/Makefile +@@ -4,7 +4,8 @@ TOOLS += vscclient$(EXESUF) + + # objects linked into a shared library, built with libtool with -fPIC if required + libcacard-obj-y = $(stub-obj-y) $(libcacard-y) +-libcacard-obj-y += util/osdep.o util/iov.o util/cutils.o util/qemu-timer-common.o util/error.o util/hexdump.o ++libcacard-obj-y += util/osdep.o util/iov.o util/cutils.o util/qemu-timer-common.o util/hexdump.o ++libcacard-obj-y += util/error.o util/qemu-error.o + libcacard-obj-$(CONFIG_WIN32) += util/oslib-win32.o util/qemu-thread-win32.o + libcacard-obj-$(CONFIG_POSIX) += util/oslib-posix.o util/qemu-thread-posix.o + libcacard-obj-y += $(filter trace/%, $(util-obj-y)) +-- +1.8.3.1 + diff --git a/SOURCES/kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch b/SOURCES/kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch index 3c0f1e7..2545192 100644 --- a/SOURCES/kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch +++ b/SOURCES/kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch @@ -1,18 +1,19 @@ -From 6e840c55cf077c166740a837edd92b8346be2cb9 Mon Sep 17 00:00:00 2001 +From 67f736a89722dcaa425c70510c080e95216a165f Mon Sep 17 00:00:00 2001 From: Fam Zheng -Date: Fri, 8 Aug 2014 03:23:27 +0200 -Subject: [PATCH 10/10] memory: Don't call memory_region_update_coalesced_range if nothing changed +Date: Thu, 19 Jun 2014 10:21:56 +0200 +Subject: [PATCH 11/13] memory: Don't call memory_region_update_coalesced_range if nothing changed -Message-id: <1407468207-28928-1-git-send-email-famz@redhat.com> -Patchwork-id: 60486 -O-Subject: [RHEL-7.0.z qemu-kvm PATCH] memory: Don't call memory_region_update_coalesced_range if nothing changed -Bugzilla: 1124660 -RH-Acked-by: Laszlo Ersek -RH-Acked-by: Paolo Bonzini +RH-Author: Fam Zheng +Message-id: <1403173316-12035-1-git-send-email-famz@redhat.com> +Patchwork-id: 59289 +O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH] memory: Don't call memory_region_update_coalesced_range if nothing changed +Bugzilla: 1096645 RH-Acked-by: Amos Kong +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1124660 -Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7805797 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7596269 +BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096645 With huge number of PCI devices in the system (for example, 200 virtio-blk-pci), this unconditional call can slow down emulation of diff --git a/SOURCES/kvm-migration-dump-vmstate-info-as-a-json-file-for-stati.patch b/SOURCES/kvm-migration-dump-vmstate-info-as-a-json-file-for-stati.patch new file mode 100644 index 0000000..9f7cc4f --- /dev/null +++ b/SOURCES/kvm-migration-dump-vmstate-info-as-a-json-file-for-stati.patch @@ -0,0 +1,278 @@ +From 2f243f0313211d416fa24a1db39b923216ce267f Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:08:58 -0500 +Subject: [CHANGE 02/29] migration: dump vmstate info as a json file for static + analysis +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <024e1bc4c9618850da0624d2d2bbe0bc106cee45.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59782 +O-Subject: [RHEL7.1 qemu-kvm PATCH 01/18] migration: dump vmstate info as a json file for static analysis +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +This commit adds a new command, '-dump-vmstate', that takes a filename +as an argument. When executed, QEMU will dump the vmstate information +for the machine type it's invoked with to the file, and quit. + +The JSON-format output can then be used to compare the vmstate info for +different QEMU versions, specifically to test whether live migration +would break due to changes in the vmstate data. + +A Python script that compares the output of such JSON dumps is included +in the following commit. + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit abfd9ce341ec66eb2e63756b9da43f77c054788e) +Signed-off-by: Amit Shah +Signed-off-by: jen + +Conflicts: + include/migration/vmstate.h + vl.c + +Signed-off-by: jen +--- + include/migration/vmstate.h | 2 + + qemu-options.hx | 14 +++++ + savevm.c | 135 ++++++++++++++++++++++++++++++++++++++++++++ + vl.c | 14 +++++ + 4 files changed, 165 insertions(+) + +diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h +index f2652e6..cae26d0 100644 +--- a/include/migration/vmstate.h ++++ b/include/migration/vmstate.h +@@ -747,4 +747,6 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev); + void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev); + void vmstate_register_ram_global(struct MemoryRegion *memory); + ++void dump_vmstate_json_to_file(FILE *out_fp); ++ + #endif +diff --git a/qemu-options.hx b/qemu-options.hx +index 1f2bb57..5d0f2cd 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -3098,6 +3098,20 @@ STEXI + prepend a timestamp to each log message.(default:on) + ETEXI + ++DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate, ++ "-dump-vmstate \n" ++ " Output vmstate information in JSON format to file.\n" ++ " Use the scripts/vmstate-static-checker.py file to\n" ++ " check for possible regressions in migration code\n" ++ " by comparing two such vmstate dumps.", ++ QEMU_ARCH_ALL) ++STEXI ++@item -dump-vmstate @var{file} ++@findex -dump-vmstate ++Dump json-encoded vmstate information for current machine type to file ++in @var{file} ++ETEXI ++ + HXCOMM This is the last statement. Insert new options before this line! + STEXI + @end table +diff --git a/savevm.c b/savevm.c +index 94512dd..963dc7d 100644 +--- a/savevm.c ++++ b/savevm.c +@@ -24,6 +24,7 @@ + + #include "config-host.h" + #include "qemu-common.h" ++#include "hw/boards.h" + #include "hw/hw.h" + #include "hw/qdev.h" + #include "net/net.h" +@@ -1484,6 +1485,140 @@ static QTAILQ_HEAD(savevm_handlers, SaveStateEntry) savevm_handlers = + QTAILQ_HEAD_INITIALIZER(savevm_handlers); + static int global_section_id; + ++static void dump_vmstate_vmsd(FILE *out_file, ++ const VMStateDescription *vmsd, int indent, ++ bool is_subsection); ++ ++static void dump_vmstate_vmsf(FILE *out_file, const VMStateField *field, ++ int indent) ++{ ++ fprintf(out_file, "%*s{\n", indent, ""); ++ indent += 2; ++ fprintf(out_file, "%*s\"field\": \"%s\",\n", indent, "", field->name); ++ fprintf(out_file, "%*s\"version_id\": %d,\n", indent, "", ++ field->version_id); ++ fprintf(out_file, "%*s\"field_exists\": %s,\n", indent, "", ++ field->field_exists ? "true" : "false"); ++ fprintf(out_file, "%*s\"size\": %zu", indent, "", field->size); ++ if (field->vmsd != NULL) { ++ fprintf(out_file, ",\n"); ++ dump_vmstate_vmsd(out_file, field->vmsd, indent, false); ++ } ++ fprintf(out_file, "\n%*s}", indent - 2, ""); ++} ++ ++static void dump_vmstate_vmss(FILE *out_file, ++ const VMStateSubsection *subsection, ++ int indent) ++{ ++ if (subsection->vmsd != NULL) { ++ dump_vmstate_vmsd(out_file, subsection->vmsd, indent, true); ++ } ++} ++ ++static void dump_vmstate_vmsd(FILE *out_file, ++ const VMStateDescription *vmsd, int indent, ++ bool is_subsection) ++{ ++ if (is_subsection) { ++ fprintf(out_file, "%*s{\n", indent, ""); ++ } else { ++ fprintf(out_file, "%*s\"%s\": {\n", indent, "", "Description"); ++ } ++ indent += 2; ++ fprintf(out_file, "%*s\"name\": \"%s\",\n", indent, "", vmsd->name); ++ fprintf(out_file, "%*s\"version_id\": %d,\n", indent, "", ++ vmsd->version_id); ++ fprintf(out_file, "%*s\"minimum_version_id\": %d", indent, "", ++ vmsd->minimum_version_id); ++ if (vmsd->fields != NULL) { ++ const VMStateField *field = vmsd->fields; ++ bool first; ++ ++ fprintf(out_file, ",\n%*s\"Fields\": [\n", indent, ""); ++ first = true; ++ while (field->name != NULL) { ++ if (field->flags & VMS_MUST_EXIST) { ++ /* Ignore VMSTATE_VALIDATE bits; these don't get migrated */ ++ field++; ++ continue; ++ } ++ if (!first) { ++ fprintf(out_file, ",\n"); ++ } ++ dump_vmstate_vmsf(out_file, field, indent + 2); ++ field++; ++ first = false; ++ } ++ fprintf(out_file, "\n%*s]", indent, ""); ++ } ++ if (vmsd->subsections != NULL) { ++ const VMStateSubsection *subsection = vmsd->subsections; ++ bool first; ++ ++ fprintf(out_file, ",\n%*s\"Subsections\": [\n", indent, ""); ++ first = true; ++ while (subsection->vmsd != NULL) { ++ if (!first) { ++ fprintf(out_file, ",\n"); ++ } ++ dump_vmstate_vmss(out_file, subsection, indent + 2); ++ subsection++; ++ first = false; ++ } ++ fprintf(out_file, "\n%*s]", indent, ""); ++ } ++ fprintf(out_file, "\n%*s}", indent - 2, ""); ++} ++ ++static void dump_machine_type(FILE *out_file) ++{ ++ fprintf(out_file, " \"vmschkmachine\": {\n"); ++ fprintf(out_file, " \"Name\": \"%s\"\n", current_machine->name); ++ fprintf(out_file, " },\n"); ++} ++ ++void dump_vmstate_json_to_file(FILE *out_file) ++{ ++ GSList *list, *elt; ++ bool first; ++ ++ fprintf(out_file, "{\n"); ++ dump_machine_type(out_file); ++ ++ first = true; ++ list = object_class_get_list(TYPE_DEVICE, true); ++ for (elt = list; elt; elt = elt->next) { ++ DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data, ++ TYPE_DEVICE); ++ const char *name; ++ int indent = 2; ++ ++ if (!dc->vmsd) { ++ continue; ++ } ++ ++ if (!first) { ++ fprintf(out_file, ",\n"); ++ } ++ name = object_class_get_name(OBJECT_CLASS(dc)); ++ fprintf(out_file, "%*s\"%s\": {\n", indent, "", name); ++ indent += 2; ++ fprintf(out_file, "%*s\"Name\": \"%s\",\n", indent, "", name); ++ fprintf(out_file, "%*s\"version_id\": %d,\n", indent, "", ++ dc->vmsd->version_id); ++ fprintf(out_file, "%*s\"minimum_version_id\": %d,\n", indent, "", ++ dc->vmsd->minimum_version_id); ++ ++ dump_vmstate_vmsd(out_file, dc->vmsd, indent, false); ++ ++ fprintf(out_file, "\n%*s}", indent - 2, ""); ++ first = false; ++ } ++ fprintf(out_file, "\n}\n"); ++ fclose(out_file); ++} ++ + static int calculate_new_instance_id(const char *idstr) + { + SaveStateEntry *se; +diff --git a/vl.c b/vl.c +index a0099f6..ca3d498 100644 +--- a/vl.c ++++ b/vl.c +@@ -2838,6 +2838,7 @@ int main(int argc, char **argv, char **envp) + }; + const char *trace_events = NULL; + const char *trace_file = NULL; ++ FILE *vmstate_dump_file = NULL; + + atexit(qemu_run_exit_notifiers); + error_set_progname(argv[0]); +@@ -3794,6 +3795,13 @@ int main(int argc, char **argv, char **envp) + } + configure_msg(opts); + break; ++ case QEMU_OPTION_dump_vmstate: ++ vmstate_dump_file = fopen(optarg, "w"); ++ if (vmstate_dump_file == NULL) { ++ fprintf(stderr, "open %s: %s\n", optarg, strerror(errno)); ++ exit(1); ++ } ++ break; + default: + os_parse_cmd_args(popt->index, optarg); + } +@@ -4346,6 +4354,12 @@ int main(int argc, char **argv, char **envp) + } + } + ++ if (vmstate_dump_file) { ++ /* dump and exit */ ++ dump_vmstate_json_to_file(vmstate_dump_file); ++ return 0; ++ } ++ + if (incoming) { + Error *local_err = NULL; + qemu_start_incoming_migration(incoming, &local_err); +-- +1.9.3 + diff --git a/SOURCES/kvm-migration-fix-parameter-validation-on-ram-load-CVE-2.patch b/SOURCES/kvm-migration-fix-parameter-validation-on-ram-load-CVE-2.patch new file mode 100644 index 0000000..1ccdaf8 --- /dev/null +++ b/SOURCES/kvm-migration-fix-parameter-validation-on-ram-load-CVE-2.patch @@ -0,0 +1,76 @@ +From 6986f7c62b38d90992bd8f7c178325fc1e31d7fe Mon Sep 17 00:00:00 2001 +Message-Id: <6986f7c62b38d90992bd8f7c178325fc1e31d7fe.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Amos Kong +Date: Mon, 8 Dec 2014 14:53:34 -0600 +Subject: [CHANGE 31/31] migration: fix parameter validation on ram load + (CVE-2014-7840) +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amos Kong +Message-id: <1418050414-25145-1-git-send-email-akong@redhat.com> +Patchwork-id: 62762 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] migration: fix parameter validation on ram load (CVE-2014-7840) +Bugzilla: 1163078 +RH-Acked-by: Juan Quintela +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Michael S. Tsirkin + +From: Michael S. Tsirkin + +During migration, the values read from migration stream during ram load +are not validated. Especially offset in host_from_stream_offset() and +also the length of the writes in the callers of said function. + +To fix this, we need to make sure that the [offset, offset + length] +range fits into one of the allocated memory regions. + +Validating addr < len should be sufficient since data seems to always be +managed in TARGET_PAGE_SIZE chunks. + +Fixes: CVE-2014-7840 + +Note: follow-up patches add extra checks on each block->host access. + +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Paolo Bonzini +Reviewed-by: Dr. David Alan Gilbert +Signed-off-by: Amit Shah +(backported from commit 0be839a2701369f669532ea5884c15bead1c6e08) +Conflict was caused by different error reporting. + +Signed-off-by: Amos Kong +Signed-off-by: Jeff E. Nelson +--- + arch_init.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch_init.c b/arch_init.c +index 0c2bde9..4c3d3b5 100644 +--- a/arch_init.c ++++ b/arch_init.c +@@ -979,7 +979,7 @@ static inline void *host_from_stream_offset(QEMUFile *f, + uint8_t len; + + if (flags & RAM_SAVE_FLAG_CONTINUE) { +- if (!block) { ++ if (!block || block->length <= offset) { + fprintf(stderr, "Ack, bad migration stream!\n"); + return NULL; + } +@@ -992,8 +992,9 @@ static inline void *host_from_stream_offset(QEMUFile *f, + id[len] = 0; + + QTAILQ_FOREACH(block, &ram_list.blocks, next) { +- if (!strncmp(id, block->idstr, sizeof(id))) ++ if (!strncmp(id, block->idstr, sizeof(id)) && block->length > offset) { + return memory_region_get_ram_ptr(block->mr) + offset; ++ } + } + + fprintf(stderr, "Can't find block %s!\n", id); +-- +2.1.0 + diff --git a/SOURCES/kvm-migration-qmp_migrate-keep-working-after-syntax-erro.patch b/SOURCES/kvm-migration-qmp_migrate-keep-working-after-syntax-erro.patch new file mode 100644 index 0000000..2f39e95 --- /dev/null +++ b/SOURCES/kvm-migration-qmp_migrate-keep-working-after-syntax-erro.patch @@ -0,0 +1,64 @@ +From e7ea7509ab95b71445d98b7c76cc74e1e1304779 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Apr 2014 09:28:47 +0200 +Subject: [PATCH 02/13] migration: qmp_migrate(): keep working after syntax error + +RH-Author: Amit Shah +Message-id: <717d7d24efbff7fe32d70c506edea41ea00d1edc.1397208304.git.amit.shah@redhat.com> +Patchwork-id: 58439 +O-Subject: [RHEL7.0.z qemu-kvm PATCH 1/1] migration: qmp_migrate(): keep working after syntax error +Bugzilla: 1086598 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Amos Kong +RH-Acked-by: Luiz Capitulino + +From: Luiz Capitulino + +If a user or QMP client enter a bad syntax for the migrate +command in QMP/HMP, then the migrate command will never succeed +from that point on. + +For example, if you enter: + +(qemu) migrate tcp;0:4444 +migrate: Parameter 'uri' expects a valid migration protocol + +Then the migrate command will always fail from now on: + +(qemu) migrate tcp:0:4444 +migrate: There's a migration process in progress + +The problem is that qmp_migrate() sets the migration status to +MIG_STATE_SETUP and doesn't reset it on syntax error. This bug +was introduced by commit 29ae8a4133082e16970c9d4be09f4b6a15034617. + +Bugzilla: 1086598 + +Reviewed-by: Michael R. Hines +Signed-off-by: Luiz Capitulino +(cherry picked from commit c950114286ea358a93ce632db0421945e1008395) +Signed-off-by: Amit Shah +--- + migration.c | 1 + + 1 file changed, 1 insertion(+) + +Signed-off-by: Miroslav Rezanina +--- + migration.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/migration.c b/migration.c +index 93de654..7efbd25 100644 +--- a/migration.c ++++ b/migration.c +@@ -457,6 +457,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, + #endif + } else { + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); ++ s->state = MIG_STATE_ERROR; + return; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-migration-static-variables-will-not-be-reset-at-seco.patch b/SOURCES/kvm-migration-static-variables-will-not-be-reset-at-seco.patch new file mode 100644 index 0000000..92f9053 --- /dev/null +++ b/SOURCES/kvm-migration-static-variables-will-not-be-reset-at-seco.patch @@ -0,0 +1,76 @@ +From bf03ba87d891a3f0f2aad8d05b5770c1ac09e800 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 21 Nov 2014 08:27:51 +0100 +Subject: [PATCH 1/7] migration: static variables will not be reset at second + migration + +Message-id: <20e4d11148c43174056cdd0e3be03480fe51ccc7.1416557860.git.amit.shah@redhat.com> +Patchwork-id: 62517 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] migration: static variables will not be reset at second migration +Bugzilla: 1071776 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini + +From: ChenLiang + +The static variables in migration_bitmap_sync will not be reset in +the case of a second attempted migration. + +Signed-off-by: ChenLiang +Signed-off-by: Gonglei +Reviewed-by: Dr. David Alan Gilbert +Signed-off-by: Amit Shah +(cherry picked from commit 6c1b663c4c3725bc4bc33f78ed266ddef80a2ca8) +Signed-off-by: Amit Shah +Signed-off-by: Miroslav Rezanina + +Conflicts: + arch_init.c +(Trivial context conflict) +--- + arch_init.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/arch_init.c b/arch_init.c +index b88d686..0c2bde9 100644 +--- a/arch_init.c ++++ b/arch_init.c +@@ -476,15 +476,23 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length) + + + /* Needs iothread lock! */ ++/* Fix me: there are too many global variables used in migration process. */ ++static int64_t start_time; ++static int64_t bytes_xfer_prev; ++static int64_t num_dirty_pages_period; ++ ++static void migration_bitmap_sync_init(void) ++{ ++ start_time = 0; ++ bytes_xfer_prev = 0; ++ num_dirty_pages_period = 0; ++} + + static void migration_bitmap_sync(void) + { + RAMBlock *block; + uint64_t num_dirty_pages_init = migration_dirty_pages; + MigrationState *s = migrate_get_current(); +- static int64_t start_time; +- static int64_t bytes_xfer_prev; +- static int64_t num_dirty_pages_period; + int64_t end_time; + int64_t bytes_xfer_now; + +@@ -732,6 +740,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) + + mig_throttle_on = false; + dirty_rate_high_cnt = 0; ++ migration_bitmap_sync_init(); + + if (migrate_use_xbzrle()) { + XBZRLE_cache_lock(); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-mirror-Fix-qiov-size-for-short-requests.patch b/SOURCES/kvm-mirror-Fix-qiov-size-for-short-requests.patch index 4ae2a35..850e23f 100644 --- a/SOURCES/kvm-mirror-Fix-qiov-size-for-short-requests.patch +++ b/SOURCES/kvm-mirror-Fix-qiov-size-for-short-requests.patch @@ -1,12 +1,12 @@ -From cb60b78e889e738f88e4c056d7312290869e4f1d Mon Sep 17 00:00:00 2001 +From 332e8935dd300a4c6f77407e281fe339759bc505 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:14 +0200 -Subject: [PATCH 7/7] mirror: Fix qiov size for short requests +Subject: [PATCH 11/11] mirror: Fix qiov size for short requests Message-id: <1408552814-23031-8-git-send-email-eblake@redhat.com> Patchwork-id: 60650 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 7/7] mirror: Fix qiov size for short requests -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch b/SOURCES/kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch index ff3922b..8553309 100644 --- a/SOURCES/kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch +++ b/SOURCES/kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch @@ -1,12 +1,12 @@ -From 64f938d5b7ae0c2b1029b9816f45c8e5c0e0f560 Mon Sep 17 00:00:00 2001 +From 5e30d941f2fb33b995333fc4bb45368129f8d4bc Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:08 +0200 -Subject: [PATCH 1/7] mirror: Fix resource leak when bdrv_getlength fails +Subject: [PATCH 05/11] mirror: Fix resource leak when bdrv_getlength fails Message-id: <1408552814-23031-2-git-send-email-eblake@redhat.com> Patchwork-id: 60646 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 1/7] mirror: Fix resource leak when bdrv_getlength fails -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch b/SOURCES/kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch index 1156d36..5099a31 100644 --- a/SOURCES/kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch +++ b/SOURCES/kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch @@ -1,12 +1,12 @@ -From a437bfcdaad8e387709506ccaa992895f76afa8e Mon Sep 17 00:00:00 2001 +From 0e7b328d0802c970f632f50d6daab0ea6d226b29 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:10 +0200 -Subject: [PATCH 3/7] mirror: Go through ready -> complete process for 0 len image +Subject: [PATCH 07/11] mirror: Go through ready -> complete process for 0 len image Message-id: <1408552814-23031-4-git-send-email-eblake@redhat.com> Patchwork-id: 60645 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 3/7] mirror: Go through ready -> complete process for 0 len image -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-pc-Add-Broadwell-CPUID-compatibility-bits.patch b/SOURCES/kvm-pc-Add-Broadwell-CPUID-compatibility-bits.patch new file mode 100644 index 0000000..3ee49c5 --- /dev/null +++ b/SOURCES/kvm-pc-Add-Broadwell-CPUID-compatibility-bits.patch @@ -0,0 +1,41 @@ +From 2986c1070e031d290c268fba039e3eac97b28467 Mon Sep 17 00:00:00 2001 +From: Eduardo Habkost +Date: Thu, 21 Aug 2014 19:58:17 +0200 +Subject: [PATCH 2/3] pc: Add Broadwell CPUID compatibility bits + +Message-id: <1408651097-24190-3-git-send-email-ehabkost@redhat.com> +Patchwork-id: 60671 +O-Subject: [RHEL7.1 qemu-kvm PATCH 2/2] pc: Add Broadwell CPUID compatibility bits +Bugzilla: 1116117 +RH-Acked-by: Bandan Das +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini + +On RHEL-6, the Broadwell CPU model won't have the RDTSCP and SMAP +features. Add compatibility code to ensure we stay compatible when +migrating from RHEL-6. + +Signed-off-by: Eduardo Habkost +Signed-off-by: Miroslav Rezanina +--- + hw/i386/pc_piix.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c +index 550acd8..4ea3f67 100644 +--- a/hw/i386/pc_piix.c ++++ b/hw/i386/pc_piix.c +@@ -935,6 +935,10 @@ static void pc_compat_rhel650(QEMUMachineInitArgs *args) + CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR | + CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU, + 0); ++ x86_cpu_compat_set_features("Broadwell", FEAT_8000_0001_EDX, ++ 0, CPUID_EXT2_RDTSCP); ++ x86_cpu_compat_set_features("Broadwell", FEAT_7_0_EBX, ++ 0, CPUID_7_0_EBX_SMAP); + + /* RHEL-6 kernel never supported exposing RDTSCP */ + x86_cpu_compat_set_features(NULL, FEAT_8000_0001_EDX, 0, CPUID_EXT2_RDTSCP); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch b/SOURCES/kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch index 8c811f4..4e99fd1 100644 --- a/SOURCES/kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch +++ b/SOURCES/kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch @@ -1,17 +1,19 @@ -From baa1f0d306b387ce7b05d1eea51034d86b1a203d Mon Sep 17 00:00:00 2001 +From 6971c1cd4d0c6822c99b2043f58c0f6a225c83b2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 5 May 2014 20:27:12 +0200 -Subject: [PATCH] pc: add hot_add_cpu callback to all machine types +Subject: [PATCH 1/2] pc: add hot_add_cpu callback to all machine types RH-Author: Paolo Bonzini Message-id: <1399321632-26203-1-git-send-email-pbonzini@redhat.com> Patchwork-id: 58691 O-Subject: [RHEL 7.0.z qemu-kvm PATCH] pc: add hot_add_cpu callback to all machine types -Bugzilla: 1094820 +Bugzilla: 1094285 RH-Acked-by: Markus Armbruster RH-Acked-by: Igor Mammedov RH-Acked-by: Laszlo Ersek +Bugzilla: 1094285 + Upstream status: N/A Brew build: 7416220 diff --git a/SOURCES/kvm-pc-increase-maximal-VCPU-count-to-240.patch b/SOURCES/kvm-pc-increase-maximal-VCPU-count-to-240.patch new file mode 100644 index 0000000..c38b9fa --- /dev/null +++ b/SOURCES/kvm-pc-increase-maximal-VCPU-count-to-240.patch @@ -0,0 +1,42 @@ +From aa6910ca37db66c51b7a9a6431b68f7223b8fd7b Mon Sep 17 00:00:00 2001 +From: Radim Krcmar +Date: Wed, 27 Aug 2014 13:29:34 +0200 +Subject: [PATCH 2/6] pc: increase maximal VCPU count to 240 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1409146174-28442-1-git-send-email-rkrcmar@redhat.com> +Patchwork-id: 60740 +O-Subject: [RHEL7.1 qemu-kvm PATCH] pc: increase maximal VCPU count to 240 +Bugzilla: 1134408 +RH-Acked-by: Eduardo Habkost +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Andrew Jones + +To prevent TCG from going over RHEL KVM's limit in bc949bc00c, we added +another downstream constraint that needs to be bumped. + +Signed-off-by: Radim KrÄŤmář +Signed-off-by: Miroslav Rezanina +--- + include/hw/i386/pc.h | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h +index 57e2f93..3b8f7d8 100644 +--- a/include/hw/i386/pc.h ++++ b/include/hw/i386/pc.h +@@ -15,7 +15,8 @@ + #include "sysemu/sysemu.h" + #include "hw/pci/pci.h" + +-#define RHEL_MAX_CPUS 160 ++/* KVM can't exceed KVM_SOFT_MAX_VCPUS (arch/x86/include/asm/kvm_host.h) */ ++#define RHEL_MAX_CPUS 240 + + /* PC-style peripherals (also used by other machines). */ + +-- +1.7.1 + diff --git a/SOURCES/kvm-pflash_cfi01-write-flash-contents-to-bdrv-on-incomin.patch b/SOURCES/kvm-pflash_cfi01-write-flash-contents-to-bdrv-on-incomin.patch new file mode 100644 index 0000000..74a9501 --- /dev/null +++ b/SOURCES/kvm-pflash_cfi01-write-flash-contents-to-bdrv-on-incomin.patch @@ -0,0 +1,105 @@ +From 2a3a2063076b590d9ef81a7d7cdc71520647734b Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Tue, 9 Sep 2014 16:04:57 +0200 +Subject: [PATCH 07/12] pflash_cfi01: write flash contents to bdrv on incoming migration + +Message-id: <1410278697-29800-2-git-send-email-lersek@redhat.com> +Patchwork-id: 60923 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] pflash_cfi01: write flash contents to bdrv on incoming migration +Bugzilla: 1139702 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Stefan Hajnoczi + +A drive that backs a pflash device is special: +- it is very small, +- its entire contents are kept in a RAMBlock at all times, covering the + guest-phys address range that provides the guest's view of the emulated + flash chip. + +The pflash device model keeps the drive (the host-side file) and the +guest-visible flash contents in sync. When migrating the guest, the +guest-visible flash contents (the RAMBlock) is migrated by default, but on +the target host, the drive (the host-side file) remains in full sync with +the RAMBlock only if: +- the source and target hosts share the storage underlying the pflash + drive, +- or the migration requests full or incremental block migration too, which + then covers all drives. + +Due to the special nature of pflash drives, the following scenario makes +sense as well: +- no full nor incremental block migration, covering all drives, alongside + the base migration (justified eg. by shared storage for "normal" (big) + drives), +- non-shared storage for pflash drives. + +In this case, currently only those portions of the flash drive are updated +on the target disk that the guest reprograms while running on the target +host. + +In order to restore accord, dump the entire flash contents to the bdrv in +a post_load() callback. + +- The read-only check follows the other call-sites of pflash_update(); +- both "pfl->ro" and pflash_update() reflect / consider the case when + "pfl->bs" is NULL; +- the total size of the flash device is calculated as in + pflash_cfi01_realize(). + +When using shared storage, or requesting full or incremental block +migration along with the normal migration, the patch should incur a +harmless rewrite from the target side. + +It is assumed that, on the target host, RAM is loaded ahead of the call to +pflash_post_load(). + +Suggested-by: Paolo Bonzini +Signed-off-by: Laszlo Ersek +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 4c0cfc72b31a79f737a64ebbe0411e4b83e25771) +--- + hw/block/pflash_cfi01.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/block/pflash_cfi01.c | 14 ++++++++++++++ + 1 files changed, 14 insertions(+), 0 deletions(-) + +diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c +index 18eb0bc..e8b47fb 100644 +--- a/hw/block/pflash_cfi01.c ++++ b/hw/block/pflash_cfi01.c +@@ -85,10 +85,13 @@ struct pflash_t { + void *storage; + }; + ++static int pflash_post_load(void *opaque, int version_id); ++ + static const VMStateDescription vmstate_pflash = { + .name = "pflash_cfi01", + .version_id = 1, + .minimum_version_id = 1, ++ .post_load = pflash_post_load, + .fields = (VMStateField[]) { + VMSTATE_UINT8(wcycle, pflash_t), + VMSTATE_UINT8(cmd, pflash_t), +@@ -768,3 +771,14 @@ MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl) + { + return &fl->mem; + } ++ ++static int pflash_post_load(void *opaque, int version_id) ++{ ++ pflash_t *pfl = opaque; ++ ++ if (!pfl->ro) { ++ DPRINTF("%s: updating bdrv for %s\n", __func__, pfl->name); ++ pflash_update(pfl, 0, pfl->sector_len * pfl->nb_blocs); ++ } ++ return 0; ++} +-- +1.7.1 + diff --git a/SOURCES/kvm-qapi-introduce-PreallocMode-and-new-PreallocModes-fu.patch b/SOURCES/kvm-qapi-introduce-PreallocMode-and-new-PreallocModes-fu.patch new file mode 100644 index 0000000..2ac40bc --- /dev/null +++ b/SOURCES/kvm-qapi-introduce-PreallocMode-and-new-PreallocModes-fu.patch @@ -0,0 +1,163 @@ +From f984e0debc17b26f36c8f73027fac11d813826d7 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 10 Nov 2014 09:14:05 +0100 +Subject: [PATCH 28/41] qapi: introduce PreallocMode and new PreallocModes full + and falloc. + +Message-id: <1415610847-15383-3-git-send-email-mreitz@redhat.com> +Patchwork-id: 62238 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 2/4] qapi: introduce PreallocMode and new PreallocModes full and falloc. +Bugzilla: 1087724 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +From: Hu Tao + +This patch prepares for the subsequent patches. + +Signed-off-by: Hu Tao +Reviewed-by: Max Reitz +Reviewed-by: Kevin Wolf +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit ffeaac9b4e23a3033e8120cc34bacadc09487f1b) +Signed-off-by: Miroslav Rezanina + +Conflicts: + block/qcow2.c + qapi/block-core.json + +Downstream's qapi-schema.json has not (yet) been split into multiple +files such as qapi/block-core.json. + +The conflicts in block/qcow2.c result from the fact that +QEMUOptionParameter has not been replaced with QemuOpts downstream +(upstream 1bd0e2d1c40ef1dbe717728197071e931abe22a4). + +Signed-off-by: Max Reitz +--- + block/qcow2.c | 28 +++++++++++++++++----------- + qapi-schema.json | 18 ++++++++++++++++++ + tests/qemu-iotests/049.out | 2 +- + 3 files changed, 36 insertions(+), 12 deletions(-) + +diff --git a/block/qcow2.c b/block/qcow2.c +index a679355..99c6b93 100644 +--- a/block/qcow2.c ++++ b/block/qcow2.c +@@ -30,6 +30,7 @@ + #include "qemu/error-report.h" + #include "qapi/qmp/qerror.h" + #include "qapi/qmp/qbool.h" ++#include "qapi/util.h" + #include "trace.h" + + /* +@@ -1555,7 +1556,7 @@ static int preallocate(BlockDriverState *bs) + + static int qcow2_create2(const char *filename, int64_t total_size, + const char *backing_file, const char *backing_format, +- int flags, size_t cluster_size, int prealloc, ++ int flags, size_t cluster_size, PreallocMode prealloc, + QEMUOptionParameter *options, int version, + Error **errp) + { +@@ -1690,7 +1691,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, + } + + /* And if we're supposed to preallocate metadata, do that now */ +- if (prealloc) { ++ if (prealloc == PREALLOC_MODE_METADATA) { + BDRVQcowState *s = bs->opaque; + qemu_co_mutex_lock(&s->lock); + ret = preallocate(bs); +@@ -1715,7 +1716,7 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options, + uint64_t sectors = 0; + int flags = 0; + size_t cluster_size = DEFAULT_CLUSTER_SIZE; +- int prealloc = 0; ++ PreallocMode prealloc = PREALLOC_MODE_OFF; + int version = 3; + Error *local_err = NULL; + int ret; +@@ -1735,13 +1736,11 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options, + cluster_size = options->value.n; + } + } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { +- if (!options->value.s || !strcmp(options->value.s, "off")) { +- prealloc = 0; +- } else if (!strcmp(options->value.s, "metadata")) { +- prealloc = 1; +- } else { +- error_setg(errp, "Invalid preallocation mode: '%s'", +- options->value.s); ++ prealloc = qapi_enum_parse(PreallocMode_lookup, options->value.s, ++ PREALLOC_MODE_MAX, PREALLOC_MODE_OFF, ++ &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); + return -EINVAL; + } + } else if (!strcmp(options->name, BLOCK_OPT_COMPAT_LEVEL)) { +@@ -1762,7 +1761,14 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options, + options++; + } + +- if (backing_file && prealloc) { ++ if (prealloc != PREALLOC_MODE_OFF && ++ prealloc != PREALLOC_MODE_METADATA) { ++ error_setg(errp, "Unsupported preallocate mode: %s", ++ PreallocMode_lookup[prealloc]); ++ return -EINVAL; ++ } ++ ++ if (backing_file && prealloc != PREALLOC_MODE_OFF) { + error_setg(errp, "Backing file and preallocation cannot be used at " + "the same time"); + return -EINVAL; +diff --git a/qapi-schema.json b/qapi-schema.json +index 31ac5c5..2af2643 100644 +--- a/qapi-schema.json ++++ b/qapi-schema.json +@@ -4118,6 +4118,24 @@ + { 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } } + + ## ++# @PreallocMode ++# ++# Preallocation mode of QEMU image file ++# ++# @off: no preallocation ++# @metadata: preallocate only for metadata ++# @falloc: like @full preallocation but allocate disk space by ++# posix_fallocate() rather than writing zeros. ++# @full: preallocate all data by writing zeros to device to ensure disk ++# space is really available. @full preallocation also sets up ++# metadata correctly. ++# ++# Since 2.2 ++## ++{ 'enum': 'PreallocMode', ++ 'data': [ 'off', 'metadata', 'falloc', 'full' ] } ++ ++## + # @RxState: + # + # Packets receiving state +diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out +index 96e83a4..b2fcf0b 100644 +--- a/tests/qemu-iotests/049.out ++++ b/tests/qemu-iotests/049.out +@@ -179,7 +179,7 @@ qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M + Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off + + qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M +-qemu-img: TEST_DIR/t.qcow2: Invalid preallocation mode: '1234' ++qemu-img: TEST_DIR/t.qcow2: invalid parameter value: 1234 + Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='1234' lazy_refcounts=off + + == Check encryption option == +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qapi-treat-all-negative-return-of-strtosz_suffix-as-.patch b/SOURCES/kvm-qapi-treat-all-negative-return-of-strtosz_suffix-as-.patch new file mode 100644 index 0000000..14eb89f --- /dev/null +++ b/SOURCES/kvm-qapi-treat-all-negative-return-of-strtosz_suffix-as-.patch @@ -0,0 +1,64 @@ +From ff6247a010ae1c37e400bbdd232df40ddcdf1bfc Mon Sep 17 00:00:00 2001 +From: Amos Kong +Date: Mon, 4 Aug 2014 03:33:38 +0200 +Subject: [PATCH 4/4] qapi: treat all negative return of strtosz_suffix() as error + +Message-id: <1407123218-15659-1-git-send-email-akong@redhat.com> +Patchwork-id: 60413 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] qapi: treat all negative return of strtosz_suffix() as error +Bugzilla: 1074403 +RH-Acked-by: Luiz Capitulino +RH-Acked-by: Fam Zheng +RH-Acked-by: Laszlo Ersek + +Bug: 1074403 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7780802 +Test: tested by myself + +strtosz_suffix() might return negative error, this patch fixes +the error handling. + +This patch also changes to handle error in the if statement +rather than handle success specially, this will make this use +of strtosz_suffix consistent with all other uses. + +Signed-off-by: Amos Kong +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Luiz Capitulino +(cherry picked from commit cb45de6798956975c4b13a6233f7a00d2239b61a) +--- + qapi/opts-visitor.c | 11 ++++++----- + 1 files changed, 6 insertions(+), 5 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + qapi/opts-visitor.c | 11 ++++++----- + 1 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c +index 174bd8b..bbb99e9 100644 +--- a/qapi/opts-visitor.c ++++ b/qapi/opts-visitor.c +@@ -348,13 +348,14 @@ opts_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) + + val = strtosz_suffix(opt->str ? opt->str : "", &endptr, + STRTOSZ_DEFSUFFIX_B); +- if (val != -1 && *endptr == '\0') { +- *obj = val; +- processed(ov, name); ++ if (val < 0 || *endptr) { ++ error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, ++ "a size value representible as a non-negative int64"); + return; + } +- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, +- "a size value representible as a non-negative int64"); ++ ++ *obj = val; ++ processed(ov, name); + } + + +-- +1.7.1 + diff --git a/SOURCES/kvm-qcow-correctly-propagate-errors.patch b/SOURCES/kvm-qcow-correctly-propagate-errors.patch index 40f9e9a..fca5246 100644 --- a/SOURCES/kvm-qcow-correctly-propagate-errors.patch +++ b/SOURCES/kvm-qcow-correctly-propagate-errors.patch @@ -1,13 +1,13 @@ -From 8e046eb446573101d92b41a88ebe1066a42d653c Mon Sep 17 00:00:00 2001 +From 7f2252627e64e975707b01eb1f4da7c2015ca457 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:43 +0200 -Subject: [PATCH 22/30] qcow: correctly propagate errors +Subject: [PATCH 26/31] qcow: correctly propagate errors RH-Author: Kevin Wolf Message-id: <1401717288-3918-2-git-send-email-kwolf@redhat.com> Patchwork-id: 59096 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 1/6] qcow: correctly propagate errors -Bugzilla: 1097229 +Bugzilla: 1097229 1097230 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina @@ -15,6 +15,8 @@ RH-Acked-by: Stefan Hajnoczi From: Paolo Bonzini +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230 + Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf diff --git a/SOURCES/kvm-qcow1-Check-maximum-cluster-size.patch b/SOURCES/kvm-qcow1-Check-maximum-cluster-size.patch index e006f39..6ba8daf 100644 --- a/SOURCES/kvm-qcow1-Check-maximum-cluster-size.patch +++ b/SOURCES/kvm-qcow1-Check-maximum-cluster-size.patch @@ -1,18 +1,20 @@ -From 0867b2aac8b789d492af127b12437e526774b7cf Mon Sep 17 00:00:00 2001 +From d40996f249a4e28a0979cd7919192d9f440800b5 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:45 +0200 -Subject: [PATCH 24/30] qcow1: Check maximum cluster size +Subject: [PATCH 28/31] qcow1: Check maximum cluster size RH-Author: Kevin Wolf Message-id: <1401717288-3918-4-git-send-email-kwolf@redhat.com> Patchwork-id: 59098 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 3/6] qcow1: Check maximum cluster size -Bugzilla: 1097229 +Bugzilla: 1097229 1097230 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230 + Huge values for header.cluster_bits cause unbounded allocations (e.g. for s->cluster_cache) and crash qemu this way. Less huge values may survive those allocations, but can cause integer overflows later on. @@ -162,10 +164,10 @@ index 0000000..8bf8158 +no file open, try 'help open' +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group -index ad96fcf..d6d4a7f 100644 +index 1c91036..e588404 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group -@@ -81,3 +81,4 @@ +@@ -82,3 +82,4 @@ 084 img auto 086 rw auto quick 088 rw auto diff --git a/SOURCES/kvm-qcow1-Make-padding-in-the-header-explicit.patch b/SOURCES/kvm-qcow1-Make-padding-in-the-header-explicit.patch index c8a69b8..a48144c 100644 --- a/SOURCES/kvm-qcow1-Make-padding-in-the-header-explicit.patch +++ b/SOURCES/kvm-qcow1-Make-padding-in-the-header-explicit.patch @@ -1,18 +1,20 @@ -From 3dae291d6b66443e016123ff763e89c07119cacb Mon Sep 17 00:00:00 2001 +From 6cce28d5332ad52ae9ec531ae382667bb03cbeb6 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:44 +0200 -Subject: [PATCH 23/30] qcow1: Make padding in the header explicit +Subject: [PATCH 27/31] qcow1: Make padding in the header explicit RH-Author: Kevin Wolf Message-id: <1401717288-3918-3-git-send-email-kwolf@redhat.com> Patchwork-id: 59097 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 2/6] qcow1: Make padding in the header explicit -Bugzilla: 1097229 +Bugzilla: 1097229 1097230 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230 + We were relying on all compilers inserting the same padding in the header struct that is used for the on-disk format. Let's not do that. Mark the struct as packed and insert an explicit padding field for diff --git a/SOURCES/kvm-qcow1-Stricter-backing-file-length-check.patch b/SOURCES/kvm-qcow1-Stricter-backing-file-length-check.patch index cbb569f..18cdd08 100644 --- a/SOURCES/kvm-qcow1-Stricter-backing-file-length-check.patch +++ b/SOURCES/kvm-qcow1-Stricter-backing-file-length-check.patch @@ -1,7 +1,7 @@ -From 9e8900ff62bb5c0009ca25a98158650e39f99c47 Mon Sep 17 00:00:00 2001 +From 4abd8ed02c277e6cd3202f61c2044a5cdff417de Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:48 +0200 -Subject: [PATCH 27/30] qcow1: Stricter backing file length check +Subject: [PATCH 31/31] qcow1: Stricter backing file length check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,12 +10,14 @@ RH-Author: Kevin Wolf Message-id: <1401717288-3918-7-git-send-email-kwolf@redhat.com> Patchwork-id: 59100 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 6/6] qcow1: Stricter backing file length check -Bugzilla: 1097236 +Bugzilla: 1097236 1097237 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097237 + Like qcow2 since commit 6d33e8e7, error out on invalid lengths instead of silently truncating them to 1023. diff --git a/SOURCES/kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch b/SOURCES/kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch index 425db79..95f641f 100644 --- a/SOURCES/kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch +++ b/SOURCES/kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch @@ -1,18 +1,20 @@ -From 6cec75be66671262a640c0424d93902862f6f1e7 Mon Sep 17 00:00:00 2001 +From 6a7dafce7c4fb8e13e331efb301baedffce08e3f Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:46 +0200 -Subject: [PATCH 25/30] qcow1: Validate L2 table size (CVE-2014-0222) +Subject: [PATCH 29/31] qcow1: Validate L2 table size (CVE-2014-0222) RH-Author: Kevin Wolf Message-id: <1401717288-3918-5-git-send-email-kwolf@redhat.com> Patchwork-id: 59099 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 4/6] qcow1: Validate L2 table size (CVE-2014-0222) -Bugzilla: 1097229 +Bugzilla: 1097229 1097230 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230 + Too large L2 table sizes cause unbounded allocations. Images actually created by qemu-img only have 512 byte or 4k L2 tables. diff --git a/SOURCES/kvm-qcow1-Validate-image-size-CVE-2014-0223.patch b/SOURCES/kvm-qcow1-Validate-image-size-CVE-2014-0223.patch index dd56cbb..cd689a8 100644 --- a/SOURCES/kvm-qcow1-Validate-image-size-CVE-2014-0223.patch +++ b/SOURCES/kvm-qcow1-Validate-image-size-CVE-2014-0223.patch @@ -1,18 +1,20 @@ -From a193c89099b75ab17e530fb909813373f72c1ca7 Mon Sep 17 00:00:00 2001 +From fca7c0bc430ddd279549cc4a10a529f0b99680fc Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 2 Jun 2014 13:54:47 +0200 -Subject: [PATCH 26/30] qcow1: Validate image size (CVE-2014-0223) +Subject: [PATCH 30/31] qcow1: Validate image size (CVE-2014-0223) RH-Author: Kevin Wolf Message-id: <1401717288-3918-6-git-send-email-kwolf@redhat.com> Patchwork-id: 59101 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 5/6] qcow1: Validate image size (CVE-2014-0223) -Bugzilla: 1097236 +Bugzilla: 1097236 1097237 RH-Acked-by: Max Reitz RH-Acked-by: Fam Zheng RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097237 + A huge image size could cause s->l1_size to overflow. Make sure that images never require a L1 table larger than what fits in s->l1_size. diff --git a/SOURCES/kvm-qcow2-Add-falloc-and-full-preallocation-option.patch b/SOURCES/kvm-qcow2-Add-falloc-and-full-preallocation-option.patch new file mode 100644 index 0000000..25619b6 --- /dev/null +++ b/SOURCES/kvm-qcow2-Add-falloc-and-full-preallocation-option.patch @@ -0,0 +1,465 @@ +From ddb1e6862dffe40bb2929d3a0e3eba198c54ee43 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 10 Nov 2014 09:14:07 +0100 +Subject: [PATCH 30/41] qcow2: Add falloc and full preallocation option + +Message-id: <1415610847-15383-5-git-send-email-mreitz@redhat.com> +Patchwork-id: 62240 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 4/4] qcow2: Add falloc and full preallocation option +Bugzilla: 1087724 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +From: Hu Tao + +preallocation=falloc allocates disk space by posix_fallocate(), +preallocation=full allocates disk space by writing zeros to disk. +Both modes imply preallocation=metadata. + +Signed-off-by: Hu Tao +Reviewed-by: Max Reitz +Signed-off-by: Kevin Wolf +(cherry picked from commit 0e4271b711a8ea766d29824c844e268b91ac3ae5) +Signed-off-by: Miroslav Rezanina + +Conflicts: + block/qcow2.c + +QEMUOptionParameter has not been replaced with QemuOpts downstream, +total_size is in sectors instead of bytes in downstream's +qcow2_create2(). + +The use of QEMUOptionParameter makes it rather difficult to set an +option in qcow2 for the underlying file to be created. Because qcow2 +already used to pass a functionally empty options array, I added an +assertion for this to be true and created a new QEMUOptionParameter +array in case there are actually options to be passed to the protocol +driver (that is, for preallocation). + +Signed-off-by: Max Reitz +--- + block/qcow2.c | 81 +++++++++++++++++++++++++++++++++++++++------- + qemu-doc.texi | 8 +++-- + qemu-img.texi | 8 +++-- + tests/qemu-iotests/082.out | 54 +++++++++++++++---------------- + 4 files changed, 106 insertions(+), 45 deletions(-) + +diff --git a/block/qcow2.c b/block/qcow2.c +index 99c6b93..43e54d6 100644 +--- a/block/qcow2.c ++++ b/block/qcow2.c +@@ -1557,8 +1557,7 @@ static int preallocate(BlockDriverState *bs) + static int qcow2_create2(const char *filename, int64_t total_size, + const char *backing_file, const char *backing_format, + int flags, size_t cluster_size, PreallocMode prealloc, +- QEMUOptionParameter *options, int version, +- Error **errp) ++ int version, Error **errp) + { + /* Calculate cluster_bits */ + int cluster_bits; +@@ -1588,8 +1587,71 @@ static int qcow2_create2(const char *filename, int64_t total_size, + uint64_t* refcount_table; + Error *local_err = NULL; + int ret; ++ QEMUOptionParameter *options = NULL; ++ BlockDriver *file_drv; ++ ++ if (prealloc == PREALLOC_MODE_FULL || prealloc == PREALLOC_MODE_FALLOC) { ++ int64_t meta_size = 0; ++ uint64_t nreftablee, nrefblocke, nl1e, nl2e; ++ int64_t aligned_total_size = align_offset(total_size * BDRV_SECTOR_SIZE, ++ cluster_size); ++ ++ /* header: 1 cluster */ ++ meta_size += cluster_size; ++ ++ /* total size of L2 tables */ ++ nl2e = aligned_total_size / cluster_size; ++ nl2e = align_offset(nl2e, cluster_size / sizeof(uint64_t)); ++ meta_size += nl2e * sizeof(uint64_t); ++ ++ /* total size of L1 tables */ ++ nl1e = nl2e * sizeof(uint64_t) / cluster_size; ++ nl1e = align_offset(nl1e, cluster_size / sizeof(uint64_t)); ++ meta_size += nl1e * sizeof(uint64_t); ++ ++ /* total size of refcount blocks ++ * ++ * note: every host cluster is reference-counted, including metadata ++ * (even refcount blocks are recursively included). ++ * Let: ++ * a = total_size * BDRV_SECTOR_SIZE (this is the guest disk size) ++ * m = meta size not including refcount blocks and refcount tables ++ * c = cluster size ++ * y1 = number of refcount blocks entries ++ * y2 = meta size including everything ++ * then, ++ * y1 = (y2 + a)/c ++ * y2 = y1 * sizeof(u16) + y1 * sizeof(u16) * sizeof(u64) / c + m ++ * we can get y1: ++ * y1 = (a + m) / (c - sizeof(u16) - sizeof(u16) * sizeof(u64) / c) ++ */ ++ nrefblocke = (aligned_total_size + meta_size + cluster_size) / ++ (cluster_size - sizeof(uint16_t) - ++ 1.0 * sizeof(uint16_t) * sizeof(uint64_t) / cluster_size); ++ nrefblocke = align_offset(nrefblocke, cluster_size / sizeof(uint16_t)); ++ meta_size += nrefblocke * sizeof(uint16_t); ++ ++ /* total size of refcount tables */ ++ nreftablee = nrefblocke * sizeof(uint16_t) / cluster_size; ++ nreftablee = align_offset(nreftablee, cluster_size / sizeof(uint64_t)); ++ meta_size += nreftablee * sizeof(uint64_t); ++ ++ file_drv = bdrv_find_protocol(filename, true); ++ if (file_drv == NULL) { ++ error_setg(errp, "Could not find protocol for file '%s'", filename); ++ return -ENOENT; ++ } ++ ++ options = append_option_parameters(options, file_drv->create_options); ++ ++ set_option_parameter_int(options, BLOCK_OPT_SIZE, ++ aligned_total_size + meta_size); ++ set_option_parameter(options, BLOCK_OPT_PREALLOC, ++ PreallocMode_lookup[prealloc]); ++ } + + ret = bdrv_create_file(filename, options, &local_err); ++ free_option_parameters(options); + if (ret < 0) { + error_propagate(errp, local_err); + return ret; +@@ -1691,7 +1753,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, + } + + /* And if we're supposed to preallocate metadata, do that now */ +- if (prealloc == PREALLOC_MODE_METADATA) { ++ if (prealloc != PREALLOC_MODE_OFF) { + BDRVQcowState *s = bs->opaque; + qemu_co_mutex_lock(&s->lock); + ret = preallocate(bs); +@@ -1761,13 +1823,6 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options, + options++; + } + +- if (prealloc != PREALLOC_MODE_OFF && +- prealloc != PREALLOC_MODE_METADATA) { +- error_setg(errp, "Unsupported preallocate mode: %s", +- PreallocMode_lookup[prealloc]); +- return -EINVAL; +- } +- + if (backing_file && prealloc != PREALLOC_MODE_OFF) { + error_setg(errp, "Backing file and preallocation cannot be used at " + "the same time"); +@@ -1780,8 +1835,9 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options, + return -EINVAL; + } + ++ assert(!options || !options->name); + ret = qcow2_create2(filename, sectors, backing_file, backing_fmt, flags, +- cluster_size, prealloc, options, version, &local_err); ++ cluster_size, prealloc, version, &local_err); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); + } +@@ -2315,7 +2371,8 @@ static QEMUOptionParameter qcow2_create_options[] = { + { + .name = BLOCK_OPT_PREALLOC, + .type = OPT_STRING, +- .help = "Preallocation mode (allowed values: off, metadata)" ++ .help = "Preallocation mode (allowed values: off, metadata, " ++ "falloc, full)" + }, + { + .name = BLOCK_OPT_LAZY_REFCOUNTS, +diff --git a/qemu-doc.texi b/qemu-doc.texi +index dc5b49e..0f7e5f8 100644 +--- a/qemu-doc.texi ++++ b/qemu-doc.texi +@@ -567,9 +567,11 @@ sizes can improve the image file size whereas larger cluster sizes generally + provide better performance. + + @item preallocation +-Preallocation mode (allowed values: off, metadata). An image with preallocated +-metadata is initially larger but can improve performance when the image needs +-to grow. ++Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc}, ++@code{full}). An image with preallocated metadata is initially larger but can ++improve performance when the image needs to grow. @code{falloc} and @code{full} ++preallocations are like the same options of @code{raw} format, but sets up ++metadata also. + + @item lazy_refcounts + If this option is set to @code{on}, reference count updates are postponed with +diff --git a/qemu-img.texi b/qemu-img.texi +index 80d3261..e943856 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -432,9 +432,11 @@ sizes can improve the image file size whereas larger cluster sizes generally + provide better performance. + + @item preallocation +-Preallocation mode (allowed values: off, metadata). An image with preallocated +-metadata is initially larger but can improve performance when the image needs +-to grow. ++Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc}, ++@code{full}). An image with preallocated metadata is initially larger but can ++improve performance when the image needs to grow. @code{falloc} and @code{full} ++preallocations are like the same options of @code{raw} format, but sets up ++metadata also. + + @item lazy_refcounts + If this option is set to @code{on}, reference count updates are postponed with +diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out +index d71610b..8abfde7 100644 +--- a/tests/qemu-iotests/082.out ++++ b/tests/qemu-iotests/082.out +@@ -64,7 +64,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o ? TEST_DIR/t.qcow2 128M +@@ -75,7 +75,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 128M +@@ -86,7 +86,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 128M +@@ -97,7 +97,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 128M +@@ -108,7 +108,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 128M +@@ -119,7 +119,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 128M +@@ -130,7 +130,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 128M +@@ -141,7 +141,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 128M +@@ -167,7 +167,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: create -o help +@@ -245,7 +245,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -256,7 +256,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -267,7 +267,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -278,7 +278,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -289,7 +289,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -300,7 +300,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -311,7 +311,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -322,7 +322,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -O qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base +@@ -348,7 +348,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -o help +@@ -415,7 +415,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o ? TEST_DIR/t.qcow2 +@@ -426,7 +426,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o cluster_size=4k,help TEST_DIR/t.qcow2 +@@ -437,7 +437,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o cluster_size=4k,? TEST_DIR/t.qcow2 +@@ -448,7 +448,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o help,cluster_size=4k TEST_DIR/t.qcow2 +@@ -459,7 +459,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o ?,cluster_size=4k TEST_DIR/t.qcow2 +@@ -470,7 +470,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o cluster_size=4k -o help TEST_DIR/t.qcow2 +@@ -481,7 +481,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o cluster_size=4k -o ? TEST_DIR/t.qcow2 +@@ -492,7 +492,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2 +@@ -520,7 +520,7 @@ backing_file File name of a base image + backing_fmt Image format of the base image + encryption Encrypt the image + cluster_size qcow2 cluster size +-preallocation Preallocation mode (allowed values: off, metadata) ++preallocation Preallocation mode (allowed values: off, metadata, falloc, full) + lazy_refcounts Postpone refcount updates + + Testing: convert -o help +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qcow2-Free-preallocated-zero-clusters.patch b/SOURCES/kvm-qcow2-Free-preallocated-zero-clusters.patch index f8ce501..d370b69 100644 --- a/SOURCES/kvm-qcow2-Free-preallocated-zero-clusters.patch +++ b/SOURCES/kvm-qcow2-Free-preallocated-zero-clusters.patch @@ -1,17 +1,19 @@ -From 0a83451f1962265f2ac2d43c7c1cbbf1ecd77552 Mon Sep 17 00:00:00 2001 +From 2d939b5a9f5717aba21727f635c6da898123ad5b Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 2 May 2014 16:06:20 +0200 -Subject: [PATCH 29/30] qcow2: Free preallocated zero clusters +Subject: [PATCH 02/31] qcow2: Free preallocated zero clusters RH-Author: Max Reitz Message-id: <1399046781-16359-2-git-send-email-mreitz@redhat.com> Patchwork-id: 58644 O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/2] qcow2: Free preallocated zero clusters -Bugzilla: 1110188 +Bugzilla: 1052093 RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Jeffrey Cody +BZ: 1052093 + In qcow2_free_any_clusters, preallocated zero clusters should be freed just as normal clusters are. diff --git a/SOURCES/kvm-qdev-properties-system.c-Allow-vlan-or-netdev-for-de.patch b/SOURCES/kvm-qdev-properties-system.c-Allow-vlan-or-netdev-for-de.patch new file mode 100644 index 0000000..4950109 --- /dev/null +++ b/SOURCES/kvm-qdev-properties-system.c-Allow-vlan-or-netdev-for-de.patch @@ -0,0 +1,66 @@ +From f54c8f7db9bca89e9989cbfe1af652f5b4552c92 Mon Sep 17 00:00:00 2001 +From: Vlad Yasevich +Date: Thu, 4 Sep 2014 20:31:00 +0200 +Subject: [PATCH 5/6] qdev-properties-system.c: Allow vlan or netdev for -device, not both + +Message-id: <1409862660-30181-1-git-send-email-vyasevic@redhat.com> +Patchwork-id: 60839 +O-Subject: [RHEL7.1 qemu-kvm PATCH] qdev-properties-system.c: Allow vlan or netdev for -device, not both +Bugzilla: 996011 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Xiao Wang + +From: Vlad Yasevich + +It is currently possible to specify things like: + -device e1000,netdev=foo,vlan=1 +With this usage, whichever argument was specified last (vlan or netdev) +overwrites what was previousely set and results in a non-working +configuration. Even worse, when used with multiqueue devices, +it causes a segmentation fault on exit in qemu_free_net_client. + +That patch treates the above command line options as invalid and +generates an error at start-up. + +Signed-off-by: Vlad Yasevich +Acked-by: Jason Wang +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 30c367ed446b6ea53245589a5cf373578ac075d7) + +Signed-off-by: Vladislav Yasevich +Signed-off-by: Miroslav Rezanina +--- + hw/core/qdev-properties-system.c | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c +index 0eada32..729efa8 100644 +--- a/hw/core/qdev-properties-system.c ++++ b/hw/core/qdev-properties-system.c +@@ -205,6 +205,11 @@ static int parse_netdev(DeviceState *dev, const char *str, void **ptr) + goto err; + } + ++ if (ncs[i]) { ++ ret = -EINVAL; ++ goto err; ++ } ++ + ncs[i] = peers[i]; + ncs[i]->queue_index = i; + } +@@ -301,6 +306,10 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, + *ptr = NULL; + return; + } ++ if (*ptr) { ++ error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name); ++ return; ++ } + + hubport = net_hub_port_find(id); + if (!hubport) { +-- +1.7.1 + diff --git a/SOURCES/kvm-qemu-Adjust-qemu-wakeup.patch b/SOURCES/kvm-qemu-Adjust-qemu-wakeup.patch new file mode 100644 index 0000000..841717c --- /dev/null +++ b/SOURCES/kvm-qemu-Adjust-qemu-wakeup.patch @@ -0,0 +1,141 @@ +From 2462c7df4513e298596559627c61108e13809470 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 5 Sep 2014 12:30:38 +0200 +Subject: [PATCH 04/12] qemu: Adjust qemu wakeup + +Message-id: <1409920238-9070-5-git-send-email-kraxel@redhat.com> +Patchwork-id: 60872 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 4/4] qemu: Adjust qemu wakeup +Bugzilla: 1064156 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +From: "Liu, Jinsong" + +Currently Xen hvm s3 has a bug coming from the difference between +qemu-traditioanl and qemu-xen. For qemu-traditional, the way to +resume from hvm s3 is via 'xl trigger' command. However, for +qemu-xen, the way to resume from hvm s3 inherited from standard +qemu, i.e. via QMP, and it doesn't work under Xen. + +The root cause is, for qemu-xen, 'xl trigger' command didn't reset +devices, while QMP didn't unpause hvm domain though they did qemu +system reset. + +We have two qemu patches and one xl patch to fix Xen hvm s3 bug. +This patch is the qemu patch 1. It adjusts qemu wakeup so that +Xen s3 resume logic (which will be implemented at qemu patch 2) +will be notified after qemu system reset. + +Signed-off-by: Liu Jinsong +Signed-off-by: Stefano Stabellini +Reviewed-by: Paolo Bonzini +Reviewed-by: Anthony PERARD +(cherry picked from commit 4bc78a877252d772b983810a7d2c0be00e9be70e) +--- + hw/acpi/core.c | 3 ++- + include/sysemu/sysemu.h | 4 +++- + vl.c | 15 +++++++-------- + 3 files changed, 12 insertions(+), 10 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/acpi/core.c | 3 ++- + include/sysemu/sysemu.h | 4 +++- + vl.c | 15 +++++++-------- + 3 files changed, 12 insertions(+), 10 deletions(-) + +diff --git a/hw/acpi/core.c b/hw/acpi/core.c +index 3352d17..88efba7 100644 +--- a/hw/acpi/core.c ++++ b/hw/acpi/core.c +@@ -364,12 +364,13 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data) + (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_TIMER_STATUS); + break; + case QEMU_WAKEUP_REASON_OTHER: +- default: + /* ACPI_BITMASK_WAKE_STATUS should be set on resume. + Pretend that resume was caused by power button */ + ar->pm1.evt.sts |= + (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS); + break; ++ default: ++ break; + } + } + +diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h +index 07181ac..3e457b8 100644 +--- a/include/sysemu/sysemu.h ++++ b/include/sysemu/sysemu.h +@@ -42,9 +42,11 @@ int vm_stop(RunState state); + int vm_stop_force_state(RunState state); + + typedef enum WakeupReason { +- QEMU_WAKEUP_REASON_OTHER = 0, ++ /* Always keep QEMU_WAKEUP_REASON_NONE = 0 */ ++ QEMU_WAKEUP_REASON_NONE = 0, + QEMU_WAKEUP_REASON_RTC, + QEMU_WAKEUP_REASON_PMTIMER, ++ QEMU_WAKEUP_REASON_OTHER, + } WakeupReason; + + void qemu_system_reset_request(void); +diff --git a/vl.c b/vl.c +index fcc8fd1..7c1b9d2 100644 +--- a/vl.c ++++ b/vl.c +@@ -1690,14 +1690,14 @@ static pid_t shutdown_pid; + static int powerdown_requested; + static int debug_requested; + static int suspend_requested; +-static int wakeup_requested; ++static WakeupReason wakeup_reason; + static NotifierList powerdown_notifiers = + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); + static NotifierList suspend_notifiers = + NOTIFIER_LIST_INITIALIZER(suspend_notifiers); + static NotifierList wakeup_notifiers = + NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); +-static uint32_t wakeup_reason_mask = ~0; ++static uint32_t wakeup_reason_mask = ~(1 << QEMU_WAKEUP_REASON_NONE); + static RunState vmstop_requested = RUN_STATE_MAX; + + int qemu_shutdown_requested_get(void) +@@ -1747,11 +1747,9 @@ static int qemu_suspend_requested(void) + return r; + } + +-static int qemu_wakeup_requested(void) ++static WakeupReason qemu_wakeup_requested(void) + { +- int r = wakeup_requested; +- wakeup_requested = 0; +- return r; ++ return wakeup_reason; + } + + static int qemu_powerdown_requested(void) +@@ -1868,8 +1866,7 @@ void qemu_system_wakeup_request(WakeupReason reason) + return; + } + runstate_set(RUN_STATE_RUNNING); +- notifier_list_notify(&wakeup_notifiers, &reason); +- wakeup_requested = 1; ++ wakeup_reason = reason; + qemu_notify_event(); + } + +@@ -1961,6 +1958,8 @@ static bool main_loop_should_exit(void) + pause_all_vcpus(); + cpu_synchronize_all_states(); + qemu_system_reset(VMRESET_SILENT); ++ notifier_list_notify(&wakeup_notifiers, &wakeup_reason); ++ wakeup_reason = QEMU_WAKEUP_REASON_NONE; + resume_all_vcpus(); + monitor_protocol_event(QEVENT_WAKEUP, NULL); + } +-- +1.7.1 + diff --git a/SOURCES/kvm-qemu-img-Allow-cache-mode-specification-for-amend.patch b/SOURCES/kvm-qemu-img-Allow-cache-mode-specification-for-amend.patch new file mode 100644 index 0000000..9882d16 --- /dev/null +++ b/SOURCES/kvm-qemu-img-Allow-cache-mode-specification-for-amend.patch @@ -0,0 +1,115 @@ +From bb18c8167f4b3a912e57ca4185e9e58d4d3a149b Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Fri, 24 Oct 2014 08:17:58 +0200 +Subject: [PATCH 10/19] qemu-img: Allow cache mode specification for amend + +Message-id: <1414138680-19600-3-git-send-email-mreitz@redhat.com> +Patchwork-id: 61863 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 2/4] qemu-img: Allow cache mode specification for amend +Bugzilla: 1138691 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Kevin Wolf + +qemu-img amend may extensively modify the target image, depending on the +options to be amended (e.g. conversion to qcow2 compat level 0.10 from +1.1 for an image with many unallocated zero clusters). Therefore it +makes sense to allow the user to specify the cache mode to be used. + +Signed-off-by: Max Reitz +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit bd39e6ed0b88a1473c652c97e731a156cccf16e2) +Signed-off-by: Miroslav Rezanina + +Conflicts: + qemu-img.c + +QemuOpts are not used throughout the downstream block layer. + +Signed-off-by: Max Reitz +--- + qemu-img-cmds.hx | 4 ++-- + qemu-img.c | 19 +++++++++++++++---- + qemu-img.texi | 2 +- + 3 files changed, 18 insertions(+), 7 deletions(-) + +diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx +index e590d46..5efdfe9 100644 +--- a/qemu-img-cmds.hx ++++ b/qemu-img-cmds.hx +@@ -70,8 +70,8 @@ STEXI + ETEXI + + DEF("amend", img_amend, +- "amend [-q] [-f fmt] -o options filename") ++ "amend [-q] [-f fmt] [-t cache] -o options filename") + STEXI +-@item amend [-q] [-f @var{fmt}] -o @var{options} @var{filename} ++@item amend [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} + @end table + ETEXI +diff --git a/qemu-img.c b/qemu-img.c +index 25fdc37..1f28729 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -2659,12 +2659,14 @@ static int img_amend(int argc, char **argv) + int c, ret = 0; + char *options = NULL; + QEMUOptionParameter *create_options = NULL, *options_param = NULL; +- const char *fmt = NULL, *filename; ++ const char *fmt = NULL, *filename, *cache; ++ int flags; + bool quiet = false; + BlockDriverState *bs = NULL; + ++ cache = BDRV_DEFAULT_CACHE; + for (;;) { +- c = getopt(argc, argv, "hqf:o:"); ++ c = getopt(argc, argv, "ho:f:t:q"); + if (c == -1) { + break; + } +@@ -2691,6 +2693,9 @@ static int img_amend(int argc, char **argv) + case 'f': + fmt = optarg; + break; ++ case 't': ++ cache = optarg; ++ break; + case 'q': + quiet = true; + break; +@@ -2713,8 +2718,14 @@ static int img_amend(int argc, char **argv) + help(); + } + +- bs = bdrv_new_open("image", filename, fmt, +- BDRV_O_FLAGS | BDRV_O_RDWR, true, quiet); ++ flags = BDRV_O_FLAGS | BDRV_O_RDWR; ++ ret = bdrv_parse_cache_flags(cache, &flags); ++ if (ret < 0) { ++ error_report("Invalid cache option: %s", cache); ++ goto out; ++ } ++ ++ bs = bdrv_new_open("image", filename, fmt, flags, true, quiet); + if (!bs) { + error_report("Could not open image '%s'", filename); + ret = -1; +diff --git a/qemu-img.texi b/qemu-img.texi +index 3d06e91..078fe81 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -370,7 +370,7 @@ After using this command to grow a disk image, you must use file system and + partitioning tools inside the VM to actually begin using the new space on the + device. + +-@item amend [-f @var{fmt}] -o @var{options} @var{filename} ++@item amend [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename} + + Amends the image format specific @var{options} for the image file + @var{filename}. Not all file formats support this operation. +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-img-Allow-source-cache-mode-specification.patch b/SOURCES/kvm-qemu-img-Allow-source-cache-mode-specification.patch new file mode 100644 index 0000000..bd3bc0a --- /dev/null +++ b/SOURCES/kvm-qemu-img-Allow-source-cache-mode-specification.patch @@ -0,0 +1,410 @@ +From a4e7f2adeadd8c03acd509028c07c7114379af10 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Fri, 24 Oct 2014 08:17:57 +0200 +Subject: [PATCH 09/19] qemu-img: Allow source cache mode specification + +Message-id: <1414138680-19600-2-git-send-email-mreitz@redhat.com> +Patchwork-id: 61862 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/4] qemu-img: Allow source cache mode specification +Bugzilla: 1138691 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Kevin Wolf + +Many qemu-img subcommands only read the source file(s) once. For these +use cases, a full write-back cache is unnecessary and mainly clutters +host cache memory. Though this is generally no concern as cache memory +is freely available and can be scaled by the host OS, it may become a +concern with thin provisioning. + +For these cases, it makes sense to allow users to freely specify the +source cache mode (e.g. use no cache at all). + +This commit adds a new switch (-T) for the qemu-img subcommands check, +compare, convert and rebase to specify the cache to be used for source +images (the backing file in case of rebase). + +Signed-off-by: Max Reitz +Reviewed-by: Eric Blake +Signed-off-by: Kevin Wolf +(cherry picked from commit 40055951a7afbfc037c6c7351d72a5c5d83ed99b) +Signed-off-by: Miroslav Rezanina + +Conflicts: + qemu-img-cmds.hx + qemu-img.c + qemu-img.texi + +Conflicts due to bdrv_open() working differently downstream +(pre-O_PROTOCOL and no reference parameter), and there are more options +to qemu-img convert upstream. + +Signed-off-by: Max Reitz +--- + qemu-img-cmds.hx | 16 ++++++------ + qemu-img.c | 76 +++++++++++++++++++++++++++++++++++++++++++++----------- + qemu-img.texi | 14 ++++++++--- + 3 files changed, 79 insertions(+), 27 deletions(-) + +diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx +index da1d965..e590d46 100644 +--- a/qemu-img-cmds.hx ++++ b/qemu-img-cmds.hx +@@ -10,9 +10,9 @@ STEXI + ETEXI + + DEF("check", img_check, +- "check [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] filename") ++ "check [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] filename") + STEXI +-@item check [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] @var{filename} ++@item check [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] @var{filename} + ETEXI + + DEF("create", img_create, +@@ -28,15 +28,15 @@ STEXI + ETEXI + + DEF("compare", img_compare, +- "compare [-f fmt] [-F fmt] [-p] [-q] [-s] filename1 filename2") ++ "compare [-f fmt] [-F fmt] [-T src_cache] [-p] [-q] [-s] filename1 filename2") + STEXI +-@item compare [-f @var{fmt}] [-F @var{fmt}] [-p] [-q] [-s] @var{filename1} @var{filename2} ++@item compare [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-q] [-s] @var{filename1} @var{filename2} + ETEXI + + DEF("convert", img_convert, +- "convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename") ++ "convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename") + STEXI +-@item convert [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} ++@item convert [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} + ETEXI + + DEF("info", img_info, +@@ -58,9 +58,9 @@ STEXI + ETEXI + + DEF("rebase", img_rebase, +- "rebase [-q] [-f fmt] [-t cache] [-p] [-u] -b backing_file [-F backing_fmt] filename") ++ "rebase [-q] [-f fmt] [-t cache] [-T src_cache] [-p] [-u] -b backing_file [-F backing_fmt] filename") + STEXI +-@item rebase [-q] [-f @var{fmt}] [-t @var{cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} ++@item rebase [-q] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} + ETEXI + + DEF("resize", img_resize, +diff --git a/qemu-img.c b/qemu-img.c +index fe0ac65..25fdc37 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -84,6 +84,7 @@ static void help(void) + " 'cache' is the cache mode used to write the output disk image, the valid\n" + " options are: 'none', 'writeback' (default, except for convert), 'writethrough',\n" + " 'directsync' and 'unsafe' (default for convert)\n" ++ " 'src_cache' in contrast is the cache mode used to read input disk images\n" + " 'size' is the disk image size in bytes. Optional suffixes\n" + " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M)\n" + " and T (terabyte, 1024G) are supported. 'b' is ignored.\n" +@@ -553,7 +554,7 @@ static int img_check(int argc, char **argv) + { + int c, ret; + OutputFormat output_format = OFORMAT_HUMAN; +- const char *filename, *fmt, *output; ++ const char *filename, *fmt, *output, *cache; + BlockDriverState *bs; + int fix = 0; + int flags = BDRV_O_FLAGS | BDRV_O_CHECK; +@@ -562,6 +563,7 @@ static int img_check(int argc, char **argv) + + fmt = NULL; + output = NULL; ++ cache = BDRV_DEFAULT_CACHE; + for(;;) { + int option_index = 0; + static const struct option long_options[] = { +@@ -571,7 +573,7 @@ static int img_check(int argc, char **argv) + {"output", required_argument, 0, OPTION_OUTPUT}, + {0, 0, 0, 0} + }; +- c = getopt_long(argc, argv, "f:hr:q", ++ c = getopt_long(argc, argv, "hf:r:T:q", + long_options, &option_index); + if (c == -1) { + break; +@@ -598,6 +600,9 @@ static int img_check(int argc, char **argv) + case OPTION_OUTPUT: + output = optarg; + break; ++ case 'T': ++ cache = optarg; ++ break; + case 'q': + quiet = true; + break; +@@ -617,6 +622,12 @@ static int img_check(int argc, char **argv) + return 1; + } + ++ ret = bdrv_parse_cache_flags(cache, &flags); ++ if (ret < 0) { ++ error_report("Invalid source cache option: %s", cache); ++ return 1; ++ } ++ + bs = bdrv_new_open("image", filename, fmt, flags, true, quiet); + if (!bs) { + return 1; +@@ -911,7 +922,7 @@ static int check_empty_sectors(BlockDriverState *bs, int64_t sect_num, + */ + static int img_compare(int argc, char **argv) + { +- const char *fmt1 = NULL, *fmt2 = NULL, *filename1, *filename2; ++ const char *fmt1 = NULL, *fmt2 = NULL, *cache, *filename1, *filename2; + BlockDriverState *bs1, *bs2; + int64_t total_sectors1, total_sectors2; + uint8_t *buf1 = NULL, *buf2 = NULL; +@@ -919,6 +930,7 @@ static int img_compare(int argc, char **argv) + int allocated1, allocated2; + int ret = 0; /* return value - 0 Ident, 1 Different, >1 Error */ + bool progress = false, quiet = false, strict = false; ++ int flags; + int64_t total_sectors; + int64_t sector_num = 0; + int64_t nb_sectors; +@@ -926,8 +938,9 @@ static int img_compare(int argc, char **argv) + uint64_t bs_sectors; + uint64_t progress_base; + ++ cache = BDRV_DEFAULT_CACHE; + for (;;) { +- c = getopt(argc, argv, "hpf:F:sq"); ++ c = getopt(argc, argv, "hf:F:T:pqs"); + if (c == -1) { + break; + } +@@ -942,6 +955,9 @@ static int img_compare(int argc, char **argv) + case 'F': + fmt2 = optarg; + break; ++ case 'T': ++ cache = optarg; ++ break; + case 'p': + progress = true; + break; +@@ -966,17 +982,25 @@ static int img_compare(int argc, char **argv) + filename1 = argv[optind++]; + filename2 = argv[optind++]; + ++ flags = BDRV_O_FLAGS; ++ ret = bdrv_parse_cache_flags(cache, &flags); ++ if (ret < 0) { ++ error_report("Invalid source cache option: %s", cache); ++ ret = 2; ++ goto out3; ++ } ++ + /* Initialize before goto out */ + qemu_progress_init(progress, 2.0); + +- bs1 = bdrv_new_open("image 1", filename1, fmt1, BDRV_O_FLAGS, true, quiet); ++ bs1 = bdrv_new_open("image 1", filename1, fmt1, flags, true, quiet); + if (!bs1) { + error_report("Can't open file %s", filename1); + ret = 2; + goto out3; + } + +- bs2 = bdrv_new_open("image 2", filename2, fmt2, BDRV_O_FLAGS, true, quiet); ++ bs2 = bdrv_new_open("image 2", filename2, fmt2, flags, true, quiet); + if (!bs2) { + error_report("Can't open file %s", filename2); + ret = 2; +@@ -1145,8 +1169,8 @@ static int img_convert(int argc, char **argv) + { + int c, n, n1, bs_n, bs_i, compress, cluster_sectors, skip_create; + int64_t ret = 0; +- int progress = 0, flags; +- const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename; ++ int progress = 0, flags, src_flags; ++ const char *fmt, *out_fmt, *cache, *src_cache, *out_baseimg, *out_filename; + BlockDriver *drv, *proto_drv; + BlockDriverState **bs = NULL, *out_bs = NULL; + int64_t total_sectors, nb_sectors, sector_num, bs_offset, +@@ -1167,11 +1191,12 @@ static int img_convert(int argc, char **argv) + fmt = NULL; + out_fmt = "raw"; + cache = "unsafe"; ++ src_cache = BDRV_DEFAULT_CACHE; + out_baseimg = NULL; + compress = 0; + skip_create = 0; + for(;;) { +- c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:qn"); ++ c = getopt(argc, argv, "hf:O:B:ce6o:s:S:pt:T:qn"); + if (c == -1) { + break; + } +@@ -1239,6 +1264,9 @@ static int img_convert(int argc, char **argv) + case 't': + cache = optarg; + break; ++ case 'T': ++ src_cache = optarg; ++ break; + case 'q': + quiet = true; + break; +@@ -1275,6 +1303,13 @@ static int img_convert(int argc, char **argv) + goto out; + } + ++ src_flags = BDRV_O_FLAGS; ++ ret = bdrv_parse_cache_flags(src_cache, &src_flags); ++ if (ret < 0) { ++ error_report("Invalid source cache option: %s", src_cache); ++ goto out; ++ } ++ + qemu_progress_print(0, 100); + + bs = g_malloc0(bs_n * sizeof(BlockDriverState *)); +@@ -1283,7 +1318,7 @@ static int img_convert(int argc, char **argv) + for (bs_i = 0; bs_i < bs_n; bs_i++) { + char *id = bs_n > 1 ? g_strdup_printf("source %d", bs_i) + : g_strdup("source"); +- bs[bs_i] = bdrv_new_open(id, argv[optind + bs_i], fmt, BDRV_O_FLAGS, ++ bs[bs_i] = bdrv_new_open(id, argv[optind + bs_i], fmt, src_flags, + true, quiet); + g_free(id); + if (!bs[bs_i]) { +@@ -2197,8 +2232,8 @@ static int img_rebase(int argc, char **argv) + BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL; + BlockDriver *old_backing_drv, *new_backing_drv; + char *filename; +- const char *fmt, *cache, *out_basefmt, *out_baseimg; +- int c, flags, ret; ++ const char *fmt, *cache, *src_cache, *out_basefmt, *out_baseimg; ++ int c, flags, src_flags, ret; + int unsafe = 0; + int progress = 0; + bool quiet = false; +@@ -2207,10 +2242,11 @@ static int img_rebase(int argc, char **argv) + /* Parse commandline parameters */ + fmt = NULL; + cache = BDRV_DEFAULT_CACHE; ++ src_cache = BDRV_DEFAULT_CACHE; + out_baseimg = NULL; + out_basefmt = NULL; + for(;;) { +- c = getopt(argc, argv, "uhf:F:b:pt:q"); ++ c = getopt(argc, argv, "hf:F:b:upt:T:q"); + if (c == -1) { + break; + } +@@ -2237,6 +2273,9 @@ static int img_rebase(int argc, char **argv) + case 't': + cache = optarg; + break; ++ case 'T': ++ src_cache = optarg; ++ break; + case 'q': + quiet = true; + break; +@@ -2262,6 +2301,13 @@ static int img_rebase(int argc, char **argv) + return -1; + } + ++ src_flags = BDRV_O_FLAGS; ++ ret = bdrv_parse_cache_flags(src_cache, &src_flags); ++ if (ret < 0) { ++ error_report("Invalid source cache option: %s", src_cache); ++ return -1; ++ } ++ + /* + * Open the images. + * +@@ -2305,7 +2351,7 @@ static int img_rebase(int argc, char **argv) + + bs_old_backing = bdrv_new("old_backing", &error_abort); + bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); +- ret = bdrv_open(bs_old_backing, backing_name, NULL, BDRV_O_FLAGS, ++ ret = bdrv_open(bs_old_backing, backing_name, NULL, src_flags, + old_backing_drv, &local_err); + if (ret) { + error_report("Could not open old backing file '%s': %s", +@@ -2315,7 +2361,7 @@ static int img_rebase(int argc, char **argv) + } + if (out_baseimg[0]) { + bs_new_backing = bdrv_new("new_backing", &error_abort); +- ret = bdrv_open(bs_new_backing, out_baseimg, NULL, BDRV_O_FLAGS, ++ ret = bdrv_open(bs_new_backing, out_baseimg, NULL, src_flags, + new_backing_drv, &local_err); + if (ret) { + error_report("Could not open new backing file '%s': %s", +diff --git a/qemu-img.texi b/qemu-img.texi +index 7c28759..3d06e91 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -68,6 +68,9 @@ down to the nearest 512 bytes. You may use the common size suffixes like + specifies the cache mode that should be used with the (destination) file. See + the documentation of the emulator's @code{-drive cache=...} option for allowed + values. ++@item -T @var{src_cache} ++in contrast specifies the cache mode that should be used with the source ++file(s). + @end table + + Parameters to snapshot subcommand: +@@ -109,7 +112,7 @@ Skip the creation of the target volume + Command description: + + @table @option +-@item check [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] @var{filename} ++@item check [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] @var{filename} + + Perform a consistency check on the disk image @var{filename}. The command can + output in the format @var{ofmt} which is either @code{human} or @code{json}. +@@ -145,7 +148,7 @@ the backing file, the backing file will not be truncated. If you want the + backing file to match the size of the smaller snapshot, you can safely truncate + it yourself once the commit operation successfully completes. + +-@item compare [-f @var{fmt}] [-F @var{fmt}] [-p] [-s] [-q] @var{filename1} @var{filename2} ++@item compare [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-s] [-q] @var{filename1} @var{filename2} + + Check if two images have the same content. You can compare images with + different format or settings. +@@ -186,7 +189,7 @@ Error on reading data + + @end table + +-@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} ++@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename} + + Convert the disk image @var{filename} or a snapshot @var{snapshot_name} to disk image @var{output_filename} + using format @var{output_fmt}. It can be optionally compressed (@code{-c} +@@ -298,7 +301,7 @@ source code. + + List, apply, create or delete snapshots in image @var{filename}. + +-@item rebase [-f @var{fmt}] [-t @var{cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} ++@item rebase [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename} + + Changes the backing file of an image. Only the formats @code{qcow2} and + @code{qed} support changing the backing file. +@@ -309,6 +312,9 @@ The backing file is changed to @var{backing_file} and (if the image format of + string), then the image is rebased onto no backing file (i.e. it will exist + independently of any backing file). + ++@var{cache} specifies the cache mode to be used for @var{filename}, whereas ++@var{src_cache} specifies the cache mode for reading the new backing file. ++ + There are two different modes in which @code{rebase} can operate: + @table @option + @item Safe mode +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-img-Avoid-duplicate-block-device-IDs.patch b/SOURCES/kvm-qemu-img-Avoid-duplicate-block-device-IDs.patch new file mode 100644 index 0000000..c65fa3b --- /dev/null +++ b/SOURCES/kvm-qemu-img-Avoid-duplicate-block-device-IDs.patch @@ -0,0 +1,172 @@ +From aa82f406b4d4ff21041ef39547d1b166e9c6ee38 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:10 +0200 +Subject: [PATCH 07/19] qemu-img: Avoid duplicate block device IDs + +Message-id: <1414059011-15516-8-git-send-email-kwolf@redhat.com> +Patchwork-id: 61842 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 7/8] qemu-img: Avoid duplicate block device IDs +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +qemu-img used to use "image" as ID for all block devices. This means +that e.g. img_convert() ended up with potentially multiple source images +and one target image, all with the same ID. The next patch will catch +this and fail to open the block device. + +This patch makes sure that qemu-img uses meaningful unique IDs for the +block devices it uses. + +Signed-off-by: Kevin Wolf +Reviewed-by: Eric Blake +(cherry picked from commit 9ffe333276de8ef463896303fb951f03fd4ffcb4) +Signed-off-by: Kevin Wolf +Signed-off-by: Miroslav Rezanina +--- + qemu-img.c | 38 ++++++++++++++++++++++---------------- + 1 file changed, 22 insertions(+), 16 deletions(-) + +diff --git a/qemu-img.c b/qemu-img.c +index 5c2f36a..fe0ac65 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -262,7 +262,8 @@ static int print_block_option_help(const char *filename, const char *fmt) + return 0; + } + +-static BlockDriverState *bdrv_new_open(const char *filename, ++static BlockDriverState *bdrv_new_open(const char *id, ++ const char *filename, + const char *fmt, + int flags, + bool require_io, +@@ -274,7 +275,7 @@ static BlockDriverState *bdrv_new_open(const char *filename, + Error *local_err = NULL; + int ret; + +- bs = bdrv_new("image", &error_abort); ++ bs = bdrv_new(id, &error_abort); + + if (fmt) { + drv = bdrv_find_format(fmt); +@@ -616,7 +617,7 @@ static int img_check(int argc, char **argv) + return 1; + } + +- bs = bdrv_new_open(filename, fmt, flags, true, quiet); ++ bs = bdrv_new_open("image", filename, fmt, flags, true, quiet); + if (!bs) { + return 1; + } +@@ -725,7 +726,7 @@ static int img_commit(int argc, char **argv) + return -1; + } + +- bs = bdrv_new_open(filename, fmt, flags, true, quiet); ++ bs = bdrv_new_open("image", filename, fmt, flags, true, quiet); + if (!bs) { + return 1; + } +@@ -968,14 +969,14 @@ static int img_compare(int argc, char **argv) + /* Initialize before goto out */ + qemu_progress_init(progress, 2.0); + +- bs1 = bdrv_new_open(filename1, fmt1, BDRV_O_FLAGS, true, quiet); ++ bs1 = bdrv_new_open("image 1", filename1, fmt1, BDRV_O_FLAGS, true, quiet); + if (!bs1) { + error_report("Can't open file %s", filename1); + ret = 2; + goto out3; + } + +- bs2 = bdrv_new_open(filename2, fmt2, BDRV_O_FLAGS, true, quiet); ++ bs2 = bdrv_new_open("image 2", filename2, fmt2, BDRV_O_FLAGS, true, quiet); + if (!bs2) { + error_report("Can't open file %s", filename2); + ret = 2; +@@ -1280,8 +1281,11 @@ static int img_convert(int argc, char **argv) + + total_sectors = 0; + for (bs_i = 0; bs_i < bs_n; bs_i++) { +- bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt, BDRV_O_FLAGS, true, +- quiet); ++ char *id = bs_n > 1 ? g_strdup_printf("source %d", bs_i) ++ : g_strdup("source"); ++ bs[bs_i] = bdrv_new_open(id, argv[optind + bs_i], fmt, BDRV_O_FLAGS, ++ true, quiet); ++ g_free(id); + if (!bs[bs_i]) { + error_report("Could not open '%s'", argv[optind + bs_i]); + ret = -1; +@@ -1395,7 +1399,7 @@ static int img_convert(int argc, char **argv) + return -1; + } + +- out_bs = bdrv_new_open(out_filename, out_fmt, flags, true, quiet); ++ out_bs = bdrv_new_open("target", out_filename, out_fmt, flags, true, quiet); + if (!out_bs) { + ret = -1; + goto out; +@@ -1758,8 +1762,8 @@ static ImageInfoList *collect_image_info_list(const char *filename, + } + g_hash_table_insert(filenames, (gpointer)filename, NULL); + +- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING, +- false, false); ++ bs = bdrv_new_open("image", filename, fmt, ++ BDRV_O_FLAGS | BDRV_O_NO_BACKING, false, false); + if (!bs) { + goto err; + } +@@ -2018,7 +2022,7 @@ static int img_map(int argc, char **argv) + return 1; + } + +- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS, true, false); ++ bs = bdrv_new_open("image", filename, fmt, BDRV_O_FLAGS, true, false); + if (!bs) { + return 1; + } +@@ -2137,7 +2141,7 @@ static int img_snapshot(int argc, char **argv) + filename = argv[optind++]; + + /* Open the image */ +- bs = bdrv_new_open(filename, NULL, bdrv_oflags, true, quiet); ++ bs = bdrv_new_open("image", filename, NULL, bdrv_oflags, true, quiet); + if (!bs) { + return 1; + } +@@ -2264,7 +2268,7 @@ static int img_rebase(int argc, char **argv) + * Ignore the old backing file for unsafe rebase in case we want to correct + * the reference to a renamed or moved backing file. + */ +- bs = bdrv_new_open(filename, fmt, flags, true, quiet); ++ bs = bdrv_new_open("image", filename, fmt, flags, true, quiet); + if (!bs) { + return 1; + } +@@ -2561,7 +2565,8 @@ static int img_resize(int argc, char **argv) + n = qemu_opt_get_size(param, BLOCK_OPT_SIZE, 0); + qemu_opts_del(param); + +- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR, true, quiet); ++ bs = bdrv_new_open("image", filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR, ++ true, quiet); + if (!bs) { + ret = -1; + goto out; +@@ -2662,7 +2667,8 @@ static int img_amend(int argc, char **argv) + help(); + } + +- bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR, true, quiet); ++ bs = bdrv_new_open("image", filename, fmt, ++ BDRV_O_FLAGS | BDRV_O_RDWR, true, quiet); + if (!bs) { + error_report("Could not open image '%s'", filename); + ret = -1; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch b/SOURCES/kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch new file mode 100644 index 0000000..22c2b13 --- /dev/null +++ b/SOURCES/kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch @@ -0,0 +1,66 @@ +From 871111d1bf38bc391728793f898527823717ed6d Mon Sep 17 00:00:00 2001 +Message-Id: <871111d1bf38bc391728793f898527823717ed6d.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:12 -0600 +Subject: [CHANGE 18/31] qemu-img: Convert by cluster size if target is + compressed +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-19-git-send-email-famz@redhat.com> +Patchwork-id: 62691 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 18/30] qemu-img: Convert by cluster size if target is compressed +Bugzilla: 1134283 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +If target block driver forces compression, qemu-img convert needs to +write by cluster size as well as "-c" option. + +Particularly, this applies for converting to VMDK streamOptimized +format. + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 85f49cad879adfb5c3cbdc47ca3c3b50eb8f40bc) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + include/block/block.h | 4 ++++ + qemu-img.c | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/include/block/block.h b/include/block/block.h +index 3651bd9..b06a9dc 100644 +--- a/include/block/block.h ++++ b/include/block/block.h +@@ -34,6 +34,10 @@ typedef struct BlockDriverInfo { + * opened with BDRV_O_UNMAP flag for this to work. + */ + bool can_write_zeroes_with_unmap; ++ /* ++ * True if this block driver only supports compressed writes ++ */ ++ bool needs_compressed_writes; + } BlockDriverInfo; + + typedef struct BlockFragInfo { +diff --git a/qemu-img.c b/qemu-img.c +index f14890f..9c021e7 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -1477,6 +1477,7 @@ static int img_convert(int argc, char **argv) + goto out; + } + } else { ++ compress = compress || bdi.needs_compressed_writes; + cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE; + } + +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-img-clarify-src_cache-option-documentation.patch b/SOURCES/kvm-qemu-img-clarify-src_cache-option-documentation.patch new file mode 100644 index 0000000..3f61d8d --- /dev/null +++ b/SOURCES/kvm-qemu-img-clarify-src_cache-option-documentation.patch @@ -0,0 +1,67 @@ +From 94301da385eea27bfd9191cfc3f68b8df2e21987 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Fri, 24 Oct 2014 08:17:59 +0200 +Subject: [PATCH 11/19] qemu-img: clarify src_cache option documentation + +Message-id: <1414138680-19600-4-git-send-email-mreitz@redhat.com> +Patchwork-id: 61864 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 3/4] qemu-img: clarify src_cache option documentation +Bugzilla: 1138691 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Kevin Wolf + +From: Stefan Hajnoczi + +The source cache option takes the same values as the cache option. The +documentation reads a little strange because it starts with "In contrast +the src_cache option ...". The fact that this is comparing with the +previous documented option (the 'cache' option) is implicit. Readers +may be confused, especially if they jump to src_cache without reading +cache documentation first. + +Suggested-by: Jeff Nelson +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Max Reitz +(cherry picked from commit bb87fdf871d321895b8f5c481977df7a3f74a765) + +Signed-off-by: Max Reitz +Signed-off-by: Miroslav Rezanina +--- + qemu-img.c | 3 ++- + qemu-img.texi | 5 +++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/qemu-img.c b/qemu-img.c +index 1f28729..39d7e05 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -84,7 +84,8 @@ static void help(void) + " 'cache' is the cache mode used to write the output disk image, the valid\n" + " options are: 'none', 'writeback' (default, except for convert), 'writethrough',\n" + " 'directsync' and 'unsafe' (default for convert)\n" +- " 'src_cache' in contrast is the cache mode used to read input disk images\n" ++ " 'src_cache' is the cache mode used to read input disk images, the valid\n" ++ " options are the same as for the 'cache' option\n" + " 'size' is the disk image size in bytes. Optional suffixes\n" + " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M)\n" + " and T (terabyte, 1024G) are supported. 'b' is ignored.\n" +diff --git a/qemu-img.texi b/qemu-img.texi +index 078fe81..4b7a331 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -69,8 +69,9 @@ specifies the cache mode that should be used with the (destination) file. See + the documentation of the emulator's @code{-drive cache=...} option for allowed + values. + @item -T @var{src_cache} +-in contrast specifies the cache mode that should be used with the source +-file(s). ++specifies the cache mode that should be used with the source file(s). See ++the documentation of the emulator's @code{-drive cache=...} option for allowed ++values. + @end table + + Parameters to snapshot subcommand: +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-img-fix-img_compare-flags-error-path.patch b/SOURCES/kvm-qemu-img-fix-img_compare-flags-error-path.patch new file mode 100644 index 0000000..6c8ad6f --- /dev/null +++ b/SOURCES/kvm-qemu-img-fix-img_compare-flags-error-path.patch @@ -0,0 +1,57 @@ +From 43c5d1b9be611a87ca71b75f5a7e1d4ec3056117 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Tue, 11 Nov 2014 16:27:43 +0100 +Subject: [PATCH 13/19] qemu-img: fix img_compare() flags error path + +Message-id: <1415723263-31710-1-git-send-email-mreitz@redhat.com> +Patchwork-id: 62277 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 5/4] qemu-img: fix img_compare() flags error path +Bugzilla: 1138691 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Markus Armbruster +RH-Acked-by: Laszlo Ersek + +From: Stefan Hajnoczi + +If img_compare() fails to parse the cache flags the goto out3 code path +will call qemu_progress_end(). Make sure we actually call +qemu_progress_init() first. + +Reported-by: Markus Armbruster +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Max Reitz +(cherry picked from commit cbda016d94017fad3be1c657f0ad98f88395c12a) + +Signed-off-by: Max Reitz +Signed-off-by: Miroslav Rezanina +--- + qemu-img.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/qemu-img.c b/qemu-img.c +index 39d7e05..f14890f 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -983,6 +983,9 @@ static int img_compare(int argc, char **argv) + filename1 = argv[optind++]; + filename2 = argv[optind++]; + ++ /* Initialize before goto out */ ++ qemu_progress_init(progress, 2.0); ++ + flags = BDRV_O_FLAGS; + ret = bdrv_parse_cache_flags(cache, &flags); + if (ret < 0) { +@@ -991,9 +994,6 @@ static int img_compare(int argc, char **argv) + goto out3; + } + +- /* Initialize before goto out */ +- qemu_progress_init(progress, 2.0); +- + bs1 = bdrv_new_open("image 1", filename1, fmt1, flags, true, quiet); + if (!bs1) { + error_report("Can't open file %s", filename1); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-img-fix-rebase-src_cache-option-documentation.patch b/SOURCES/kvm-qemu-img-fix-rebase-src_cache-option-documentation.patch new file mode 100644 index 0000000..24dea5d --- /dev/null +++ b/SOURCES/kvm-qemu-img-fix-rebase-src_cache-option-documentation.patch @@ -0,0 +1,63 @@ +From 1a7d0d17b3b2aeae3c48895ee60da17e3ee27f32 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Fri, 24 Oct 2014 08:18:00 +0200 +Subject: [PATCH 12/19] qemu-img: fix rebase src_cache option documentation + +Message-id: <1414138680-19600-5-git-send-email-mreitz@redhat.com> +Patchwork-id: 61865 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 4/4] qemu-img: fix rebase src_cache option documentation +Bugzilla: 1138691 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Kevin Wolf + +From: Stefan Hajnoczi + +The src_cache option (-T) specifies the cache mode for backing files. +It applies both the image's old backing file as well as the new backing +file: + + ret = bdrv_open(&bs_old_backing, backing_name, NULL, NULL, src_flags, + old_backing_drv, &local_err); + if (ret) { + ... + } + if (out_baseimg[0]) { + bs_new_backing = bdrv_new("new_backing", &error_abort); + ret = bdrv_open(&bs_new_backing, out_baseimg, NULL, NULL, src_flags, + new_backing_drv, &local_err); + if (ret) { + ... + } + } + +The documentation only mentions the new backing file but it really +applies to both. + +Suggested-by: Jeff Nelson +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Max Reitz +(cherry picked from commit 3ba6796d080a90440573ef29d657e4902be7e238) + +Signed-off-by: Max Reitz +Signed-off-by: Miroslav Rezanina +--- + qemu-img.texi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/qemu-img.texi b/qemu-img.texi +index 4b7a331..5f99ebb 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -314,7 +314,7 @@ string), then the image is rebased onto no backing file (i.e. it will exist + independently of any backing file). + + @var{cache} specifies the cache mode to be used for @var{filename}, whereas +-@var{src_cache} specifies the cache mode for reading the new backing file. ++@var{src_cache} specifies the cache mode for reading backing files. + + There are two different modes in which @code{rebase} can operate: + @table @option +-- +1.8.3.1 + diff --git a/SOURCES/kvm-qemu-iotest-Make-077-raw-only.patch b/SOURCES/kvm-qemu-iotest-Make-077-raw-only.patch new file mode 100644 index 0000000..a50542b --- /dev/null +++ b/SOURCES/kvm-qemu-iotest-Make-077-raw-only.patch @@ -0,0 +1,54 @@ +From ffe8dca5ecc0546ea719652eaa5f52a25e45e7d8 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:03 -0600 +Subject: [CHANGE 09/31] qemu-iotest: Make 077 raw-only +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-10-git-send-email-famz@redhat.com> +Patchwork-id: 62682 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 09/30] qemu-iotest: Make 077 raw-only +Bugzilla: 1134237 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Kevin Wolf + +The qemu-io command sequences make the assumption that an unaligned +request on the format layer will be unaligned on the blkdebug layer as +well. This doesn't necessarily hold true for drivers other than raw. + +Signed-off-by: Kevin Wolf +Reviewed-by: Stefan Hajnoczi +Reviewed-by: BenoĂ®t Canet +(cherry picked from commit f51062061e6adf64a879177f35ff5c6babb63e7e) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/077 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077 +index bbf7b51..4dd1bdd 100755 +--- a/tests/qemu-iotests/077 ++++ b/tests/qemu-iotests/077 +@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + . ./common.rc + . ./common.filter + +-_supported_fmt generic ++_supported_fmt raw + _supported_proto generic + _supported_os Linux + +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-iotests-Add-_unsupported_imgopts-for-vmdk-subfo.patch b/SOURCES/kvm-qemu-iotests-Add-_unsupported_imgopts-for-vmdk-subfo.patch new file mode 100644 index 0000000..d019d11 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Add-_unsupported_imgopts-for-vmdk-subfo.patch @@ -0,0 +1,167 @@ +From 0b8d9819cfe455e9ff4c2c77de1dd8069d00ce9c Mon Sep 17 00:00:00 2001 +Message-Id: <0b8d9819cfe455e9ff4c2c77de1dd8069d00ce9c.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:04:59 -0600 +Subject: [CHANGE 05/31] qemu-iotests: Add _unsupported_imgopts for vmdk + subformats +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-6-git-send-email-famz@redhat.com> +Patchwork-id: 62678 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 05/30] qemu-iotests: Add _unsupported_imgopts for vmdk subformats +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Some cases are not applicable for vmdk subformats those don't support +certain features, e.g. backing file, and some others can't run on +mult-file image, e.g. monolithicFlat. This adds declaration in test +cases to skip them automatically, so that iotests on vmdk can go +more smoothly (without manually picking of cases for each subformat). + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Kevin Wolf +(cherry picked from commit d2329f27c9c8408d4134c7243313dbaa37270384) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/017 | 1 + + tests/qemu-iotests/018 | 1 + + tests/qemu-iotests/019 | 3 +++ + tests/qemu-iotests/020 | 3 +++ + tests/qemu-iotests/034 | 3 +++ + tests/qemu-iotests/037 | 3 +++ + tests/qemu-iotests/059 | 3 +++ + tests/qemu-iotests/063 | 3 +++ + tests/qemu-iotests/069 | 1 + + 9 files changed, 21 insertions(+) + +diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 +index aba3faf..3af3cdf 100755 +--- a/tests/qemu-iotests/017 ++++ b/tests/qemu-iotests/017 +@@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" + + TEST_OFFSETS="0 4294967296" + +diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018 +index 15fcfe5..6f7f054 100755 +--- a/tests/qemu-iotests/018 ++++ b/tests/qemu-iotests/018 +@@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" + + TEST_OFFSETS="0 4294967296" + +diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019 +index 5bb18d0..b43e70f 100755 +--- a/tests/qemu-iotests/019 ++++ b/tests/qemu-iotests/019 +@@ -47,6 +47,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + TEST_OFFSETS="0 4294967296" + CLUSTER_SIZE=65536 +diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 +index b3c86d8..73a0429 100755 +--- a/tests/qemu-iotests/020 ++++ b/tests/qemu-iotests/020 +@@ -45,6 +45,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + TEST_OFFSETS="0 4294967296" + +diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034 +index 67f1959..7349789 100755 +--- a/tests/qemu-iotests/034 ++++ b/tests/qemu-iotests/034 +@@ -41,6 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + CLUSTER_SIZE=4k + size=128M +diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037 +index 743bae3..e444349 100755 +--- a/tests/qemu-iotests/037 ++++ b/tests/qemu-iotests/037 +@@ -41,6 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + CLUSTER_SIZE=4k + size=128M +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index c8d92a0..9ef848b 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -42,6 +42,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt vmdk + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + capacity_offset=16 + granularity_offset=20 +diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063 +index 2ab8f20..77503a2 100644 +--- a/tests/qemu-iotests/063 ++++ b/tests/qemu-iotests/063 +@@ -44,6 +44,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt qcow qcow2 vmdk qed raw + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" \ ++ "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + _make_test_img 4M + +diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069 +index 3042803..50347d9 100755 +--- a/tests/qemu-iotests/069 ++++ b/tests/qemu-iotests/069 +@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt cow qed qcow qcow2 vmdk + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" + + IMG_SIZE=128K + +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-iotests-Add-sample-image-and-test-for-VMDK-vers.patch b/SOURCES/kvm-qemu-iotests-Add-sample-image-and-test-for-VMDK-vers.patch new file mode 100644 index 0000000..36c8c93 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Add-sample-image-and-test-for-VMDK-vers.patch @@ -0,0 +1,88 @@ +From 8d0b44f2b7bbca158aeb3a732f5689965857edfd Mon Sep 17 00:00:00 2001 +Message-Id: <8d0b44f2b7bbca158aeb3a732f5689965857edfd.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:04:56 -0600 +Subject: [CHANGE 02/31] qemu-iotests: Add sample image and test for VMDK + version 3 +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-3-git-send-email-famz@redhat.com> +Patchwork-id: 62675 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 02/30] qemu-iotests: Add sample image and test for VMDK version 3 +Bugzilla: 1134237 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 981cbf59b5360647e908186e7306ee9013a58c88) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/059 | 5 +++++ + tests/qemu-iotests/059.out | 5 +++++ + tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 | Bin 0 -> 414 bytes + 3 files changed, 10 insertions(+) + create mode 100644 tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 + +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index 1ec34d5..23534c2 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -80,6 +80,11 @@ echo "=== Testing big twoGbMaxExtentFlat ===" + IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G + $QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/' + ++echo ++echo "=== Testing version 3 ===" ++_use_sample_img iotest-version3.vmdk.bz2 ++_img_info ++ + # success, all done + echo "*** done" + rm -f $seq.full +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index 262e3b2..87a2004 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -2037,4 +2037,9 @@ Format specific information: + virtual size: 2147483648 + filename: TEST_DIR/t-f500.vmdk + format: FLAT ++ ++=== Testing version 3 === ++image: TEST_DIR/iotest-version3.IMGFMT ++file format: IMGFMT ++virtual size: 1.0G (1073741824 bytes) + *** done +# JEN 2014-12-16 +# Temporarily disable creating of this bz2 file, because brew does +# not support binary patches. When we have a solution for how to +# incorporate this, this section will be adjusted accordingly. +# JEN 2014-12-16 +#diff --git a/tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 b/tests/qemu-iotests/sample_images/iotest-version3.vmdk.bz2 +#new file mode 100644 +#index 0000000000000000000000000000000000000000..30abf217e72d38e97b1e34a5db6add15ca3812d9 +#GIT binary patch +#literal 414 +#zcmV;P0b%|^T4*^jL0KkKS-4ab^Z){!-`M?Q}oWup($ZYNuP+onz +#zC89&oo+5m#SRo3f$tj3j4cj-uY<9AFkA%eEJTaa)*;e;U06X$QBY(3aGcne4@Z5Q` +#zOld1c2c2n5eaHx1cF@GqGfd88M9D~UB914v;WOL96@WSu-<9};viD>nCB_lZ=L5MA +#zWAhh{E!lb{@J3L6J+%};gkaKNrNrxivB)qiB85a>b>(iaNAFyd9Z|7XRWs!&h*2TY +#z2uM_*TOC2Lp=5yL%rudbN4;JP^)svmH_P%A-P+35?p=v$3M>tU*);6x0S=pmRj{{| +#z7O Date: Fri, 2 May 2014 16:06:21 +0200 -Subject: [PATCH 30/30] qemu-iotests: Discard preallocated zero clusters +Subject: [PATCH 03/31] qemu-iotests: Discard preallocated zero clusters RH-Author: Max Reitz Message-id: <1399046781-16359-3-git-send-email-mreitz@redhat.com> Patchwork-id: 58645 O-Subject: [RHEL-7.0 qemu-kvm PATCH 2/2] qemu-iotests: Discard preallocated zero clusters -Bugzilla: 1110188 +Bugzilla: 1052093 RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Jeffrey Cody +BZ: 1052093 + Add a new test case for discarding preallocated zero clusters; doing this should not result in any leaks. @@ -129,7 +131,7 @@ index 0000000..9139780 +No errors were found on the image. +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group -index d6d4a7f..e588404 100644 +index ad96fcf..1c91036 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -68,6 +68,7 @@ diff --git a/SOURCES/kvm-qemu-iotests-Don-t-run-005-on-vmdk-split-formats.patch b/SOURCES/kvm-qemu-iotests-Don-t-run-005-on-vmdk-split-formats.patch new file mode 100644 index 0000000..93fcfc4 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Don-t-run-005-on-vmdk-split-formats.patch @@ -0,0 +1,68 @@ +From 25a620f2e952cdbc10b148f403013e07e0b7285f Mon Sep 17 00:00:00 2001 +Message-Id: <25a620f2e952cdbc10b148f403013e07e0b7285f.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:04 -0600 +Subject: [CHANGE 10/31] qemu-iotests: Don't run 005 on vmdk split formats +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-11-git-send-email-famz@redhat.com> +Patchwork-id: 62683 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 10/30] qemu-iotests: Don't run 005 on vmdk split formats +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +There would be too many extents that VMDK driver can't open all of them: + + > 005 0s ... - output mismatch (see 005.out.bad) + > --- 005.out 2013-12-24 09:27:27.608181030 +0800 + > +++ 005.out.bad 2014-02-13 10:00:15.282184557 +0800 + > @@ -4,10 +4,10 @@ + > Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5368709120000 + > + > small read + > -read 4096/4096 bytes at offset 1024 + > -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + > +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files + > +no file open, try 'help open' + > + > small write + > -wrote 4096/4096 bytes at offset 8192 + > -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + > +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files + > +no file open, try 'help open' + > *** done + +So disable the two subformats. + +Signed-off-by: Fam Zheng +Reviewed-by: Kevin Wolf +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 2aa4a86f59c7093e03d2ec18c5d5f08c957d1a78) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/005 | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 +index 9abcb84..ba1236d 100755 +--- a/tests/qemu-iotests/005 ++++ b/tests/qemu-iotests/005 +@@ -44,6 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 + _supported_fmt generic + _supported_proto generic + _supported_os Linux ++_unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" + + # vpc is limited to 127GB, so we can't test it here + if [ "$IMGFMT" = "vpc" ]; then +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-iotests-Introduce-_unsupported_imgopts.patch b/SOURCES/kvm-qemu-iotests-Introduce-_unsupported_imgopts.patch new file mode 100644 index 0000000..af50ca0 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Introduce-_unsupported_imgopts.patch @@ -0,0 +1,57 @@ +From 40bbc03370fbd830e8010764318e01c3e6af631f Mon Sep 17 00:00:00 2001 +Message-Id: <40bbc03370fbd830e8010764318e01c3e6af631f.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:04:58 -0600 +Subject: [CHANGE 04/31] qemu-iotests: Introduce _unsupported_imgopts +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-5-git-send-email-famz@redhat.com> +Patchwork-id: 62677 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 04/30] qemu-iotests: Introduce _unsupported_imgopts +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Introduce _unsupported_imgopts that causes _notrun for specific image +options. + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Kevin Wolf +(cherry picked from commit 2c77f52e39ff2ba071e3b549ad7a3ebea0758edd) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/common.rc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc +index 65c5bc1..9c6e94b 100644 +--- a/tests/qemu-iotests/common.rc ++++ b/tests/qemu-iotests/common.rc +@@ -404,6 +404,17 @@ _unsupported_qemu_io_options() + done + } + ++_unsupported_imgopts() ++{ ++ for bad_opt ++ do ++ if echo "$IMGOPTS" | grep -q 2>/dev/null "$bad_opt" ++ then ++ _notrun "not suitable for image option: $bad_opt" ++ fi ++ done ++} ++ + # this test requires that a specified command (executable) exists + # + _require_command() +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-iotests-Test-0-length-image-for-mirror.patch b/SOURCES/kvm-qemu-iotests-Test-0-length-image-for-mirror.patch index 7a77c05..9e6418d 100644 --- a/SOURCES/kvm-qemu-iotests-Test-0-length-image-for-mirror.patch +++ b/SOURCES/kvm-qemu-iotests-Test-0-length-image-for-mirror.patch @@ -1,12 +1,12 @@ -From 8042a9daf7913e39b7ee4f6417f1d934e5dabbff Mon Sep 17 00:00:00 2001 +From 54287567a2e235abe6967e15dd46eeebe8834f3b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:13 +0200 -Subject: [PATCH 6/7] qemu-iotests: Test 0-length image for mirror +Subject: [PATCH 10/11] qemu-iotests: Test 0-length image for mirror Message-id: <1408552814-23031-7-git-send-email-eblake@redhat.com> Patchwork-id: 60648 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 6/7] qemu-iotests: Test 0-length image for mirror -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch b/SOURCES/kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch index ff61734..c67e976 100644 --- a/SOURCES/kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch +++ b/SOURCES/kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch @@ -1,12 +1,12 @@ -From 2b17bf64d8b033b7a85b67597282d1751d027d7a Mon Sep 17 00:00:00 2001 +From 470f4cc7e63a96872463ab7a4a1c23689e32036b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Aug 2014 16:40:11 +0200 -Subject: [PATCH 4/7] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit +Subject: [PATCH 08/11] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit Message-id: <1408552814-23031-5-git-send-email-eblake@redhat.com> Patchwork-id: 60649 O-Subject: [qemu-kvm-rhev 7.0.z PATCH 4/7] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit -Bugzilla: 1132806 +Bugzilla: 1130603 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi diff --git a/SOURCES/kvm-qemu-iotests-Test-a-few-blockdev-add-error-cases.patch b/SOURCES/kvm-qemu-iotests-Test-a-few-blockdev-add-error-cases.patch new file mode 100644 index 0000000..d83fbd9 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Test-a-few-blockdev-add-error-cases.patch @@ -0,0 +1,218 @@ +From 3ca6e2a4a1ecd9515eda8ebe400e0791a227fb79 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Thu, 23 Oct 2014 10:10:09 +0200 +Subject: [PATCH 05/19] qemu-iotests: Test a few blockdev-add error cases + +Message-id: <1414059011-15516-7-git-send-email-kwolf@redhat.com> +Patchwork-id: 61841 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 6/8] qemu-iotests: Test a few blockdev-add error cases +Bugzilla: 1088176 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Signed-off-by: Kevin Wolf +Reviewed-by: Benoit Canet +(cherry picked from commit c75203c8d343dc71d95144862bbb47290689c455) +Signed-off-by: Miroslav Rezanina + +Conflicts: + tests/qemu-iotests/group + +Signed-off-by: Kevin Wolf +--- + tests/qemu-iotests/087 | 122 +++++++++++++++++++++++++++++++++++++++++++++ + tests/qemu-iotests/087.out | 40 +++++++++++++++ + tests/qemu-iotests/group | 1 + + 3 files changed, 163 insertions(+) + create mode 100755 tests/qemu-iotests/087 + create mode 100644 tests/qemu-iotests/087.out + +diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087 +new file mode 100755 +index 0000000..53b6c43 +--- /dev/null ++++ b/tests/qemu-iotests/087 +@@ -0,0 +1,122 @@ ++#!/bin/bash ++# ++# Test unsupported blockdev-add cases ++# ++# Copyright (C) 2014 Red Hat, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++# creator ++owner=kwolf@redhat.com ++ ++seq=`basename $0` ++echo "QA output created by $seq" ++ ++here=`pwd` ++tmp=/tmp/$$ ++status=1 # failure is the default! ++ ++# get standard environment, filters and checks ++. ./common.rc ++. ./common.filter ++ ++_supported_fmt qcow2 ++_supported_proto file ++_supported_os Linux ++ ++function do_run_qemu() ++{ ++ echo Testing: "$@" ++ $QEMU -nographic -qmp stdio -serial none "$@" ++ echo ++} ++ ++function run_qemu() ++{ ++ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g' ++} ++ ++size=128M ++ ++_make_test_img $size ++ ++echo ++echo === Missing ID === ++echo ++ ++run_qemu < +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:04:55 -0600 +Subject: [CHANGE 01/31] qemu-iotests: Test case for backing file deletion +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-2-git-send-email-famz@redhat.com> +Patchwork-id: 62674 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 01/30] qemu-iotests: Test case for backing file deletion +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Max Reitz + +Add a test case for trying to open an image file where it is impossible +to open its backing file (in this case, because it was deleted). When +doing this, qemu (or qemu-io in this case) should not crash but rather +print an appropriate error message. + +Signed-off-by: Max Reitz +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 321fd7d2b88defe11528e4d5a9f686c89ebee1ee) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson + +Conflicts: + tests/qemu-iotests/group +Trivial context conflict. + +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/069 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ + tests/qemu-iotests/069.out | 8 +++++++ + tests/qemu-iotests/group | 1 + + 3 files changed, 68 insertions(+) + create mode 100755 tests/qemu-iotests/069 + create mode 100644 tests/qemu-iotests/069.out + +diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069 +new file mode 100755 +index 0000000..3042803 +--- /dev/null ++++ b/tests/qemu-iotests/069 +@@ -0,0 +1,59 @@ ++#!/bin/bash ++# ++# Test case for deleting a backing file ++# ++# Copyright (C) 2013 Red Hat, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++# creator ++owner=mreitz@redhat.com ++ ++seq="$(basename $0)" ++echo "QA output created by $seq" ++ ++here="$PWD" ++tmp=/tmp/$$ ++status=1 # failure is the default! ++ ++_cleanup() ++{ ++ _cleanup_test_img ++} ++trap "_cleanup; exit \$status" 0 1 2 3 15 ++ ++# get standard environment, filters and checks ++. ./common.rc ++. ./common.filter ++ ++_supported_fmt cow qed qcow qcow2 vmdk ++_supported_proto generic ++_supported_os Linux ++ ++IMG_SIZE=128K ++ ++echo ++echo "=== Creating an image with a backing file and deleting that file ===" ++echo ++TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE ++_make_test_img -b "$TEST_IMG.base" $IMG_SIZE ++rm -f "$TEST_IMG.base" ++# Just open the image and close it right again (this should print an error message) ++$QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt ++ ++# success, all done ++echo "*** done" ++rm -f $seq.full ++status=0 +diff --git a/tests/qemu-iotests/069.out b/tests/qemu-iotests/069.out +new file mode 100644 +index 0000000..3648814 +--- /dev/null ++++ b/tests/qemu-iotests/069.out +@@ -0,0 +1,8 @@ ++QA output created by 069 ++ ++=== Creating an image with a backing file and deleting that file === ++ ++Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=131072 ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file='TEST_DIR/t.IMGFMT.base' ++qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open file: No such file or directory ++*** done +diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group +index 3fad61d..572438e 100644 +--- a/tests/qemu-iotests/group ++++ b/tests/qemu-iotests/group +@@ -71,6 +71,7 @@ + 066 rw auto + 067 rw auto + 068 rw auto ++069 rw auto + 070 rw auto + 075 rw auto + 076 auto +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu-iotests-Test-converting-to-streamOptimized-from.patch b/SOURCES/kvm-qemu-iotests-Test-converting-to-streamOptimized-from.patch new file mode 100644 index 0000000..525fd58 --- /dev/null +++ b/SOURCES/kvm-qemu-iotests-Test-converting-to-streamOptimized-from.patch @@ -0,0 +1,69 @@ +From 44c99fa6aeff34f654a1475b4273308411b58520 Mon Sep 17 00:00:00 2001 +Message-Id: <44c99fa6aeff34f654a1475b4273308411b58520.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:15 -0600 +Subject: [CHANGE 21/31] qemu-iotests: Test converting to streamOptimized from + small cluster size +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-22-git-send-email-famz@redhat.com> +Patchwork-id: 62694 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 21/30] qemu-iotests: Test converting to streamOptimized from small cluster size +Bugzilla: 1134283 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 10f08a0a3435afea441db8d0981dbad49042c7cf) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + tests/qemu-iotests/059 | 7 +++++++ + tests/qemu-iotests/059.out | 7 +++++++ + 2 files changed, 14 insertions(+) + +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index 71b7b49..1e7dbf6 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -104,6 +104,13 @@ truncate -s 10M $TEST_IMG + _img_info + + echo ++echo "=== Converting to streamOptimized from image with small cluster size===" ++TEST_IMG="$TEST_IMG.qcow2" IMGFMT=qcow2 IMGOPTS="cluster_size=4096" _make_test_img 1G ++$QEMU_IO -c "write -P 0xa 0 512" "$TEST_IMG.qcow2" | _filter_qemu_io ++$QEMU_IO -c "write -P 0xb 10240 512" "$TEST_IMG.qcow2" | _filter_qemu_io ++$QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2" "$TEST_IMG" 2>&1 ++ ++echo + echo "=== Testing version 3 ===" + _use_sample_img iotest-version3.vmdk.bz2 + _img_info +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index f226f71..9893edf 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -2046,6 +2046,13 @@ RW 12582912 VMFS "dummy.IMGFMT" 1 + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 + qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes + ++=== Converting to streamOptimized from image with small cluster size=== ++Formatting 'TEST_DIR/t.vmdk.IMGFMT', fmt=IMGFMT size=1073741824 ++wrote 512/512 bytes at offset 0 ++512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++wrote 512/512 bytes at offset 10240 ++512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++ + === Testing version 3 === + image: TEST_DIR/iotest-version3.IMGFMT + file format: IMGFMT +-- +2.1.0 + diff --git a/SOURCES/kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch b/SOURCES/kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch index 03e5027..27b8a92 100644 --- a/SOURCES/kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch +++ b/SOURCES/kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch @@ -1,4 +1,4 @@ -From df9e9e9c56c7fbf0ea54a342591c5427b508a7bf Mon Sep 17 00:00:00 2001 +From 9f136b4ed4ecd83a2de6ffa52775286b106bb5f5 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 17 Apr 2014 11:13:59 +0200 Subject: [PATCH 10/12] qemu_loadvm_state(): shadow SeaBIOS for VM incoming from RHEL-6 host @@ -7,7 +7,7 @@ RH-Author: Laszlo Ersek Message-id: <1397733239-8835-1-git-send-email-lersek@redhat.com> Patchwork-id: 58498 O-Subject: [RHEL-7.0 0day qemu-kvm PATCH v2] qemu_loadvm_state(): shadow SeaBIOS for VM incoming from RHEL-6 host -Bugzilla: 1090978 +Bugzilla: 1027565 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Eduardo Habkost diff --git a/SOURCES/kvm-raw-posix-Add-falloc-and-full-preallocation-option.patch b/SOURCES/kvm-raw-posix-Add-falloc-and-full-preallocation-option.patch new file mode 100644 index 0000000..1422891 --- /dev/null +++ b/SOURCES/kvm-raw-posix-Add-falloc-and-full-preallocation-option.patch @@ -0,0 +1,188 @@ +From 61a3061760caaaaa4f025f5712dcd8f84f2f5d70 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 10 Nov 2014 09:14:06 +0100 +Subject: [PATCH 29/41] raw-posix: Add falloc and full preallocation option + +Message-id: <1415610847-15383-4-git-send-email-mreitz@redhat.com> +Patchwork-id: 62239 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 3/4] raw-posix: Add falloc and full preallocation option +Bugzilla: 1087724 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +From: Hu Tao + +This patch adds a new option preallocation for raw format, and implements +falloc and full preallocation. + +Signed-off-by: Hu Tao +Reviewed-by: Max Reitz +Signed-off-by: Kevin Wolf +(cherry picked from commit 06247428be8037b3739280f82cb29efe8397695f) +Signed-off-by: Miroslav Rezanina + +Conflicts: + block/raw-posix.c + +QEMUOptionParameter has not been replaced with QemuOpts downstream +(upstream 6f482f742dd841b45297fb0e5f3d2c81779253be) and no "nocow" +downstream. + +Signed-off-by: Max Reitz +--- + block/raw-posix.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++------ + qemu-doc.texi | 9 ++++++++ + qemu-img.texi | 9 ++++++++ + 3 files changed, 78 insertions(+), 7 deletions(-) + +diff --git a/block/raw-posix.c b/block/raw-posix.c +index 9ee5b8e..cfe7452 100644 +--- a/block/raw-posix.c ++++ b/block/raw-posix.c +@@ -30,6 +30,7 @@ + #include "block/thread-pool.h" + #include "qemu/iov.h" + #include "raw-aio.h" ++#include "qapi/util.h" + + #if defined(__APPLE__) && (__MACH__) + #include +@@ -1230,11 +1231,23 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, + int fd; + int result = 0; + int64_t total_size = 0; ++ PreallocMode prealloc = PREALLOC_MODE_OFF; ++ char *buf = NULL; ++ Error *local_err = NULL; + + /* Read out options */ + while (options && options->name) { + if (!strcmp(options->name, BLOCK_OPT_SIZE)) { + total_size = options->value.n / BDRV_SECTOR_SIZE; ++ } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { ++ prealloc = qapi_enum_parse(PreallocMode_lookup, options->value.s, ++ PREALLOC_MODE_MAX, PREALLOC_MODE_OFF, ++ &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); ++ result = -EINVAL; ++ goto out; ++ } + } + options++; + } +@@ -1244,16 +1257,51 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, + if (fd < 0) { + result = -errno; + error_setg_errno(errp, -result, "Could not create file"); +- } else { +- if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) { +- result = -errno; +- error_setg_errno(errp, -result, "Could not resize file"); ++ goto out; ++ } ++ ++ if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) { ++ result = -errno; ++ error_setg_errno(errp, -result, "Could not resize file"); ++ goto out_close; ++ } ++ ++ if (prealloc == PREALLOC_MODE_FALLOC) { ++ /* posix_fallocate() doesn't set errno. */ ++ result = -posix_fallocate(fd, 0, total_size * BDRV_SECTOR_SIZE); ++ if (result != 0) { ++ error_setg_errno(errp, -result, ++ "Could not preallocate data for the new file"); + } +- if (qemu_close(fd) != 0) { +- result = -errno; +- error_setg_errno(errp, -result, "Could not close the new file"); ++ } else if (prealloc == PREALLOC_MODE_FULL) { ++ buf = g_malloc0(65536); ++ int64_t num = 0, left = total_size * BDRV_SECTOR_SIZE; ++ ++ while (left > 0) { ++ num = MIN(left, 65536); ++ result = write(fd, buf, num); ++ if (result < 0) { ++ result = -errno; ++ error_setg_errno(errp, -result, ++ "Could not write to the new file"); ++ break; ++ } ++ left -= num; + } ++ fsync(fd); ++ g_free(buf); ++ } else if (prealloc != PREALLOC_MODE_OFF) { ++ result = -EINVAL; ++ error_setg(errp, "Unsupported preallocation mode: %s", ++ PreallocMode_lookup[prealloc]); ++ } ++ ++out_close: ++ if (qemu_close(fd) != 0 && result == 0) { ++ result = -errno; ++ error_setg_errno(errp, -result, "Could not close the new file"); + } ++out: + return result; + } + +@@ -1404,6 +1452,11 @@ static QEMUOptionParameter raw_create_options[] = { + .type = OPT_SIZE, + .help = "Virtual disk size" + }, ++ { ++ .name = BLOCK_OPT_PREALLOC, ++ .type = OPT_STRING, ++ .help = "Preallocation mode (allowed values: off, falloc, full)" ++ }, + { NULL } + }; + +diff --git a/qemu-doc.texi b/qemu-doc.texi +index 54ab3c5..dc5b49e 100644 +--- a/qemu-doc.texi ++++ b/qemu-doc.texi +@@ -527,6 +527,15 @@ Linux or NTFS on Windows), then only the written sectors will reserve + space. Use @code{qemu-img info} to know the real size used by the + image or @code{ls -ls} on Unix/Linux. + ++Supported options: ++@table @code ++@item preallocation ++Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}). ++@code{falloc} mode preallocates space for image by calling posix_fallocate(). ++@code{full} mode preallocates space for image by writing zeros to underlying ++storage. ++@end table ++ + @item qcow2 + QEMU image format, the most versatile format. Use it to have smaller + images (useful if your filesystem does not supports holes, for example +diff --git a/qemu-img.texi b/qemu-img.texi +index 5f99ebb..80d3261 100644 +--- a/qemu-img.texi ++++ b/qemu-img.texi +@@ -392,6 +392,15 @@ Linux or NTFS on Windows), then only the written sectors will reserve + space. Use @code{qemu-img info} to know the real size used by the + image or @code{ls -ls} on Unix/Linux. + ++Supported options: ++@table @code ++@item preallocation ++Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}). ++@code{falloc} mode preallocates space for image by calling posix_fallocate(). ++@code{full} mode preallocates space for image by writing zeros to underlying ++storage. ++@end table ++ + @item qcow2 + QEMU image format, the most versatile format. Use it to have smaller + images (useful if your filesystem does not supports holes, for example +-- +1.8.3.1 + diff --git a/SOURCES/kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch b/SOURCES/kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch index 306bbca..b850b9b 100644 --- a/SOURCES/kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch +++ b/SOURCES/kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch @@ -1,12 +1,12 @@ -From ea2675a74ab31ec9938dd50b4954ea9d6ba5fb50 Mon Sep 17 00:00:00 2001 +From d058befe667eb24da6884a78efc23443dd9de566 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:17 +0100 -Subject: [PATCH 4/7] raw-posix: Fix raw_co_get_block_status() after EOF +Subject: [PATCH 38/41] raw-posix: Fix raw_co_get_block_status() after EOF Message-id: <1416324620-16229-5-git-send-email-mreitz@redhat.com> Patchwork-id: 62439 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 4/7] raw-posix: Fix raw_co_get_block_status() after EOF -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -46,10 +46,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 47b4b71..d04e683 100644 +index 781ebf3..75a81b1 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -1314,10 +1314,6 @@ static int64_t try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, +@@ -1362,10 +1362,6 @@ static int64_t try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, *hole = lseek(s->fd, start, SEEK_HOLE); if (*hole == -1) { @@ -60,7 +60,7 @@ index 47b4b71..d04e683 100644 return -errno; } -@@ -1357,6 +1353,7 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1405,6 +1401,7 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, int nb_sectors, int *pnum) { off_t start, data = 0, hole = 0; @@ -68,7 +68,7 @@ index 47b4b71..d04e683 100644 int64_t ret; ret = fd_open(bs); -@@ -1365,6 +1362,15 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1413,6 +1410,15 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, } start = sector_num * BDRV_SECTOR_SIZE; diff --git a/SOURCES/kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch b/SOURCES/kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch index d15c01f..82d80af 100644 --- a/SOURCES/kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch +++ b/SOURCES/kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch @@ -1,12 +1,12 @@ -From dd6a7e436e1bfa441c6851103156828000362560 Mon Sep 17 00:00:00 2001 +From 726f113a3fbea10e910a2962fa25b6274314380c Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:19 +0100 -Subject: [PATCH 6/7] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP +Subject: [PATCH 40/41] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP Message-id: <1416324620-16229-7-git-send-email-mreitz@redhat.com> Patchwork-id: 62441 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 6/7] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -78,10 +78,10 @@ Signed-off-by: Max Reitz 1 file changed, 4 insertions(+), 59 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 78b968a..3ddcd2d 100644 +index a46e50b..aeb8a97 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -56,9 +56,6 @@ +@@ -57,9 +57,6 @@ #include #include #endif @@ -91,7 +91,7 @@ index 78b968a..3ddcd2d 100644 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE #include #endif -@@ -146,9 +143,6 @@ typedef struct BDRVRawState { +@@ -147,9 +144,6 @@ typedef struct BDRVRawState { bool has_discard:1; bool has_write_zeroes:1; bool discard_zeroes:1; @@ -101,7 +101,7 @@ index 78b968a..3ddcd2d 100644 } BDRVRawState; typedef struct BDRVRawReopenState { -@@ -1260,52 +1254,6 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, +@@ -1308,52 +1302,6 @@ out: return result; } @@ -154,7 +154,7 @@ index 78b968a..3ddcd2d 100644 static int try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) { -@@ -1374,13 +1322,10 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1422,13 +1370,10 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, ret = try_seek_hole(bs, start, &data, &hole); if (ret < 0) { diff --git a/SOURCES/kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch b/SOURCES/kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch index a3ddaeb..d33c6e9 100644 --- a/SOURCES/kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch +++ b/SOURCES/kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch @@ -1,12 +1,12 @@ -From f3d3993ffd2caeef594351702f42e86218f2a2fb Mon Sep 17 00:00:00 2001 +From 03b3f6befef3ab33a422d4dad9c2b3892e49b686 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:20 +0100 -Subject: [PATCH 7/7] raw-posix: The SEEK_HOLE code is flawed, rewrite it +Subject: [PATCH 41/41] raw-posix: The SEEK_HOLE code is flawed, rewrite it Message-id: <1416324620-16229-8-git-send-email-mreitz@redhat.com> Patchwork-id: 62442 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 7/7] raw-posix: The SEEK_HOLE code is flawed, rewrite it -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -49,10 +49,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 85 insertions(+), 26 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index 3ddcd2d..f2244a9 100644 +index aeb8a97..6a50856 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -1254,28 +1254,86 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, +@@ -1302,28 +1302,86 @@ out: return result; } @@ -152,7 +152,7 @@ index 3ddcd2d..f2244a9 100644 #else return -ENOTSUP; #endif -@@ -1320,25 +1378,26 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1368,25 +1426,26 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, nb_sectors = DIV_ROUND_UP(total_size - start, BDRV_SECTOR_SIZE); } diff --git a/SOURCES/kvm-raw-posix-raw_co_get_block_status-return-value.patch b/SOURCES/kvm-raw-posix-raw_co_get_block_status-return-value.patch index d72bf58..3b4d4b8 100644 --- a/SOURCES/kvm-raw-posix-raw_co_get_block_status-return-value.patch +++ b/SOURCES/kvm-raw-posix-raw_co_get_block_status-return-value.patch @@ -1,12 +1,12 @@ -From 7cea0711fbd71118754947385a157ff1b72e8234 Mon Sep 17 00:00:00 2001 +From 89ef5998670954140a6e605f6a5e6286ee3a5eb2 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:30:18 +0100 -Subject: [PATCH 5/7] raw-posix: raw_co_get_block_status() return value +Subject: [PATCH 39/41] raw-posix: raw_co_get_block_status() return value Message-id: <1416324620-16229-6-git-send-email-mreitz@redhat.com> Patchwork-id: 62440 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 5/7] raw-posix: raw_co_get_block_status() return value -Bugzilla: 1166605 +Bugzilla: 1160237 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster @@ -33,10 +33,10 @@ Signed-off-by: Miroslav Rezanina 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c -index d04e683..78b968a 100644 +index 75a81b1..a46e50b 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c -@@ -1260,12 +1260,12 @@ static int raw_create(const char *filename, QEMUOptionParameter *options, +@@ -1308,12 +1308,12 @@ out: return result; } @@ -52,7 +52,7 @@ index d04e683..78b968a 100644 struct { struct fiemap fm; struct fiemap_extent fe; -@@ -1306,8 +1306,8 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data, +@@ -1354,8 +1354,8 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data, #endif } @@ -63,7 +63,7 @@ index d04e683..78b968a 100644 { #if defined SEEK_HOLE && defined SEEK_DATA BDRVRawState *s = bs->opaque; -@@ -1327,7 +1327,7 @@ static int64_t try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, +@@ -1375,7 +1375,7 @@ static int64_t try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, } } @@ -72,7 +72,7 @@ index d04e683..78b968a 100644 #else return -ENOTSUP; #endif -@@ -1354,7 +1354,7 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1402,7 +1402,7 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, { off_t start, data = 0, hole = 0; int64_t total_size; @@ -81,7 +81,7 @@ index d04e683..78b968a 100644 ret = fd_open(bs); if (ret < 0) { -@@ -1372,28 +1372,28 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, +@@ -1420,28 +1420,28 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, nb_sectors = DIV_ROUND_UP(total_size - start, BDRV_SECTOR_SIZE); } diff --git a/SOURCES/kvm-rdma-Fix-block-during-rdma-migration.patch b/SOURCES/kvm-rdma-Fix-block-during-rdma-migration.patch new file mode 100644 index 0000000..ed3d110 --- /dev/null +++ b/SOURCES/kvm-rdma-Fix-block-during-rdma-migration.patch @@ -0,0 +1,49 @@ +From 68dbf16886540b4ec6edc46409f5adf0b97f1dcf Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert (git)" +Date: Mon, 20 Oct 2014 14:55:55 +0200 +Subject: [PATCH 43/43] rdma: Fix block during rdma migration + +Message-id: <1413816955-4190-2-git-send-email-dgilbert@redhat.com> +Patchwork-id: 61746 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] rdma: Fix block during rdma migration +Bugzilla: 1152969 +RH-Acked-by: Juan Quintela +RH-Acked-by: Amit Shah +RH-Acked-by: Marcel Apfelbaum + +From: Gonglei + +If the networking break or there's something wrong with rdma +device(ib0 with no IP) during rdma migration, the main_loop of +qemu will be blocked in rdma_destroy_id. I add rdma_ack_cm_event +to fix this bug. + +Signed-off-by: Mo Yuxiang +Signed-off-by: Gonglei +Reviewed-by: Michael R. Hines +Signed-off-by: Juan Quintela +(cherry picked from commit 2a9343470432573acf06379bcbf8e5e6568507e4) +--- + migration-rdma.c | 1 + + 1 file changed, 1 insertion(+) + +Signed-off-by: Miroslav Rezanina +--- + migration-rdma.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/migration-rdma.c b/migration-rdma.c +index ba4ad76..5596571 100644 +--- a/migration-rdma.c ++++ b/migration-rdma.c +@@ -949,6 +949,7 @@ route: + ERROR(errp, "result not equal to event_addr_resolved %s", + rdma_event_str(cm_event->event)); + perror("rdma_resolve_addr"); ++ rdma_ack_cm_event(cm_event); + ret = -EINVAL; + goto err_resolve_get_addr; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-rdma-bug-fixes.patch b/SOURCES/kvm-rdma-bug-fixes.patch new file mode 100644 index 0000000..56456dd --- /dev/null +++ b/SOURCES/kvm-rdma-bug-fixes.patch @@ -0,0 +1,91 @@ +From 41048b716132906fe54b6dbca48421a24f78affb Mon Sep 17 00:00:00 2001 +From: Dr. David Alan Gilbert (git) +Date: Fri, 11 Jul 2014 09:05:28 +0200 +Subject: [PATCH 01/11] rdma: bug fixes + +Message-id: <1405069528-20466-2-git-send-email-dgilbert@redhat.com> +Patchwork-id: 59778 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] rdma: bug fixes +Bugzilla: 1107821 +RH-Acked-by: Luiz Capitulino +RH-Acked-by: Amit Shah +RH-Acked-by: Laszlo Ersek + +From: "Michael R. Hines" + +1. Fix small memory leak in parsing inet address from command line in data_init() +2. Fix ibv_post_send() return value check and pass error code back up correctly. +3. Fix rdma_destroy_qp() segfault after failure to connect to destination. + +Reported-by: frank.yangjie@gmail.com +Reported-by: dgilbert@redhat.com +Signed-off-by: Michael R. Hines +Signed-off-by: Juan Quintela +(cherry picked from commit e325b49a320b493cc5d69e263751ff716dc458fe) +--- + migration-rdma.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + migration-rdma.c | 20 ++++++++++---------- + 1 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/migration-rdma.c b/migration-rdma.c +index f79be20..ba4ad76 100644 +--- a/migration-rdma.c ++++ b/migration-rdma.c +@@ -1589,13 +1589,11 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf, + } + + +- if (ibv_post_send(rdma->qp, &send_wr, &bad_wr)) { +- return -1; +- } ++ ret = ibv_post_send(rdma->qp, &send_wr, &bad_wr); + +- if (ret < 0) { ++ if (ret > 0) { + fprintf(stderr, "Failed to use post IB SEND for control!\n"); +- return ret; ++ return -ret; + } + + ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL, NULL); +@@ -2237,10 +2235,6 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) + } + } + +- if (rdma->qp) { +- rdma_destroy_qp(rdma->cm_id); +- rdma->qp = NULL; +- } + if (rdma->cq) { + ibv_destroy_cq(rdma->cq); + rdma->cq = NULL; +@@ -2258,6 +2252,10 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) + rdma->listen_id = NULL; + } + if (rdma->cm_id) { ++ if (rdma->qp) { ++ rdma_destroy_qp(rdma->cm_id); ++ rdma->qp = NULL; ++ } + rdma_destroy_id(rdma->cm_id); + rdma->cm_id = NULL; + } +@@ -2512,8 +2510,10 @@ static void *qemu_rdma_data_init(const char *host_port, Error **errp) + } else { + ERROR(errp, "bad RDMA migration address '%s'", host_port); + g_free(rdma); +- return NULL; ++ rdma = NULL; + } ++ ++ qapi_free_InetSocketAddress(addr); + } + + return rdma; +-- +1.7.1 + diff --git a/SOURCES/kvm-rename-parse_enum_option-to-qapi_enum_parse-and-make.patch b/SOURCES/kvm-rename-parse_enum_option-to-qapi_enum_parse-and-make.patch new file mode 100644 index 0000000..4a42a47 --- /dev/null +++ b/SOURCES/kvm-rename-parse_enum_option-to-qapi_enum_parse-and-make.patch @@ -0,0 +1,119 @@ +From af8241e3dc9a94d82423cb106114ae77a0333f32 Mon Sep 17 00:00:00 2001 +From: Max Reitz +Date: Mon, 10 Nov 2014 09:14:04 +0100 +Subject: [PATCH 27/41] rename parse_enum_option to qapi_enum_parse and make it + public + +Message-id: <1415610847-15383-2-git-send-email-mreitz@redhat.com> +Patchwork-id: 62237 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/4] rename parse_enum_option to qapi_enum_parse and make it public +Bugzilla: 1087724 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi + +From: Peter Lieven + +relaxing the license to LGPLv2+ is intentional. + +Suggested-by: Markus Armbruster +Signed-off-by: Hu Tao +Signed-off-by: Peter Lieven +Reviewed-by: Eric Blake +Reviewed-by: Benoit Canet +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 9e7dac7c6c6003ad9d4aca0125f0278233fcf761) +Signed-off-by: Miroslav Rezanina + +Conflicts: + blockdev.c + qapi/Makefile.objs + +Since detect-zeroes does not exist downstream, there was no +parse_enum_option() in blockdev.c and therefore no changes to that file +are necessary. + +Signed-off-by: Max Reitz +--- + include/qapi/util.h | 17 +++++++++++++++++ + qapi/Makefile.objs | 1 + + qapi/qapi-util.c | 34 ++++++++++++++++++++++++++++++++++ + 3 files changed, 52 insertions(+) + create mode 100644 include/qapi/util.h + create mode 100644 qapi/qapi-util.c + +diff --git a/include/qapi/util.h b/include/qapi/util.h +new file mode 100644 +index 0000000..de9238b +--- /dev/null ++++ b/include/qapi/util.h +@@ -0,0 +1,17 @@ ++/* ++ * QAPI util functions ++ * ++ * Copyright Fujitsu, Inc. 2014 ++ * ++ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. ++ * See the COPYING.LIB file in the top-level directory. ++ * ++ */ ++ ++#ifndef QAPI_UTIL_H ++#define QAPI_UTIL_H ++ ++int qapi_enum_parse(const char *lookup[], const char *buf, ++ int max, int def, Error **errp); ++ ++#endif +diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs +index 1f9c973..d896ef0 100644 +--- a/qapi/Makefile.objs ++++ b/qapi/Makefile.objs +@@ -3,3 +3,4 @@ util-obj-y += qmp-output-visitor.o qmp-registry.o qmp-dispatch.o + util-obj-y += string-input-visitor.o string-output-visitor.o + + util-obj-y += opts-visitor.o ++util-obj-y += qapi-util.o +diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c +new file mode 100644 +index 0000000..1d8fb96 +--- /dev/null ++++ b/qapi/qapi-util.c +@@ -0,0 +1,34 @@ ++/* ++ * QAPI util functions ++ * ++ * Authors: ++ * Hu Tao ++ * Peter Lieven ++ * ++ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. ++ * See the COPYING.LIB file in the top-level directory. ++ * ++ */ ++ ++#include "qemu-common.h" ++#include "qapi/error.h" ++#include "qapi/util.h" ++ ++int qapi_enum_parse(const char *lookup[], const char *buf, ++ int max, int def, Error **errp) ++{ ++ int i; ++ ++ if (!buf) { ++ return def; ++ } ++ ++ for (i = 0; i < max; i++) { ++ if (!strcmp(buf, lookup[i])) { ++ return i; ++ } ++ } ++ ++ error_setg(errp, "invalid parameter value: %s", buf); ++ return def; ++} +-- +1.8.3.1 + diff --git a/SOURCES/kvm-rhel-Drop-machine-type-pc-q35-rhel7.0.0.patch b/SOURCES/kvm-rhel-Drop-machine-type-pc-q35-rhel7.0.0.patch new file mode 100644 index 0000000..24e2ebc --- /dev/null +++ b/SOURCES/kvm-rhel-Drop-machine-type-pc-q35-rhel7.0.0.patch @@ -0,0 +1,114 @@ +From 983dc94f2937e8f19732f205711348b0a170e604 Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 14:11:31 +0100 +Subject: [PATCH 3/9] rhel: Drop machine type pc-q35-rhel7.0.0 + +Message-id: <1414764691-31603-2-git-send-email-armbru@redhat.com> +Patchwork-id: 62013 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 1/1] rhel: Drop machine type pc-q35-rhel7.0.0 +Bugzilla: 1111107 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Marcel Apfelbaum + +Q35 is tech preview in RHEL 7.0. From 7.1 on, we want to support it, +but only in qemu-kvm-rhev. We don't intend to support it in qemu-kvm. +So as to not mislead customers, drop the machine type from qemu-kvm, +by removing pc_q35.c from the build. Remove RHEL-specific code from +pc_q35.c just to avoid confusion. + +Signed-off-by: Markus Armbruster +Signed-off-by: Miroslav Rezanina +--- + hw/i386/Makefile.objs | 2 +- + hw/i386/pc_q35.c | 58 --------------------------------------------------- + 2 files changed, 1 insertion(+), 59 deletions(-) + +diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs +index 09ac433..f2bcdcb 100644 +--- a/hw/i386/Makefile.objs ++++ b/hw/i386/Makefile.objs +@@ -1,6 +1,6 @@ + obj-$(CONFIG_KVM) += kvm/ + obj-y += multiboot.o smbios.o +-obj-y += pc.o pc_piix.o pc_q35.o ++obj-y += pc.o pc_piix.o + obj-y += pc_sysfw.o + obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o + +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 4534539..850a25a 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -218,8 +218,6 @@ static void pc_q35_init(QEMUMachineInitArgs *args) + } + } + +-#if 0 /* Disabled for Red Hat Enterprise Linux */ +- + static void pc_q35_init_1_5(QEMUMachineInitArgs *args) + { + has_pci_info = false; +@@ -266,59 +264,3 @@ static void pc_q35_machine_init(void) + } + + machine_init(pc_q35_machine_init); +- +-#endif /* Disabled for Red Hat Enterprise Linux */ +- +-/* Red Hat Enterprise Linux machine types */ +- +-static void pc_q35_compat_rhel700(QEMUMachineInitArgs *args) +-{ +- x86_cpu_compat_set_features("Conroe", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Penryn", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Nehalem", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- /* SandyBridge and Haswell already have x2apic enabled */ +- x86_cpu_compat_set_features("Opteron_G1", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Opteron_G2", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Opteron_G3", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, CPUID_EXT_X2APIC, 0); +- +- /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it +- * on AMD CPU models. +- */ +- x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0, +- CPUID_EXT2_RDTSCP); +- x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0, +- CPUID_EXT2_RDTSCP); +- x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0, +- CPUID_EXT2_RDTSCP); +- x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0, +- CPUID_EXT2_RDTSCP); +- x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0, +- CPUID_EXT2_RDTSCP); +-} +- +-static void pc_q35_init_rhel700(QEMUMachineInitArgs *args) +-{ +- pc_q35_compat_rhel700(args); +- pc_q35_init(args); +-} +- +-static QEMUMachine pc_q35_machine_rhel700 = { +- .name = "pc-q35-rhel7.0.0", +- .alias = "q35", +- .desc = "RHEL-7.0.0 PC (Q35 + ICH9, 2009)", +- .init = pc_q35_init_rhel700, +- .hot_add_cpu = pc_hot_add_cpu, +- .max_cpus = RHEL_MAX_CPUS, +- .default_machine_opts = "firmware=bios-256k.bin", +- DEFAULT_MACHINE_OPTIONS, +-}; +- +-static void rhel_pc_q35_machine_init(void) +-{ +- qemu_register_machine(&pc_q35_machine_rhel700); +-} +- +-machine_init(rhel_pc_q35_machine_init); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-rules.mak-allow-per-object-cflags-and-libs.patch b/SOURCES/kvm-rules.mak-allow-per-object-cflags-and-libs.patch new file mode 100644 index 0000000..a662fab --- /dev/null +++ b/SOURCES/kvm-rules.mak-allow-per-object-cflags-and-libs.patch @@ -0,0 +1,104 @@ +From ef6f26bb4a43131a7a3de4109aa9aeb145ad139a Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Wed, 16 Jul 2014 02:20:27 -0500 +Subject: [CHANGE 27/29] rules.mak: allow per object cflags and libs +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405477228-11490-4-git-send-email-famz@redhat.com> +Patchwork-id: 59917 +O-Subject: [RHEL-7 qemu-kvm PATCH 3/4] rules.mak: allow per object cflags and libs +Bugzilla: 1017685 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Miroslav Rezanina + +Adds extract-libs in LINK to expand any "per object libs", the syntax to define +such a libs options is like: + + foo.o-libs := $(CURL_LIBS) + +in block/Makefile.objs. + +Similarly, + + foo.o-cflags := $(FOO_CFLAGS) + +is also supported. + +"foo.o" must be listed in a nested var (e.g. common-obj-y) to make the +option variables effective. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit 5c0d52bcd3aada33e274ea7dad75955f98bc2636) +Signed-off-by: Fam Zheng +--- + rules.mak | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +Signed-off-by: jen +--- + rules.mak | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/rules.mak b/rules.mak +index 0c5125d..355c275 100644 +--- a/rules.mak ++++ b/rules.mak +@@ -17,15 +17,17 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d + # Same as -I$(SRC_PATH) -I., but for the nested source/object directories + QEMU_INCLUDES += -I$( +Date: Wed, 16 Jul 2014 02:20:26 -0500 +Subject: [CHANGE 26/29] rules.mak: fix $(obj) to a real relative path +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405477228-11490-3-git-send-email-famz@redhat.com> +Patchwork-id: 59921 +O-Subject: [RHEL-7 qemu-kvm PATCH 2/4] rules.mak: fix $(obj) to a real relative path +Bugzilla: 1017685 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Miroslav Rezanina + +From: Miroslav Rezanina + +Upstream: ba1183da9a10b94611cad88c44a5c6df005f9b55 + +Makefile.target includes rule.mak and unnested common-obj-y, then prefix +them with '../', this will ignore object specific QEMU_CFLAGS in subdir +Makefile.objs: + +$(obj)/curl.o: QEMU_CFLAGS += $(CURL_CFLAGS) + +Because $(obj) here is './block', instead of '../block'. This doesn't +hurt compiling because we basically build all .o from top Makefile, +before entering Makefile.target, but it will affact arriving per-object +libs support. + +The starting point of $(obj) is passed in as argument of unnest-vars, as +well as nested variables, so that different Makefiles can pass in a +right value. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini + +This is manual backport. +Signed-off-by: Miroslav Rezanina +Signed-off-by: Fam Zheng +--- + Makefile | 14 ++++++++++++++ + Makefile.objs | 16 +--------------- + Makefile.target | 17 +++++++++++++---- + configure | 1 + + rules.mak | 14 +++++++++----- + 5 files changed, 38 insertions(+), 24 deletions(-) + +Signed-off-by: jen +--- + Makefile | 14 ++++++++++++++ + Makefile.objs | 16 +--------------- + Makefile.target | 17 +++++++++++++---- + configure | 1 + + rules.mak | 14 +++++++++----- + 5 files changed, 38 insertions(+), 24 deletions(-) + +diff --git a/Makefile b/Makefile +index 66774de..f504754 100644 +--- a/Makefile ++++ b/Makefile +@@ -120,6 +120,16 @@ defconfig: + + ifneq ($(wildcard config-host.mak),) + include $(SRC_PATH)/Makefile.objs ++endif ++ ++dummy := $(call unnest-vars,, \ ++ stub-obj-y \ ++ util-obj-y \ ++ qga-obj-y \ ++ block-obj-y \ ++ common-obj-y) ++ ++ifneq ($(wildcard config-host.mak),) + include $(SRC_PATH)/tests/Makefile + endif + ifeq ($(CONFIG_SMARTCARD_NSS),y) +@@ -128,6 +138,10 @@ endif + + all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all + ++vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) ++ ++vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) ++ + config-host.h: config-host.h-timestamp + config-host.h-timestamp: config-host.mak + qemu-options.def: $(SRC_PATH)/qemu-options.hx +diff --git a/Makefile.objs b/Makefile.objs +index 67b4a28..f83a5b2 100644 +--- a/Makefile.objs ++++ b/Makefile.objs +@@ -40,7 +40,7 @@ libcacard-y += libcacard/vcardt.o + # single QEMU executable should support all CPUs and machines. + + ifeq ($(CONFIG_SOFTMMU),y) +-common-obj-y = $(block-obj-y) blockdev.o blockdev-nbd.o block/ ++common-obj-y = blockdev.o blockdev-nbd.o block/ + common-obj-y += net/ + common-obj-y += readline.o + common-obj-y += qdev-monitor.o device-hotplug.o +@@ -103,17 +103,3 @@ common-obj-y += disas/ + # FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed + # by libqemuutil.a. These should be moved to a separate .json schema. + qga-obj-y = qga/ qapi-types.o qapi-visit.o +- +-vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) +- +-vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) +- +-QEMU_CFLAGS+=$(GLIB_CFLAGS) +- +-nested-vars += \ +- stub-obj-y \ +- util-obj-y \ +- qga-obj-y \ +- block-obj-y \ +- common-obj-y +-dummy := $(call unnest-vars) +diff --git a/Makefile.target b/Makefile.target +index 1cafb17..b871dda 100644 +--- a/Makefile.target ++++ b/Makefile.target +@@ -135,13 +135,22 @@ endif # CONFIG_SOFTMMU + # Workaround for http://gcc.gnu.org/PR55489, see configure. + %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) + +-nested-vars += obj-y ++dummy := $(call unnest-vars,,obj-y) + +-# This resolves all nested paths, so it must come last ++# we are making another call to unnest-vars with different vars, protect obj-y, ++# it can be overriden in subdir Makefile.objs ++obj-y-save := $(obj-y) ++ ++block-obj-y := ++common-obj-y := + include $(SRC_PATH)/Makefile.objs ++dummy := $(call unnest-vars,..,block-obj-y common-obj-y) + +-all-obj-y = $(obj-y) +-all-obj-y += $(addprefix ../, $(common-obj-y)) ++# Now restore obj-y ++obj-y := $(obj-y-save) ++ ++all-obj-y = $(obj-y) $(common-obj-y) ++all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) + + ifndef CONFIG_HAIKU + LIBS+=-lm +diff --git a/configure b/configure +index 0ac437c..8c6f4e5 100755 +--- a/configure ++++ b/configure +@@ -2333,6 +2333,7 @@ if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 gmodule-2.0 > /dev/nu + then + glib_cflags=`$pkg_config --cflags gthread-2.0 gmodule-2.0 2>/dev/null` + glib_libs=`$pkg_config --libs gthread-2.0 gmodule-2.0 2>/dev/null` ++ CFLAGS="$glib_cflags $CFLAGS" + LIBS="$glib_libs $LIBS" + libs_qga="$glib_libs $libs_qga" + else +diff --git a/rules.mak b/rules.mak +index 4499745..0c5125d 100644 +--- a/rules.mak ++++ b/rules.mak +@@ -103,9 +103,6 @@ clean: clean-timestamp + + # magic to descend into other directories + +-obj := . +-old-nested-dirs := +- + define push-var + $(eval save-$2-$1 = $(value $1)) + $(eval $1 :=) +@@ -119,9 +116,11 @@ endef + + define unnest-dir + $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) +-$(eval obj := $(obj)/$1) ++$(eval obj-parent-$1 := $(obj)) ++$(eval obj := $(if $(obj),$(obj)/$1,$1)) + $(eval include $(SRC_PATH)/$1/Makefile.objs) +-$(eval obj := $(patsubst %/$1,%,$(obj))) ++$(eval obj := $(obj-parent-$1)) ++$(eval obj-parent-$1 := ) + $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) + endef + +@@ -136,7 +135,12 @@ $(if $(nested-dirs), + endef + + define unnest-vars ++$(eval obj := $1) ++$(eval nested-vars := $2) ++$(eval old-nested-dirs := ) + $(call unnest-vars-1) ++$(if $1,$(foreach v,$(nested-vars),$(eval \ ++ $v := $(addprefix $1/,$($v))))) + $(foreach var,$(nested-vars),$(eval $(var) := $(filter-out %/, $($(var))))) + $(shell mkdir -p $(sort $(foreach var,$(nested-vars),$(dir $($(var)))))) + $(foreach var,$(nested-vars), $(eval \ +-- +1.9.3 + diff --git a/SOURCES/kvm-scsi-Improve-error-messages-more.patch b/SOURCES/kvm-scsi-Improve-error-messages-more.patch new file mode 100644 index 0000000..fdd2ada --- /dev/null +++ b/SOURCES/kvm-scsi-Improve-error-messages-more.patch @@ -0,0 +1,103 @@ +From 3560dd9e730c41824fcaa9aeb9b4ee503aa98de1 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Fri, 6 Jun 2014 04:11:39 +0200 +Subject: [PATCH 10/13] scsi: Improve error messages more + +RH-Author: Fam Zheng +Message-id: <1402027899-1917-3-git-send-email-famz@redhat.com> +Patchwork-id: 59164 +O-Subject: [RHEL-7 qemu-kvm PATCH 2/2] scsi: Improve error messages more +Bugzilla: 1021788 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Amos Kong +RH-Acked-by: Stefan Hajnoczi + +From: Paolo Bonzini + +Remove the "scsi-block:" prefix for error messages as suggested +by Markus. + +Improve the previous patch by making the message the same for both +scsi-block and scsi-generic, including the strerror() output in both +and making an explicit reference to SG_IO. Also s/can not/cannot/. + +Signed-off-by: Paolo Bonzini +(cherry picked from commit 6ee143a0a4f8b5c437ac327e3d694a6a0e5380ad) +Signed-off-by: Fam Zheng +--- + hw/scsi/scsi-disk.c | 11 ++++++----- + hw/scsi/scsi-generic.c | 8 ++++++-- + 2 files changed, 12 insertions(+), 7 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/scsi/scsi-disk.c | 11 ++++++----- + hw/scsi/scsi-generic.c | 8 ++++++-- + 2 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 5a6384e..1d41db2 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -2434,26 +2434,27 @@ static int scsi_block_initfn(SCSIDevice *dev) + int rc; + + if (!s->qdev.conf.bs) { +- error_report("scsi-block: drive property not set"); ++ error_report("drive property not set"); + return -1; + } + + /* check we are using a driver managing SG_IO (version 3 and after) */ +- rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version); ++ rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version); + if (rc < 0) { +- error_report("scsi-block: can not get version number: %s", ++ error_report("cannot get SG_IO version number: %s. " ++ "Is this a SCSI device?", + strerror(-rc)); + return -1; + } + if (sg_version < 30000) { +- error_report("scsi-block: scsi generic interface too old"); ++ error_report("scsi generic interface too old"); + return -1; + } + + /* get device type from INQUIRY data */ + rc = get_device_type(s); + if (rc < 0) { +- error_report("scsi-block: INQUIRY failed"); ++ error_report("INQUIRY failed"); + return -1; + } + +diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c +index 8d92e0d..3733d2c 100644 +--- a/hw/scsi/scsi-generic.c ++++ b/hw/scsi/scsi-generic.c +@@ -394,6 +394,7 @@ static void scsi_destroy(SCSIDevice *s) + + static int scsi_generic_initfn(SCSIDevice *s) + { ++ int rc; + int sg_version; + struct sg_scsi_id scsiid; + +@@ -412,8 +413,11 @@ static int scsi_generic_initfn(SCSIDevice *s) + } + + /* check we are using a driver managing SG_IO (version 3 and after */ +- if (bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0) { +- error_report("scsi generic interface not supported"); ++ rc = bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version); ++ if (rc < 0) { ++ error_report("cannot get SG_IO version number: %s. " ++ "Is this a SCSI device?", ++ strerror(-rc)); + return -1; + } + if (sg_version < 30000) { +-- +1.7.1 + diff --git a/SOURCES/kvm-scsi-Report-error-when-lun-number-is-in-use.patch b/SOURCES/kvm-scsi-Report-error-when-lun-number-is-in-use.patch new file mode 100644 index 0000000..c6c368d --- /dev/null +++ b/SOURCES/kvm-scsi-Report-error-when-lun-number-is-in-use.patch @@ -0,0 +1,52 @@ +From dcbbbce1a1315b8baf85e10f43ee8355b34314cf Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Tue, 15 Jul 2014 15:54:03 -0500 +Subject: [CHANGE 24/29] scsi: Report error when lun number is in use +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405439643-14545-1-git-send-email-famz@redhat.com> +Patchwork-id: 59914 +O-Subject: [RHEL-7 qemu-kvm PATCH] scsi: Report error when lun number is in use +Bugzilla: 1096576 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Amos Kong + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1096576 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7702061 + +In the case that the lun number is taken by another scsi device, don't +release the existing device siliently, but report an error to user. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit 2039511b8f573165420c86380762ae829dc398d9) +Signed-off-by: Fam Zheng +--- + hw/scsi/scsi-bus.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +Signed-off-by: jen +--- + hw/scsi/scsi-bus.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c +index 77e0c10..7e25c62 100644 +--- a/hw/scsi/scsi-bus.c ++++ b/hw/scsi/scsi-bus.c +@@ -178,7 +178,8 @@ static int scsi_qdev_init(DeviceState *qdev) + d = scsi_device_find(bus, dev->channel, dev->id, dev->lun); + assert(d); + if (d->lun == dev->lun && dev != d) { +- object_unparent(OBJECT(d)); ++ error_report("lun already used by '%s'", d->qdev.id); ++ goto err; + } + } + +-- +1.9.3 + diff --git a/SOURCES/kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch b/SOURCES/kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch new file mode 100644 index 0000000..b112df6 --- /dev/null +++ b/SOURCES/kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch @@ -0,0 +1,54 @@ +From cd4c45ef3c5323053d76057a0435759ce84ede90 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Fri, 6 Jun 2014 04:11:38 +0200 +Subject: [PATCH 09/13] scsi-disk: Improve error messager if can't get version number + +RH-Author: Fam Zheng +Message-id: <1402027899-1917-2-git-send-email-famz@redhat.com> +Patchwork-id: 59163 +O-Subject: [RHEL-7 qemu-kvm PATCH 1/2] scsi-disk: Improve error messager if can't get version number +Bugzilla: 1021788 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Amos Kong +RH-Acked-by: Stefan Hajnoczi + +More often it is that bdrv_ioctl fails due to not supported by driver or +whatever reason, in this case we should be specific, because "interface +too old" is very confusing. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit 4bbeb8b173e8116851d5ececb93189ae34c68309) +Signed-off-by: Fam Zheng +--- + hw/scsi/scsi-disk.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/scsi/scsi-disk.c | 9 +++++++-- + 1 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 6491091..5a6384e 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -2439,8 +2439,13 @@ static int scsi_block_initfn(SCSIDevice *dev) + } + + /* check we are using a driver managing SG_IO (version 3 and after) */ +- if (bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0 || +- sg_version < 30000) { ++ rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version); ++ if (rc < 0) { ++ error_report("scsi-block: can not get version number: %s", ++ strerror(-rc)); ++ return -1; ++ } ++ if (sg_version < 30000) { + error_report("scsi-block: scsi generic interface too old"); + return -1; + } +-- +1.7.1 + diff --git a/SOURCES/kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch b/SOURCES/kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch index 430e321..8ee496d 100644 --- a/SOURCES/kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch +++ b/SOURCES/kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch @@ -1,4 +1,4 @@ -From 0eae214c2b36ad2dd2b841c2dc97e1f86a8284c0 Mon Sep 17 00:00:00 2001 +From 4c3960c0fdeb57a5cb74a9de3883b6e6109bf946 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 12 Sep 2014 11:56:30 +0200 Subject: [PATCH] scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c @@ -6,7 +6,7 @@ Subject: [PATCH] scsi-disk: fix bug in scsi_block_new_request() introduced by co Message-id: <1410522991-11612-1-git-send-email-pbonzini@redhat.com> Patchwork-id: 61021 O-Subject: [RHEL 7.1/7.0.z qemu-kvm PATCH] scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c -Bugzilla: 1141189 +Bugzilla: 1105880 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Laszlo Ersek RH-Acked-by: Fam Zheng @@ -29,10 +29,10 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c -index 6491091..830e3bd 100644 +index 1d41db2..50b7910 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c -@@ -2496,7 +2496,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag, +@@ -2502,7 +2502,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag, * ones (such as WRITE SAME or EXTENDED COPY, etc.). So, without * O_DIRECT everything must go through SG_IO. */ diff --git a/SOURCES/kvm-seccomp-add-semctl-to-the-syscall-whitelist.patch b/SOURCES/kvm-seccomp-add-semctl-to-the-syscall-whitelist.patch new file mode 100644 index 0000000..9e5476e --- /dev/null +++ b/SOURCES/kvm-seccomp-add-semctl-to-the-syscall-whitelist.patch @@ -0,0 +1,50 @@ +From 2b34fb6fdd65055bb38f53312542a1ea7ecbed2e Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Thu, 11 Sep 2014 03:16:56 +0200 +Subject: [PATCH 1/6] seccomp: add semctl() to the syscall whitelist + +Message-id: <20140911031656.11035.52808.stgit@localhost> +Patchwork-id: 60971 +O-Subject: [RHEL7 qemu-kvm PATCH] seccomp: add semctl() to the syscall whitelist +Bugzilla: 1026314 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Laszlo Ersek + + commit b22876cc2f863c58cfebd4a5301fc47e8ec89228 + Author: Paul Moore + Date: Thu Aug 14 13:19:32 2014 -0400 + + seccomp: add semctl() to the syscall whitelist + + QEMU needs to call semctl() for correct operation. This particular + problem was identified on shutdown with the following commandline: + + # qemu -sandbox on -monitor stdio \ + -device intel-hda -device hda-duplex -vnc :0 + + Signed-off-by: Paul Moore + Signed-off-by: Eduardo Otubo + +Signed-off-by: Miroslav Rezanina +--- + qemu-seccomp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/qemu-seccomp.c b/qemu-seccomp.c +index cca1070..59cae8e 100644 +--- a/qemu-seccomp.c ++++ b/qemu-seccomp.c +@@ -245,7 +245,8 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { + { SCMP_SYS(shmdt), 240 }, + { SCMP_SYS(shmctl), 240 }, + { SCMP_SYS(mlock), 240 }, +- { SCMP_SYS(munlock), 240 } ++ { SCMP_SYS(munlock), 240 }, ++ { SCMP_SYS(semctl), 240 } + }; + + int seccomp_start(void) +-- +1.8.3.1 + diff --git a/SOURCES/kvm-seccomp-add-shmctl-mlock-and-munlock-to-the-syscall-.patch b/SOURCES/kvm-seccomp-add-shmctl-mlock-and-munlock-to-the-syscall-.patch new file mode 100644 index 0000000..9940777 --- /dev/null +++ b/SOURCES/kvm-seccomp-add-shmctl-mlock-and-munlock-to-the-syscall-.patch @@ -0,0 +1,66 @@ +From 06d87c5605ba8229f2a3a0f257621bcf6e8c4330 Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Wed, 30 Apr 2014 19:54:46 +0200 +Subject: [PATCH 03/13] seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist + +RH-Author: Paul Moore +Message-id: <20140430195446.13069.14348.stgit@localhost> +Patchwork-id: 58635 +O-Subject: [RHEL7 qemu-kvm PATCH] seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist +Bugzilla: 1026314 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Bandan Das +RH-Acked-by: Laszlo Ersek + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1026314 +Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7405978 +Upstream: Upstream, see commit ID below +Testing: Tested, see BZ + +Minor differences from upstream patch due to a slowly diverging +codebase. + + commit e3f9bb011ae24a594310fa4917754945dc832f8f + Author: Paul Moore + Date: Wed Feb 26 10:25:01 2014 -0500 + + seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist + + Additional testing reveals that PulseAudio requires shmctl() and the + mlock()/munlock() syscalls on some systems/configurations. As before, + on systems that do require these syscalls, the problem can be seen with + the following command line: + + # qemu -monitor stdio -sandbox on \ + -device intel-hda -device hda-duplex + + Signed-off-by: Paul Moore + Signed-off-by: Eduardo Otubo +--- + qemu-seccomp.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + qemu-seccomp.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/qemu-seccomp.c b/qemu-seccomp.c +index 3a2fbed..cca1070 100644 +--- a/qemu-seccomp.c ++++ b/qemu-seccomp.c +@@ -242,7 +242,10 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { + { SCMP_SYS(fchmod), 240 }, + { SCMP_SYS(shmget), 240 }, + { SCMP_SYS(shmat), 240 }, +- { SCMP_SYS(shmdt), 240 } ++ { SCMP_SYS(shmdt), 240 }, ++ { SCMP_SYS(shmctl), 240 }, ++ { SCMP_SYS(mlock), 240 }, ++ { SCMP_SYS(munlock), 240 } + }; + + int seccomp_start(void) +-- +1.7.1 + diff --git a/SOURCES/kvm-simpletrace-add-simpletrace.py-no-header-option.patch b/SOURCES/kvm-simpletrace-add-simpletrace.py-no-header-option.patch new file mode 100644 index 0000000..1b0b0b6 --- /dev/null +++ b/SOURCES/kvm-simpletrace-add-simpletrace.py-no-header-option.patch @@ -0,0 +1,109 @@ +From ae603c6d842f7e7f1529f040ca463be2f2edd4c8 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:53 +0200 +Subject: [PATCH 35/43] simpletrace: add simpletrace.py --no-header option + +Message-id: <1412690820-31016-5-git-send-email-stefanha@redhat.com> +Patchwork-id: 61609 +O-Subject: [RHEL7.1 qemu-kvm PATCH 04/11] simpletrace: add simpletrace.py --no-header option +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +It can be useful to read simpletrace files that have no header. For +example, a ring buffer may not have a header record but can still be +processed if the user is sure the file format version is compatible. + + $ scripts/simpletrace.py --no-header trace-events trace-file + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 15327c3df049c9621ff9b542ccbfc3d17203d1f7) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + scripts/simpletrace.py + +Context conflict because upstream doesn't have enabled_events[]. +--- + scripts/simpletrace.py | 25 ++++++++++++++++++------- + 1 file changed, 18 insertions(+), 7 deletions(-) + +diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py +index 682ec66..b931dd2 100755 +--- a/scripts/simpletrace.py ++++ b/scripts/simpletrace.py +@@ -59,8 +59,8 @@ def read_record(edict, fobj): + rechdr = read_header(fobj, rec_header_fmt) + return get_record(edict, rechdr, fobj) # return tuple of record elements + +-def read_trace_file(edict, fobj): +- """Deserialize trace records from a file, yielding record tuples (event_num, timestamp, pid, arg1, ..., arg6).""" ++def read_trace_header(fobj): ++ """Read and verify trace file header""" + header = read_header(fobj, log_header_fmt) + if header is None or \ + header[0] != header_event_id or \ +@@ -74,6 +74,8 @@ def read_trace_file(edict, fobj): + raise ValueError('Log format %d not supported with this QEMU release!' + % log_version) + ++def read_trace_records(edict, fobj): ++ """Deserialize trace records from a file, yielding record tuples (event_num, timestamp, pid, arg1, ..., arg6).""" + while True: + rec = read_record(edict, fobj) + if rec is None: +@@ -103,7 +105,7 @@ class Analyzer(object): + """Called at the end of the trace.""" + pass + +-def process(events, log, analyzer): ++def process(events, log, analyzer, read_header=True): + """Invoke an analyzer on each event in a log.""" + if isinstance(events, str): + events = _read_events(open(events, 'r')) +@@ -111,6 +113,10 @@ def process(events, log, analyzer): + log = open(log, 'rb') + + enabled_events = [] ++ ++ if read_header: ++ read_trace_header(log) ++ + dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)") + edict = {dropped_event_id: dropped_event} + +@@ -142,7 +148,7 @@ def process(events, log, analyzer): + + analyzer.begin() + fn_cache = {} +- for rec in read_trace_file(edict, log): ++ for rec in read_trace_records(edict, log): + event_num = rec[0] + event = edict[event_num] + if event_num not in fn_cache: +@@ -157,12 +163,17 @@ def run(analyzer): + advanced scripts will want to call process() instead.""" + import sys + +- if len(sys.argv) != 3: +- sys.stderr.write('usage: %s \n' % sys.argv[0]) ++ read_header = True ++ if len(sys.argv) == 4 and sys.argv[1] == '--no-header': ++ read_header = False ++ del sys.argv[1] ++ elif len(sys.argv) != 3: ++ sys.stderr.write('usage: %s [--no-header] ' \ ++ '\n' % sys.argv[0]) + sys.exit(1) + + events = _read_events(open(sys.argv[1], 'r')) +- process(events, sys.argv[2], analyzer) ++ process(events, sys.argv[2], analyzer, read_header=read_header) + + if __name__ == '__main__': + class Formatter(Analyzer): +-- +1.8.3.1 + diff --git a/SOURCES/kvm-simpletrace-add-support-for-trace-record-pid-field.patch b/SOURCES/kvm-simpletrace-add-support-for-trace-record-pid-field.patch new file mode 100644 index 0000000..9101155 --- /dev/null +++ b/SOURCES/kvm-simpletrace-add-support-for-trace-record-pid-field.patch @@ -0,0 +1,113 @@ +From c319a5160a1b86c5cfa288cdf36e7473f8c38515 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:52 +0200 +Subject: [PATCH 34/43] simpletrace: add support for trace record pid field + +Message-id: <1412690820-31016-4-git-send-email-stefanha@redhat.com> +Patchwork-id: 61608 +O-Subject: [RHEL7.1 qemu-kvm PATCH 03/11] simpletrace: add support for trace record pid field +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +Extract the pid field from the trace record and print it. + +Change the trace record tuple from: + (event_num, timestamp, arg1, ..., arg6) +to: + (event_num, timestamp, pid, arg1, ..., arg6) + +Trace event methods now support 3 prototypes: +1. (arg1, arg2, arg3) +2. (timestamp, arg1, arg2, arg3) +3. (timestamp, pid, arg1, arg2, arg3) + +Existing script continue to work without changes, they only know about +prototypes 1 and 2. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 80ff35cd3ff451e8f200413ddf27816058630c1f) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina +--- + scripts/simpletrace.py | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py +index 3cb2cf0..682ec66 100755 +--- a/scripts/simpletrace.py ++++ b/scripts/simpletrace.py +@@ -32,10 +32,10 @@ def read_header(fobj, hfmt): + return struct.unpack(hfmt, hdr) + + def get_record(edict, rechdr, fobj): +- """Deserialize a trace record from a file into a tuple (event_num, timestamp, arg1, ..., arg6).""" ++ """Deserialize a trace record from a file into a tuple (event_num, timestamp, pid, arg1, ..., arg6).""" + if rechdr is None: + return None +- rec = (rechdr[0], rechdr[1]) ++ rec = (rechdr[0], rechdr[1], rechdr[3]) + if rechdr[0] != dropped_event_id: + event_id = rechdr[0] + event = edict[event_id] +@@ -55,12 +55,12 @@ def get_record(edict, rechdr, fobj): + + + def read_record(edict, fobj): +- """Deserialize a trace record from a file into a tuple (event_num, timestamp, arg1, ..., arg6).""" ++ """Deserialize a trace record from a file into a tuple (event_num, timestamp, pid, arg1, ..., arg6).""" + rechdr = read_header(fobj, rec_header_fmt) + return get_record(edict, rechdr, fobj) # return tuple of record elements + + def read_trace_file(edict, fobj): +- """Deserialize trace records from a file, yielding record tuples (event_num, timestamp, arg1, ..., arg6).""" ++ """Deserialize trace records from a file, yielding record tuples (event_num, timestamp, pid, arg1, ..., arg6).""" + header = read_header(fobj, log_header_fmt) + if header is None or \ + header[0] != header_event_id or \ +@@ -132,10 +132,13 @@ def process(events, log, analyzer): + fn_argcount = len(inspect.getargspec(fn)[0]) - 1 + if fn_argcount == event_argcount + 1: + # Include timestamp as first argument +- return lambda _, rec: fn(*rec[1:2 + event_argcount]) ++ return lambda _, rec: fn(*((rec[1:2],) + rec[3:3 + event_argcount])) ++ elif fn_argcount == event_argcount + 2: ++ # Include timestamp and pid ++ return lambda _, rec: fn(*rec[1:3 + event_argcount]) + else: +- # Just arguments, no timestamp +- return lambda _, rec: fn(*rec[2:2 + event_argcount]) ++ # Just arguments, no timestamp or pid ++ return lambda _, rec: fn(*rec[3:3 + event_argcount]) + + analyzer.begin() + fn_cache = {} +@@ -167,19 +170,20 @@ if __name__ == '__main__': + self.last_timestamp = None + + def catchall(self, event, rec): +- i = 1 + timestamp = rec[1] + if self.last_timestamp is None: + self.last_timestamp = timestamp + delta_ns = timestamp - self.last_timestamp + self.last_timestamp = timestamp + +- fields = [event.name, '%0.3f' % (delta_ns / 1000.0)] ++ fields = [event.name, '%0.3f' % (delta_ns / 1000.0), ++ 'pid=%d' % rec[2]] ++ i = 3 + for type, name in event.args: + if is_string(type): +- fields.append('%s=%s' % (name, rec[i + 1])) ++ fields.append('%s=%s' % (name, rec[i])) + else: +- fields.append('%s=0x%x' % (name, rec[i + 1])) ++ fields.append('%s=0x%x' % (name, rec[i])) + i += 1 + print ' '.join(fields) + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-skip-system-call-when-msi-route-is-unchanged.patch b/SOURCES/kvm-skip-system-call-when-msi-route-is-unchanged.patch index 70ce125..bee1ded 100644 --- a/SOURCES/kvm-skip-system-call-when-msi-route-is-unchanged.patch +++ b/SOURCES/kvm-skip-system-call-when-msi-route-is-unchanged.patch @@ -1,4 +1,4 @@ -From 00a2c1d4f4dff271a314f0e9eb3b4c873b1a06c1 Mon Sep 17 00:00:00 2001 +From 34488aa0dd2c4c0a0dcc57a0557ec07750170f67 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin Date: Mon, 19 May 2014 09:57:40 +0200 Subject: [PATCH 2/2] kvm: skip system call when msi route is unchanged @@ -7,7 +7,7 @@ RH-Author: Michael S. Tsirkin Message-id: <1400493448-29146-3-git-send-email-mst@redhat.com> Patchwork-id: 58949 O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] kvm: skip system call when msi route is unchanged -Bugzilla: 1110693 +Bugzilla: 1098976 RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek RH-Acked-by: Marcel Apfelbaum diff --git a/SOURCES/kvm-slirp-udp-fix-NULL-pointer-dereference-because-of-un.patch b/SOURCES/kvm-slirp-udp-fix-NULL-pointer-dereference-because-of-un.patch new file mode 100644 index 0000000..fd0eb37 --- /dev/null +++ b/SOURCES/kvm-slirp-udp-fix-NULL-pointer-dereference-because-of-un.patch @@ -0,0 +1,55 @@ +From 00e16a0908803bf1e796864511862067a763e95e Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Thu, 23 Oct 2014 09:19:24 +0200 +Subject: [PATCH 1/9] slirp: udp: fix NULL pointer dereference because of + uninitialized socket + +Message-id: <1414055964-27479-1-git-send-email-mrezanin@redhat.com> +Patchwork-id: 61832 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] slirp: udp: fix NULL pointer dereference because of uninitialized socket +Bugzilla: 1144820 +RH-Acked-by: Petr Matousek +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Amos Kong + +From: Petr Matousek + +When guest sends udp packet with source port and source addr 0, +uninitialized socket is picked up when looking for matching and already +created udp sockets, and later passed to sosendto() where NULL pointer +dereference is hit during so->slirp->vnetwork_mask.s_addr access. + +Fix this by checking that the socket is not just a socket stub. + +This is CVE-2014-3640. + +Signed-off-by: Petr Matousek +Reported-by: Xavier Mehrenberger +Reported-by: Stephane Duverger +Reviewed-by: Jan Kiszka +Reviewed-by: Michael S. Tsirkin +Reviewed-by: Michael Tokarev +Message-id: 20140918063537.GX9321@dhcp-25-225.brq.redhat.com +Signed-off-by: Peter Maydell +(cherry picked from commit 01f7cecf0037997cb0e58ec0d56bf9b5a6f7cb2a) +Signed-off-by: Miroslav Rezanina +--- + slirp/udp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/slirp/udp.c b/slirp/udp.c +index b105f87..2188176 100644 +--- a/slirp/udp.c ++++ b/slirp/udp.c +@@ -152,7 +152,7 @@ udp_input(register struct mbuf *m, int iphlen) + * Locate pcb for datagram. + */ + so = slirp->udp_last_so; +- if (so->so_lport != uh->uh_sport || ++ if (so == &slirp->udb || so->so_lport != uh->uh_sport || + so->so_laddr.s_addr != ip->ip_src.s_addr) { + struct socket *tmp; + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-spice-call-qemu_spice_set_passwd-during-init.patch b/SOURCES/kvm-spice-call-qemu_spice_set_passwd-during-init.patch new file mode 100644 index 0000000..0111422 --- /dev/null +++ b/SOURCES/kvm-spice-call-qemu_spice_set_passwd-during-init.patch @@ -0,0 +1,46 @@ +From 3d38cb5a412b18287684cd52579afe8034294d53 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Tue, 18 Nov 2014 13:35:20 +0100 +Subject: [PATCH 34/41] spice: call qemu_spice_set_passwd() during init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1416317720-17906-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 62433 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] spice: call qemu_spice_set_passwd() during init +Bugzilla: 1138639 +RH-Acked-by: Amos Kong +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Laszlo Ersek + +From: Marc-AndrĂ© Lureau + +Don't call SPICE API directly to set password given in command line, but +use the internal API, saving password for later calls. + +This solves losing password when changing expiration in qemu monitor. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 07d49a53b6394941ed833486a3acb5c480d87db2) +Signed-off-by: Miroslav Rezanina +--- + ui/spice-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ui/spice-core.c b/ui/spice-core.c +index 99a76d2..141afd1 100644 +--- a/ui/spice-core.c ++++ b/ui/spice-core.c +@@ -721,7 +721,7 @@ void qemu_spice_init(void) + tls_ciphers); + } + if (password) { +- spice_server_set_ticket(spice_server, password, 0, 0, 0); ++ qemu_spice_set_passwd(password, false, false); + } + if (qemu_opt_get_bool(opts, "sasl", 0)) { + if (spice_server_set_sasl_appname(spice_server, "qemu") == -1 || +-- +1.8.3.1 + diff --git a/SOURCES/kvm-spice-display-add-display-channel-id-to-the-debug-me.patch b/SOURCES/kvm-spice-display-add-display-channel-id-to-the-debug-me.patch index 7d2b037..fe0dd15 100644 --- a/SOURCES/kvm-spice-display-add-display-channel-id-to-the-debug-me.patch +++ b/SOURCES/kvm-spice-display-add-display-channel-id-to-the-debug-me.patch @@ -1,12 +1,12 @@ -From 21a79d9dab61df3942c13df2a2472182abdb8a7f Mon Sep 17 00:00:00 2001 +From 514a9261b651aacc643075159f7c8eac07c64d81 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 15 Sep 2014 13:08:22 +0200 -Subject: [PATCH 5/6] spice-display: add display channel id to the debug messages. +Subject: [PATCH 3/4] spice-display: add display channel id to the debug messages. Message-id: <1410786503-19794-4-git-send-email-kraxel@redhat.com> Patchwork-id: 61138 O-Subject: [RHEL-7.1 qemu-kvm PATCH 3/4] spice-display: add display channel id to the debug messages. -Bugzilla: 1139117 +Bugzilla: 1139118 RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek @@ -22,10 +22,10 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c -index 82d8b9f..da45282 100644 +index f0f95c8..5d0a21e 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c -@@ -297,7 +297,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) +@@ -280,7 +280,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) { QXLDevMemSlot memslot; @@ -34,7 +34,7 @@ index 82d8b9f..da45282 100644 memset(&memslot, 0, sizeof(memslot)); memslot.slot_group_id = MEMSLOT_GROUP_HOST; -@@ -311,7 +311,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) +@@ -294,7 +294,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) memset(&surface, 0, sizeof(surface)); @@ -43,7 +43,7 @@ index 82d8b9f..da45282 100644 surface_width(ssd->ds), surface_height(ssd->ds)); surface.format = SPICE_SURFACE_FMT_32_xRGB; -@@ -329,7 +329,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) +@@ -312,7 +312,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd) { @@ -52,7 +52,7 @@ index 82d8b9f..da45282 100644 qemu_spice_destroy_primary_surface(ssd, 0, QXL_SYNC); } -@@ -354,7 +354,8 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, +@@ -337,7 +337,8 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, { QXLRect update_area; @@ -62,7 +62,7 @@ index 82d8b9f..da45282 100644 update_area.left = x, update_area.right = x + w; update_area.top = y; -@@ -371,7 +372,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, +@@ -354,7 +355,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, { SimpleSpiceUpdate *update; @@ -71,7 +71,7 @@ index 82d8b9f..da45282 100644 memset(&ssd->dirty, 0, sizeof(ssd->dirty)); if (ssd->surface) { -@@ -413,7 +414,7 @@ void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd) +@@ -396,7 +397,7 @@ void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd) void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) { @@ -80,7 +80,7 @@ index 82d8b9f..da45282 100644 graphic_hw_update(ssd->dcl.con); qemu_mutex_lock(&ssd->lock); -@@ -427,7 +428,7 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) +@@ -410,7 +411,7 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) if (ssd->notify) { ssd->notify = 0; qemu_spice_wakeup(ssd); @@ -89,7 +89,7 @@ index 82d8b9f..da45282 100644 } } -@@ -437,19 +438,19 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) +@@ -420,19 +421,19 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); @@ -112,7 +112,7 @@ index 82d8b9f..da45282 100644 /* nothing to do */ } -@@ -472,7 +473,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) +@@ -455,7 +456,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) SimpleSpiceUpdate *update; int ret = false; @@ -121,7 +121,7 @@ index 82d8b9f..da45282 100644 qemu_mutex_lock(&ssd->lock); update = QTAILQ_FIRST(&ssd->updates); -@@ -488,7 +489,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) +@@ -471,7 +472,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) static int interface_req_cmd_notification(QXLInstance *sin) { @@ -130,7 +130,7 @@ index 82d8b9f..da45282 100644 return 1; } -@@ -498,7 +499,7 @@ static void interface_release_resource(QXLInstance *sin, +@@ -481,7 +482,7 @@ static void interface_release_resource(QXLInstance *sin, SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); uintptr_t id; diff --git a/SOURCES/kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch b/SOURCES/kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch index 54c00c6..84e7650 100644 --- a/SOURCES/kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch +++ b/SOURCES/kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch @@ -1,12 +1,12 @@ -From 997ea047468b04f18925ba1309068d69c16bdcc4 Mon Sep 17 00:00:00 2001 +From 27d5bab00da6a59c9eae2e5f66dc985f1a0b95ac Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 15 Sep 2014 13:08:23 +0200 -Subject: [PATCH 6/6] spice: make sure we don't overflow ssd->buf +Subject: [PATCH 4/4] spice: make sure we don't overflow ssd->buf Message-id: <1410786503-19794-5-git-send-email-kraxel@redhat.com> Patchwork-id: 61136 O-Subject: [RHEL-7.1 qemu-kvm PATCH 4/4] spice: make sure we don't overflow ssd->buf -Bugzilla: 1139117 +Bugzilla: 1139118 RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek @@ -38,10 +38,10 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c -index da45282..dce9c1b 100644 +index 5d0a21e..dc8be8a 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c -@@ -308,11 +308,23 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) +@@ -291,11 +291,23 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) { QXLDevSurfaceCreate surface; @@ -67,7 +67,7 @@ index da45282..dce9c1b 100644 surface.format = SPICE_SURFACE_FMT_32_xRGB; surface.width = surface_width(ssd->ds); -@@ -343,8 +355,6 @@ void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd) +@@ -326,8 +338,6 @@ void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd) if (ssd->num_surfaces == 0) { ssd->num_surfaces = 1024; } @@ -76,7 +76,7 @@ index da45282..dce9c1b 100644 } /* display listener callbacks */ -@@ -463,7 +473,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) +@@ -446,7 +456,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) info->num_memslots = NUM_MEMSLOTS; info->num_memslots_groups = NUM_MEMSLOTS_GROUPS; info->internal_groupslot_id = 0; diff --git a/SOURCES/kvm-spice-move-qemu_spice_display_-from-spice-graphics-t.patch b/SOURCES/kvm-spice-move-qemu_spice_display_-from-spice-graphics-t.patch new file mode 100644 index 0000000..799ac97 --- /dev/null +++ b/SOURCES/kvm-spice-move-qemu_spice_display_-from-spice-graphics-t.patch @@ -0,0 +1,91 @@ +From 79928996c2bf6ebb143564faf371433489ae5da4 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 5 Sep 2014 12:30:35 +0200 +Subject: [PATCH 01/12] spice: move qemu_spice_display_*() from spice-graphics to spice-core + +Message-id: <1409920238-9070-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 60875 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/4] spice: move qemu_spice_display_*() from spice-graphics to spice-core +Bugzilla: 1054077 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 7cc6a25fe94b430cb5a041bcb19d7d854b4e99a7) +--- + ui/spice-core.c | 16 ++++++++++++++++ + ui/spice-display.c | 17 ----------------- + 2 files changed, 16 insertions(+), 17 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + ui/spice-core.c | 16 ++++++++++++++++ + ui/spice-display.c | 17 ----------------- + 2 files changed, 16 insertions(+), 17 deletions(-) + +diff --git a/ui/spice-core.c b/ui/spice-core.c +index d67449e..6a7c86f 100644 +--- a/ui/spice-core.c ++++ b/ui/spice-core.c +@@ -47,6 +47,7 @@ static const char *auth = "spice"; + static char *auth_passwd; + static time_t auth_expires = TIME_MAX; + static int spice_migration_completed; ++static int spice_display_is_running; + int using_spice = 0; + int spice_displays; + +@@ -873,6 +874,21 @@ int qemu_spice_display_add_client(int csock, int skipauth, int tls) + } + } + ++void qemu_spice_display_start(void) ++{ ++ spice_display_is_running = true; ++} ++ ++void qemu_spice_display_stop(void) ++{ ++ spice_display_is_running = false; ++} ++ ++int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd) ++{ ++ return spice_display_is_running; ++} ++ + static void spice_register_config(void) + { + qemu_add_opts(&qemu_spice_opts); +diff --git a/ui/spice-display.c b/ui/spice-display.c +index 82d8b9f..f0f95c8 100644 +--- a/ui/spice-display.c ++++ b/ui/spice-display.c +@@ -126,23 +126,6 @@ void qemu_spice_wakeup(SimpleSpiceDisplay *ssd) + ssd->worker->wakeup(ssd->worker); + } + +-static int spice_display_is_running; +- +-void qemu_spice_display_start(void) +-{ +- spice_display_is_running = true; +-} +- +-void qemu_spice_display_stop(void) +-{ +- spice_display_is_running = false; +-} +- +-int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd) +-{ +- return spice_display_is_running; +-} +- + static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, + QXLRect *rect) + { +-- +1.7.1 + diff --git a/SOURCES/kvm-spice-move-spice_server_vm_-start-stop-calls-into-qe.patch b/SOURCES/kvm-spice-move-spice_server_vm_-start-stop-calls-into-qe.patch new file mode 100644 index 0000000..770177f --- /dev/null +++ b/SOURCES/kvm-spice-move-spice_server_vm_-start-stop-calls-into-qe.patch @@ -0,0 +1,57 @@ +From 8b96a7cb5bab06ecc5e85f292fbe7598b0e24c8c Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 5 Sep 2014 12:30:36 +0200 +Subject: [PATCH 02/12] spice: move spice_server_vm_{start, stop} calls into qemu_spice_display_*() + +Message-id: <1409920238-9070-3-git-send-email-kraxel@redhat.com> +Patchwork-id: 60874 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/4] spice: move spice_server_vm_{start, stop} calls into qemu_spice_display_*() +Bugzilla: 1054077 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +So calling spice server to start/stop the worker goes +hand in hand with the status variable update. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit b50f3e42b9438e033074222671c0502ecfeba82c) +--- + ui/spice-core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + ui/spice-core.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ui/spice-core.c b/ui/spice-core.c +index 6a7c86f..99a76d2 100644 +--- a/ui/spice-core.c ++++ b/ui/spice-core.c +@@ -621,9 +621,7 @@ static void vm_change_state_handler(void *opaque, int running, + { + if (running) { + qemu_spice_display_start(); +- spice_server_vm_start(spice_server); + } else { +- spice_server_vm_stop(spice_server); + qemu_spice_display_stop(); + } + } +@@ -877,10 +875,12 @@ int qemu_spice_display_add_client(int csock, int skipauth, int tls) + void qemu_spice_display_start(void) + { + spice_display_is_running = true; ++ spice_server_vm_start(spice_server); + } + + void qemu_spice_display_stop(void) + { ++ spice_server_vm_stop(spice_server); + spice_display_is_running = false; + } + +-- +1.7.1 + diff --git a/SOURCES/kvm-spice-stop-server-for-qxl-hard-reset.patch b/SOURCES/kvm-spice-stop-server-for-qxl-hard-reset.patch new file mode 100644 index 0000000..96c8fc3 --- /dev/null +++ b/SOURCES/kvm-spice-stop-server-for-qxl-hard-reset.patch @@ -0,0 +1,62 @@ +From 4997362f21fdf91a47dbcce2c8c27fcad673d21a Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 5 Sep 2014 12:30:37 +0200 +Subject: [PATCH 03/12] spice: stop server for qxl hard reset + +Message-id: <1409920238-9070-4-git-send-email-kraxel@redhat.com> +Patchwork-id: 60876 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 3/4] spice: stop server for qxl hard reset +Bugzilla: 1054077 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Hard reset can happen at any time. We should be able to put qxl into a +known-good state no matter what. Stop spice server thread for reset so +it can't be confused by fetching stale commands lingering around in the +rings while we reset is ongoing. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 75c70e37bc4a6bdc394b4d1b163fe730abb82c72) +--- + hw/display/qxl.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/display/qxl.c | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +diff --git a/hw/display/qxl.c b/hw/display/qxl.c +index 4fe4f1b..6f8adc8 100644 +--- a/hw/display/qxl.c ++++ b/hw/display/qxl.c +@@ -1146,8 +1146,14 @@ static void qxl_soft_reset(PCIQXLDevice *d) + + static void qxl_hard_reset(PCIQXLDevice *d, int loadvm) + { ++ bool startstop = qemu_spice_display_is_running(&d->ssd); ++ + trace_qxl_hard_reset(d->id, loadvm); + ++ if (startstop) { ++ qemu_spice_display_stop(); ++ } ++ + qxl_spice_reset_cursor(d); + qxl_spice_reset_image_cache(d); + qxl_reset_surfaces(d); +@@ -1161,6 +1167,10 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm) + } + qemu_spice_create_host_memslot(&d->ssd); + qxl_soft_reset(d); ++ ++ if (startstop) { ++ qemu_spice_display_start(); ++ } + } + + static void qxl_reset_handler(DeviceState *dev) +-- +1.7.1 + diff --git a/SOURCES/kvm-target-i386-Broadwell-CPU-model.patch b/SOURCES/kvm-target-i386-Broadwell-CPU-model.patch new file mode 100644 index 0000000..58b0ac1 --- /dev/null +++ b/SOURCES/kvm-target-i386-Broadwell-CPU-model.patch @@ -0,0 +1,90 @@ +From 9593b95415b6da77211860e76987c988c08e19d4 Mon Sep 17 00:00:00 2001 +From: Eduardo Habkost +Date: Thu, 21 Aug 2014 19:58:16 +0200 +Subject: [PATCH 1/3] target-i386: Broadwell CPU model +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1408651097-24190-2-git-send-email-ehabkost@redhat.com> +Patchwork-id: 60670 +O-Subject: [RHEL7.1 qemu-kvm PATCH 1/2] target-i386: Broadwell CPU model +Bugzilla: 1116117 +RH-Acked-by: Bandan Das +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini + +This adds a new CPU model named "Broadwell". It has all the features +from Haswell, plus PREFETCHW, RDSEED, ADX, SMAP. + +PREFETCHW was already supported as "3dnowprefetch". +[Already supported by RHEL-7 kernel, too] + +RDSEED, ADX was added on Linux v3.15-rc1. +[RDSEED: RHEL-7 kernel commit c4311bc8c9167a3d7011aff8728fd8067404246f] +[ADX: RHEL-7 kernel commit fe5f6cdf4428dcd01f5b060b31eabe44c2f5e468] + +SMAP was added on Linux v3.15-rc2. +[RHEL-7 kernel commit 890edaefc84a2596a3f17d1e9967935a1984e302] + +About migration support: +* SMAP state is a single bit on CR4 which is already migrated; +* PREFETCHW, RDSEED, ADX have no new state. + +Signed-off-by: Eduardo Habkost +Signed-off-by: Andreas Färber +(cherry picked from commit ece01354073f8e02db0205ea7522f3dbf589c9aa) +Signed-off-by: Eduardo Habkost +Signed-off-by: Miroslav Rezanina +--- + target-i386/cpu.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/target-i386/cpu.c b/target-i386/cpu.c +index e65318e..1507530 100644 +--- a/target-i386/cpu.c ++++ b/target-i386/cpu.c +@@ -860,6 +860,40 @@ static x86_def_t builtin_x86_defs[] = { + .model_id = "Intel Core Processor (Haswell)", + }, + { ++ .name = "Broadwell", ++ .level = 0xd, ++ .vendor = CPUID_VENDOR_INTEL, ++ .family = 6, ++ .model = 61, ++ .stepping = 2, ++ .features[FEAT_1_EDX] = ++ CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | ++ CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | ++ CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | ++ CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | ++ CPUID_DE | CPUID_FP87, ++ .features[FEAT_1_ECX] = ++ CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | ++ CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | ++ CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | ++ CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | ++ CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE | ++ CPUID_EXT_PCID, ++ .features[FEAT_8000_0001_EDX] = ++ CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | ++ CPUID_EXT2_SYSCALL, ++ .features[FEAT_8000_0001_ECX] = ++ CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, ++ .features[FEAT_7_0_EBX] = ++ CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | ++ CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | ++ CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID | ++ CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | ++ CPUID_7_0_EBX_SMAP, ++ .xlevel = 0x8000000A, ++ .model_id = "Intel Core Processor (Broadwell)", ++ }, ++ { + .name = "Opteron_G1", + .level = 5, + .vendor = CPUID_VENDOR_AMD, +-- +1.8.3.1 + diff --git a/SOURCES/kvm-target-i386-get-CPL-from-SS.DPL.patch b/SOURCES/kvm-target-i386-get-CPL-from-SS.DPL.patch new file mode 100644 index 0000000..08eff71 --- /dev/null +++ b/SOURCES/kvm-target-i386-get-CPL-from-SS.DPL.patch @@ -0,0 +1,74 @@ +From 848115120ffa7b2287069fe6d23683304b9ffec1 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 12 Sep 2014 11:56:31 +0200 +Subject: [PATCH 31/43] target-i386: get CPL from SS.DPL + +Message-id: <1410522991-11612-2-git-send-email-pbonzini@redhat.com> +Patchwork-id: 61022 +O-Subject: [RHEL 7.1 qemu-kvm PATCH] target-i386: get CPL from SS.DPL +Bugzilla: 1097363 +RH-Acked-by: wei@redhat.com +RH-Acked-by: Radim Krcmar +RH-Acked-by: Laszlo Ersek + +CS.RPL is not equal to the CPL in the few instructions between +setting CR0.PE and reloading CS. We get this right in the common +case, because writes to CR0 do not modify the CPL, but it would +not be enough if an SMI comes exactly during that brief period. +Were this to happen, the RSM instruction would erroneously set +CPL to the low two bits of the real-mode selector; and if they are +not 00, the next instruction fetch cannot access the code segment +and causes a triple fault. + +However, SS.DPL *is* always equal to the CPL. In real processors +(AMD only) there is a weird case of SYSRET setting SS.DPL=SS.RPL +from the STAR register while forcing CPL=3, but we do not emulate +that. + +Tested-by: Kevin O'Connor +Signed-off-by: Paolo Bonzini +(cherry picked from commit 7125c937c97d9ec4a41b3cb6d1b3e805ec53e255) +Signed-off-by: Miroslav Rezanina + +Conflicts: + target-i386/cpu.h [only needed for TCG and has other dependencies] +--- + target-i386/kvm.c | 2 +- + target-i386/machine.c | 8 ++++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/target-i386/kvm.c b/target-i386/kvm.c +index 6b250f5..65362ac 100644 +--- a/target-i386/kvm.c ++++ b/target-i386/kvm.c +@@ -1381,7 +1381,7 @@ static int kvm_get_sregs(X86CPU *cpu) + HF_OSFXSR_MASK | HF_LMA_MASK | HF_CS32_MASK | \ + HF_SS32_MASK | HF_CS64_MASK | HF_ADDSEG_MASK) + +- hflags = (env->segs[R_CS].flags >> DESC_DPL_SHIFT) & HF_CPL_MASK; ++ hflags = (env->segs[R_SS].flags >> DESC_DPL_SHIFT) & HF_CPL_MASK; + hflags |= (env->cr[0] & CR0_PE_MASK) << (HF_PE_SHIFT - CR0_PE_SHIFT); + hflags |= (env->cr[0] << (HF_MP_SHIFT - CR0_MP_SHIFT)) & + (HF_MP_MASK | HF_EM_MASK | HF_TS_MASK); +diff --git a/target-i386/machine.c b/target-i386/machine.c +index 42b049b..87fd496 100644 +--- a/target-i386/machine.c ++++ b/target-i386/machine.c +@@ -296,6 +296,14 @@ static int cpu_post_load(void *opaque, int version_id) + env->segs[R_SS].flags &= ~(env->segs[R_SS].flags & DESC_DPL_MASK); + } + ++ /* Older versions of QEMU incorrectly used CS.DPL as the CPL when ++ * running under KVM. This is wrong for conforming code segments. ++ * Luckily, in our implementation the CPL field of hflags is redundant ++ * and we can get the right value from the SS descriptor privilege level. ++ */ ++ env->hflags &= ~HF_CPL_MASK; ++ env->hflags |= (env->segs[R_SS].flags >> DESC_DPL_SHIFT) & HF_CPL_MASK; ++ + /* XXX: restore FPU round state */ + env->fpstt = (env->fpus_vmstate >> 11) & 7; + env->fpus = env->fpus_vmstate & ~0x3800; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-add-dump1-and-dump2-fil.patch b/SOURCES/kvm-tests-vmstate-static-checker-add-dump1-and-dump2-fil.patch new file mode 100644 index 0000000..8056d1b --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-add-dump1-and-dump2-fil.patch @@ -0,0 +1,2376 @@ +From a681849c8c4978c085fc8882fa750e00cf03492c Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:00 -0500 +Subject: [CHANGE 04/29] tests: vmstate static checker: add dump1 and dump2 + files +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <42a556722619e2344964639021fb55f882f30586.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59784 +O-Subject: [RHEL7.1 qemu-kvm PATCH 03/18] tests: vmstate static checker: add dump1 and dump2 files +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +These are stripped-down JSON data as obtained from the -dump-vmstate +option. The two files are identical in this commit, and will be +modified in the later commits to show what the script does with the +data. + +Signed-off-by: Amit Shah +Acked-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit a10413e4fc96f83ff60b3c57d7b805752a7fc492) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump1.json | 1163 ++++++++++++++++++++++++++ + tests/vmstate-static-checker-data/dump2.json | 1163 ++++++++++++++++++++++++++ + 2 files changed, 2326 insertions(+) + create mode 100644 tests/vmstate-static-checker-data/dump1.json + create mode 100644 tests/vmstate-static-checker-data/dump2.json + +diff --git a/tests/vmstate-static-checker-data/dump1.json b/tests/vmstate-static-checker-data/dump1.json +new file mode 100644 +index 0000000..44200fb +--- /dev/null ++++ b/tests/vmstate-static-checker-data/dump1.json +@@ -0,0 +1,1163 @@ ++{ ++ "vmschkmachine": { ++ "Name": "pc-i440fx-2.1" ++ }, ++ "fw_cfg": { ++ "Name": "fw_cfg", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "fw_cfg", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "cur_entry", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "cur_offset", ++ "version_id": 0, ++ "field_exists": true, ++ "size": 4 ++ }, ++ { ++ "field": "cur_offset", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ "fusbh200-ehci-usb": { ++ "Name": "fusbh200-ehci-usb", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "ehci-sysbus", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "ehci", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 1880, ++ "Description": { ++ "name": "ehci-core", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "usbcmd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts_pending", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts_frindex", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbintr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "frindex", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "ctrldssegment", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "periodiclistbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "asynclistaddr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "configflag", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[0]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[1]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[2]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[3]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[4]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[5]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "frame_timer", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "last_run_ns", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "async_stepdown", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "astate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "pstate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "a_fetch_addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "p_fetch_addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ } ++ ] ++ } ++ }, ++ "pci-serial-4x": { ++ "Name": "pci-serial-4x", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "pci-serial-multi", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 368, ++ "Description": { ++ "name": "serial", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "divider", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "rbr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "ier", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "iir", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "mcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lsr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "msr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "scr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "fcr_vmstate", ++ "version_id": 3, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "level", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ "intel-hda-generic": { ++ "Name": "intel-hda-generic", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Description": { ++ "name": "intel-hda", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "pci", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "g_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wake_en", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "state_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "int_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "int_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wall_clk", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_rp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_wp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_size", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_wp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_cnt", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_size", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "dp_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "dp_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "icw", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "irr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "ics", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "st", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 56, ++ "Description": { ++ "name": "intel-hda-stream", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "lpib", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "cbl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "lvi", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "fmt", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "bdlp_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "bdlp_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "rirb_count", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wall_base_ns", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "cfi.pflash01": { ++ "Name": "cfi.pflash01", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "pflash_cfi01", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "wcycle", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "cmd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "counter", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "megasas": { ++ "Name": "megasas", ++ "version_id": 0, ++ "minimum_version_id": 0, ++ "Description": { ++ "name": "megasas", ++ "version_id": 0, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "parent_obj", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "fw_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "intr_mask", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "doorbell", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "reply_queue_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "consumer_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "producer_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "PIIX3-xen": { ++ "Name": "PIIX3-xen", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Description": { ++ "name": "PIIX3", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "pci_irq_levels_vmstate", ++ "version_id": 3, ++ "field_exists": false, ++ "size": 4 ++ } ++ ], ++ "Subsections": [ ++ { ++ "name": "PIIX3/rcr", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "rcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ ] ++ } ++ }, ++ "tpci200": { ++ "Name": "tpci200", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "tpci200", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "big_endian", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "ctrl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "int_set", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ "SUNW,fdtwo": { ++ "Name": "SUNW,fdtwo", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Description": { ++ "name": "fdc", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 360, ++ "Description": { ++ "name": "fdc", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "sra", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "srb", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "dor_vmstate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "tdr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "dsr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "msr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status0", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status1", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status2", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "fifo", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "data_pos", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "data_len", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "data_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "data_dir", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "eot", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "timer0", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "timer1", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "precomp_trk", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lock", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "pwrd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "num_floppies", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "drives", ++ "version_id": 1, ++ "field_exists": false, ++ "size": 40, ++ "Description": { ++ "name": "fdrive", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "head", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "track", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "sect", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ], ++ "Subsections": [ ++ { ++ "name": "fdrive/media_changed", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "media_changed", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ }, ++ { ++ "name": "fdrive/media_rate", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "media_rate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ ] ++ } ++ } ++ ] ++ } ++ } ++ ] ++ } ++ }, ++ "usb-kbd": { ++ "Name": "usb-kbd", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "usb-kbd", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4352, ++ "Description": { ++ "name": "USBDevice", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "remote_wakeup", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_len", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_index", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_buf", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "kbd.keycodes", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "head", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "n", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "kbd.modifiers", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "kbd.leds", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.key", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.keys", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "protocol", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "idle", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ } ++} +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +new file mode 100644 +index 0000000..44200fb +--- /dev/null ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -0,0 +1,1163 @@ ++{ ++ "vmschkmachine": { ++ "Name": "pc-i440fx-2.1" ++ }, ++ "fw_cfg": { ++ "Name": "fw_cfg", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "fw_cfg", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "cur_entry", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "cur_offset", ++ "version_id": 0, ++ "field_exists": true, ++ "size": 4 ++ }, ++ { ++ "field": "cur_offset", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ "fusbh200-ehci-usb": { ++ "Name": "fusbh200-ehci-usb", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "ehci-sysbus", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "ehci", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 1880, ++ "Description": { ++ "name": "ehci-core", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "usbcmd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts_pending", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbsts_frindex", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "usbintr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "frindex", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "ctrldssegment", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "periodiclistbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "asynclistaddr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "configflag", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[0]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[1]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[2]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[3]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[4]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "portsc[5]", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "frame_timer", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "last_run_ns", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "async_stepdown", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "astate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "pstate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "a_fetch_addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "p_fetch_addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ } ++ ] ++ } ++ }, ++ "pci-serial-4x": { ++ "Name": "pci-serial-4x", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "pci-serial-multi", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 368, ++ "Description": { ++ "name": "serial", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "divider", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "rbr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "ier", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "iir", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "mcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lsr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "msr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "scr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "fcr_vmstate", ++ "version_id": 3, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "level", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ "intel-hda-generic": { ++ "Name": "intel-hda-generic", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Description": { ++ "name": "intel-hda", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "pci", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "g_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wake_en", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "state_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "int_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "int_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wall_clk", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_rp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_wp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "corb_size", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_wp", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_cnt", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_sts", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "rirb_size", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "dp_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "dp_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "icw", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "irr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "ics", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "st", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 56, ++ "Description": { ++ "name": "intel-hda-stream", ++ "version_id": 1, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "ctl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "lpib", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "cbl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "lvi", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "fmt", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "bdlp_lbase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "bdlp_ubase", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "rirb_count", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "wall_base_ns", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "cfi.pflash01": { ++ "Name": "cfi.pflash01", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "pflash_cfi01", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "wcycle", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "cmd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "counter", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "megasas": { ++ "Name": "megasas", ++ "version_id": 0, ++ "minimum_version_id": 0, ++ "Description": { ++ "name": "megasas", ++ "version_id": 0, ++ "minimum_version_id": 0, ++ "Fields": [ ++ { ++ "field": "parent_obj", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "fw_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "intr_mask", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "doorbell", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "reply_queue_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "consumer_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ }, ++ { ++ "field": "producer_pa", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 8 ++ } ++ ] ++ } ++ }, ++ "PIIX3-xen": { ++ "Name": "PIIX3-xen", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Description": { ++ "name": "PIIX3", ++ "version_id": 3, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "pci_irq_levels_vmstate", ++ "version_id": 3, ++ "field_exists": false, ++ "size": 4 ++ } ++ ], ++ "Subsections": [ ++ { ++ "name": "PIIX3/rcr", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "rcr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ ] ++ } ++ }, ++ "tpci200": { ++ "Name": "tpci200", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "tpci200", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1944, ++ "Description": { ++ "name": "PCIDevice", ++ "version_id": 2, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "version_id", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 256 ++ }, ++ { ++ "field": "irq_state", ++ "version_id": 2, ++ "field_exists": false, ++ "size": 16 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "big_endian", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "ctrl", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "int_set", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ "SUNW,fdtwo": { ++ "Name": "SUNW,fdtwo", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Description": { ++ "name": "fdc", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 360, ++ "Description": { ++ "name": "fdc", ++ "version_id": 2, ++ "minimum_version_id": 2, ++ "Fields": [ ++ { ++ "field": "sra", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "srb", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "dor_vmstate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "tdr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "dsr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "msr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status0", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status1", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "status2", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "fifo", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "data_pos", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "data_len", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "data_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "data_dir", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "eot", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "timer0", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "timer1", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "precomp_trk", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "config", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "lock", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "pwrd", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "num_floppies", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "drives", ++ "version_id": 1, ++ "field_exists": false, ++ "size": 40, ++ "Description": { ++ "name": "fdrive", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "head", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "track", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "sect", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ], ++ "Subsections": [ ++ { ++ "name": "fdrive/media_changed", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "media_changed", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ }, ++ { ++ "name": "fdrive/media_rate", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "media_rate", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ ] ++ } ++ } ++ ] ++ } ++ } ++ ] ++ } ++ }, ++ "usb-kbd": { ++ "Name": "usb-kbd", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Description": { ++ "name": "usb-kbd", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "dev", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4352, ++ "Description": { ++ "name": "USBDevice", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "addr", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "remote_wakeup", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_state", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_len", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_index", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "setup_buf", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ }, ++ { ++ "field": "kbd.keycodes", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "head", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "n", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "kbd.modifiers", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "kbd.leds", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.key", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.keys", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "protocol", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "idle", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } ++ } ++} +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-add-size-mismatch-insid.patch b/SOURCES/kvm-tests-vmstate-static-checker-add-size-mismatch-insid.patch new file mode 100644 index 0000000..db2f886 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-add-size-mismatch-insid.patch @@ -0,0 +1,43 @@ +From 9c606e84ad6c69ac27a1f6d8ec7b077722d0a80a Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:15 -0500 +Subject: [CHANGE 19/29] tests: vmstate static checker: add size mismatch + inside substructure +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <88c2db2eee6f9327d274f61e63c4c05effc05e01.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59799 +O-Subject: [RHEL7.1 qemu-kvm PATCH 18/18] tests: vmstate static checker: add size mismatch inside substructure +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 38ef86b5a68a6553904ee89672417d7a61c5182e) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 45cccaf..75719f5 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -909,7 +909,7 @@ + "field": "kbd.keycodes", + "version_id": 0, + "field_exists": false, +- "size": 4 ++ "size": 2 + }, + { + "field": "head", +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-add-substructure-for-us.patch b/SOURCES/kvm-tests-vmstate-static-checker-add-substructure-for-us.patch new file mode 100644 index 0000000..655a4ae --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-add-substructure-for-us.patch @@ -0,0 +1,168 @@ +From a2686d53c032a75e66f3be389671c9f07359c53d Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:14 -0500 +Subject: [CHANGE 18/29] tests: vmstate static checker: add substructure for + usb-kbd for hid section +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59798 +O-Subject: [RHEL7.1 qemu-kvm PATCH 17/18] tests: vmstate static checker: add substructure for usb-kbd for hid section +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +This shows how the script deals with substructures added to vmstate +descriptions that don't change the on-wire format. + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit af3713f6b9eaef52ae0eef2f95c5df1987e8f0a4) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 115 +++++++++++++++------------ + 1 file changed, 64 insertions(+), 51 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index b5cb1aa..45cccaf 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -844,7 +844,7 @@ + "field": "dev", + "version_id": 0, + "field_exists": false, +- "size": 4352, ++ "size": 5832, + "Description": { + "name": "USBDevice", + "version_id": 1, +@@ -896,58 +896,71 @@ + } + }, + { +- "field": "kbd.keycodes", ++ "field": "hid", + "version_id": 0, + "field_exists": false, +- "size": 4 +- }, +- { +- "field": "head", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "n", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "kbd.modifiers", +- "version_id": 0, +- "field_exists": false, +- "size": 2 +- }, +- { +- "field": "kbd.leds", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "kbd.key", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "kbd.keys", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "protocol", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "idle", +- "version_id": 0, +- "field_exists": false, +- "size": 1 ++ "size": 312, ++ "Description": { ++ "name": "HIDKeyboardDevice", ++ "version_id": 1, ++ "minimum_version_id": 1, ++ "Fields": [ ++ { ++ "field": "kbd.keycodes", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "head", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "n", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "kbd.modifiers", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 2 ++ }, ++ { ++ "field": "kbd.leds", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.key", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ }, ++ { ++ "field": "kbd.keys", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "protocol", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 4 ++ }, ++ { ++ "field": "idle", ++ "version_id": 0, ++ "field_exists": false, ++ "size": 1 ++ } ++ ] ++ } + } + ] + } +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-add-version-error-in-ma.patch b/SOURCES/kvm-tests-vmstate-static-checker-add-version-error-in-ma.patch new file mode 100644 index 0000000..71ba732 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-add-version-error-in-ma.patch @@ -0,0 +1,43 @@ +From 5cea0da742284b2c1aea911a3e20860c42110d4d Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:02 -0500 +Subject: [CHANGE 06/29] tests: vmstate static checker: add version error in + main section +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59786 +O-Subject: [RHEL7.1 qemu-kvm PATCH 05/18] tests: vmstate static checker: add version error in main section +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Acked-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit a81d3fad87302e482c4a8009c3c7d3eca96527e0) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 0a8b81d..f405534 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -34,7 +34,7 @@ + }, + "fusbh200-ehci-usb": { + "Name": "fusbh200-ehci-usb", +- "version_id": 2, ++ "version_id": 1, + "minimum_version_id": 1, + "Description": { + "name": "ehci-sysbus", +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-change-description-name.patch b/SOURCES/kvm-tests-vmstate-static-checker-change-description-name.patch new file mode 100644 index 0000000..fae4852 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-change-description-name.patch @@ -0,0 +1,42 @@ +From fab8b4c62034a9987cee2601f49972e597cab50f Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:08 -0500 +Subject: [CHANGE 12/29] tests: vmstate static checker: change description name +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59792 +O-Subject: [RHEL7.1 qemu-kvm PATCH 11/18] tests: vmstate static checker: change description name +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 1d681c712af592287750fc9ac9f7f75005e7b039) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 34bfbf6..f69966d 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -749,7 +749,7 @@ + "version_id": 1, + "minimum_version_id": 1, + "Description": { +- "name": "tpci200", ++ "name": "tpci2002", + "version_id": 1, + "minimum_version_id": 1, + "Fields": [ +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-incompat-machine-types.patch b/SOURCES/kvm-tests-vmstate-static-checker-incompat-machine-types.patch new file mode 100644 index 0000000..db3375a --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-incompat-machine-types.patch @@ -0,0 +1,44 @@ +From 7cae700ac81f981cccc7da24bf0bafa5553c6814 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:01 -0500 +Subject: [CHANGE 05/29] tests: vmstate static checker: incompat machine types +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <2702cc4c7819182770b80f1e3b846163a7a7d9d5.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59785 +O-Subject: [RHEL7.1 qemu-kvm PATCH 04/18] tests: vmstate static checker: incompat machine types +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +This commit modifies the dump2 data to flag incompatibilities in the +machine types being compared. + +Signed-off-by: Amit Shah +Acked-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit bc178dc5630a243f95c9d3c2ee2329af09606f41) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 44200fb..0a8b81d 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -1,6 +1,6 @@ + { + "vmschkmachine": { +- "Name": "pc-i440fx-2.1" ++ "Name": "pc-i440fx-2.2" + }, + "fw_cfg": { + "Name": "fw_cfg", +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-minimum_version_id-chec.patch b/SOURCES/kvm-tests-vmstate-static-checker-minimum_version_id-chec.patch new file mode 100644 index 0000000..c3041f2 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-minimum_version_id-chec.patch @@ -0,0 +1,43 @@ +From 45d82bd7efc9c6f2f241b36b40f467ae07cf35d8 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:04 -0500 +Subject: [CHANGE 08/29] tests: vmstate static checker: minimum_version_id + check +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <5e344334e387d805ccfdeab313f70f06cfdcc57b.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59788 +O-Subject: [RHEL7.1 qemu-kvm PATCH 07/18] tests: vmstate static checker: minimum_version_id check +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 7daa3d76dff720465188867272682a4f8fcf6e82) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump1.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump1.json b/tests/vmstate-static-checker-data/dump1.json +index 44200fb..786ca0b 100644 +--- a/tests/vmstate-static-checker-data/dump1.json ++++ b/tests/vmstate-static-checker-data/dump1.json +@@ -698,7 +698,7 @@ + "minimum_version_id": 2, + "Description": { + "name": "PIIX3", +- "version_id": 3, ++ "version_id": 1, + "minimum_version_id": 2, + "Fields": [ + { +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-Description-insi.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-Description-insi.patch new file mode 100644 index 0000000..8217993 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-Description-insi.patch @@ -0,0 +1,68 @@ +From eaf817bf17f3413f9b4ecc8751bc7fce55af4d7a Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:11 -0500 +Subject: [CHANGE 15/29] tests: vmstate static checker: remove Description + inside Fields +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59795 +O-Subject: [RHEL7.1 qemu-kvm PATCH 14/18] tests: vmstate static checker: remove Description inside Fields +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit b5968f0ab399002cae2fddbc24c6a89cee90ebd3) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 27 +-------------------------- + 1 file changed, 1 insertion(+), 26 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 66ac3bd..05b8fce 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -212,32 +212,7 @@ + "field": "pci", + "version_id": 0, + "field_exists": false, +- "size": 1944, +- "Description": { +- "name": "PCIDevice", +- "version_id": 2, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "version_id", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "config", +- "version_id": 0, +- "field_exists": false, +- "size": 256 +- }, +- { +- "field": "irq_state", +- "version_id": 2, +- "field_exists": false, +- "size": 16 +- } +- ] +- } ++ "size": 1944 + }, + { + "field": "g_ctl", +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-Description.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-Description.patch new file mode 100644 index 0000000..3eae2ad --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-Description.patch @@ -0,0 +1,73 @@ +From 7e6a14b47a1a22dfd6b2eff2a761586706de71b6 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:10 -0500 +Subject: [CHANGE 14/29] tests: vmstate static checker: remove Description +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59794 +O-Subject: [RHEL7.1 qemu-kvm PATCH 13/18] tests: vmstate static checker: remove Description +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit ff29b8573f250148a567bfdc0ee7d077aa17b7f6) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 33 +--------------------------- + 1 file changed, 1 insertion(+), 32 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index cc0aae3..66ac3bd 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -462,38 +462,7 @@ + "cfi.pflash01": { + "Name": "cfi.pflash01", + "version_id": 1, +- "minimum_version_id": 1, +- "Description": { +- "name": "pflash_cfi01", +- "version_id": 1, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "wcycle", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "cmd", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "status", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "counter", +- "version_id": 0, +- "field_exists": false, +- "size": 8 +- } +- ] +- } ++ "minimum_version_id": 1 + }, + "megasas": { + "Name": "megasas", +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-Fields.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-Fields.patch new file mode 100644 index 0000000..c63bb38 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-Fields.patch @@ -0,0 +1,154 @@ +From ca933e260fc4d595e1cdeae545953873d68823d1 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:09 -0500 +Subject: [CHANGE 13/29] tests: vmstate static checker: remove Fields +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <69b371009d0ee46ec02502595e5bc4d273cc1b5c.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59793 +O-Subject: [RHEL7.1 qemu-kvm PATCH 12/18] tests: vmstate static checker: remove Fields +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 083bac3484e335130235ca0369e840a9ee766c4f) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 114 +-------------------------- + 1 file changed, 1 insertion(+), 113 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index f69966d..cc0aae3 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -196,119 +196,7 @@ + "Description": { + "name": "pci-serial-multi", + "version_id": 1, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "dev", +- "version_id": 0, +- "field_exists": false, +- "size": 1944, +- "Description": { +- "name": "PCIDevice", +- "version_id": 2, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "version_id", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { +- "field": "config", +- "version_id": 0, +- "field_exists": false, +- "size": 256 +- }, +- { +- "field": "irq_state", +- "version_id": 2, +- "field_exists": false, +- "size": 16 +- } +- ] +- } +- }, +- { +- "field": "state", +- "version_id": 0, +- "field_exists": false, +- "size": 368, +- "Description": { +- "name": "serial", +- "version_id": 3, +- "minimum_version_id": 2, +- "Fields": [ +- { +- "field": "divider", +- "version_id": 2, +- "field_exists": false, +- "size": 2 +- }, +- { +- "field": "rbr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "ier", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "iir", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "lcr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "mcr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "lsr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "msr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "scr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- }, +- { +- "field": "fcr_vmstate", +- "version_id": 3, +- "field_exists": false, +- "size": 1 +- } +- ] +- } +- }, +- { +- "field": "level", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- } +- ] ++ "minimum_version_id": 1 + } + }, + "intel-hda-generic": { +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-Subsections.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-Subsections.patch new file mode 100644 index 0000000..02f4156 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-Subsections.patch @@ -0,0 +1,55 @@ +From cee2b0f8cedc1308b9e215091ce75907d737406b Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:13 -0500 +Subject: [CHANGE 17/29] tests: vmstate static checker: remove Subsections +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <257ecb190461b9f6e3ab763896b6831cdbc4341e.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59797 +O-Subject: [RHEL7.1 qemu-kvm PATCH 16/18] tests: vmstate static checker: remove Subsections +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit c7173a9c182c9092de6be57490132a218c850675) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 15 --------------- + 1 file changed, 15 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 6f8a617..b5cb1aa 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -558,21 +558,6 @@ + "field_exists": false, + "size": 4 + } +- ], +- "Subsections": [ +- { +- "name": "PIIX3/rcr", +- "version_id": 1, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "rcr", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- } +- ] +- } + ] + } + }, +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-a-field.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-field.patch new file mode 100644 index 0000000..19cc0cc --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-field.patch @@ -0,0 +1,46 @@ +From fc38cd81546942d51dd29c8e9660523d2da7b044 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:06 -0500 +Subject: [CHANGE 10/29] tests: vmstate static checker: remove a field +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <074c895a3122131fd689795261464f5a28e3b8da.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59790 +O-Subject: [RHEL7.1 qemu-kvm PATCH 09/18] tests: vmstate static checker: remove a field +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 55e8e0e19c169ee83fd23436f348a948adf5d095) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 4ccfd67..f6b52d0 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -58,12 +58,6 @@ + "size": 4 + }, + { +- "field": "usbsts", +- "version_id": 0, +- "field_exists": false, +- "size": 4 +- }, +- { + "field": "usbsts_pending", + "version_id": 2, + "field_exists": false, +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-a-section.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-section.patch new file mode 100644 index 0000000..7a0c2c3 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-section.patch @@ -0,0 +1,42 @@ +From fb43164b1d88f51beb9a3b81e18a4327a29d518d Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:05 -0500 +Subject: [CHANGE 09/29] tests: vmstate static checker: remove a section +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <85af25c60c6546e4b4fef4176b5a5ac67088afe8.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59789 +O-Subject: [RHEL7.1 qemu-kvm PATCH 08/18] tests: vmstate static checker: remove a section +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit ab99bdbe33cd108f490d89ba92361c4197c5c56b) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 36a9b4b..4ccfd67 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -2,7 +2,7 @@ + "vmschkmachine": { + "Name": "pc-i440fx-2.2" + }, +- "fw_cfg": { ++ "fw_cfg2": { + "Name": "fw_cfg", + "version_id": 2, + "minimum_version_id": 1, +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-a-subsection.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-subsection.patch new file mode 100644 index 0000000..73676f5 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-a-subsection.patch @@ -0,0 +1,53 @@ +From fe9b5a30d04270d9639e3f5ce8a4338a4074e39f Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:12 -0500 +Subject: [CHANGE 16/29] tests: vmstate static checker: remove a subsection +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59796 +O-Subject: [RHEL7.1 qemu-kvm PATCH 15/18] tests: vmstate static checker: remove a subsection +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit aa2a12bb824170a0dae94f0d39bbd3b61add038f) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index 05b8fce..6f8a617 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -836,19 +836,6 @@ + "size": 1 + } + ] +- }, +- { +- "name": "fdrive/media_rate", +- "version_id": 1, +- "minimum_version_id": 1, +- "Fields": [ +- { +- "field": "media_rate", +- "version_id": 0, +- "field_exists": false, +- "size": 1 +- } +- ] + } + ] + } +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-remove-last-field-in-a-.patch b/SOURCES/kvm-tests-vmstate-static-checker-remove-last-field-in-a-.patch new file mode 100644 index 0000000..0787ab2 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-remove-last-field-in-a-.patch @@ -0,0 +1,47 @@ +From dbcb21d9f76dd057e78273de8720cb8092ba0315 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:07 -0500 +Subject: [CHANGE 11/29] tests: vmstate static checker: remove last field in a + struct +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59791 +O-Subject: [RHEL7.1 qemu-kvm PATCH 10/18] tests: vmstate static checker: remove last field in a struct +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Reviewed-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit fd52ffb9bfa3cb9adc4d7578209ec95eba47b45f) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index f6b52d0..34bfbf6 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -637,12 +637,6 @@ + "version_id": 0, + "field_exists": false, + "size": 256 +- }, +- { +- "field": "irq_state", +- "version_id": 2, +- "field_exists": false, +- "size": 16 + } + ] + } +-- +1.9.3 + diff --git a/SOURCES/kvm-tests-vmstate-static-checker-version-mismatch-inside.patch b/SOURCES/kvm-tests-vmstate-static-checker-version-mismatch-inside.patch new file mode 100644 index 0000000..89c82a2 --- /dev/null +++ b/SOURCES/kvm-tests-vmstate-static-checker-version-mismatch-inside.patch @@ -0,0 +1,43 @@ +From 25c8d00cf4d0ad9e464c44ae8564f8f78f8da119 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:09:03 -0500 +Subject: [CHANGE 07/29] tests: vmstate static checker: version mismatch inside + a Description +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: <42e1d8959484f1d5c4e085ec4b9516aba940c105.1405072585.git.amit.shah@redhat.com> +Patchwork-id: 59787 +O-Subject: [RHEL7.1 qemu-kvm PATCH 06/18] tests: vmstate static checker: version mismatch inside a Description +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +Signed-off-by: Amit Shah +Acked-by: Juan Quintela +Signed-off-by: Juan Quintela +(cherry picked from commit 4efa6e1d6473dbd775a5dd7eb976fa11501a94d2) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + tests/vmstate-static-checker-data/dump2.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/vmstate-static-checker-data/dump2.json b/tests/vmstate-static-checker-data/dump2.json +index f405534..36a9b4b 100644 +--- a/tests/vmstate-static-checker-data/dump2.json ++++ b/tests/vmstate-static-checker-data/dump2.json +@@ -829,7 +829,7 @@ + "minimum_version_id": 2, + "Description": { + "name": "fdc", +- "version_id": 2, ++ "version_id": 1, + "minimum_version_id": 2, + "Fields": [ + { +-- +1.9.3 + diff --git a/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch b/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch new file mode 100644 index 0000000..f883a18 --- /dev/null +++ b/SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch @@ -0,0 +1,107 @@ +From a8ebb2f69df031099116afebca2fb2a2cb3ec678 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:58 +0200 +Subject: [PATCH 40/43] trace: add SystemTap init scripts for simpletrace + bridge + +Message-id: <1412690820-31016-10-git-send-email-stefanha@redhat.com> +Patchwork-id: 61614 +O-Subject: [RHEL7.1 qemu-kvm PATCH 09/11] trace: add SystemTap init scripts for simpletrace bridge +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +Add example files for use with the systemtap-initscript package. These +example files set up the SystemTap flight recorder with our simpletrace +bridge script. In other words, they set up always-on simpletrace. + +The example file enables a small subset of trace events across all +qemu-kvm processes with 4MB per CPU trace buffers. This example +configuration may be useful to customers who wish to run with always-on +tracing. + +To enable it: + + # yum install systemtap-initscript + # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ + # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ + # service systemtap start qemu_kvm + +Note that due to systemtap-initscript naming restrictions the scripts +are called "qemu_kvm" instead of "qemu-kvm". + +Once installed the script will be activated on boot. + +Note that since gitignore(1) hides *.d we explicitly unhide +scripts/systemtap/{conf.d,script.d} in this patch. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 3a83a60ee0fd25580499695e4781fc473de147c5) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + Makefile + redhat/qemu-kvm.spec.template + +This downstream commit from RHEL 6.6 was forwarded-ported to RHEL 7.1 +where the Makefile and qemu-kvm.spec.template are organized differently. +--- + .gitignore | 2 ++ + Makefile | 4 ++++ + redhat/qemu-kvm.spec.template | 4 +++- + scripts/systemtap/conf.d/qemu_kvm.conf | 4 ++++ + scripts/systemtap/script.d/qemu_kvm.stp | 1 + + 5 files changed, 14 insertions(+), 1 deletion(-) + create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf + create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp + +diff --git a/.gitignore b/.gitignore +index 4f2345c..454561e 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -74,6 +74,8 @@ fsdev/virtfs-proxy-helper.pod + *.vr + *.d + !scripts/qemu-guest-agent/fsfreeze-hook.d ++!scripts/systemtap/script.d ++!scripts/systemtap/conf.d + *.o + *.lo + *.la +diff --git a/Makefile b/Makefile +index 1b0b4f7..8407945 100644 +--- a/Makefile ++++ b/Makefile +@@ -407,6 +407,10 @@ endif + $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ + done + $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" ++ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/script.d" ++ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(qemu_datadir)/systemtap/script.d/" ++ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d" ++ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d/" + for d in $(TARGET_DIRS); do \ + $(MAKE) -C $$d $@ || exit 1 ; \ + done +diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf +new file mode 100644 +index 0000000..372d816 +--- /dev/null ++++ b/scripts/systemtap/conf.d/qemu_kvm.conf +@@ -0,0 +1,4 @@ ++# Force load uprobes (see BZ#1118352) ++stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true ++ ++qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes +diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp +new file mode 100644 +index 0000000..c04abf9 +--- /dev/null ++++ b/scripts/systemtap/script.d/qemu_kvm.stp +@@ -0,0 +1 @@ ++probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {} +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-add-pid-field-to-simpletrace-record.patch b/SOURCES/kvm-trace-add-pid-field-to-simpletrace-record.patch new file mode 100644 index 0000000..5003f3f --- /dev/null +++ b/SOURCES/kvm-trace-add-pid-field-to-simpletrace-record.patch @@ -0,0 +1,89 @@ +From af89b472e5fb4743a41cd7304ac831e777eadaa4 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:51 +0200 +Subject: [PATCH 33/43] trace: add pid field to simpletrace record + +Message-id: <1412690820-31016-3-git-send-email-stefanha@redhat.com> +Patchwork-id: 61607 +O-Subject: [RHEL7.1 qemu-kvm PATCH 02/11] trace: add pid field to simpletrace record +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +It is useful to know the QEMU process ID when working with traces from +multiple VMs. Although the trace filename may contain the pid, tools +that aggregate traces or even trace globally need somewhere to record +the pid. + +There is a reserved field in the trace event header struct that we can +use. + +It is not necessary to bump the simpletrace file format version number +because it has already been incremented for the QEMU 2.1 release cycle +in commit "trace: [simple] Bump up log version number". + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 26896cbf353e3017f76da8193074839b6e875250) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + trace/simple.c + +Downstream still has a g_thread_init() call in trace/simple.c so there +is a context conflict. Easy to resolve. +--- + trace/simple.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/trace/simple.c b/trace/simple.c +index 64e196a..479b7d2 100644 +--- a/trace/simple.c ++++ b/trace/simple.c +@@ -64,6 +64,7 @@ uint8_t trace_buf[TRACE_BUF_LEN]; + static volatile gint trace_idx; + static unsigned int writeout_idx; + static volatile gint dropped_events; ++static uint32_t trace_pid; + static FILE *trace_fp; + static char *trace_file_name; + +@@ -72,7 +73,7 @@ typedef struct { + uint64_t event; /* TraceEventID */ + uint64_t timestamp_ns; + uint32_t length; /* in bytes */ +- uint32_t reserved; /* unused */ ++ uint32_t pid; + uint64_t arguments[]; + } TraceRecord; + +@@ -180,7 +181,7 @@ static gpointer writeout_thread(gpointer opaque) + dropped.rec.event = DROPPED_EVENT_ID, + dropped.rec.timestamp_ns = get_clock(); + dropped.rec.length = sizeof(TraceRecord) + sizeof(uint64_t), +- dropped.rec.reserved = 0; ++ dropped.rec.pid = trace_pid; + do { + dropped_count = g_atomic_int_get(&dropped_events); + } while (!g_atomic_int_compare_and_exchange(&dropped_events, +@@ -239,6 +240,7 @@ int trace_record_start(TraceBufferRecord *rec, TraceEventID event, size_t datasi + rec_off = write_to_buffer(rec_off, &event_u64, sizeof(event_u64)); + rec_off = write_to_buffer(rec_off, ×tamp_ns, sizeof(timestamp_ns)); + rec_off = write_to_buffer(rec_off, &rec_len, sizeof(rec_len)); ++ rec_off = write_to_buffer(rec_off, &trace_pid, sizeof(trace_pid)); + + rec->tbuf_idx = idx; + rec->rec_off = (idx + sizeof(TraceRecord)) % TRACE_BUF_LEN; +@@ -413,6 +415,8 @@ bool trace_backend_init(const char *events, const char *file) + #endif + } + ++ trace_pid = getpid(); ++ + #if !GLIB_CHECK_VERSION(2, 31, 0) + trace_available_cond = g_cond_new(); + trace_empty_cond = g_cond_new(); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch b/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch new file mode 100644 index 0000000..76d1b07 --- /dev/null +++ b/SOURCES/kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch @@ -0,0 +1,85 @@ +From 47c61bc22285224ee24a7cbfa822c481f1155a81 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:07:00 +0200 +Subject: [PATCH 42/43] trace: add systemtap-initscript README file to RPM + +Message-id: <1412690820-31016-12-git-send-email-stefanha@redhat.com> +Patchwork-id: 61616 +O-Subject: [RHEL7.1 qemu-kvm PATCH 11/11] trace: add systemtap-initscript README file to RPM +Bugzilla: 1088112 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini + +The downstream systemtap-initscript integration is undocumented. Fix +that with a brief guide containing usage instructions. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit d73b49dbbce7535531da5aa1dc640208f18979d2) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + redhat/qemu-kvm.spec.template + +This patch is forward-ported from RHEL 6 qemu-kvm. RHEL 7's +qemu-kvm.spec.template is significantly different from RHEL 6 so +adjustments are necessary to include README.systemtap in the RPM. +--- + README.systemtap | 43 +++++++++++++++++++++++++++++++++++++++++++ + redhat/qemu-kvm.spec.template | 3 ++- + 2 files changed, 45 insertions(+), 1 deletion(-) + create mode 100644 README.systemtap + +diff --git a/README.systemtap b/README.systemtap +new file mode 100644 +index 0000000..ad913fc +--- /dev/null ++++ b/README.systemtap +@@ -0,0 +1,43 @@ ++QEMU tracing using systemtap-initscript ++--------------------------------------- ++ ++You can capture QEMU trace data all the time using systemtap-initscript. This ++uses SystemTap's flight recorder mode to trace all running guests to a ++fixed-size buffer on the host. Old trace entries are overwritten by new ++entries when the buffer size wraps. ++ ++1. Install the systemtap-initscript package: ++ # yum install systemtap-initscript ++ ++2. Install the systemtap scripts and the conf file: ++ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ ++ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ ++ ++The set of trace events to enable is given in qemu_kvm.stp. This SystemTap ++script can be customized to add or remove trace events provided in ++/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp. ++ ++SystemTap customizations can be made to qemu_kvm.conf to control the flight ++recorder buffer size and whether to store traces in memory only or disk too. ++See stap(1) for option documentation. ++ ++3. Start the systemtap service. ++ # service systemtap start qemu_kvm ++ ++4. Make the service start at boot time. ++ # chkconfig systemtap on ++ ++5. Confirm that the service works. ++ # service systemtap status qemu_kvm ++ qemu_kvm is running... ++ ++When you want to inspect the trace buffer, perform the following steps: ++ ++1. Dump the trace buffer. ++ # staprun -A qemu_kvm >/tmp/trace.log ++ ++2. Start the systemtap service because the preceding step stops the service. ++ # service systemtap start qemu_kvm ++ ++3. Translate the trace record to readable format. ++ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-add-tracetool-simpletrace_stap-format.patch b/SOURCES/kvm-trace-add-tracetool-simpletrace_stap-format.patch new file mode 100644 index 0000000..5a9823b --- /dev/null +++ b/SOURCES/kvm-trace-add-tracetool-simpletrace_stap-format.patch @@ -0,0 +1,140 @@ +From a38cb7ff39accd9ea600e2409866eb12fb3b8871 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:55 +0200 +Subject: [PATCH 37/43] trace: add tracetool simpletrace_stap format + +Message-id: <1412690820-31016-7-git-send-email-stefanha@redhat.com> +Patchwork-id: 61611 +O-Subject: [RHEL7.1 qemu-kvm PATCH 06/11] trace: add tracetool simpletrace_stap format +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +This new tracetool "format" generates a SystemTap .stp file that outputs +simpletrace binary trace data. + +In contrast to simpletrace or ftrace, SystemTap does not define its own +trace format. All output from SystemTap is generated by .stp files. +This patch lets us generate a .stp file that outputs in the simpletrace +binary format. + +This makes it possible to reuse simpletrace.py to analyze traces +recorded using SystemTap. The simpletrace binary format is especially +useful for long-running traces like flight-recorder mode where string +formatting can be expensive. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 3f8b112d6b9ab65e165096582c78154dda1adc69) +Signed-off-by: Stefan Hajnoczi + +Downstream tracetool does not have the code reorganization from the +multi-backend tracing changes. Therefore the stap generation has to +happen in scripts/tracetool/backend/dtrace.py while the +scripts/tracetool/format/simpletrace_stap.py file just emits the file +header. + +Remember to import tracetool.backend.simple is_string() in dtrace.py. + +Also note that scripts/tracetool/__init__.py filters out disabled events +so we don't need to skip them explicitly. + +Signed-off-by: Miroslav Rezanina +--- + scripts/tracetool/backend/dtrace.py | 47 ++++++++++++++++++++++++++++ + scripts/tracetool/format/simpletrace_stap.py | 21 +++++++++++++ + 2 files changed, 68 insertions(+) + create mode 100644 scripts/tracetool/format/simpletrace_stap.py + +diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py +index 614316f..2d8cd2d 100644 +--- a/scripts/tracetool/backend/dtrace.py ++++ b/scripts/tracetool/backend/dtrace.py +@@ -14,6 +14,7 @@ __email__ = "stefanha@linux.vnet.ibm.com" + + + from tracetool import out ++from tracetool.backend.simple import is_string + + + PUBLIC = True +@@ -112,3 +113,49 @@ def stap(events): + out('}') + + out() ++ ++ ++def simpletrace_stap(events): ++ for event_id, e in enumerate(events): ++ out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?', ++ '{', ++ probeprefix=_probeprefix(), ++ name=e.name) ++ ++ # Calculate record size ++ sizes = ['24'] # sizeof(TraceRecord) ++ for type_, name in e.args: ++ name = stap_escape(name) ++ if is_string(type_): ++ out(' try {', ++ ' arg%(name)s_str = %(name)s ? user_string_n(%(name)s, 512) : ""', ++ ' } catch {}', ++ ' arg%(name)s_len = strlen(arg%(name)s_str)', ++ name=name) ++ sizes.append('4 + arg%s_len' % name) ++ else: ++ sizes.append('8') ++ sizestr = ' + '.join(sizes) ++ ++ # Generate format string and value pairs for record header and arguments ++ fields = [('8b', str(event_id)), ++ ('8b', 'gettimeofday_ns()'), ++ ('4b', sizestr), ++ ('4b', 'pid()')] ++ for type_, name in e.args: ++ name = stap_escape(name) ++ if is_string(type_): ++ fields.extend([('4b', 'arg%s_len' % name), ++ ('.*s', 'arg%s_len, arg%s_str' % (name, name))]) ++ else: ++ fields.append(('8b', name)) ++ ++ # Emit the entire record in a single SystemTap printf() ++ fmt_str = '%'.join(fmt for fmt, _ in fields) ++ arg_str = ', '.join(arg for _, arg in fields) ++ out(' printf("%%%(fmt_str)s", %(arg_str)s)', ++ fmt_str=fmt_str, arg_str=arg_str) ++ ++ out('}') ++ ++ out() +diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py +new file mode 100644 +index 0000000..b8daa03 +--- /dev/null ++++ b/scripts/tracetool/format/simpletrace_stap.py +@@ -0,0 +1,21 @@ ++#!/usr/bin/env python ++# -*- coding: utf-8 -*- ++ ++""" ++Generate .stp file that outputs simpletrace binary traces (DTrace with SystemTAP only). ++""" ++ ++__author__ = "Stefan Hajnoczi " ++__copyright__ = "Copyright (C) 2014, Red Hat, Inc." ++__license__ = "GPL version 2 or (at your option) any later version" ++ ++__maintainer__ = "Stefan Hajnoczi" ++__email__ = "stefanha@redhat.com" ++ ++ ++from tracetool import out ++ ++ ++def begin(events): ++ out('/* This file is autogenerated by tracetool, do not edit. */', ++ '') +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-extract-stap_escape-function-for-reuse.patch b/SOURCES/kvm-trace-extract-stap_escape-function-for-reuse.patch new file mode 100644 index 0000000..c4825c0 --- /dev/null +++ b/SOURCES/kvm-trace-extract-stap_escape-function-for-reuse.patch @@ -0,0 +1,66 @@ +From 7c6cf82e285a657b38a2b2c85e26d975b7e91ae0 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:54 +0200 +Subject: [PATCH 36/43] trace: extract stap_escape() function for reuse + +Message-id: <1412690820-31016-6-git-send-email-stefanha@redhat.com> +Patchwork-id: 61610 +O-Subject: [RHEL7.1 qemu-kvm PATCH 05/11] trace: extract stap_escape() function for reuse +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +SystemTap reserved words sometimes conflict with QEMU variable names. +We escape them to prevent conflicts. + +Move escaping into its own function so the next patch can reuse it. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit a76ccf3c1cb06576af091c5ac8bc264515b1bb7f) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + scripts/tracetool/format/stap.py + +The tracetool downstream code is missing the TCG instrumentation and +multi-backend tracing, which involved a reorganization of the code. +The upstream patch modified scripts/tracetool/format/stap.py but +downstream the right file is scripts/tracetool/backend/dtrace.py. +--- + scripts/tracetool/backend/dtrace.py | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py +index e31bc79..614316f 100644 +--- a/scripts/tracetool/backend/dtrace.py ++++ b/scripts/tracetool/backend/dtrace.py +@@ -35,6 +35,13 @@ def _binary(): + return BINARY + + ++def stap_escape(identifier): ++ # Append underscore to reserved keywords ++ if identifier in RESERVED_WORDS: ++ return identifier + '_' ++ return identifier ++ ++ + def c(events): + pass + +@@ -98,9 +105,7 @@ def stap(events): + i = 1 + if len(e.args) > 0: + for name in e.args.names(): +- # Append underscore to reserved keywords +- if name in RESERVED_WORDS: +- name += '_' ++ name = stap_escape(name) + out(' %s = $arg%d;' % (name, i)) + i += 1 + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-install-simpletrace-SystemTap-tapset.patch b/SOURCES/kvm-trace-install-simpletrace-SystemTap-tapset.patch new file mode 100644 index 0000000..86dbec9 --- /dev/null +++ b/SOURCES/kvm-trace-install-simpletrace-SystemTap-tapset.patch @@ -0,0 +1,97 @@ +From 13f5df42cd4ccb6d199305b1c82bdd6d39403ae8 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:56 +0200 +Subject: [PATCH 38/43] trace: install simpletrace SystemTap tapset + +Message-id: <1412690820-31016-8-git-send-email-stefanha@redhat.com> +Patchwork-id: 61612 +O-Subject: [RHEL7.1 qemu-kvm PATCH 07/11] trace: install simpletrace SystemTap tapset +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +The simpletrace SystemTap tapset outputs simpletrace binary traces for +SystemTap probes. This is useful because SystemTap has no default way +to format or store traces. The simpletrace SystemTap tapset provides an +easy way to store traces. + +The simpletrace.py tool or custom Python scripts using the +simpletrace.py API can analyze SystemTap these traces: + + $ ./configure --enable-trace-backends=dtrace ... + $ make && make install + $ stap -e 'probe qemu.system.x86_64.simpletrace.* {}' \ + -c qemu-system-x86_64 >/tmp/trace.out + $ scripts/simpletrace.py --no-header trace-events /tmp/trace.out + g_malloc 4.531 pid=15519 size=0xb ptr=0x7f8639c10470 + g_malloc 3.264 pid=15519 size=0x300 ptr=0x7f8639c10490 + g_free 5.155 pid=15519 ptr=0x7f8639c0f7b0 + +Note that, unlike qemu-system-x86_64.stp and +qemu-system-x86_64.stp-installed, only one file is needed since the +simpletrace SystemTap tapset does not reference the QEMU binary by path. +Therefore it doesn't matter whether the QEMU binary is installed or not. + +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit e0b2fd0efb4d282bc6fa0ed5397f472298a66ca2) +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina + +Conflicts: + Makefile.target + +Downstream does not have .stp-installed, which was added upstream to +differentiate between .stp files that can be used in the build tree and +.stp files that can be used after make install. Context conflict. + +Also note that downstream uses --backend=$(TRACE_BACKEND) instead of +--backends=$(TRACE_BACKENDS). + +Downstream needs to install the qemu-kvm-simpletrace.stp file right away +to avoid rpm check "unpackaged file" errors, so modify +qemu-kvm.spec.template. +--- + Makefile.target | 11 ++++++++++- + redhat/qemu-kvm.spec.template | 10 +++++++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/Makefile.target b/Makefile.target +index b871dda..ca407d7 100644 +--- a/Makefile.target ++++ b/Makefile.target +@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp + config-target.h-timestamp: config-target.mak + + ifdef CONFIG_TRACE_SYSTEMTAP +-stap: $(QEMU_PROG).stp ++stap: $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp + + ifdef CONFIG_USER_ONLY + TARGET_TYPE=user +@@ -51,6 +51,14 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events + --target-arch=$(TARGET_ARCH) \ + --target-type=$(TARGET_TYPE) \ + < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") ++ ++$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events ++ $(call quiet-command,$(TRACETOOL) \ ++ --format=simpletrace-stap \ ++ --backend=$(TRACE_BACKEND) \ ++ --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_ARCH) \ ++ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp") ++ + else + stap: + endif +@@ -194,6 +202,7 @@ endif + ifdef CONFIG_TRACE_SYSTEMTAP + $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" + $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" ++ $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp" + endif + + GENERATED_HEADERS += config-target.h +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-install-trace-events-file.patch b/SOURCES/kvm-trace-install-trace-events-file.patch new file mode 100644 index 0000000..8fe8683 --- /dev/null +++ b/SOURCES/kvm-trace-install-trace-events-file.patch @@ -0,0 +1,52 @@ +From a648336c0e837c016bba5f19ec683d09f91471e5 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:57 +0200 +Subject: [PATCH 39/43] trace: install trace-events file + +Message-id: <1412690820-31016-9-git-send-email-stefanha@redhat.com> +Patchwork-id: 61613 +O-Subject: [RHEL7.1 qemu-kvm PATCH 08/11] trace: install trace-events file +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +Install the ./trace-events file into the data directory. This file +contains the list of trace events that were built into QEMU at +compile-time. + +The file is a handy reference for the set of trace events that the QEMU +binary was built with. It is also needed by the simpletrace.py tool +that parses binary trace data either emitted from QEMU when built with +--enable-trace-backend=simple or by the SystemTap simpletrace script +that QEMU provides. + +Signed-off-by: Stefan Hajnoczi +Message-id: 1411486175-3017-1-git-send-email-stefanha@redhat.com +(cherry picked from commit 89ae5831a53e2d30a370e9a30fdb35da5a8f89aa) +Signed-off-by: Stefan Hajnoczi + +Downstream needs to install trace-events in qemu-kvm.spec.template to +prevent rpm check "unpackaged file" errors. + +Signed-off-by: Miroslav Rezanina +--- + Makefile | 1 + + redhat/qemu-kvm.spec.template | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index f504754..1b0b4f7 100644 +--- a/Makefile ++++ b/Makefile +@@ -406,6 +406,7 @@ endif + set -e; for x in $(KEYMAPS); do \ + $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ + done ++ $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" + for d in $(TARGET_DIRS); do \ + $(MAKE) -C $$d $@ || exit 1 ; \ + done +-- +1.8.3.1 + diff --git a/SOURCES/kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch b/SOURCES/kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch new file mode 100644 index 0000000..1c483c4 --- /dev/null +++ b/SOURCES/kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch @@ -0,0 +1,78 @@ +From 002f410771e49dbfe738a2c31a231b5e0ca97b38 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 7 Oct 2014 14:06:50 +0200 +Subject: [PATCH 32/43] trace: use unique Red Hat version number in simpletrace + +Message-id: <1412690820-31016-2-git-send-email-stefanha@redhat.com> +Patchwork-id: 61606 +O-Subject: [RHEL7.1 qemu-kvm PATCH 01/11] trace: use unique Red Hat version number in simpletrace +Bugzilla: 1088112 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Paolo Bonzini + +The simpletrace format has changed upstream several times. RHEL7 +qemu-kvm is currently at version 2 level, but now we need to add the pid +field. This means we need to bump the version number. + +Upstream version 3 changed the way that trace event IDs are calculated. +Those tracetool changes are not downstream. + +Avoid colliding with upstream version numbers - just in case binary +trace files from upstream and RHEL are exchanged. Use a unique part of +the 64-bit version number namespace (based on Red Hat's PCI vendor ID). + +Signed-off-by: Stefan Hajnoczi +Signed-off-by: Miroslav Rezanina +--- + scripts/simpletrace.py | 11 ++++++----- + trace/simple.c | 2 +- + 2 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py +index 8bbcb42..3cb2cf0 100755 +--- a/scripts/simpletrace.py ++++ b/scripts/simpletrace.py +@@ -18,6 +18,7 @@ from tracetool.backend.simple import is_string + header_event_id = 0xffffffffffffffff + header_magic = 0xf2b177cb0aa429b4 + dropped_event_id = 0xfffffffffffffffe ++red_hat_version = 0x00001af400000000 + + log_header_fmt = '=QQQ' + rec_header_fmt = '=QQII' +@@ -65,13 +66,13 @@ def read_trace_file(edict, fobj): + header[0] != header_event_id or \ + header[1] != header_magic: + raise ValueError('Not a valid trace file!') +- if header[2] != 0 and \ +- header[2] != 2: +- raise ValueError('Unknown version of tracelog format!') + + log_version = header[2] +- if log_version == 0: +- raise ValueError('Older log format, not supported with this QEMU release!') ++ if log_version not in [0, 2, 3, red_hat_version]: ++ raise ValueError('Unknown version of tracelog format!') ++ if log_version != red_hat_version: ++ raise ValueError('Log format %d not supported with this QEMU release!' ++ % log_version) + + while True: + rec = read_record(edict, fobj) +diff --git a/trace/simple.c b/trace/simple.c +index 1e3f691..64e196a 100644 +--- a/trace/simple.c ++++ b/trace/simple.c +@@ -27,7 +27,7 @@ + #define HEADER_MAGIC 0xf2b177cb0aa429b4ULL + + /** Trace file version number, bump if format changes */ +-#define HEADER_VERSION 2 ++#define HEADER_VERSION 0x00001af400000000ULL + + /** Records were dropped event ID */ + #define DROPPED_EVENT_ID (~(uint64_t)0 - 1) +-- +1.8.3.1 + diff --git a/SOURCES/kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch b/SOURCES/kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch index ccbd383..78d3bef 100644 --- a/SOURCES/kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch +++ b/SOURCES/kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch @@ -1,4 +1,4 @@ -From 48addb5b5b3b4712744e2ba9c3205b981f898118 Mon Sep 17 00:00:00 2001 +From 8061ffe654905d1e184b82cb4b4d75647618a0c1 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 24 Apr 2014 10:57:23 +0200 Subject: [PATCH 11/12] uhci: UNfix irq routing for RHEL-6 machtypes (RHEL only) diff --git a/SOURCES/kvm-uhci-egsm-fix.patch b/SOURCES/kvm-uhci-egsm-fix.patch new file mode 100644 index 0000000..6d07ffe --- /dev/null +++ b/SOURCES/kvm-uhci-egsm-fix.patch @@ -0,0 +1,56 @@ +From a558699e5f028623c2d5f9bb60d28b8f56b7766a Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:36 +0200 +Subject: [PATCH 03/43] uhci: egsm fix + +Message-id: <1405088470-24115-4-git-send-email-kraxel@redhat.com> +Patchwork-id: 59820 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 03/37] uhci: egsm fix +Bugzilla: 1046873 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +When the guest goes suspend the uhci controller while there are +pending resume requests on the ports go signal global resume +instantly. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 9f0f1a0c096f29a856f2e6903beda45b44ce9cdd) +--- + hw/usb/hcd-uhci.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-uhci.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c +index 3380107..989c37a 100644 +--- a/hw/usb/hcd-uhci.c ++++ b/hw/usb/hcd-uhci.c +@@ -191,6 +191,7 @@ bool ich9_uhci123_irqpin_override; + + static void uhci_async_cancel(UHCIAsync *async); + static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td); ++static void uhci_resume(void *opaque); + + static inline int32_t uhci_queue_token(UHCI_TD *td) + { +@@ -500,6 +501,12 @@ static void uhci_port_write(void *opaque, hwaddr addr, + return; + } + s->cmd = val; ++ if (val & UHCI_CMD_EGSM) { ++ if ((s->ports[0].ctrl & UHCI_PORT_RD) || ++ (s->ports[1].ctrl & UHCI_PORT_RD)) { ++ uhci_resume(s); ++ } ++ } + break; + case 0x02: + s->status &= ~val; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-uhci-invalidate-queue-on-device-address-changes.patch b/SOURCES/kvm-uhci-invalidate-queue-on-device-address-changes.patch new file mode 100644 index 0000000..82807a8 --- /dev/null +++ b/SOURCES/kvm-uhci-invalidate-queue-on-device-address-changes.patch @@ -0,0 +1,43 @@ +From c5deaa70b6b347189a53bd2b058164dffc439a59 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:56 +0200 +Subject: [PATCH 22/43] uhci: invalidate queue on device address changes + +Message-id: <1405088470-24115-24-git-send-email-kraxel@redhat.com> +Patchwork-id: 59851 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 23/37] uhci: invalidate queue on device address changes +Bugzilla: 1111450 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit c348e481759057c925cce4bf54336f1518b8c702) +--- + hw/usb/hcd-uhci.c | 2 ++ + 1 file changed, 2 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-uhci.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c +index 989c37a..f38f737 100644 +--- a/hw/usb/hcd-uhci.c ++++ b/hw/usb/hcd-uhci.c +@@ -254,9 +254,11 @@ static bool uhci_queue_verify(UHCIQueue *queue, uint32_t qh_addr, UHCI_TD *td, + uint32_t td_addr, bool queuing) + { + UHCIAsync *first = QTAILQ_FIRST(&queue->asyncs); ++ uint32_t queue_token_addr = (queue->token >> 8) & 0x7f; + + return queue->qh_addr == qh_addr && + queue->token == uhci_queue_token(td) && ++ queue_token_addr == queue->ep->dev->addr && + (queuing || !(td->ctrl & TD_CTRL_ACTIVE) || first == NULL || + first->td_addr == td_addr); + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-Add-max_streams-attribute-to-endpoint-info.patch b/SOURCES/kvm-usb-Add-max_streams-attribute-to-endpoint-info.patch new file mode 100644 index 0000000..9cc5211 --- /dev/null +++ b/SOURCES/kvm-usb-Add-max_streams-attribute-to-endpoint-info.patch @@ -0,0 +1,115 @@ +From 232db7b0f138480202ce2bba4e69de5b0972c455 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:53 +0200 +Subject: [PATCH 19/43] usb: Add max_streams attribute to endpoint info + +Message-id: <1405088470-24115-21-git-send-email-kraxel@redhat.com> +Patchwork-id: 59847 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 20/37] usb: Add max_streams attribute to endpoint info +Bugzilla: 1111450 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 04b300f85fafd2d6a92ec0a766f0035e9bc5835c) +--- + hw/usb/core.c | 22 ++++++++++++++++++++++ + hw/usb/desc.c | 2 ++ + include/hw/usb.h | 3 +++ + 3 files changed, 27 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/core.c | 22 ++++++++++++++++++++++ + hw/usb/desc.c | 2 ++ + include/hw/usb.h | 3 +++ + 3 files changed, 27 insertions(+) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index cf59a1a..67ba7d6 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -623,6 +623,7 @@ void usb_ep_reset(USBDevice *dev) + dev->ep_ctl.type = USB_ENDPOINT_XFER_CONTROL; + dev->ep_ctl.ifnum = 0; + dev->ep_ctl.max_packet_size = 64; ++ dev->ep_ctl.max_streams = 0; + dev->ep_ctl.dev = dev; + dev->ep_ctl.pipeline = false; + for (ep = 0; ep < USB_MAX_ENDPOINTS; ep++) { +@@ -636,6 +637,8 @@ void usb_ep_reset(USBDevice *dev) + dev->ep_out[ep].ifnum = USB_INTERFACE_INVALID; + dev->ep_in[ep].max_packet_size = 0; + dev->ep_out[ep].max_packet_size = 0; ++ dev->ep_in[ep].max_streams = 0; ++ dev->ep_out[ep].max_streams = 0; + dev->ep_in[ep].dev = dev; + dev->ep_out[ep].dev = dev; + dev->ep_in[ep].pipeline = false; +@@ -764,6 +767,25 @@ int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep) + return uep->max_packet_size; + } + ++void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) ++{ ++ struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); ++ int MaxStreams; ++ ++ MaxStreams = raw & 0x1f; ++ if (MaxStreams) { ++ uep->max_streams = 1 << MaxStreams; ++ } else { ++ uep->max_streams = 0; ++ } ++} ++ ++int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep) ++{ ++ struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); ++ return uep->max_streams; ++} ++ + void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled) + { + struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); +diff --git a/hw/usb/desc.c b/hw/usb/desc.c +index 5a954c6..f133ddb 100644 +--- a/hw/usb/desc.c ++++ b/hw/usb/desc.c +@@ -385,6 +385,8 @@ static void usb_desc_ep_init(USBDevice *dev) + usb_ep_set_ifnum(dev, pid, ep, iface->bInterfaceNumber); + usb_ep_set_max_packet_size(dev, pid, ep, + iface->eps[e].wMaxPacketSize); ++ usb_ep_set_max_streams(dev, pid, ep, ++ iface->eps[e].bmAttributes_super); + } + } + } +diff --git a/include/hw/usb.h b/include/hw/usb.h +index 5668701..116293e 100644 +--- a/include/hw/usb.h ++++ b/include/hw/usb.h +@@ -199,6 +199,7 @@ struct USBEndpoint { + uint8_t type; + uint8_t ifnum; + int max_packet_size; ++ int max_streams; + bool pipeline; + bool halted; + USBDevice *dev; +@@ -433,6 +434,8 @@ void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum); + void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep, + uint16_t raw); + int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep); ++void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw); ++int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep); + void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled); + void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted); + USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep, +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-Add-usb_device_alloc-free_streams.patch b/SOURCES/kvm-usb-Add-usb_device_alloc-free_streams.patch new file mode 100644 index 0000000..a94b684 --- /dev/null +++ b/SOURCES/kvm-usb-Add-usb_device_alloc-free_streams.patch @@ -0,0 +1,91 @@ +From eccc9faa264d2228126d4fccc5a603b70b02cc9c Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:54 +0200 +Subject: [PATCH 20/43] usb: Add usb_device_alloc/free_streams + +Message-id: <1405088470-24115-22-git-send-email-kraxel@redhat.com> +Patchwork-id: 59833 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 21/37] usb: Add usb_device_alloc/free_streams +Bugzilla: 1111450 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 3b444eadf7726d976be4ac89e8e742cb7eb7a5ee) +--- + hw/usb/bus.c | 18 ++++++++++++++++++ + include/hw/usb.h | 12 ++++++++++++ + 2 files changed, 30 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/bus.c | 18 ++++++++++++++++++ + include/hw/usb.h | 12 ++++++++++++ + 2 files changed, 30 insertions(+) + +diff --git a/hw/usb/bus.c b/hw/usb/bus.c +index f4eeb5e..12641fe 100644 +--- a/hw/usb/bus.c ++++ b/hw/usb/bus.c +@@ -206,6 +206,24 @@ void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep) + } + } + ++int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps, ++ int streams) ++{ ++ USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev); ++ if (klass->alloc_streams) { ++ return klass->alloc_streams(dev, eps, nr_eps, streams); ++ } ++ return 0; ++} ++ ++void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps) ++{ ++ USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev); ++ if (klass->free_streams) { ++ klass->free_streams(dev, eps, nr_eps); ++ } ++} ++ + static int usb_qdev_init(DeviceState *qdev) + { + USBDevice *dev = USB_DEVICE(qdev); +diff --git a/include/hw/usb.h b/include/hw/usb.h +index 116293e..000001b 100644 +--- a/include/hw/usb.h ++++ b/include/hw/usb.h +@@ -327,6 +327,14 @@ typedef struct USBDeviceClass { + */ + void (*ep_stopped)(USBDevice *dev, USBEndpoint *ep); + ++ /* ++ * Called by the hcd to alloc / free streams on a bulk endpoint. ++ * Optional may be NULL. ++ */ ++ int (*alloc_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps, ++ int streams); ++ void (*free_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps); ++ + const char *product_desc; + const USBDesc *usb_desc; + } USBDeviceClass; +@@ -564,6 +572,10 @@ void usb_device_flush_ep_queue(USBDevice *dev, USBEndpoint *ep); + + void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep); + ++int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps, ++ int streams); ++void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps); ++ + const char *usb_device_get_product_desc(USBDevice *dev); + + const USBDesc *usb_device_get_usb_desc(USBDevice *dev); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-Also-reset-max_packet_size-on-ep_reset.patch b/SOURCES/kvm-usb-Also-reset-max_packet_size-on-ep_reset.patch new file mode 100644 index 0000000..242061b --- /dev/null +++ b/SOURCES/kvm-usb-Also-reset-max_packet_size-on-ep_reset.patch @@ -0,0 +1,51 @@ +From ded29e4e267ff8f7cbaf815f27e2ced2e4a24775 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:46 +0200 +Subject: [PATCH 12/43] usb: Also reset max_packet_size on ep_reset + +Message-id: <1405088470-24115-14-git-send-email-kraxel@redhat.com> +Patchwork-id: 59824 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 13/37] usb: Also reset max_packet_size on ep_reset +Bugzilla: 1075846 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 9adbaad318cddd300c42dbbbc88991cdc9cecd99) +--- + hw/usb/core.c | 3 +++ + 1 file changed, 3 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index 31960c2..cf59a1a 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -622,6 +622,7 @@ void usb_ep_reset(USBDevice *dev) + dev->ep_ctl.nr = 0; + dev->ep_ctl.type = USB_ENDPOINT_XFER_CONTROL; + dev->ep_ctl.ifnum = 0; ++ dev->ep_ctl.max_packet_size = 64; + dev->ep_ctl.dev = dev; + dev->ep_ctl.pipeline = false; + for (ep = 0; ep < USB_MAX_ENDPOINTS; ep++) { +@@ -633,6 +634,8 @@ void usb_ep_reset(USBDevice *dev) + dev->ep_out[ep].type = USB_ENDPOINT_XFER_INVALID; + dev->ep_in[ep].ifnum = USB_INTERFACE_INVALID; + dev->ep_out[ep].ifnum = USB_INTERFACE_INVALID; ++ dev->ep_in[ep].max_packet_size = 0; ++ dev->ep_out[ep].max_packet_size = 0; + dev->ep_in[ep].dev = dev; + dev->ep_out[ep].dev = dev; + dev->ep_in[ep].pipeline = false; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-Fix-iovec-memleak-on-combined-packet-free.patch b/SOURCES/kvm-usb-Fix-iovec-memleak-on-combined-packet-free.patch new file mode 100644 index 0000000..6d8ec92 --- /dev/null +++ b/SOURCES/kvm-usb-Fix-iovec-memleak-on-combined-packet-free.patch @@ -0,0 +1,42 @@ +From 722ac823089706c3c4ea71386eafb4d7062fa7c9 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:47 +0200 +Subject: [PATCH 13/43] usb: Fix iovec memleak on combined-packet free + +Message-id: <1405088470-24115-15-git-send-email-kraxel@redhat.com> +Patchwork-id: 59845 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 14/37] usb: Fix iovec memleak on combined-packet free +Bugzilla: 1075846 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 0ca6db4f3b3df5c4e5285a48a7709bdced5068de) +--- + hw/usb/combined-packet.c | 1 + + 1 file changed, 1 insertion(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/combined-packet.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c +index 13f6602..ad77705 100644 +--- a/hw/usb/combined-packet.c ++++ b/hw/usb/combined-packet.c +@@ -39,6 +39,7 @@ static void usb_combined_packet_remove(USBCombinedPacket *combined, + p->combined = NULL; + QTAILQ_REMOVE(&combined->packets, p, combined_entry); + if (QTAILQ_EMPTY(&combined->packets)) { ++ qemu_iovec_destroy(&combined->iov); + g_free(combined); + } + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-add-usb_pick_speed.patch b/SOURCES/kvm-usb-add-usb_pick_speed.patch new file mode 100644 index 0000000..36813f3 --- /dev/null +++ b/SOURCES/kvm-usb-add-usb_pick_speed.patch @@ -0,0 +1,115 @@ +From 2eb03118784d98cc6cd1d1cadd2badc0cfd19469 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:21:08 +0200 +Subject: [PATCH 28/43] usb: add usb_pick_speed + +Message-id: <1405088470-24115-36-git-send-email-kraxel@redhat.com> +Patchwork-id: 59839 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 35/37] usb: add usb_pick_speed +Bugzilla: 1075846 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +We can pick the usb port speed in generic code, by looking at the port +and device speed masks and looking for the fastest match. So add a +function to do exactly that, and drop the speed setting code from +usb_desc_attach as it isn't needed any more. + +This way we can set the device speed before calling port->ops->attach, +which fixes some xhci hotplug issues. + +https://bugzilla.redhat.com/show_bug.cgi?id=1046873 + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit b791c3b38c7969cb9f4acda8229e19fd865a1c08) +--- + hw/usb/core.c | 21 +++++++++++++++++++++ + hw/usb/desc.c | 12 ------------ + include/hw/usb.h | 1 + + 3 files changed, 22 insertions(+), 12 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/core.c | 21 +++++++++++++++++++++ + hw/usb/desc.c | 12 ------------ + include/hw/usb.h | 1 + + 3 files changed, 22 insertions(+), 12 deletions(-) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index 67ba7d6..cf34755 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -28,6 +28,26 @@ + #include "qemu/iov.h" + #include "trace.h" + ++void usb_pick_speed(USBPort *port) ++{ ++ static const int speeds[] = { ++ USB_SPEED_SUPER, ++ USB_SPEED_HIGH, ++ USB_SPEED_FULL, ++ USB_SPEED_LOW, ++ }; ++ USBDevice *udev = port->dev; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(speeds); i++) { ++ if ((udev->speedmask & (1 << speeds[i])) && ++ (port->speedmask & (1 << speeds[i]))) { ++ udev->speed = speeds[i]; ++ return; ++ } ++ } ++} ++ + void usb_attach(USBPort *port) + { + USBDevice *dev = port->dev; +@@ -35,6 +55,7 @@ void usb_attach(USBPort *port) + assert(dev != NULL); + assert(dev->attached); + assert(dev->state == USB_STATE_NOTATTACHED); ++ usb_pick_speed(port); + port->ops->attach(port); + dev->state = USB_STATE_ATTACHED; + usb_device_handle_attach(dev); +diff --git a/hw/usb/desc.c b/hw/usb/desc.c +index f133ddb..138881f 100644 +--- a/hw/usb/desc.c ++++ b/hw/usb/desc.c +@@ -518,18 +518,6 @@ void usb_desc_init(USBDevice *dev) + + void usb_desc_attach(USBDevice *dev) + { +- const USBDesc *desc = usb_device_get_usb_desc(dev); +- +- assert(desc != NULL); +- if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) { +- dev->speed = USB_SPEED_SUPER; +- } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) { +- dev->speed = USB_SPEED_HIGH; +- } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) { +- dev->speed = USB_SPEED_FULL; +- } else { +- return; +- } + usb_desc_setdefaults(dev); + } + +diff --git a/include/hw/usb.h b/include/hw/usb.h +index 000001b..ebbff47 100644 +--- a/include/hw/usb.h ++++ b/include/hw/usb.h +@@ -453,6 +453,7 @@ void usb_ep_combine_input_packets(USBEndpoint *ep); + void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p); + void usb_combined_packet_cancel(USBDevice *dev, USBPacket *p); + ++void usb_pick_speed(USBPort *port); + void usb_attach(USBPort *port); + void usb_detach(USBPort *port); + void usb_port_reset(USBPort *port); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-fix-up-post-load-checks.patch b/SOURCES/kvm-usb-fix-up-post-load-checks.patch index ca14310..a63db0d 100644 --- a/SOURCES/kvm-usb-fix-up-post-load-checks.patch +++ b/SOURCES/kvm-usb-fix-up-post-load-checks.patch @@ -1,13 +1,13 @@ -From f01e8ceed912ea31bf22046197fd18b82e554e48 Mon Sep 17 00:00:00 2001 +From b7dd3cebccd2a785e78aca482f336d0e1500cfc5 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Thu, 15 May 2014 09:52:52 +0200 -Subject: [PATCH 16/30] usb: fix up post load checks +Date: Thu, 15 May 2014 09:52:56 +0200 +Subject: [PATCH 25/31] usb: fix up post load checks RH-Author: Michael S. Tsirkin -Message-id: <1400144747-16304-1-git-send-email-mst@redhat.com> -Patchwork-id: 58906 -O-Subject: [PATCH qemu-kvm RHEL7.0.z] usb: fix up post load checks -Bugzilla: 1096828 +Message-id: <1400144784-16355-1-git-send-email-mst@redhat.com> +Patchwork-id: 58907 +O-Subject: [PATCH qemu-kvm RHEL7.1] usb: fix up post load checks +Bugzilla: 1096829 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Laszlo Ersek RH-Acked-by: Marcel Apfelbaum @@ -32,8 +32,8 @@ Note: in maintainer's tree CVE-2014-3461 -Bugzilla: 1096828 -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7459773 +Bugzilla: 1096829 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7459730 Tested: lightly on developer's box --- hw/usb/bus.c | 4 ++-- diff --git a/SOURCES/kvm-usb-hcd-xhci-QOM-Upcast-Sweep.patch b/SOURCES/kvm-usb-hcd-xhci-QOM-Upcast-Sweep.patch new file mode 100644 index 0000000..ed36aa2 --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-QOM-Upcast-Sweep.patch @@ -0,0 +1,126 @@ +From ccf8ee841c1d72d74bc4b6b54247089eb847087b Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:34 +0200 +Subject: [PATCH 01/43] usb/hcd-xhci: QOM Upcast Sweep +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1405088470-24115-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 59835 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 01/37] usb/hcd-xhci: QOM Upcast Sweep +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Peter Crosthwaite + +Define and use standard QOM cast macro. Remove usages of DO_UPCAST() +and direct -> style upcasting. + +Signed-off-by: Peter Crosthwaite +[AF: Dropped usb_xhci_init() DeviceState argument and renamed variable] +Signed-off-by: Andreas Färber + +(cherry picked from commit 37034575d23a06447e4f44ab365afec6b198c53f) +--- + hw/usb/hcd-xhci.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 2c9e36a..8fa1c6e 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -485,6 +485,11 @@ struct XHCIState { + XHCIRing cmd_ring; + }; + ++#define TYPE_XHCI "nec-usb-xhci" ++ ++#define XHCI(obj) \ ++ OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI) ++ + typedef struct XHCIEvRingSeg { + uint32_t addr_low; + uint32_t addr_high; +@@ -2719,7 +2724,7 @@ static void xhci_port_reset(XHCIPort *port, bool warm_reset) + + static void xhci_reset(DeviceState *dev) + { +- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev.qdev, dev); ++ XHCIState *xhci = XHCI(dev); + int i; + + trace_usb_xhci_reset(); +@@ -2968,6 +2973,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg, + uint64_t val, unsigned size) + { + XHCIState *xhci = ptr; ++ DeviceState *d = DEVICE(ptr); + + trace_usb_xhci_oper_write(reg, val); + +@@ -2989,7 +2995,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg, + xhci->usbcmd = val & 0xc0f; + xhci_mfwrap_update(xhci); + if (val & USBCMD_HCRST) { +- xhci_reset(&xhci->pci_dev.qdev); ++ xhci_reset(d); + } + xhci_intx_update(xhci); + break; +@@ -3315,8 +3321,9 @@ static USBBusOps xhci_bus_ops = { + .wakeup_endpoint = xhci_wakeup_endpoint, + }; + +-static void usb_xhci_init(XHCIState *xhci, DeviceState *dev) ++static void usb_xhci_init(XHCIState *xhci) + { ++ DeviceState *dev = DEVICE(xhci); + XHCIPort *port; + int i, usbports, speedmask; + +@@ -3331,7 +3338,7 @@ static void usb_xhci_init(XHCIState *xhci, DeviceState *dev) + usbports = MAX(xhci->numports_2, xhci->numports_3); + xhci->numports = xhci->numports_2 + xhci->numports_3; + +- usb_bus_new(&xhci->bus, &xhci_bus_ops, &xhci->pci_dev.qdev); ++ usb_bus_new(&xhci->bus, &xhci_bus_ops, dev); + + for (i = 0; i < usbports; i++) { + speedmask = 0; +@@ -3363,14 +3370,14 @@ static int usb_xhci_initfn(struct PCIDevice *dev) + { + int i, ret; + +- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev, dev); ++ XHCIState *xhci = XHCI(dev); + + xhci->pci_dev.config[PCI_CLASS_PROG] = 0x30; /* xHCI */ + xhci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */ + xhci->pci_dev.config[PCI_CACHE_LINE_SIZE] = 0x10; + xhci->pci_dev.config[0x60] = 0x30; /* release number */ + +- usb_xhci_init(xhci, &dev->qdev); ++ usb_xhci_init(xhci); + + if (xhci->numintrs > MAXINTRS) { + xhci->numintrs = MAXINTRS; +@@ -3644,7 +3651,7 @@ static void xhci_class_init(ObjectClass *klass, void *data) + } + + static const TypeInfo xhci_info = { +- .name = "nec-usb-xhci", ++ .name = TYPE_XHCI, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(XHCIState), + .class_init = xhci_class_init, +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-hcd-xhci-QOM-parent-field-cleanup.patch b/SOURCES/kvm-usb-hcd-xhci-QOM-parent-field-cleanup.patch new file mode 100644 index 0000000..a27f60c --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-QOM-parent-field-cleanup.patch @@ -0,0 +1,331 @@ +From d7852bf27b3c4bb0fa932d171325c3d386550ebe Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:35 +0200 +Subject: [PATCH 02/43] usb/hcd-xhci: QOM parent field cleanup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1405088470-24115-3-git-send-email-kraxel@redhat.com> +Patchwork-id: 59826 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 02/37] usb/hcd-xhci: QOM parent field cleanup +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Andreas Färber + +Replace direct uses of XHCIState::pci_dev with QOM casts and rename it +to parent_obj. + +Acked-by: Peter Crosthwaite +Signed-off-by: Andreas Färber +(cherry picked from commit 9b7d3334d062e8c9e4f1b0ad3df35abb08cd8bf0) +--- + hw/usb/hcd-xhci.c | 83 ++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 48 insertions(+), 35 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 83 ++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 48 insertions(+), 35 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 8fa1c6e..724c412 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -446,7 +446,10 @@ typedef struct XHCIInterrupter { + } XHCIInterrupter; + + struct XHCIState { +- PCIDevice pci_dev; ++ /*< private >*/ ++ PCIDevice parent_obj; ++ /*< public >*/ ++ + USBBus bus; + qemu_irq irq; + MemoryRegion mem; +@@ -662,7 +665,7 @@ static inline void xhci_dma_read_u32s(XHCIState *xhci, dma_addr_t addr, + + assert((len % sizeof(uint32_t)) == 0); + +- pci_dma_read(&xhci->pci_dev, addr, buf, len); ++ pci_dma_read(PCI_DEVICE(xhci), addr, buf, len); + + for (i = 0; i < (len / sizeof(uint32_t)); i++) { + buf[i] = le32_to_cpu(buf[i]); +@@ -680,7 +683,7 @@ static inline void xhci_dma_write_u32s(XHCIState *xhci, dma_addr_t addr, + for (i = 0; i < (len / sizeof(uint32_t)); i++) { + tmp[i] = cpu_to_le32(buf[i]); + } +- pci_dma_write(&xhci->pci_dev, addr, tmp, len); ++ pci_dma_write(PCI_DEVICE(xhci), addr, tmp, len); + } + + static XHCIPort *xhci_lookup_port(XHCIState *xhci, struct USBPort *uport) +@@ -707,10 +710,11 @@ static XHCIPort *xhci_lookup_port(XHCIState *xhci, struct USBPort *uport) + + static void xhci_intx_update(XHCIState *xhci) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + int level = 0; + +- if (msix_enabled(&xhci->pci_dev) || +- msi_enabled(&xhci->pci_dev)) { ++ if (msix_enabled(pci_dev) || ++ msi_enabled(pci_dev)) { + return; + } + +@@ -726,9 +730,10 @@ static void xhci_intx_update(XHCIState *xhci) + + static void xhci_msix_update(XHCIState *xhci, int v) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + bool enabled; + +- if (!msix_enabled(&xhci->pci_dev)) { ++ if (!msix_enabled(pci_dev)) { + return; + } + +@@ -739,17 +744,19 @@ static void xhci_msix_update(XHCIState *xhci, int v) + + if (enabled) { + trace_usb_xhci_irq_msix_use(v); +- msix_vector_use(&xhci->pci_dev, v); ++ msix_vector_use(pci_dev, v); + xhci->intr[v].msix_used = true; + } else { + trace_usb_xhci_irq_msix_unuse(v); +- msix_vector_unuse(&xhci->pci_dev, v); ++ msix_vector_unuse(pci_dev, v); + xhci->intr[v].msix_used = false; + } + } + + static void xhci_intr_raise(XHCIState *xhci, int v) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); ++ + xhci->intr[v].erdp_low |= ERDP_EHB; + xhci->intr[v].iman |= IMAN_IP; + xhci->usbsts |= USBSTS_EINT; +@@ -762,15 +769,15 @@ static void xhci_intr_raise(XHCIState *xhci, int v) + return; + } + +- if (msix_enabled(&xhci->pci_dev)) { ++ if (msix_enabled(pci_dev)) { + trace_usb_xhci_irq_msix(v); +- msix_notify(&xhci->pci_dev, v); ++ msix_notify(pci_dev, v); + return; + } + +- if (msi_enabled(&xhci->pci_dev)) { ++ if (msi_enabled(pci_dev)) { + trace_usb_xhci_irq_msi(v); +- msi_notify(&xhci->pci_dev, v); ++ msi_notify(pci_dev, v); + return; + } + +@@ -793,6 +800,7 @@ static void xhci_die(XHCIState *xhci) + + static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + XHCIInterrupter *intr = &xhci->intr[v]; + XHCITRB ev_trb; + dma_addr_t addr; +@@ -811,7 +819,7 @@ static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v) + ev_trb.status, ev_trb.control); + + addr = intr->er_start + TRB_SIZE*intr->er_ep_idx; +- pci_dma_write(&xhci->pci_dev, addr, &ev_trb, TRB_SIZE); ++ pci_dma_write(pci_dev, addr, &ev_trb, TRB_SIZE); + + intr->er_ep_idx++; + if (intr->er_ep_idx >= intr->er_size) { +@@ -958,9 +966,11 @@ static void xhci_ring_init(XHCIState *xhci, XHCIRing *ring, + static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb, + dma_addr_t *addr) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); ++ + while (1) { + TRBType type; +- pci_dma_read(&xhci->pci_dev, ring->dequeue, trb, TRB_SIZE); ++ pci_dma_read(pci_dev, ring->dequeue, trb, TRB_SIZE); + trb->addr = ring->dequeue; + trb->ccs = ring->ccs; + le64_to_cpus(&trb->parameter); +@@ -993,6 +1003,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb, + + static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + XHCITRB trb; + int length = 0; + dma_addr_t dequeue = ring->dequeue; +@@ -1002,7 +1013,7 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring) + + while (1) { + TRBType type; +- pci_dma_read(&xhci->pci_dev, dequeue, &trb, TRB_SIZE); ++ pci_dma_read(pci_dev, dequeue, &trb, TRB_SIZE); + le64_to_cpus(&trb.parameter); + le32_to_cpus(&trb.status); + le32_to_cpus(&trb.control); +@@ -1054,7 +1065,7 @@ static void xhci_er_reset(XHCIState *xhci, int v) + return; + } + dma_addr_t erstba = xhci_addr64(intr->erstba_low, intr->erstba_high); +- pci_dma_read(&xhci->pci_dev, erstba, &seg, sizeof(seg)); ++ pci_dma_read(PCI_DEVICE(xhci), erstba, &seg, sizeof(seg)); + le32_to_cpus(&seg.addr_low); + le32_to_cpus(&seg.addr_high); + le32_to_cpus(&seg.size); +@@ -1528,7 +1539,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer) + int i; + + xfer->int_req = false; +- pci_dma_sglist_init(&xfer->sgl, &xhci->pci_dev, xfer->trb_count); ++ pci_dma_sglist_init(&xfer->sgl, PCI_DEVICE(xhci), xfer->trb_count); + for (i = 0; i < xfer->trb_count; i++) { + XHCITRB *trb = &xfer->trbs[i]; + dma_addr_t addr; +@@ -2144,7 +2155,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + assert(slotid >= 1 && slotid <= xhci->numslots); + + dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); +- poctx = ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid); ++ poctx = ldq_le_pci_dma(PCI_DEVICE(xhci), dcbaap + 8 * slotid); + ictx = xhci_mask64(pictx); + octx = xhci_mask64(poctx); + +@@ -2465,7 +2476,7 @@ static TRBCCode xhci_get_port_bandwidth(XHCIState *xhci, uint64_t pctx) + /* TODO: actually implement real values here */ + bw_ctx[0] = 0; + memset(&bw_ctx[1], 80, xhci->numports); /* 80% */ +- pci_dma_write(&xhci->pci_dev, ctx, bw_ctx, sizeof(bw_ctx)); ++ pci_dma_write(PCI_DEVICE(xhci), ctx, bw_ctx, sizeof(bw_ctx)); + + return CC_SUCCESS; + } +@@ -2488,11 +2499,12 @@ static uint32_t xhci_nec_challenge(uint32_t hi, uint32_t lo) + + static void xhci_via_challenge(XHCIState *xhci, uint64_t addr) + { ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + uint32_t buf[8]; + uint32_t obuf[8]; + dma_addr_t paddr = xhci_mask64(addr); + +- pci_dma_read(&xhci->pci_dev, paddr, &buf, 32); ++ pci_dma_read(pci_dev, paddr, &buf, 32); + + memcpy(obuf, buf, sizeof(obuf)); + +@@ -2508,7 +2520,7 @@ static void xhci_via_challenge(XHCIState *xhci, uint64_t addr) + obuf[7] = obuf[2] ^ obuf[3] ^ 0x65866593; + } + +- pci_dma_write(&xhci->pci_dev, paddr, &obuf, 32); ++ pci_dma_write(pci_dev, paddr, &obuf, 32); + } + + static void xhci_process_commands(XHCIState *xhci) +@@ -3372,10 +3384,10 @@ static int usb_xhci_initfn(struct PCIDevice *dev) + + XHCIState *xhci = XHCI(dev); + +- xhci->pci_dev.config[PCI_CLASS_PROG] = 0x30; /* xHCI */ +- xhci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */ +- xhci->pci_dev.config[PCI_CACHE_LINE_SIZE] = 0x10; +- xhci->pci_dev.config[0x60] = 0x30; /* release number */ ++ dev->config[PCI_CLASS_PROG] = 0x30; /* xHCI */ ++ dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */ ++ dev->config[PCI_CACHE_LINE_SIZE] = 0x10; ++ dev->config[0x60] = 0x30; /* release number */ + + usb_xhci_init(xhci); + +@@ -3397,7 +3409,7 @@ static int usb_xhci_initfn(struct PCIDevice *dev) + + xhci->mfwrap_timer = qemu_new_timer_ns(vm_clock, xhci_mfwrap_timer, xhci); + +- xhci->irq = xhci->pci_dev.irq[0]; ++ xhci->irq = dev->irq[0]; + + memory_region_init(&xhci->mem, "xhci", LEN_REGS); + memory_region_init_io(&xhci->mem_cap, &xhci_cap_ops, xhci, +@@ -3423,18 +3435,18 @@ static int usb_xhci_initfn(struct PCIDevice *dev) + memory_region_add_subregion(&xhci->mem, offset, &port->mem); + } + +- pci_register_bar(&xhci->pci_dev, 0, ++ pci_register_bar(dev, 0, + PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64, + &xhci->mem); + +- ret = pcie_endpoint_cap_init(&xhci->pci_dev, 0xa0); ++ ret = pcie_endpoint_cap_init(dev, 0xa0); + assert(ret >= 0); + + if (xhci->flags & (1 << XHCI_FLAG_USE_MSI)) { +- msi_init(&xhci->pci_dev, 0x70, xhci->numintrs, true, false); ++ msi_init(dev, 0x70, xhci->numintrs, true, false); + } + if (xhci->flags & (1 << XHCI_FLAG_USE_MSI_X)) { +- msix_init(&xhci->pci_dev, xhci->numintrs, ++ msix_init(dev, xhci->numintrs, + &xhci->mem, 0, OFF_MSIX_TABLE, + &xhci->mem, 0, OFF_MSIX_PBA, + 0x90); +@@ -3446,6 +3458,7 @@ static int usb_xhci_initfn(struct PCIDevice *dev) + static int usb_xhci_post_load(void *opaque, int version_id) + { + XHCIState *xhci = opaque; ++ PCIDevice *pci_dev = PCI_DEVICE(xhci); + XHCISlot *slot; + XHCIEPContext *epctx; + dma_addr_t dcbaap, pctx; +@@ -3461,7 +3474,7 @@ static int usb_xhci_post_load(void *opaque, int version_id) + continue; + } + slot->ctx = +- xhci_mask64(ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid)); ++ xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid)); + xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); + slot->uport = xhci_lookup_uport(xhci, slot_ctx); + assert(slot->uport && slot->uport->dev); +@@ -3486,9 +3499,9 @@ static int usb_xhci_post_load(void *opaque, int version_id) + + for (intr = 0; intr < xhci->numintrs; intr++) { + if (xhci->intr[intr].msix_used) { +- msix_vector_use(&xhci->pci_dev, intr); ++ msix_vector_use(pci_dev, intr); + } else { +- msix_vector_unuse(&xhci->pci_dev, intr); ++ msix_vector_unuse(pci_dev, intr); + } + } + +@@ -3593,8 +3606,8 @@ static const VMStateDescription vmstate_xhci = { + .version_id = 1, + .post_load = usb_xhci_post_load, + .fields = (VMStateField[]) { +- VMSTATE_PCIE_DEVICE(pci_dev, XHCIState), +- VMSTATE_MSIX(pci_dev, XHCIState), ++ VMSTATE_PCIE_DEVICE(parent_obj, XHCIState), ++ VMSTATE_MSIX(parent_obj, XHCIState), + + VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1, + vmstate_xhci_port, XHCIPort), +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-hcd-xhci-Remove-unused-cancelled-member-from-XHC.patch b/SOURCES/kvm-usb-hcd-xhci-Remove-unused-cancelled-member-from-XHC.patch new file mode 100644 index 0000000..9eaa998 --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-Remove-unused-cancelled-member-from-XHC.patch @@ -0,0 +1,72 @@ +From fc1acb16e008aea013d59435fc14b967f1c8a144 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:49 +0200 +Subject: [PATCH 15/43] usb-hcd-xhci: Remove unused cancelled member from + XHCITransfer + +Message-id: <1405088470-24115-17-git-send-email-kraxel@redhat.com> +Patchwork-id: 59831 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 16/37] usb-hcd-xhci: Remove unused cancelled member from XHCITransfer +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Since qemu's USB model is geared towards emulated devices cancellation +is instanteneous, so no need to wait for cancellation to complete, as +such there is no wait for cancellation code, and the cancelled bool +as well as the bogus comment about it can be removed. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 8de1838afed4b5b05d18cc42a3e5a6fe9b19f29b) +--- + hw/usb/hcd-xhci.c | 5 ----- + 1 file changed, 5 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index af0c42d..3b4cd01 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -346,7 +346,6 @@ typedef struct XHCITransfer { + QEMUSGList sgl; + bool running_async; + bool running_retry; +- bool cancelled; + bool complete; + bool int_req; + unsigned int iso_pkts; +@@ -1312,8 +1311,6 @@ static int xhci_ep_nuke_one_xfer(XHCITransfer *t) + if (t->running_async) { + usb_cancel_packet(&t->packet); + t->running_async = 0; +- t->cancelled = 1; +- DPRINTF("xhci: cancelling transfer, waiting for it to complete\n"); + killed = 1; + } + if (t->running_retry) { +@@ -1730,14 +1727,12 @@ static int xhci_complete_packet(XHCITransfer *xfer) + xfer->running_async = 1; + xfer->running_retry = 0; + xfer->complete = 0; +- xfer->cancelled = 0; + return 0; + } else if (xfer->packet.status == USB_RET_NAK) { + trace_usb_xhci_xfer_nak(xfer); + xfer->running_async = 0; + xfer->running_retry = 1; + xfer->complete = 0; +- xfer->cancelled = 0; + return 0; + } else { + xfer->running_async = 0; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-hcd-xhci-Remove-unused-sstreamsm-member-from-XHC.patch b/SOURCES/kvm-usb-hcd-xhci-Remove-unused-sstreamsm-member-from-XHC.patch new file mode 100644 index 0000000..7ab6ada --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-Remove-unused-sstreamsm-member-from-XHC.patch @@ -0,0 +1,67 @@ +From 20c1e309f606aaec8274ff3cc7471382de049473 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:48 +0200 +Subject: [PATCH 14/43] usb-hcd-xhci: Remove unused sstreamsm member from + XHCIStreamContext + +Message-id: <1405088470-24115-16-git-send-email-kraxel@redhat.com> +Patchwork-id: 59828 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 15/37] usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 946ff2c0c353e4bf493f6ff2bcc308adddee4a4c) +--- + hw/usb/hcd-xhci.c | 9 --------- + 1 file changed, 9 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index bb3bba3..af0c42d 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -374,7 +374,6 @@ struct XHCIStreamContext { + dma_addr_t pctx; + unsigned int sct; + XHCIRing ring; +- XHCIStreamContext *sstreams; + }; + + struct XHCIEPContext { +@@ -1135,7 +1134,6 @@ static void xhci_reset_streams(XHCIEPContext *epctx) + + for (i = 0; i < epctx->nr_pstreams; i++) { + epctx->pstreams[i].sct = -1; +- g_free(epctx->pstreams[i].sstreams); + } + } + +@@ -1148,15 +1146,8 @@ static void xhci_alloc_streams(XHCIEPContext *epctx, dma_addr_t base) + + static void xhci_free_streams(XHCIEPContext *epctx) + { +- int i; +- + assert(epctx->pstreams != NULL); + +- if (!epctx->lsa) { +- for (i = 0; i < epctx->nr_pstreams; i++) { +- g_free(epctx->pstreams[i].sstreams); +- } +- } + g_free(epctx->pstreams); + epctx->pstreams = NULL; + epctx->nr_pstreams = 0; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-hcd-xhci-Report-completion-of-active-transfer-wi.patch b/SOURCES/kvm-usb-hcd-xhci-Report-completion-of-active-transfer-wi.patch new file mode 100644 index 0000000..ac6eff4 --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-Report-completion-of-active-transfer-wi.patch @@ -0,0 +1,136 @@ +From 356cd0ad58931df9374324eeceff760a6310db27 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:50 +0200 +Subject: [PATCH 16/43] usb-hcd-xhci: Report completion of active transfer with + CC_STOPPED on ep stop + +Message-id: <1405088470-24115-18-git-send-email-kraxel@redhat.com> +Patchwork-id: 59832 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 17/37] usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +As we should per the XHCI spec "4.6.9 Stop Endpoint". + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 582d6f4aba0ff24604a82b48aee2db17b100d4b4) +--- + hw/usb/hcd-xhci.c | 26 ++++++++++++++++++-------- + 1 file changed, 18 insertions(+), 8 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 26 ++++++++++++++++++-------- + 1 file changed, 18 insertions(+), 8 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 3b4cd01..fc3b330 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -507,6 +507,7 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + unsigned int epid, unsigned int streamid); + static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, + unsigned int epid); ++static void xhci_xfer_report(XHCITransfer *xfer); + static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v); + static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v); + static USBEndpoint *xhci_epid_to_usbep(XHCIState *xhci, +@@ -1304,10 +1305,15 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid, + return CC_SUCCESS; + } + +-static int xhci_ep_nuke_one_xfer(XHCITransfer *t) ++static int xhci_ep_nuke_one_xfer(XHCITransfer *t, TRBCCode report) + { + int killed = 0; + ++ if (report && (t->running_async || t->running_retry)) { ++ t->status = report; ++ xhci_xfer_report(t); ++ } ++ + if (t->running_async) { + usb_cancel_packet(&t->packet); + t->running_async = 0; +@@ -1320,6 +1326,7 @@ static int xhci_ep_nuke_one_xfer(XHCITransfer *t) + qemu_del_timer(epctx->kick_timer); + } + t->running_retry = 0; ++ killed = 1; + } + if (t->trbs) { + g_free(t->trbs); +@@ -1332,7 +1339,7 @@ static int xhci_ep_nuke_one_xfer(XHCITransfer *t) + } + + static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid, +- unsigned int epid) ++ unsigned int epid, TRBCCode report) + { + XHCISlot *slot; + XHCIEPContext *epctx; +@@ -1353,7 +1360,10 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid, + + xferi = epctx->next_xfer; + for (i = 0; i < TD_QUEUE; i++) { +- killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi]); ++ killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi], report); ++ if (killed) { ++ report = 0; /* Only report once */ ++ } + epctx->transfers[xferi].packet.ep = NULL; + xferi = (xferi + 1) % TD_QUEUE; + } +@@ -1383,7 +1393,7 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, + return CC_SUCCESS; + } + +- xhci_ep_nuke_xfers(xhci, slotid, epid); ++ xhci_ep_nuke_xfers(xhci, slotid, epid, 0); + + epctx = slot->eps[epid-1]; + +@@ -1425,7 +1435,7 @@ static TRBCCode xhci_stop_ep(XHCIState *xhci, unsigned int slotid, + return CC_EP_NOT_ENABLED_ERROR; + } + +- if (xhci_ep_nuke_xfers(xhci, slotid, epid) > 0) { ++ if (xhci_ep_nuke_xfers(xhci, slotid, epid, CC_STOPPED) > 0) { + fprintf(stderr, "xhci: FIXME: endpoint stopped w/ xfers running, " + "data might be lost\n"); + } +@@ -1470,7 +1480,7 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid, + return CC_CONTEXT_STATE_ERROR; + } + +- if (xhci_ep_nuke_xfers(xhci, slotid, epid) > 0) { ++ if (xhci_ep_nuke_xfers(xhci, slotid, epid, 0) > 0) { + fprintf(stderr, "xhci: FIXME: endpoint reset w/ xfers running, " + "data might be lost\n"); + } +@@ -2463,7 +2473,7 @@ static void xhci_detach_slot(XHCIState *xhci, USBPort *uport) + + for (ep = 0; ep < 31; ep++) { + if (xhci->slots[slot].eps[ep]) { +- xhci_ep_nuke_xfers(xhci, slot+1, ep+1); ++ xhci_ep_nuke_xfers(xhci, slot + 1, ep + 1, 0); + } + } + xhci->slots[slot].uport = NULL; +@@ -3286,7 +3296,7 @@ static void xhci_complete(USBPort *port, USBPacket *packet) + XHCITransfer *xfer = container_of(packet, XHCITransfer, packet); + + if (packet->status == USB_RET_REMOVE_FROM_QUEUE) { +- xhci_ep_nuke_one_xfer(xfer); ++ xhci_ep_nuke_one_xfer(xfer, 0); + return; + } + xhci_complete_packet(xfer); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-hcd-xhci-Update-endpoint-context-dequeue-pointer.patch b/SOURCES/kvm-usb-hcd-xhci-Update-endpoint-context-dequeue-pointer.patch new file mode 100644 index 0000000..6cea4a0 --- /dev/null +++ b/SOURCES/kvm-usb-hcd-xhci-Update-endpoint-context-dequeue-pointer.patch @@ -0,0 +1,77 @@ +From 83423f42cd68e8b3ee644f38686dc4eabba9ce37 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:51 +0200 +Subject: [PATCH 17/43] usb-hcd-xhci: Update endpoint context dequeue pointer + for streams too + +Message-id: <1405088470-24115-19-git-send-email-kraxel@redhat.com> +Patchwork-id: 59838 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 18/37] usb-hcd-xhci: Update endpoint context dequeue pointer for streams too +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +With streams the endpoint context dequeue pointer should point to the +dequeue value for the currently active stream. + +At least Linux guests expect it to point to value set by an set_ep_dequeue +upon completion of the set_ep_dequeue (before kicking the ep). + +Otherwise the Linux kernel will complain (and things won't work): + +xhci_hcd 0000:00:05.0: Mismatch between completed Set TR Deq Ptr command & xHCI internal state. +xhci_hcd 0000:00:05.0: ep deq seg = ffff8800366f0880, deq ptr = ffff8800366ec010 + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit c90daa1c109348099088c1cc954c1e9f3392ae03) +--- + hw/usb/hcd-xhci.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index fc3b330..ef0c073 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1189,6 +1189,7 @@ static XHCIStreamContext *xhci_find_stream(XHCIEPContext *epctx, + static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx, + XHCIStreamContext *sctx, uint32_t state) + { ++ XHCIRing *ring = NULL; + uint32_t ctx[5]; + uint32_t ctx2[2]; + +@@ -1199,6 +1200,7 @@ static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx, + /* update ring dequeue ptr */ + if (epctx->nr_pstreams) { + if (sctx != NULL) { ++ ring = &sctx->ring; + xhci_dma_read_u32s(xhci, sctx->pctx, ctx2, sizeof(ctx2)); + ctx2[0] &= 0xe; + ctx2[0] |= sctx->ring.dequeue | sctx->ring.ccs; +@@ -1206,8 +1208,12 @@ static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx, + xhci_dma_write_u32s(xhci, sctx->pctx, ctx2, sizeof(ctx2)); + } + } else { +- ctx[2] = epctx->ring.dequeue | epctx->ring.ccs; +- ctx[3] = (epctx->ring.dequeue >> 16) >> 16; ++ ring = &epctx->ring; ++ } ++ if (ring) { ++ ctx[2] = ring->dequeue | ring->ccs; ++ ctx[3] = (ring->dequeue >> 16) >> 16; ++ + DPRINTF("xhci: set epctx: " DMA_ADDR_FMT " state=%d dequeue=%08x%08x\n", + epctx->pctx, state, ctx[3], ctx[2]); + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-initialize-libusb_device-to-avoid-crash.patch b/SOURCES/kvm-usb-initialize-libusb_device-to-avoid-crash.patch new file mode 100644 index 0000000..aef0ff7 --- /dev/null +++ b/SOURCES/kvm-usb-initialize-libusb_device-to-avoid-crash.patch @@ -0,0 +1,72 @@ +From 7940a4b551e845a34409ad79a6250c5ea2f97df6 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:21:10 +0200 +Subject: [PATCH 30/43] usb: initialize libusb_device to avoid crash + +Message-id: <1405088470-24115-38-git-send-email-kraxel@redhat.com> +Patchwork-id: 59842 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 37/37] usb: initialize libusb_device to avoid crash +Bugzilla: 1111450 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Jincheng Miao + +If libusb_get_device_list() fails, the uninitialized local variable +libusb_device would be passed to libusb_free_device_list(), that +will cause a crash, like: +(gdb) bt + #0 0x00007fbbb4bafc10 in pthread_mutex_lock () from /lib64/libpthread.so.0 + #1 0x00007fbbb233e653 in libusb_unref_device (dev=0x6275682d627375) + at core.c:902 + #2 0x00007fbbb233e739 in libusb_free_device_list (list=0x7fbbb6e8436e, + unref_devices=) at core.c:653 + #3 0x00007fbbb6cd80a4 in usb_host_auto_check (unused=unused@entry=0x0) + at hw/usb/host-libusb.c:1446 + #4 0x00007fbbb6cd8525 in usb_host_initfn (udev=0x7fbbbd3c5670) + at hw/usb/host-libusb.c:912 + #5 0x00007fbbb6cc123b in usb_device_init (dev=0x7fbbbd3c5670) + at hw/usb/bus.c:106 + ... + +So initialize libusb_device at the begin time. + +Signed-off-by: Jincheng Miao +Reviewed-by: Gonglei +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 3ce21445387c64032a21ae73c995195307a28a36) +--- + hw/usb/host-libusb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/host-libusb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c +index 8510902..ef3dd5f 100644 +--- a/hw/usb/host-libusb.c ++++ b/hw/usb/host-libusb.c +@@ -1384,7 +1384,7 @@ static void usb_host_auto_check(void *unused) + { + struct USBHostDevice *s; + struct USBAutoFilter *f; +- libusb_device **devs; ++ libusb_device **devs = NULL; + struct libusb_device_descriptor ddesc; + int unconnected = 0; + int i, n; +@@ -1485,7 +1485,7 @@ static void usb_host_auto_check(void *unused) + + void usb_host_info(Monitor *mon, const QDict *qdict) + { +- libusb_device **devs; ++ libusb_device **devs = NULL; + struct libusb_device_descriptor ddesc; + char port[16]; + int i, n; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-parallelize-usb3-streams.patch b/SOURCES/kvm-usb-parallelize-usb3-streams.patch new file mode 100644 index 0000000..b06cebb --- /dev/null +++ b/SOURCES/kvm-usb-parallelize-usb3-streams.patch @@ -0,0 +1,66 @@ +From 2160ddf46b85b84d271e450383151ff288958622 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:41 +0200 +Subject: [PATCH 08/43] usb: parallelize usb3 streams + +Message-id: <1405088470-24115-9-git-send-email-kraxel@redhat.com> +Patchwork-id: 59844 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 08/37] usb: parallelize usb3 streams +Bugzilla: 1075846 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +usb3 bulk endpoints with streams are implicitly pipelined now, +so the requests will actually be processed in parallel. Also +allow them to complete out-of-order. + +Fixes stalls in the uas driver. + +Cc: qemu-stable@nongnu.org +Signed-off-by: Gerd Hoffmann +(cherry picked from commit c96c41ed0d38d68a6c8b6f84751afebafeae31be) +--- + hw/usb/core.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/core.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index 05948ca..31960c2 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -403,7 +403,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p) + p->ep->halted = false; + } + +- if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline) { ++ if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline || p->stream) { + usb_process_one(p); + if (p->status == USB_RET_ASYNC) { + /* hcd drivers cannot handle async for isoc */ +@@ -420,7 +420,8 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p) + * When pipelining is enabled usb-devices must always return async, + * otherwise packets can complete out of order! + */ +- assert(!p->ep->pipeline || QTAILQ_EMPTY(&p->ep->queue)); ++ assert(p->stream || !p->ep->pipeline || ++ QTAILQ_EMPTY(&p->ep->queue)); + if (p->status != USB_RET_NAK) { + usb_packet_set_state(p, USB_PACKET_COMPLETE); + } +@@ -434,7 +435,7 @@ void usb_packet_complete_one(USBDevice *dev, USBPacket *p) + { + USBEndpoint *ep = p->ep; + +- assert(QTAILQ_FIRST(&ep->queue) == p); ++ assert(p->stream || QTAILQ_FIRST(&ep->queue) == p); + assert(p->status != USB_RET_ASYNC && p->status != USB_RET_NAK); + + if (p->status != USB_RET_SUCCESS || +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-redir-fix-use-after-free.patch b/SOURCES/kvm-usb-redir-fix-use-after-free.patch new file mode 100644 index 0000000..7f1af09 --- /dev/null +++ b/SOURCES/kvm-usb-redir-fix-use-after-free.patch @@ -0,0 +1,45 @@ +From bba21b64c47889ee3a11b3f011fab73b84697e16 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:37 +0200 +Subject: [PATCH 04/43] usb-redir: fix use-after-free + +Message-id: <1405088470-24115-5-git-send-email-kraxel@redhat.com> +Patchwork-id: 59819 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 04/37] usb-redir: fix use-after-free +Bugzilla: 1046574 1088116 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Hans de Goede +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Markus Armbruster +RH-Acked-by: Laszlo Ersek + +Reinitialize dev->cs to NULL after deleting it, to make sure it isn't +used afterwards. + +Reported-by: Martin Cerveny +Signed-off-by: Gerd Hoffmann +(cherry picked from commit a14ff8a650b5943ee6221b952494661f7cb3b5e2) +--- + hw/usb/redirect.c | 1 + + 1 file changed, 1 insertion(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/redirect.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c +index 8b8c010..e3b9f32 100644 +--- a/hw/usb/redirect.c ++++ b/hw/usb/redirect.c +@@ -1334,6 +1334,7 @@ static void usbredir_handle_destroy(USBDevice *udev) + USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); + + qemu_chr_delete(dev->cs); ++ dev->cs = NULL; + /* Note must be done after qemu_chr_close, as that causes a close event */ + qemu_bh_delete(dev->chardev_close_bh); + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch b/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch index 74a41d4..790bf36 100644 --- a/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch +++ b/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch @@ -1,13 +1,13 @@ -From bbe33dbd43e6b562459624adb801f9b35d0f5211 Mon Sep 17 00:00:00 2001 +From 66f0fbb6a54ab1110afd12eb9a25d8966b60c7fa Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:26:17 +0200 -Subject: [PATCH 15/30] usb: sanity check setup_index+setup_len in post_load +Date: Wed, 14 May 2014 08:36:01 +0200 +Subject: [PATCH 19/31] usb: sanity check setup_index+setup_len in post_load RH-Author: Michael S. Tsirkin -Message-id: <1400055942-6418-2-git-send-email-mst@redhat.com> -Patchwork-id: 58854 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 2/2] usb: sanity check setup_index+setup_len in post_load -Bugzilla: 1095746 +Message-id: <1400056525-6869-2-git-send-email-mst@redhat.com> +Patchwork-id: 58865 +O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] usb: sanity check setup_index+setup_len in post_load +Bugzilla: 1095747 RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann @@ -27,7 +27,7 @@ Reviewed-by: Gerd Hoffmann Signed-off-by: Juan Quintela (cherry picked from commit 9f8e9895c504149d7048e9fc5eb5cbb34b16e49a) -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 Tested: lightly on developer's box Bugzilla: 1095743 diff --git a/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch b/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch index 190ec3d..af9b2a1 100644 --- a/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch +++ b/SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch @@ -1,13 +1,13 @@ -From 586e92b335a98dcfbb4a797eb744753038da4374 Mon Sep 17 00:00:00 2001 +From 744a9df71d68005c83f01ddde142f1b08c8fc69c Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:26:14 +0200 -Subject: [PATCH 14/30] usb: sanity check setup_index+setup_len in post_load +Date: Wed, 14 May 2014 08:35:57 +0200 +Subject: [PATCH 18/31] usb: sanity check setup_index+setup_len in post_load RH-Author: Michael S. Tsirkin -Message-id: <1400055942-6418-1-git-send-email-mst@redhat.com> -Patchwork-id: 58853 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 1/2] usb: sanity check setup_index+setup_len in post_load -Bugzilla: 1095746 +Message-id: <1400056525-6869-1-git-send-email-mst@redhat.com> +Patchwork-id: 58864 +O-Subject: [PATCH qemu-kvm RHEL7.1 1/2] usb: sanity check setup_index+setup_len in post_load +Bugzilla: 1095747 RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann @@ -17,7 +17,7 @@ From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann (cherry picked from commit c60174e847082ab9f70720f86509a3353f816fad) -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 Tested: lightly on developer's box Bugzilla: 1095743 --- diff --git a/SOURCES/kvm-util-Split-out-exec_dir-from-os_find_datadir.patch b/SOURCES/kvm-util-Split-out-exec_dir-from-os_find_datadir.patch new file mode 100644 index 0000000..c076d6e --- /dev/null +++ b/SOURCES/kvm-util-Split-out-exec_dir-from-os_find_datadir.patch @@ -0,0 +1,358 @@ +From cf0bb22a1d897cc225f14489eaad0dd02ec4a6e3 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Wed, 16 Jul 2014 02:20:25 -0500 +Subject: [CHANGE 25/29] util: Split out exec_dir from os_find_datadir +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405477228-11490-2-git-send-email-famz@redhat.com> +Patchwork-id: 59920 +O-Subject: [RHEL-7 qemu-kvm PATCH 1/4] util: Split out exec_dir from os_find_datadir +Bugzilla: 1017685 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Miroslav Rezanina + +From: Miroslav Rezanina + +Upstream: 10f5bff622cad71645e22c027b77ac31e51008ef + +With this change, main() calls qemu_init_exec_dir and uses argv[0] to +init exec_dir. The saved value can be retrieved with +qemu_get_exec_dir later. It will be reused by module loading. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini + +This is manual backport. Following change is handling -Werror=strict-prototypes +error (function declaration isn't a prototype): + +Upstream: char *os_find_datadir(); +RHEL: char *os_find_datadir(void); + +Signed-off-by: Miroslav Rezanina +Signed-off-by: Fam Zheng +--- + include/qemu-common.h | 2 +- + include/qemu/osdep.h | 9 +++++++++ + os-posix.c | 42 +++++++-------------------------------- + os-win32.c | 21 ++------------------ + qemu-img.c | 1 + + qemu-io.c | 1 + + qemu-nbd.c | 1 + + util/oslib-posix.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ + util/oslib-win32.c | 30 ++++++++++++++++++++++++++++ + vl.c | 3 ++- + 10 files changed, 108 insertions(+), 56 deletions(-) + +Signed-off-by: jen +--- + include/qemu-common.h | 2 +- + include/qemu/osdep.h | 9 +++++++++ + os-posix.c | 42 +++++++-------------------------------- + os-win32.c | 21 ++------------------ + qemu-img.c | 1 + + qemu-io.c | 1 + + qemu-nbd.c | 1 + + util/oslib-posix.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ + util/oslib-win32.c | 30 ++++++++++++++++++++++++++++ + vl.c | 3 ++- + 10 files changed, 108 insertions(+), 56 deletions(-) + +diff --git a/include/qemu-common.h b/include/qemu-common.h +index 73c6419..aee85e3 100644 +--- a/include/qemu-common.h ++++ b/include/qemu-common.h +@@ -360,7 +360,7 @@ char *qemu_find_file(int type, const char *name); + + /* OS specific functions */ + void os_setup_early_signal_handling(void); +-char *os_find_datadir(const char *argv0); ++char *os_find_datadir(void); + void os_parse_cmd_args(int index, const char *optarg); + void os_pidfile_error(void); + +diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h +index 26136f1..7a5ae28 100644 +--- a/include/qemu/osdep.h ++++ b/include/qemu/osdep.h +@@ -215,4 +215,13 @@ bool fips_get_state(void); + */ + char *qemu_get_local_state_pathname(const char *relative_pathname); + ++/* Find program directory, and save it for later usage with ++ * qemu_get_exec_dir(). ++ * Try OS specific API first, if not working, parse from argv0. */ ++void qemu_init_exec_dir(const char *argv0); ++ ++/* Get the saved exec dir. ++ * Caller needs to release the returned string by g_free() */ ++char *qemu_get_exec_dir(void); ++ + #endif +diff --git a/os-posix.c b/os-posix.c +index 3a4678a..7cfca4b 100644 +--- a/os-posix.c ++++ b/os-posix.c +@@ -84,46 +84,17 @@ void os_setup_signal_handling(void) + running from the build tree this will be "$bindir/../pc-bios". */ + #define SHARE_SUFFIX "/share/qemu-kvm" + #define BUILD_SUFFIX "/pc-bios" +-char *os_find_datadir(const char *argv0) ++char *os_find_datadir(void) + { +- char *dir; +- char *p = NULL; ++ char *dir, *exec_dir; + char *res; +- char buf[PATH_MAX]; + size_t max_len; + +-#if defined(__linux__) +- { +- int len; +- len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); +- if (len > 0) { +- buf[len] = 0; +- p = buf; +- } ++ exec_dir = qemu_get_exec_dir(); ++ if (exec_dir == NULL) { ++ return NULL; + } +-#elif defined(__FreeBSD__) +- { +- static int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; +- size_t len = sizeof(buf) - 1; +- +- *buf = '\0'; +- if (!sysctl(mib, ARRAY_SIZE(mib), buf, &len, NULL, 0) && +- *buf) { +- buf[sizeof(buf) - 1] = '\0'; +- p = buf; +- } +- } +-#endif +- /* If we don't have any way of figuring out the actual executable +- location then try argv[0]. */ +- if (!p) { +- p = realpath(argv0, buf); +- if (!p) { +- return NULL; +- } +- } +- dir = dirname(p); +- dir = dirname(dir); ++ dir = dirname(exec_dir); + + max_len = strlen(dir) + + MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1; +@@ -137,6 +108,7 @@ char *os_find_datadir(const char *argv0) + } + } + ++ g_free(exec_dir); + return res; + } + #undef SHARE_SUFFIX +diff --git a/os-win32.c b/os-win32.c +index 50b7f6f..5f95caa 100644 +--- a/os-win32.c ++++ b/os-win32.c +@@ -84,26 +84,9 @@ void os_setup_early_signal_handling(void) + } + + /* Look for support files in the same directory as the executable. */ +-char *os_find_datadir(const char *argv0) ++char *os_find_datadir(void) + { +- char *p; +- char buf[MAX_PATH]; +- DWORD len; +- +- len = GetModuleFileName(NULL, buf, sizeof(buf) - 1); +- if (len == 0) { +- return NULL; +- } +- +- buf[len] = 0; +- p = buf + len - 1; +- while (p != buf && *p != '\\') +- p--; +- *p = 0; +- if (access(buf, R_OK) == 0) { +- return g_strdup(buf); +- } +- return NULL; ++ return qemu_get_exec_dir(); + } + + void os_set_line_buffering(void) +diff --git a/qemu-img.c b/qemu-img.c +index dcce380..ed1799c 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -2726,6 +2726,7 @@ int main(int argc, char **argv) + #endif + + error_set_progname(argv[0]); ++ qemu_init_exec_dir(argv[0]); + + qemu_init_main_loop(); + bdrv_init(); +diff --git a/qemu-io.c b/qemu-io.c +index 0959178..bbe2518 100644 +--- a/qemu-io.c ++++ b/qemu-io.c +@@ -2008,6 +2008,7 @@ int main(int argc, char **argv) + #endif + + progname = basename(argv[0]); ++ qemu_init_exec_dir(argv[0]); + + while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) { + switch (c) { +diff --git a/qemu-nbd.c b/qemu-nbd.c +index c1b395d..207a610 100644 +--- a/qemu-nbd.c ++++ b/qemu-nbd.c +@@ -363,6 +363,7 @@ int main(int argc, char **argv) + memset(&sa_sigterm, 0, sizeof(sa_sigterm)); + sa_sigterm.sa_handler = termsig_handler; + sigaction(SIGTERM, &sa_sigterm, NULL); ++ qemu_init_exec_dir(argv[0]); + + while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { + switch (ch) { +diff --git a/util/oslib-posix.c b/util/oslib-posix.c +index 2c756c7..fef840a 100644 +--- a/util/oslib-posix.c ++++ b/util/oslib-posix.c +@@ -54,6 +54,7 @@ extern int daemon(int, int); + #include "trace.h" + #include "qemu/sockets.h" + #include ++#include + + #ifdef CONFIG_LINUX + #include +@@ -244,3 +245,56 @@ qemu_get_local_state_pathname(const char *relative_pathname) + return g_strdup_printf("%s/%s", CONFIG_QEMU_LOCALSTATEDIR, + relative_pathname); + } ++ ++static char exec_dir[PATH_MAX]; ++ ++void qemu_init_exec_dir(const char *argv0) ++{ ++ char *dir; ++ char *p = NULL; ++ char buf[PATH_MAX]; ++ ++ assert(!exec_dir[0]); ++ ++#if defined(__linux__) ++ { ++ int len; ++ len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); ++ if (len > 0) { ++ buf[len] = 0; ++ p = buf; ++ } ++ } ++#elif defined(__FreeBSD__) ++ { ++ static int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; ++ size_t len = sizeof(buf) - 1; ++ ++ *buf = '\0'; ++ if (!sysctl(mib, ARRAY_SIZE(mib), buf, &len, NULL, 0) && ++ *buf) { ++ buf[sizeof(buf) - 1] = '\0'; ++ p = buf; ++ } ++ } ++#endif ++ /* If we don't have any way of figuring out the actual executable ++ location then try argv[0]. */ ++ if (!p) { ++ if (!argv0) { ++ return; ++ } ++ p = realpath(argv0, buf); ++ if (!p) { ++ return; ++ } ++ } ++ dir = dirname(p); ++ ++ pstrcpy(exec_dir, sizeof(exec_dir), dir); ++} ++ ++char *qemu_get_exec_dir(void) ++{ ++ return g_strdup(exec_dir); ++} +diff --git a/util/oslib-win32.c b/util/oslib-win32.c +index 983b7a2..332e743 100644 +--- a/util/oslib-win32.c ++++ b/util/oslib-win32.c +@@ -179,3 +179,33 @@ qemu_get_local_state_pathname(const char *relative_pathname) + return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", base_path, + relative_pathname); + } ++ ++static char exec_dir[PATH_MAX]; ++ ++void qemu_init_exec_dir(const char *argv0) ++{ ++ ++ char *p; ++ char buf[MAX_PATH]; ++ DWORD len; ++ ++ len = GetModuleFileName(NULL, buf, sizeof(buf) - 1); ++ if (len == 0) { ++ return; ++ } ++ ++ buf[len] = 0; ++ p = buf + len - 1; ++ while (p != buf && *p != '\\') { ++ p--; ++ } ++ *p = 0; ++ if (access(buf, R_OK) == 0) { ++ pstrcpy(exec_dir, sizeof(exec_dir), buf); ++ } ++} ++ ++char *qemu_get_exec_dir(void) ++{ ++ return g_strdup(exec_dir); ++} +diff --git a/vl.c b/vl.c +index ca3d498..ead90ba 100644 +--- a/vl.c ++++ b/vl.c +@@ -2842,6 +2842,7 @@ int main(int argc, char **argv, char **envp) + + atexit(qemu_run_exit_notifiers); + error_set_progname(argv[0]); ++ qemu_init_exec_dir(argv[0]); + + g_mem_set_vtable(&mem_trace); + if (!g_thread_supported()) { +@@ -3880,7 +3881,7 @@ int main(int argc, char **argv, char **envp) + /* If no data_dir is specified then try to find it relative to the + executable path. */ + if (data_dir_idx < ARRAY_SIZE(data_dir)) { +- data_dir[data_dir_idx] = os_find_datadir(argv[0]); ++ data_dir[data_dir_idx] = os_find_datadir(); + if (data_dir[data_dir_idx] != NULL) { + data_dir_idx++; + } +-- +1.9.3 + diff --git a/SOURCES/kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch b/SOURCES/kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch index 4e22076..cca5fec 100644 --- a/SOURCES/kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch +++ b/SOURCES/kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch @@ -1,12 +1,12 @@ -From 110fded1f5457f5c089f865636119140b2ee1f94 Mon Sep 17 00:00:00 2001 +From 2e02d49769291dda0436ec3d113c5b4917037f3f Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 15 Sep 2014 13:08:20 +0200 -Subject: [PATCH 3/6] vbe: make bochs dispi interface return the correct memory size with qxl +Subject: [PATCH 1/4] vbe: make bochs dispi interface return the correct memory size with qxl Message-id: <1410786503-19794-2-git-send-email-kraxel@redhat.com> Patchwork-id: 61135 O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/4] vbe: make bochs dispi interface return the correct memory size with qxl -Bugzilla: 1139117 +Bugzilla: 1139118 RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek @@ -23,7 +23,6 @@ Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek (cherry picked from commit 54a85d462447c1cb8a1638578a7fd086350b4d2d) - Signed-off-by: Miroslav Rezanina --- hw/display/qxl.c | 1 + @@ -32,10 +31,10 @@ Signed-off-by: Miroslav Rezanina 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c -index 4fe4f1b..0ecd64e 100644 +index 6f8adc8..f11210c 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c -@@ -2046,6 +2046,7 @@ static int qxl_init_primary(PCIDevice *dev) +@@ -2056,6 +2056,7 @@ static int qxl_init_primary(PCIDevice *dev) qxl->id = 0; qxl_init_ramsize(qxl); diff --git a/SOURCES/kvm-vbe-rework-sanity-checks.patch b/SOURCES/kvm-vbe-rework-sanity-checks.patch index 363b703..e90d0b2 100644 --- a/SOURCES/kvm-vbe-rework-sanity-checks.patch +++ b/SOURCES/kvm-vbe-rework-sanity-checks.patch @@ -1,12 +1,12 @@ -From df5995a56f706268a23451204eadb1823a1f93b5 Mon Sep 17 00:00:00 2001 +From a0cd3ce8aa79a08cfc41ca5926889ca591ac5cd1 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 15 Sep 2014 13:08:21 +0200 -Subject: [PATCH 4/6] vbe: rework sanity checks +Subject: [PATCH 2/4] vbe: rework sanity checks Message-id: <1410786503-19794-3-git-send-email-kraxel@redhat.com> Patchwork-id: 61137 O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/4] vbe: rework sanity checks -Bugzilla: 1139117 +Bugzilla: 1139118 RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek @@ -46,7 +46,6 @@ Cc: secalert@redhat.com Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek (cherry picked from commit c1b886c45dc70f247300f549dce9833f3fa2def5) - Signed-off-by: Miroslav Rezanina --- hw/display/vga.c | 154 +++++++++++++++++++++++++++++++++--------------------- diff --git a/SOURCES/kvm-vdi-remove-double-conversion.patch b/SOURCES/kvm-vdi-remove-double-conversion.patch new file mode 100644 index 0000000..8acb3c4 --- /dev/null +++ b/SOURCES/kvm-vdi-remove-double-conversion.patch @@ -0,0 +1,44 @@ +From 873247249112ac26ae02946d3f6a9484a85268a3 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:46 +0200 +Subject: [PATCH 08/20] vdi: remove double conversion + +Message-id: <843ab27113b00881159ce51034472849d8178804.1410897407.git.jcody@redhat.com> +Patchwork-id: 61212 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 07/15] vdi: remove double conversion +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +This should be a problem when running on big-endian machines. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Benoit Canet +Reviewed-by: Stefan Weil +Signed-off-by: Michael Tokarev +(cherry picked from commit 6998b6c11b4e8ca5e3c3e6bdbdf07a4f747d5d37) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index fecfa14..0211023 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -239,7 +239,6 @@ static void vdi_header_to_le(VdiHeader *header) + cpu_to_le32s(&header->block_extra); + cpu_to_le32s(&header->blocks_in_image); + cpu_to_le32s(&header->blocks_allocated); +- cpu_to_le32s(&header->blocks_allocated); + uuid_convert(header->uuid_image); + uuid_convert(header->uuid_last_snap); + uuid_convert(header->uuid_link); +-- +1.7.1 + diff --git a/SOURCES/kvm-vdi-say-why-an-image-is-bad.patch b/SOURCES/kvm-vdi-say-why-an-image-is-bad.patch new file mode 100644 index 0000000..4807352 --- /dev/null +++ b/SOURCES/kvm-vdi-say-why-an-image-is-bad.patch @@ -0,0 +1,98 @@ +From ee2c4c17b2bf7a0f1b420096460d33d87792ef78 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:42 +0200 +Subject: [PATCH 04/20] vdi: say why an image is bad + +Message-id: <3fcc4a3635f7e4e2da9110df47e59d9727327707.1410897407.git.jcody@redhat.com> +Patchwork-id: 61208 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 03/15] vdi: say why an image is bad +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Instead of just putting it in debugging output, we can now put the +value in an Error. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 5b7aa9b56d1bfc79916262f380c3fc7961becb50) + +Conflicts: + block/vdi.c + +RHEL7 Conflict Notes: Conflict due to different patch order, from + a CVE commit. + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vdi.c | 25 ++++++++++++++++--------- + 1 files changed, 16 insertions(+), 9 deletions(-) + +diff --git a/block/vdi.c b/block/vdi.c +index 5e2fad5..b095bee 100644 +--- a/block/vdi.c ++++ b/block/vdi.c +@@ -412,39 +412,46 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, + ret = -EMEDIUMTYPE; + goto fail; + } else if (header.version != VDI_VERSION_1_1) { +- logout("unsupported version %u.%u\n", +- header.version >> 16, header.version & 0xffff); ++ error_setg(errp, "unsupported VDI image (version %u.%u)", ++ header.version >> 16, header.version & 0xffff); + ret = -ENOTSUP; + goto fail; + } else if (header.offset_bmap % SECTOR_SIZE != 0) { + /* We only support block maps which start on a sector boundary. */ +- logout("unsupported block map offset 0x%x B\n", header.offset_bmap); ++ error_setg(errp, "unsupported VDI image (unaligned block map offset " ++ "0x%x)", header.offset_bmap); + ret = -ENOTSUP; + goto fail; + } else if (header.offset_data % SECTOR_SIZE != 0) { + /* We only support data blocks which start on a sector boundary. */ +- logout("unsupported data offset 0x%x B\n", header.offset_data); ++ error_setg(errp, "unsupported VDI image (unaligned data offset 0x%x)", ++ header.offset_data); + ret = -ENOTSUP; + goto fail; + } else if (header.sector_size != SECTOR_SIZE) { +- logout("unsupported sector size %u B\n", header.sector_size); ++ error_setg(errp, "unsupported VDI image (sector size %u is not %u)", ++ header.sector_size, SECTOR_SIZE); + ret = -ENOTSUP; + goto fail; + } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { +- logout("unsupported block size %u B\n", header.block_size); ++ error_setg(errp, "unsupported VDI image (sector size %u is not %u)", ++ header.block_size, DEFAULT_CLUSTER_SIZE); + ret = -ENOTSUP; + goto fail; + } else if (header.disk_size > + (uint64_t)header.blocks_in_image * header.block_size) { +- logout("unsupported disk size %" PRIu64 " B\n", header.disk_size); ++ error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", " ++ "image bitmap has room for %" PRIu64 ")", ++ header.disk_size, ++ (uint64_t)header.blocks_in_image * header.block_size); + ret = -ENOTSUP; + goto fail; + } else if (!uuid_is_null(header.uuid_link)) { +- logout("link uuid != 0, unsupported\n"); ++ error_setg(errp, "unsupported VDI image (non-NULL link UUID)"); + ret = -ENOTSUP; + goto fail; + } else if (!uuid_is_null(header.uuid_parent)) { +- logout("parent uuid != 0, unsupported\n"); ++ error_setg(errp, "unsupported VDI image (non-NULL parent UUID)"); + ret = -ENOTSUP; + goto fail; + } else if (header.blocks_in_image > VDI_BLOCKS_IN_IMAGE_MAX) { +-- +1.7.1 + diff --git a/SOURCES/kvm-vfio-Don-t-cache-MSIMessage.patch b/SOURCES/kvm-vfio-Don-t-cache-MSIMessage.patch index 9e69317..fc66deb 100644 --- a/SOURCES/kvm-vfio-Don-t-cache-MSIMessage.patch +++ b/SOURCES/kvm-vfio-Don-t-cache-MSIMessage.patch @@ -1,18 +1,16 @@ -From f0550083eabcc0fff10cd8a55ed534f8563ce022 Mon Sep 17 00:00:00 2001 +From cc5b2c1e8ea83b1d1e377993c302322beb37bc50 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:03:20 +0200 -Subject: [PATCH 07/10] vfio: Don't cache MSIMessage +Subject: [PATCH 7/7] vfio: Don't cache MSIMessage Message-id: <20140807210320.11689.35203.stgit@gimli.home> Patchwork-id: 60483 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 6/6] vfio: Don't cache MSIMessage -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek -Upstream: 9b3af4c0e40f14b5173ad6e2d9fcc376207ec1dd - Commit 40509f7f added a test to avoid updating KVM MSI routes when the MSIMessage is unchanged and f4d45d47 switched to relying on this rather than doing our own comparison. Our cached msg is effectively @@ -21,8 +19,8 @@ unused now. Remove it. Signed-off-by: Alex Williamson Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 8 ++------ - 1 files changed, 2 insertions(+), 6 deletions(-) + hw/misc/vfio.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 688e2ef..abaa4c1 100644 @@ -76,5 +74,5 @@ index 688e2ef..abaa4c1 100644 /* Set interrupt type prior to possible interrupts */ -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-Fix-MSI-X-vector-expansion.patch b/SOURCES/kvm-vfio-Fix-MSI-X-vector-expansion.patch index a4a54d4..b9c0c0d 100644 --- a/SOURCES/kvm-vfio-Fix-MSI-X-vector-expansion.patch +++ b/SOURCES/kvm-vfio-Fix-MSI-X-vector-expansion.patch @@ -1,18 +1,16 @@ -From bdd720aafc6099e126b682f70e4163e1b2097594 Mon Sep 17 00:00:00 2001 +From e71b8aac80271011c1248a32782452c02bb23198 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:03:14 +0200 -Subject: [PATCH 06/10] vfio: Fix MSI-X vector expansion +Subject: [PATCH 6/7] vfio: Fix MSI-X vector expansion Message-id: <20140807210314.11689.89693.stgit@gimli.home> Patchwork-id: 60482 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 5/6] vfio: Fix MSI-X vector expansion -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek -Upstream: c048be5cc92ae201c339d46984476c4629275ed6 - When new MSI-X vectors are enabled we need to disable MSI-X and re-enable it with the correct number of vectors. That means we need to reprogram the eventfd triggers for each vector. Prior to f4d45d47 @@ -28,8 +26,8 @@ Signed-off-by: Alex Williamson Cc: qemu-stable@nongnu.org # QEMU 2.1 Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 38 +++++++++++++++++++++++++++++--------- - 1 files changed, 29 insertions(+), 9 deletions(-) + hw/misc/vfio.c | 38 +++++++++++++++++++++++++++++--------- + 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index bd37924..688e2ef 100644 @@ -91,5 +89,5 @@ index bd37924..688e2ef 100644 ret = ioctl(vdev->fd, VFIO_DEVICE_SET_IRQS, irq_set); -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-correct-debug-macro-typo.patch b/SOURCES/kvm-vfio-correct-debug-macro-typo.patch index d91ba42..10fedc9 100644 --- a/SOURCES/kvm-vfio-correct-debug-macro-typo.patch +++ b/SOURCES/kvm-vfio-correct-debug-macro-typo.patch @@ -1,20 +1,18 @@ -From 18f67233db4f428332e100ccb194090675db0cdb Mon Sep 17 00:00:00 2001 +From e91335b95ff98b38bfa8f054fda9ff8f4abdae87 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:02:57 +0200 -Subject: [PATCH 03/10] vfio: correct debug macro typo +Subject: [PATCH 3/7] vfio: correct debug macro typo Message-id: <20140807210257.11689.30368.stgit@gimli.home> Patchwork-id: 60479 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 2/6] vfio: correct debug macro typo -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek From: Bandan Das -Upstream: 8b6d14087d487203f4d1a67aeaddc3be6c73f49f - Change to DEBUG_VFIO in vfio_msi_interrupt() for debug messages to get printed @@ -22,8 +20,8 @@ Signed-off-by: Bandan Das Signed-off-by: Alex Williamson Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) + hw/misc/vfio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index b5387ca..7f6ebf9 100644 @@ -39,5 +37,5 @@ index b5387ca..7f6ebf9 100644 if (vdev->interrupt == VFIO_INT_MSIX) { -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch b/SOURCES/kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch index a2f925e..e7cb548 100644 --- a/SOURCES/kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch +++ b/SOURCES/kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch @@ -1,12 +1,13 @@ -From 8b417dd4a269341d4167ac7df64285869d37af58 Mon Sep 17 00:00:00 2001 +From ef5458e0c626a035c0de4b0b44e5fc0a38ab352c Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:02:51 +0200 -Subject: [PATCH 02/10] vfio-pci: Add debug config options to disable MSI/X KVM support +Subject: [PATCH 2/7] vfio-pci: Add debug config options to disable MSI/X KVM + support Message-id: <20140807210251.11689.35960.stgit@gimli.home> Patchwork-id: 60478 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 1/6] vfio-pci: Add debug config options to disable MSI/X KVM support -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek @@ -17,8 +18,8 @@ through correctly. Signed-off-by: Alex Williamson Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 24 ++++++++++++++++++++---- - 1 files changed, 20 insertions(+), 4 deletions(-) + hw/misc/vfio.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index b04170e..b5387ca 100644 @@ -78,5 +79,5 @@ index b04170e..b5387ca 100644 kvm_irqchip_add_irqfd_notifier(kvm_state, &vector->interrupt, vector->virq) < 0) { -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-pci-Fix-MSI-X-debug-code.patch b/SOURCES/kvm-vfio-pci-Fix-MSI-X-debug-code.patch index f480bf0..98e3a07 100644 --- a/SOURCES/kvm-vfio-pci-Fix-MSI-X-debug-code.patch +++ b/SOURCES/kvm-vfio-pci-Fix-MSI-X-debug-code.patch @@ -1,25 +1,23 @@ -From 1311f877741665964f5c6a56854a033ad704ef46 Mon Sep 17 00:00:00 2001 +From 6b9b6494bc17888edf8a9673e645fb0416aa6e3e Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:03:03 +0200 -Subject: [PATCH 04/10] vfio-pci: Fix MSI/X debug code +Subject: [PATCH 4/7] vfio-pci: Fix MSI/X debug code Message-id: <20140807210302.11689.73901.stgit@gimli.home> Patchwork-id: 60480 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 3/6] vfio-pci: Fix MSI/X debug code -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek -Upstream: 9035f8c09bebb63c0cc6014acf5c7066ef778aff - Use the correct MSI message function for debug info. Signed-off-by: Alex Williamson Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) + hw/misc/vfio.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 7f6ebf9..5f0460a 100644 @@ -38,5 +36,5 @@ index 7f6ebf9..5f0460a 100644 abort(); } -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-pci-Fix-MSI-X-masking-performance.patch b/SOURCES/kvm-vfio-pci-Fix-MSI-X-masking-performance.patch index 9731731..88d2e35 100644 --- a/SOURCES/kvm-vfio-pci-Fix-MSI-X-masking-performance.patch +++ b/SOURCES/kvm-vfio-pci-Fix-MSI-X-masking-performance.patch @@ -1,18 +1,16 @@ -From a48a4761390e9aa917ebef7628dfc72f905910ee Mon Sep 17 00:00:00 2001 +From 81ee28858d0082b300184c9fcfc10480c67aa74d Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 7 Aug 2014 21:03:08 +0200 -Subject: [PATCH 05/10] vfio-pci: Fix MSI-X masking performance +Subject: [PATCH 5/7] vfio-pci: Fix MSI-X masking performance Message-id: <20140807210308.11689.93757.stgit@gimli.home> Patchwork-id: 60481 O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 4/6] vfio-pci: Fix MSI-X masking performance -Bugzilla: 1110693 1110695 +Bugzilla: 1098976 RH-Acked-by: Bandan Das RH-Acked-by: Amos Kong RH-Acked-by: Laszlo Ersek -Upstream: f4d45d47826377722700894dbf7f47444527a9d2 - There are still old guests out there that over-exercise MSI-X masking. The current code completely sets-up and tears-down an MSI-X vector on the "use" and "release" callbacks. While this is functional, it can @@ -34,8 +32,8 @@ for newer guests with more well behaved MSI-X support. Signed-off-by: Alex Williamson Signed-off-by: Miroslav Rezanina --- - hw/misc/vfio.c | 233 +++++++++++++++++++++++++++++++------------------------ - 1 files changed, 131 insertions(+), 102 deletions(-) + hw/misc/vfio.c | 233 ++++++++++++++++++++++++++++++++------------------------- + 1 file changed, 131 insertions(+), 102 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 5f0460a..bd37924 100644 @@ -407,5 +405,5 @@ index 5f0460a..bd37924 100644 } -- -1.7.1 +1.8.3.1 diff --git a/SOURCES/kvm-vfio-pci-Fix-interrupt-disabling.patch b/SOURCES/kvm-vfio-pci-Fix-interrupt-disabling.patch new file mode 100644 index 0000000..3c4e0ee --- /dev/null +++ b/SOURCES/kvm-vfio-pci-Fix-interrupt-disabling.patch @@ -0,0 +1,74 @@ +From fdad8c197b91f1010e4f61147f27513a4f061e40 Mon Sep 17 00:00:00 2001 +From: Alex Williamson +Date: Mon, 12 Jan 2015 04:52:17 +0100 +Subject: [PATCH 1/3] vfio-pci: Fix interrupt disabling + +Message-id: <20150112045144.9215.59820.stgit@gimli.home> +Patchwork-id: 63242 +O-Subject: [RHEL7.1 qemu-kvm PATCH] vfio-pci: Fix interrupt disabling +Bugzilla: 1180942 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Bandan Das +RH-Acked-by: Laszlo Ersek + +Upstream: b3e27c3aee8f5a96debfe0346e9c0e3a641a8516 + +When disabling MSI/X interrupts the disable functions will leave the +device in INTx mode (when available). This matches how hardware +operates, INTx is enabled unless MSI/X is enabled (DisINTx is handled +separately). Therefore when we really want to disable all interrupts, +such as when removing the device, and we start with the device in +MSI/X mode, we need to pass through INTx on our way to being +completely quiesced. + +In well behaved situations, the guest driver will have shutdown the +device and it will start vfio_exitfn() in INTx mode, producing the +desired result. If hot-unplug causes the guest to crash, we may get +the device in MSI/X state, which will leave QEMU with a bogus handler +installed. + +Fix this by re-ordering our disable routine so that it should always +finish in VFIO_INT_NONE state, which is what all callers expect. + +Signed-off-by: Alex Williamson +Signed-off-by: Miroslav Rezanina +--- + hw/misc/vfio.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c +index abaa4c1..40b0923 100644 +--- a/hw/misc/vfio.c ++++ b/hw/misc/vfio.c +@@ -2353,16 +2353,19 @@ static void vfio_listener_release(VFIOContainer *container) + */ + static void vfio_disable_interrupts(VFIODevice *vdev) + { +- switch (vdev->interrupt) { +- case VFIO_INT_INTx: +- vfio_disable_intx(vdev); +- break; +- case VFIO_INT_MSI: +- vfio_disable_msi(vdev); +- break; +- case VFIO_INT_MSIX: ++ /* ++ * More complicated than it looks. Disabling MSI/X transitions the ++ * device to INTx mode (if supported). Therefore we need to first ++ * disable MSI/X and then cleanup by disabling INTx. ++ */ ++ if (vdev->interrupt == VFIO_INT_MSIX) { + vfio_disable_msix(vdev); +- break; ++ } else if (vdev->interrupt == VFIO_INT_MSI) { ++ vfio_disable_msi(vdev); ++ } ++ ++ if (vdev->interrupt == VFIO_INT_INTx) { ++ vfio_disable_intx(vdev); + } + } + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-vga-fix-invalid-read-after-free.patch b/SOURCES/kvm-vga-fix-invalid-read-after-free.patch new file mode 100644 index 0000000..c0cc8e5 --- /dev/null +++ b/SOURCES/kvm-vga-fix-invalid-read-after-free.patch @@ -0,0 +1,73 @@ +From 92ff5f7388ad0e0826c8ca6fc362b0f84a37f26c Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 12 Nov 2014 13:05:33 +0100 +Subject: [PATCH 31/41] vga: fix invalid read after free +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Message-id: <1415797533-28127-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 62323 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] vga: fix invalid read after free +Bugzilla: 1161890 +RH-Acked-by: dgibson +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini + +From: Marc-AndrĂ© Lureau + +After calling dpy_gfx_replace_surface(s->con, surface), the outer +surface is invalid. + +==5370== Invalid read of size 4 +==5370== at 0x460229: surface_bits_per_pixel (console.h:250) +==5370== by 0x466A81: get_depth_index (vga.c:1173) +==5370== by 0x467EC2: vga_draw_graphic (vga.c:1718) +==5370== by 0x4687A5: vga_update_display (vga.c:1914) +==5370== by 0x2A782E: qxl_hw_update (qxl.c:1766) +==5370== by 0x3EB83B: graphic_hw_update (console.c:254) +==5370== by 0x3FBE31: qemu_spice_display_refresh (spice-display.c:418) +==5370== by 0x2A7D01: display_refresh (qxl.c:1886) +==5370== by 0x3EEE1C: dpy_refresh (console.c:1436) +==5370== by 0x3EB543: gui_update (console.c:192) +==5370== by 0x3C43B3: timerlist_run_timers (qemu-timer.c:488) +==5370== by 0x3C4416: qemu_clock_run_timers (qemu-timer.c:499) +==5370== Address 0x22ffb1e0 is 0 bytes inside a block of size 56 free'd +==5370== at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) +==5370== by 0x4245FC: free_and_trace (vl.c:2771) +==5370== by 0x50899AE: g_free (gmem.c:252) +==5370== by 0x3EE8D3: qemu_free_displaysurface (console.c:1332) +==5370== by 0x3EEDB7: dpy_gfx_replace_surface (console.c:1427) +==5370== by 0x467EB6: vga_draw_graphic (vga.c:1714) +==5370== by 0x4687A5: vga_update_display (vga.c:1914) +==5370== by 0x2A782E: qxl_hw_update (qxl.c:1766) +==5370== by 0x3EB83B: graphic_hw_update (console.c:254) +==5370== by 0x3FBE31: qemu_spice_display_refresh (spice-display.c:418) +==5370== by 0x2A7D01: display_refresh (qxl.c:1886) +==5370== by 0x3EEE1C: dpy_refresh (console.c:1436) + +Signed-off-by: Marc-AndrĂ© Lureau +Reviewed-by: Gerd Hoffmann +Message-id: 1383664554-15248-1-git-send-email-marcandre.lureau@gmail.com +Signed-off-by: Anthony Liguori +(cherry picked from commit 2c8ebac7ccf51a8e683de593c4240d2ed7d592ec) +Signed-off-by: Miroslav Rezanina +--- + hw/display/vga.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/hw/display/vga.c b/hw/display/vga.c +index de5d63d..0761b9e 100644 +--- a/hw/display/vga.c ++++ b/hw/display/vga.c +@@ -1746,7 +1746,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) + } else if (is_buffer_shared(surface) && + (full_update || surface_data(surface) != s->vram_ptr + + (s->start_addr * 4))) { +- DisplaySurface *surface; + surface = qemu_create_displaysurface_from(disp_width, + height, depth, s->line_offset, + s->vram_ptr + (s->start_addr * 4), byteswap); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-allow-mapping-up-to-max-queue-size.patch b/SOURCES/kvm-virtio-allow-mapping-up-to-max-queue-size.patch index 415209d..698feb3 100644 --- a/SOURCES/kvm-virtio-allow-mapping-up-to-max-queue-size.patch +++ b/SOURCES/kvm-virtio-allow-mapping-up-to-max-queue-size.patch @@ -1,13 +1,13 @@ -From 7a967f4dd36ab8cba940bacda4c893829affcd8d Mon Sep 17 00:00:00 2001 +From c518aac987c63baaf6f039589c043e3da966974e Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:11:59 +0200 -Subject: [PATCH 09/30] virtio: allow mapping up to max queue size +Date: Wed, 14 May 2014 08:34:08 +0200 +Subject: [PATCH 17/31] virtio: allow mapping up to max queue size RH-Author: Michael S. Tsirkin -Message-id: <1400054952-6106-2-git-send-email-mst@redhat.com> -Patchwork-id: 58847 -O-Subject: [PATCH qemu-kvm RHEL7.0 2/2] virtio: allow mapping up to max queue size -Bugzilla: 1095765 +Message-id: <1400056377-6802-2-git-send-email-mst@redhat.com> +Patchwork-id: 58863 +O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] virtio: allow mapping up to max queue size +Bugzilla: 1095766 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong @@ -23,10 +23,10 @@ Cc: qemu-stable@nongnu.org Signed-off-by: Michael S. Tsirkin Upstream status: 937251408051e0489f78e4db3c92e045b147b38b -(in maintainer's tree, PULL request sent) +(in maintainer's tree, pull request sent) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095765 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095766 --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch b/SOURCES/kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch index d605897..19b5f8c 100644 --- a/SOURCES/kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch +++ b/SOURCES/kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch @@ -1,13 +1,13 @@ -From d1ada486bbdecd785762a192eae716a3484d4f16 Mon Sep 17 00:00:00 2001 +From 790375122726ecafec569bb31bbc68df7400f3b9 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:52 +0200 -Subject: [PATCH 05/30] virtio: avoid buffer overrun on incoming migration +Date: Wed, 14 May 2014 08:32:06 +0200 +Subject: [PATCH 13/31] virtio: avoid buffer overrun on incoming migration RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-10-git-send-email-mst@redhat.com> -Patchwork-id: 58843 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio: avoid buffer overrun on incoming migration -Bugzilla: 1095737 +Message-id: <1400056285-6688-10-git-send-email-mst@redhat.com> +Patchwork-id: 58859 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio: avoid buffer overrun on incoming migration +Bugzilla: 1095738 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong @@ -31,8 +31,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit 4b53c2c72cb5541cf394033b528a6fe2a86c0ac1) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095737 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095738 --- hw/virtio/virtio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SOURCES/kvm-virtio-balloon-fix-integer-overflow-in-memory-stats-.patch b/SOURCES/kvm-virtio-balloon-fix-integer-overflow-in-memory-stats-.patch new file mode 100644 index 0000000..9cd838d --- /dev/null +++ b/SOURCES/kvm-virtio-balloon-fix-integer-overflow-in-memory-stats-.patch @@ -0,0 +1,64 @@ +From 62ba92f33f1d727cff17f5d1b38fabfe0901f7ee Mon Sep 17 00:00:00 2001 +From: Luiz Capitulino +Date: Tue, 30 Sep 2014 01:08:31 +0200 +Subject: [PATCH 3/3] virtio-balloon: fix integer overflow in memory stats + feature + +Message-id: <20140929210831.1cc65ebe@redhat.com> +Patchwork-id: 61504 +O-Subject: [RHEL7.1 qemu-kvm PATCH] virtio-balloon: fix integer overflow in memory stats feature +Bugzilla: 1142290 +RH-Acked-by: Amit Shah +RH-Acked-by: Juan Quintela +RH-Acked-by: Markus Armbruster + +When a QMP client changes the polling interval time by setting +the guest-stats-polling-interval property, the interval value +is stored and manipulated as an int64_t variable. + +However, the balloon_stats_change_timer() function, which is +used to set the actual timer with the interval value, takes +an int instead, causing an overflow for big interval values. + +This commit fix this bug by changing balloon_stats_change_timer() +to take an int64_t and also it limits the polling interval value +to UINT_MAX to avoid other kinds of overflow. + +Signed-off-by: Luiz Capitulino +Reviewed-by: Eric Blake +Reviewed-by: Markus Armbruster +(cherry picked from commit 1f9296b51a26650916a2c4191268bb64057bdc5f) +Signed-off-by: Luiz Capitulino +Signed-off-by: Miroslav Rezanina +--- + hw/virtio/virtio-balloon.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c +index 76c607f..016dc60 100644 +--- a/hw/virtio/virtio-balloon.c ++++ b/hw/virtio/virtio-balloon.c +@@ -85,7 +85,7 @@ static void balloon_stats_destroy_timer(VirtIOBalloon *s) + } + } + +-static void balloon_stats_change_timer(VirtIOBalloon *s, int secs) ++static void balloon_stats_change_timer(VirtIOBalloon *s, int64_t secs) + { + qemu_mod_timer(s->stats_timer, qemu_get_clock_ms(vm_clock) + secs * 1000); + } +@@ -154,6 +154,11 @@ static void balloon_stats_set_poll_interval(Object *obj, struct Visitor *v, + return; + } + ++ if (value > UINT_MAX) { ++ error_setg(errp, "timer value is too big"); ++ return; ++ } ++ + if (value == s->stats_poll_interval) { + return; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-blk-Bypass-error-action-and-I-O-accounting-on.patch b/SOURCES/kvm-virtio-blk-Bypass-error-action-and-I-O-accounting-on.patch new file mode 100644 index 0000000..1ee46af --- /dev/null +++ b/SOURCES/kvm-virtio-blk-Bypass-error-action-and-I-O-accounting-on.patch @@ -0,0 +1,88 @@ +From 8406a85d6b78d2f3478a204b5eab0cd714fe9aa4 Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 16:29:53 +0100 +Subject: [PATCH 16/19] virtio-blk: Bypass error action and I/O accounting on + invalid r/w + +Message-id: <1414772996-17272-3-git-send-email-armbru@redhat.com> +Patchwork-id: 62014 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 2/5] virtio-blk: Bypass error action and I/O accounting on invalid r/w +Bugzilla: 1085232 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Fam Zheng + +When a device model's I/O operation fails, we execute the error +action. This lets layers above QEMU implement thin provisioning, or +attempt to correct errors before they reach the guest. But when the +I/O operation fails because it's invalid, reporting the error to the +guest is the only sensible action. + +If the guest's read or write asks for an invalid sector range, fail +the request right away, without considering the error action. No +change with error action BDRV_ACTION_REPORT. + +Furthermore, bypass I/O accounting, because we want to track only I/O +that actually reaches the block layer. + +The next commit will extend "invalid sector range" to cover attempts +to read/write beyond the end of the medium. + +Signed-off-by: Markus Armbruster +Signed-off-by: Kevin Wolf +(cherry picked from commit 42e38c1fd0199155d32f3464aedce282d3d7f6a1) + +Straightforward semantic conflict: requests still have to be freed +with g_free() because we don't have commit 671ec3f. + +Signed-off-by: Markus Armbruster +Signed-off-by: Miroslav Rezanina +--- + hw/block/virtio-blk.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c +index 0f1d3ec..ffb311c 100644 +--- a/hw/block/virtio-blk.c ++++ b/hw/block/virtio-blk.c +@@ -300,15 +300,16 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) + + sector = ldq_p(&req->out->sector); + +- bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE); +- + trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512); + + if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { +- virtio_blk_rw_complete(req, -EIO); ++ virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); ++ g_free(req); + return; + } + ++ bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE); ++ + if (mrb->num_writes == 32) { + virtio_submit_multiwrite(req->dev->bs, mrb); + } +@@ -330,14 +331,15 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req) + + sector = ldq_p(&req->out->sector); + +- bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_READ); +- + trace_virtio_blk_handle_read(req, sector, req->qiov.size / 512); + + if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { +- virtio_blk_rw_complete(req, -EIO); ++ virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); ++ g_free(req); + return; + } ++ ++ bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_READ); + bdrv_aio_readv(req->dev->bs, sector, &req->qiov, + req->qiov.size / BDRV_SECTOR_SIZE, + virtio_blk_rw_complete, req); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-blk-Factor-common-checks-out-of-virtio_blk_ha.patch b/SOURCES/kvm-virtio-blk-Factor-common-checks-out-of-virtio_blk_ha.patch new file mode 100644 index 0000000..05dad31 --- /dev/null +++ b/SOURCES/kvm-virtio-blk-Factor-common-checks-out-of-virtio_blk_ha.patch @@ -0,0 +1,74 @@ +From 08530984c8ea08a6e0494e91576ff24917c46e14 Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 16:29:52 +0100 +Subject: [PATCH 15/19] virtio-blk: Factor common checks out of + virtio_blk_handle_read/write() + +Message-id: <1414772996-17272-2-git-send-email-armbru@redhat.com> +Patchwork-id: 62018 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 1/5] virtio-blk: Factor common checks out of virtio_blk_handle_read/write() +Bugzilla: 1085232 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Fam Zheng + +Signed-off-by: Markus Armbruster +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit d0e14376eefc40b07c8fb42c132c2202c66dcb0b) +Signed-off-by: Miroslav Rezanina +--- + hw/block/virtio-blk.c | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c +index a96207d..0f1d3ec 100644 +--- a/hw/block/virtio-blk.c ++++ b/hw/block/virtio-blk.c +@@ -281,6 +281,18 @@ static void virtio_blk_handle_flush(VirtIOBlockReq *req, MultiReqBuffer *mrb) + bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req); + } + ++static bool virtio_blk_sect_range_ok(VirtIOBlock *dev, ++ uint64_t sector, size_t size) ++{ ++ if (sector & dev->sector_mask) { ++ return false; ++ } ++ if (size % dev->conf->logical_block_size) { ++ return false; ++ } ++ return true; ++} ++ + static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) + { + BlockRequest *blkreq; +@@ -292,11 +304,7 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) + + trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512); + +- if (sector & req->dev->sector_mask) { +- virtio_blk_rw_complete(req, -EIO); +- return; +- } +- if (req->qiov.size % req->dev->conf->logical_block_size) { ++ if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { + virtio_blk_rw_complete(req, -EIO); + return; + } +@@ -326,11 +334,7 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req) + + trace_virtio_blk_handle_read(req, sector, req->qiov.size / 512); + +- if (sector & req->dev->sector_mask) { +- virtio_blk_rw_complete(req, -EIO); +- return; +- } +- if (req->qiov.size % req->dev->conf->logical_block_size) { ++ if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { + virtio_blk_rw_complete(req, -EIO); + return; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-blk-Treat-read-write-beyond-end-as-invalid.patch b/SOURCES/kvm-virtio-blk-Treat-read-write-beyond-end-as-invalid.patch new file mode 100644 index 0000000..720a75e --- /dev/null +++ b/SOURCES/kvm-virtio-blk-Treat-read-write-beyond-end-as-invalid.patch @@ -0,0 +1,56 @@ +From 55767ddb818ef53eee50777bd276cbf7e7813bfb Mon Sep 17 00:00:00 2001 +From: Markus Armbruster +Date: Fri, 31 Oct 2014 16:29:54 +0100 +Subject: [PATCH 17/19] virtio-blk: Treat read/write beyond end as invalid + +Message-id: <1414772996-17272-4-git-send-email-armbru@redhat.com> +Patchwork-id: 62019 +O-Subject: [PATCH RHEL-7.1 qemu-kvm 3/5] virtio-blk: Treat read/write beyond end as invalid +Bugzilla: 1085232 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Fam Zheng + +The block layer fails such reads and writes just fine. However, they +then get treated like valid operations that fail: the error action +gets executed. Unwanted; reporting the error to the guest is the only +sensible action. + +Reject them before passing them to the block layer. This bypasses the +error action and I/O accounting. + +Signed-off-by: Markus Armbruster +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 3c2daac0b98952a858277878cb11294256b39e43) +Signed-off-by: Miroslav Rezanina +--- + hw/block/virtio-blk.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c +index ffb311c..4f6aa22 100644 +--- a/hw/block/virtio-blk.c ++++ b/hw/block/virtio-blk.c +@@ -284,12 +284,19 @@ static void virtio_blk_handle_flush(VirtIOBlockReq *req, MultiReqBuffer *mrb) + static bool virtio_blk_sect_range_ok(VirtIOBlock *dev, + uint64_t sector, size_t size) + { ++ uint64_t nb_sectors = size >> BDRV_SECTOR_BITS; ++ uint64_t total_sectors; ++ + if (sector & dev->sector_mask) { + return false; + } + if (size % dev->conf->logical_block_size) { + return false; + } ++ bdrv_get_geometry(dev->bs, &total_sectors); ++ if (sector > total_sectors || nb_sectors > total_sectors - sector) { ++ return false; ++ } + return true; + } + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch b/SOURCES/kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch index 0739415..51bc040 100644 --- a/SOURCES/kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch +++ b/SOURCES/kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch @@ -1,12 +1,12 @@ -From 75ccf361064e8eb2fc7f5e7606cbd0760c9baf7e Mon Sep 17 00:00:00 2001 +From e892a0cc154fecadbd209c4cac1ebcc9208173d9 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Mon, 4 Aug 2014 04:12:07 +0200 -Subject: [PATCH 08/10] virtio-net: Do not filter VLANs without F_CTRL_VLAN +Subject: [PATCH 1/4] virtio-net: Do not filter VLANs without F_CTRL_VLAN Message-id: <1407125528-27862-2-git-send-email-akong@redhat.com> Patchwork-id: 60415 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 1/2] virtio-net: Do not filter VLANs without F_CTRL_VLAN -Bugzilla: 1130149 +Bugzilla: 1065724 RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Xiao Wang RH-Acked-by: Vlad Yasevich @@ -24,6 +24,10 @@ Signed-off-by: Amos Kong Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 0b1eaa8803e680de9a05727355dfe3d306b81e17) +--- + hw/net/virtio-net.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + Signed-off-by: Miroslav Rezanina --- hw/net/virtio-net.c | 6 ++++++ diff --git a/SOURCES/kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch b/SOURCES/kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch index e8a07a0..97a25b0 100644 --- a/SOURCES/kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch +++ b/SOURCES/kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch @@ -1,12 +1,12 @@ -From 2bfc8b6bf5e03e3b8c0c7dc1743f719cc4273784 Mon Sep 17 00:00:00 2001 +From 89c377a3dbf9f2caf94f210025c96bc84f7c2a4d Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Mon, 4 Aug 2014 04:12:08 +0200 -Subject: [PATCH 09/10] virtio-net: add vlan receive state to RxFilterInfo +Subject: [PATCH 2/4] virtio-net: add vlan receive state to RxFilterInfo Message-id: <1407125528-27862-3-git-send-email-akong@redhat.com> Patchwork-id: 60416 O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 2/2] virtio-net: add vlan receive state to RxFilterInfo -Bugzilla: 1130149 +Bugzilla: 1065724 RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Xiao Wang RH-Acked-by: Vlad Yasevich @@ -28,6 +28,12 @@ Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Eric Blake (backport from commit f7bc8ef8091229a4bec0e2a40af90abb8dcb3834) +--- + hw/net/virtio-net.c | 42 +++++++++++++++++++++++++++++------------- + qapi-schema.json | 3 +++ + qmp-commands.hx | 2 ++ + 3 files changed, 34 insertions(+), 13 deletions(-) + Signed-off-by: Miroslav Rezanina --- hw/net/virtio-net.c | 42 +++++++++++++++++++++++++++++------------- diff --git a/SOURCES/kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch b/SOURCES/kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch index 7958f3d..70fb250 100644 --- a/SOURCES/kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch +++ b/SOURCES/kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch @@ -1,13 +1,13 @@ -From fbae1c1a80fc0c1495c86695f5f48ee1003c2a1a Mon Sep 17 00:00:00 2001 +From 798f06c3737233a836584a72565f8076907365d9 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:39 +0200 -Subject: [PATCH 01/30] virtio-net: fix buffer overflow on invalid state load +Date: Wed, 14 May 2014 08:31:36 +0200 +Subject: [PATCH 09/31] virtio-net: fix buffer overflow on invalid state load RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-1-git-send-email-mst@redhat.com> -Patchwork-id: 58839 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio-net: fix buffer overflow on invalid state load -Bugzilla: 1095677 +Message-id: <1400056285-6688-1-git-send-email-mst@redhat.com> +Patchwork-id: 58855 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio-net: fix buffer overflow on invalid state load +Bugzilla: 1095678 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong @@ -48,9 +48,9 @@ Reviewed-by: Laszlo Ersek Signed-off-by: Juan Quintela (cherry picked from commit 71f7fe48e10a8437c9d42d859389f37157f59980) -Bugzilla: 1095677 +Bugzilla: 1095678 Tested: on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 --- include/hw/virtio/virtio-net.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch b/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch index 21e157d..dc942a9 100644 --- a/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch +++ b/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch @@ -1,17 +1,16 @@ -From 2b6768100640ef4b0387f42391f5e9e82cf67284 Mon Sep 17 00:00:00 2001 +From 953a3b8344e504a7333ba9bb6df840d6d94ff872 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:45 +0200 -Subject: [PATCH 03/30] virtio-net: out-of-bounds buffer write on invalid state load +Date: Wed, 14 May 2014 08:31:47 +0200 +Subject: [PATCH 10/31] virtio-net: out-of-bounds buffer write on invalid state load RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-3-git-send-email-mst@redhat.com> -Patchwork-id: 58841 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio-net: out-of-bounds buffer write on invalid state load -Bugzilla: 1095689 +Message-id: <1400056285-6688-3-git-send-email-mst@redhat.com> +Patchwork-id: 58857 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio-net: out-of-bounds buffer write on invalid state load +Bugzilla: 1095690 RH-Acked-by: Dr. David Alan Gilbert (git) -RH-Acked-by: Juan Quintela -RH-Acked-by: Vlad Yasevich RH-Acked-by: Xiao Wang +RH-Acked-by: Juan Quintela CVE-2013-4150 QEMU 1.5.0 out-of-bounds buffer write in virtio_net_load()@hw/net/virtio-net.c @@ -45,8 +44,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit eea750a5623ddac7a61982eec8f1c93481857578) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla: 1095689 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla: 1095690 --- hw/net/virtio-net.c | 5 +++++ 1 file changed, 5 insertions(+) @@ -57,10 +56,10 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index f6ed241..f72be9f 100644 +index 2d559e0..007cc2a 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c -@@ -1334,6 +1334,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) +@@ -1327,6 +1327,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) } n->curr_queues = qemu_get_be16(f); diff --git a/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch b/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch index 9100648..8a55c1a 100644 --- a/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch +++ b/SOURCES/kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch @@ -1,16 +1,17 @@ -From a3f3310a41ed5af1c701fea5dd7892dd9409e7d8 Mon Sep 17 00:00:00 2001 +From 33ea847dbe677a3df68fecac80636050f72286ae Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:42 +0200 -Subject: [PATCH 02/30] virtio-net: out-of-bounds buffer write on load +Date: Wed, 14 May 2014 08:31:42 +0200 +Subject: [PATCH 11/31] virtio-net: out-of-bounds buffer write on load RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-2-git-send-email-mst@redhat.com> -Patchwork-id: 58840 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio-net: out-of-bounds buffer write on load -Bugzilla: 1095684 +Message-id: <1400056285-6688-2-git-send-email-mst@redhat.com> +Patchwork-id: 58856 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio-net: out-of-bounds buffer write on load +Bugzilla: 1095685 RH-Acked-by: Dr. David Alan Gilbert (git) -RH-Acked-by: Xiao Wang RH-Acked-by: Juan Quintela +RH-Acked-by: Xiao Wang +RH-Acked-by: Amos Kong CVE-2013-4149 QEMU 1.3.0 out-of-bounds buffer write in virtio_net_load()@hw/net/virtio-net.c @@ -33,9 +34,9 @@ Signed-off-by: Michael S. Tsirkin Signed-off-by: Juan Quintela (cherry picked from commit 98f93ddd84800f207889491e0b5d851386b459cf) -Bugzilla: 1095684 +Bugzilla: 1095685 Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 --- hw/net/virtio-net.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) @@ -46,7 +47,7 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index 2d559e0..f6ed241 100644 +index 007cc2a..f72be9f 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1273,10 +1273,17 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) diff --git a/SOURCES/kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch b/SOURCES/kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch index 4283207..0213d7b 100644 --- a/SOURCES/kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch +++ b/SOURCES/kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch @@ -1,16 +1,15 @@ -From 246b73b5e55eedcc30a213a685a46ad2f117862e Mon Sep 17 00:00:00 2001 +From 9dfb93fc21a678858e95e604339d95829f405724 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:49 +0200 -Subject: [PATCH 04/30] virtio: out-of-bounds buffer write on invalid state load +Date: Wed, 14 May 2014 08:31:53 +0200 +Subject: [PATCH 12/31] virtio: out-of-bounds buffer write on invalid state load RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-4-git-send-email-mst@redhat.com> -Patchwork-id: 58842 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio: out-of-bounds buffer write on invalid state load -Bugzilla: 1095694 +Message-id: <1400056285-6688-4-git-send-email-mst@redhat.com> +Patchwork-id: 58858 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio: out-of-bounds buffer write on invalid state load +Bugzilla: 1095695 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Juan Quintela -RH-Acked-by: Vlad Yasevich RH-Acked-by: Xiao Wang CVE-2013-4151 QEMU 1.0 out-of-bounds buffer write in @@ -32,8 +31,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit cc45995294b92d95319b4782750a3580cabdbc0c) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla: 1095694 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla: 1095695 --- hw/virtio/virtio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SOURCES/kvm-virtio-pci-Report-an-error-when-msix-vectors-init-fa.patch b/SOURCES/kvm-virtio-pci-Report-an-error-when-msix-vectors-init-fa.patch new file mode 100644 index 0000000..ddaa357 --- /dev/null +++ b/SOURCES/kvm-virtio-pci-Report-an-error-when-msix-vectors-init-fa.patch @@ -0,0 +1,54 @@ +From 31c38d22c1d0e852c05eb8d74295f940fc93aaa8 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Mon, 14 Jul 2014 02:38:04 -0500 +Subject: [CHANGE 23/29] virtio-pci: Report an error when msix vectors init + fails +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405305484-12175-1-git-send-email-famz@redhat.com> +Patchwork-id: 59873 +O-Subject: [RHEL-7 qemu-kvm PATCH] virtio-pci: Report an error when msix vectors init fails +Bugzilla: 1095645 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Dr. David Alan Gilbert (git) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1095645 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7695836 + +Currently vectors silently cleared to 0 if the initialization is failed, +but user should at least have one way to notice this. + +Signed-off-by: Fam Zheng +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin + +(cherry picked from commit c7ff54825b74f27c3aac85aad540542801630d0a) +Signed-off-by: Fam Zheng +--- + hw/virtio/virtio-pci.c | 2 ++ + 1 file changed, 2 insertions(+) + +Signed-off-by: jen +--- + hw/virtio/virtio-pci.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c +index 00df4aa..7c09ac4 100644 +--- a/hw/virtio/virtio-pci.c ++++ b/hw/virtio/virtio-pci.c +@@ -981,6 +981,8 @@ static void virtio_pci_device_plugged(DeviceState *d) + + if (proxy->nvectors && + msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { ++ error_report("unable to init msix vectors to %" PRIu32, ++ proxy->nvectors); + proxy->nvectors = 0; + } + +-- +1.9.3 + diff --git a/SOURCES/kvm-virtio-rng-check-return-value-of-virtio_load.patch b/SOURCES/kvm-virtio-rng-check-return-value-of-virtio_load.patch new file mode 100644 index 0000000..820121c --- /dev/null +++ b/SOURCES/kvm-virtio-rng-check-return-value-of-virtio_load.patch @@ -0,0 +1,55 @@ +From 590c54266333cf9b147144d80999086dc877aba3 Mon Sep 17 00:00:00 2001 +From: Amos Kong +Date: Mon, 4 Aug 2014 03:16:39 +0200 +Subject: [PATCH 3/4] virtio-rng: check return value of virtio_load() + +Message-id: <1407122199-6365-1-git-send-email-akong@redhat.com> +Patchwork-id: 60412 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] virtio-rng: check return value of virtio_load() +Bugzilla: 1116941 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Fam Zheng +RH-Acked-by: Amit Shah + +Bugzilla: 1116941 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7780748 +Upstream: it's fixed by commit 3902d49e, we don't need to + backport whole patch. + +virtio_load() might fail, we should check the return value. + +Signed-off-by: Amos Kong +--- + hw/virtio/virtio-rng.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/virtio/virtio-rng.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) + +diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c +index 6895146..83d4a55 100644 +--- a/hw/virtio/virtio-rng.c ++++ b/hw/virtio/virtio-rng.c +@@ -108,11 +108,16 @@ static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) + { + VirtIORNG *vrng = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(vrng); ++ int ret; + + if (version_id != 1) { + return -EINVAL; + } +- virtio_load(vdev, f); ++ ++ ret = virtio_load(vdev, f); ++ if (ret) { ++ return ret; ++ } + + /* We may have an element ready but couldn't process it due to a quota + * limit. Make sure to try again after live migration when the quota may +-- +1.7.1 + diff --git a/SOURCES/kvm-virtio-scsi-Fix-memory-leak-when-realize-failed.patch b/SOURCES/kvm-virtio-scsi-Fix-memory-leak-when-realize-failed.patch new file mode 100644 index 0000000..fa21f98 --- /dev/null +++ b/SOURCES/kvm-virtio-scsi-Fix-memory-leak-when-realize-failed.patch @@ -0,0 +1,41 @@ +From 4595453e4ff31019ccaa9732bbef5106f6d46e6b Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Tue, 4 Nov 2014 03:06:40 +0100 +Subject: [PATCH 6/9] virtio-scsi: Fix memory leak when realize failed + +Message-id: <1415070401-21222-3-git-send-email-famz@redhat.com> +Patchwork-id: 62061 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 2/3] virtio-scsi: Fix memory leak when realize failed +Bugzilla: 1089606 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Max Reitz + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit 93bd49aff9081bbe9440192db9da3676941f77a3) +Signed-off-by: Fam Zheng +Signed-off-by: Miroslav Rezanina + +Conflicts: + hw/scsi/virtio-scsi.c +Context conflict due to previous patch's resolution. +--- + hw/scsi/virtio-scsi.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c +index 73f5ad1..13df89d 100644 +--- a/hw/scsi/virtio-scsi.c ++++ b/hw/scsi/virtio-scsi.c +@@ -609,6 +609,7 @@ int virtio_scsi_common_init(VirtIOSCSICommon *s) + error_report("Invalid number of queues (= %" PRId32 "), " + "must be a positive integer less than %d.", + s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); ++ virtio_cleanup(vdev); + return -1; + } + s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-scsi-Fix-num_queue-input-validation.patch b/SOURCES/kvm-virtio-scsi-Fix-num_queue-input-validation.patch new file mode 100644 index 0000000..a484bdd --- /dev/null +++ b/SOURCES/kvm-virtio-scsi-Fix-num_queue-input-validation.patch @@ -0,0 +1,53 @@ +From 925c0124d8948ca9e2b9db5e5415beff758c752d Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Tue, 4 Nov 2014 03:06:41 +0100 +Subject: [PATCH 7/9] virtio-scsi: Fix num_queue input validation + +Message-id: <1415070401-21222-4-git-send-email-famz@redhat.com> +Patchwork-id: 62062 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 3/3] virtio-scsi: Fix num_queue input validation +Bugzilla: 1089606 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Max Reitz + +We need to count the ctrlq and eventq, and also cleanup before +returning. Besides, the format string should be unsigned. + +The number could never be less than zero. + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit 0ba1f53191221b541b938df86a39eeccfb87f996) +Signed-off-by: Fam Zheng +Signed-off-by: Miroslav Rezanina + +Conflicts: + hw/scsi/virtio-scsi.c +Straightforward resolution. +--- + hw/scsi/virtio-scsi.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c +index 13df89d..cda8f8a 100644 +--- a/hw/scsi/virtio-scsi.c ++++ b/hw/scsi/virtio-scsi.c +@@ -605,10 +605,11 @@ int virtio_scsi_common_init(VirtIOSCSICommon *s) + virtio_init(VIRTIO_DEVICE(s), "virtio-scsi", VIRTIO_ID_SCSI, + sizeof(VirtIOSCSIConfig)); + +- if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { +- error_report("Invalid number of queues (= %" PRId32 "), " ++ if (s->conf.num_queues == 0 || ++ s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX - 2) { ++ error_report("Invalid number of queues (= %" PRIu32 "), " + "must be a positive integer less than %d.", +- s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); ++ s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX - 2); + virtio_cleanup(vdev); + return -1; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-scsi-Plug-memory-leak-on-virtio_scsi_push_eve.patch b/SOURCES/kvm-virtio-scsi-Plug-memory-leak-on-virtio_scsi_push_eve.patch new file mode 100644 index 0000000..83a85c1 --- /dev/null +++ b/SOURCES/kvm-virtio-scsi-Plug-memory-leak-on-virtio_scsi_push_eve.patch @@ -0,0 +1,55 @@ +From 56c66eefb296121eca5c78c7ab17215671712045 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Mon, 3 Nov 2014 04:56:41 +0100 +Subject: [PATCH 4/9] virtio-scsi: Plug memory leak on virtio_scsi_push_event() + error path + +Message-id: <1414990601-21198-1-git-send-email-famz@redhat.com> +Patchwork-id: 62029 +O-Subject: [RHEL-7.1 qemu-kvm PATCH] virtio-scsi: Plug memory leak on virtio_scsi_push_event() error path +Bugzilla: 1088822 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Marcel Apfelbaum + +From: Markus Armbruster + +Spotted by Coverity. + +calling virtqueue_pop() without checking VIRTIO_CONFIG_S_DRIVER_OK first +is racy: we may use the queues before the guest set them up. + +Signed-off-by: Markus Armbruster +Cc: qemu-stable@nongnu.org +Signed-off-by: Paolo Bonzini +(cherry picked from commit 91e7fcca4743cf694eb0c8e7a8d938cf359b5bd8) +Signed-off-by: Fam Zheng +Signed-off-by: Miroslav Rezanina +--- + hw/scsi/virtio-scsi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c +index 7cf3e4b..35b3d65 100644 +--- a/hw/scsi/virtio-scsi.c ++++ b/hw/scsi/virtio-scsi.c +@@ -490,7 +490,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, + uint32_t event, uint32_t reason) + { + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); +- VirtIOSCSIReq *req = virtio_scsi_pop_req(s, vs->event_vq); ++ VirtIOSCSIReq *req; + VirtIOSCSIEvent *evt; + VirtIODevice *vdev = VIRTIO_DEVICE(s); + int in_size; +@@ -499,6 +499,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, + return; + } + ++ req = virtio_scsi_pop_req(s, vs->event_vq); + if (!req) { + s->events_dropped = true; + return; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-scsi-Report-error-if-num_queues-is-0-or-too-l.patch b/SOURCES/kvm-virtio-scsi-Report-error-if-num_queues-is-0-or-too-l.patch new file mode 100644 index 0000000..4808e59 --- /dev/null +++ b/SOURCES/kvm-virtio-scsi-Report-error-if-num_queues-is-0-or-too-l.patch @@ -0,0 +1,49 @@ +From c4f4c924bac393b2112ce89c66b825730327159f Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Tue, 4 Nov 2014 03:06:39 +0100 +Subject: [PATCH 5/9] virtio-scsi: Report error if num_queues is 0 or too large + +Message-id: <1415070401-21222-2-git-send-email-famz@redhat.com> +Patchwork-id: 62060 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/3] virtio-scsi: Report error if num_queues is 0 or too large +Bugzilla: 1089606 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Max Reitz + +No cmd vq surprises guest (Linux panics in virtscsi_probe), too many +queues abort qemu (in the following virtio_add_queue). + +Signed-off-by: Fam Zheng +Signed-off-by: Paolo Bonzini +(cherry picked from commit c9f6552803d852d593dec9ef5bb39b7a61091963) +Signed-off-by: Fam Zheng + +Downstream notes: changed error_setg -> error_report because downstream +oesn't have errp. Also changed "return;" -> "return -1". + +Signed-off-by: Miroslav Rezanina +--- + hw/scsi/virtio-scsi.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c +index 35b3d65..73f5ad1 100644 +--- a/hw/scsi/virtio-scsi.c ++++ b/hw/scsi/virtio-scsi.c +@@ -605,6 +605,12 @@ int virtio_scsi_common_init(VirtIOSCSICommon *s) + virtio_init(VIRTIO_DEVICE(s), "virtio-scsi", VIRTIO_ID_SCSI, + sizeof(VirtIOSCSIConfig)); + ++ if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) { ++ error_report("Invalid number of queues (= %" PRId32 "), " ++ "must be a positive integer less than %d.", ++ s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); ++ return -1; ++ } + s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); + s->sense_size = VIRTIO_SCSI_SENSE_SIZE; + s->cdb_size = VIRTIO_SCSI_CDB_SIZE; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch b/SOURCES/kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch index c0b9dda..ddfe32b 100644 --- a/SOURCES/kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch +++ b/SOURCES/kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch @@ -1,16 +1,16 @@ -From 1900368b14d425fdfe1b084892d7e2b86ba64903 Mon Sep 17 00:00:00 2001 +From 9dc2684d2d9c9f9e62b5e4260fcd0c254f58bb6d Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:55 +0200 -Subject: [PATCH 06/30] virtio-scsi: fix buffer overrun on invalid state load +Date: Wed, 14 May 2014 08:32:12 +0200 +Subject: [PATCH 14/31] virtio-scsi: fix buffer overrun on invalid state load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-11-git-send-email-mst@redhat.com> -Patchwork-id: 58844 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio-scsi: fix buffer overrun on invalid state load -Bugzilla: 1095741 +Message-id: <1400056285-6688-11-git-send-email-mst@redhat.com> +Patchwork-id: 58860 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio-scsi: fix buffer overrun on invalid state load +Bugzilla: 1095742 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong @@ -52,8 +52,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit 3c3ce981423e0d6c18af82ee62f1850c2cda5976) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095741 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095742 --- hw/scsi/virtio-scsi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SOURCES/kvm-virtio-serial-report-frontend-connection-state-via-m.patch b/SOURCES/kvm-virtio-serial-report-frontend-connection-state-via-m.patch new file mode 100644 index 0000000..311f945 --- /dev/null +++ b/SOURCES/kvm-virtio-serial-report-frontend-connection-state-via-m.patch @@ -0,0 +1,142 @@ +From b9295fa6535d7092f9234e63ed6b5670bd862d0c Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Tue, 22 Jul 2014 18:31:22 +0200 +Subject: [PATCH 02/11] virtio-serial: report frontend connection state via monitor + +Message-id: <1406053883-21237-2-git-send-email-lersek@redhat.com> +Patchwork-id: 60229 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/2] virtio-serial: report frontend connection state via monitor +Bugzilla: 1122151 +RH-Acked-by: Luiz Capitulino +RH-Acked-by: Amit Shah +RH-Acked-by: Eric Blake + +Libvirt wants to know about the guest-side connection state of some +virtio-serial ports (in particular the one(s) assigned to guest agent(s)). +Report such states with a new monitor event. + +RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376 +Signed-off-by: Laszlo Ersek +Reviewed-by: Eric Blake +Reviewed-by: Amit Shah +Signed-off-by: Luiz Capitulino + +RHEL-7 notes: manual reimplementation of upstream commit +e2ae6159de2482ee5e22532301eb7f2795828d07, because we don't have Wenchao +Xia's qapi-event series. + +Signed-off-by: Laszlo Ersek +--- + include/monitor/monitor.h | 1 + + hw/char/virtio-console.c | 17 ++++++++++++++--- + monitor.c | 2 ++ + QMP/qmp-events.txt | 16 ++++++++++++++++ + 4 files changed, 33 insertions(+), 3 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + QMP/qmp-events.txt | 16 ++++++++++++++++ + hw/char/virtio-console.c | 17 ++++++++++++++--- + include/monitor/monitor.h | 1 + + monitor.c | 2 ++ + 4 files changed, 33 insertions(+), 3 deletions(-) + +diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt +index fc4b7db..ec4e4b9 100644 +--- a/QMP/qmp-events.txt ++++ b/QMP/qmp-events.txt +@@ -485,6 +485,22 @@ Example: + "host": "127.0.0.1", "sasl_username": "luiz" } }, + "timestamp": { "seconds": 1263475302, "microseconds": 150772 } } + ++VSERPORT_CHANGE ++--------------- ++ ++Emitted when the guest opens or closes a virtio-serial port. ++ ++Data: ++ ++- "id": device identifier of the virtio-serial port (json-string) ++- "open": true if the guest has opened the virtio-serial port (json-bool) ++ ++Example: ++ ++{ "event": "VSERPORT_CHANGE", ++ "data": { "id": "channel0", "open": true }, ++ "timestamp": { "seconds": 1401385907, "microseconds": 422329 } } ++ + WAKEUP + ------ + +diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c +index 2e00ad2..1b01dcd 100644 +--- a/hw/char/virtio-console.c ++++ b/hw/char/virtio-console.c +@@ -14,6 +14,8 @@ + #include "qemu/error-report.h" + #include "trace.h" + #include "hw/virtio/virtio-serial.h" ++#include "monitor/monitor.h" ++#include "qapi/qmp/qjson.h" + + typedef struct VirtConsole { + VirtIOSerialPort port; +@@ -76,11 +78,20 @@ static ssize_t flush_buf(VirtIOSerialPort *port, + static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) + { + VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); ++ DeviceState *dev = DEVICE(port); + +- if (!vcon->chr) { +- return; ++ if (vcon->chr) { ++ qemu_chr_fe_set_open(vcon->chr, guest_connected); + } +- qemu_chr_fe_set_open(vcon->chr, guest_connected); ++ ++ if (dev->id) { ++ QObject *data; ++ ++ data = qobject_from_jsonf("{ 'id': %s, 'open': %i }", ++ dev->id, guest_connected); ++ monitor_protocol_event(QEVENT_VSERPORT_CHANGE, data); ++ qobject_decref(data); ++ } + } + + /* Readiness of the guest to accept data on a port */ +diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h +index dcce609..6c128e9 100644 +--- a/include/monitor/monitor.h ++++ b/include/monitor/monitor.h +@@ -52,6 +52,7 @@ typedef enum MonitorEvent { + QEVENT_SPICE_MIGRATE_COMPLETED, + QEVENT_GUEST_PANICKED, + QEVENT_BLOCK_IMAGE_CORRUPTED, ++ QEVENT_VSERPORT_CHANGE, + + /* Add to 'monitor_event_names' array in monitor.c when + * defining new events here */ +diff --git a/monitor.c b/monitor.c +index a6abfb5..798885d 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -506,6 +506,7 @@ static const char *monitor_event_names[] = { + [QEVENT_SPICE_MIGRATE_COMPLETED] = "SPICE_MIGRATE_COMPLETED", + [QEVENT_GUEST_PANICKED] = "GUEST_PANICKED", + [QEVENT_BLOCK_IMAGE_CORRUPTED] = "BLOCK_IMAGE_CORRUPTED", ++ [QEVENT_VSERPORT_CHANGE] = "VSERPORT_CHANGE", + }; + QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX) + +@@ -642,6 +643,7 @@ static void monitor_protocol_event_init(void) + monitor_protocol_event_throttle(QEVENT_RTC_CHANGE, 1000); + monitor_protocol_event_throttle(QEVENT_BALLOON_CHANGE, 1000); + monitor_protocol_event_throttle(QEVENT_WATCHDOG, 1000); ++ monitor_protocol_event_throttle(QEVENT_VSERPORT_CHANGE, 1000); + } + + /** +-- +1.7.1 + diff --git a/SOURCES/kvm-virtio-validate-config_len-on-load.patch b/SOURCES/kvm-virtio-validate-config_len-on-load.patch index 010d822..7da48d6 100644 --- a/SOURCES/kvm-virtio-validate-config_len-on-load.patch +++ b/SOURCES/kvm-virtio-validate-config_len-on-load.patch @@ -1,16 +1,15 @@ -From 3a5fadc2341be9efd129aed5cd04ebdba2cdc36d Mon Sep 17 00:00:00 2001 +From caaae46a54a676914cc3725b7fe892874825302d Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:07:58 +0200 -Subject: [PATCH 07/30] virtio: validate config_len on load +Date: Wed, 14 May 2014 08:32:21 +0200 +Subject: [PATCH 15/31] virtio: validate config_len on load RH-Author: Michael S. Tsirkin -Message-id: <1400054498-4366-17-git-send-email-mst@redhat.com> -Patchwork-id: 58845 -O-Subject: [PATCH qemu-kvm RHEL7.0] virtio: validate config_len on load -Bugzilla: 1095782 +Message-id: <1400056285-6688-17-git-send-email-mst@redhat.com> +Patchwork-id: 58861 +O-Subject: [PATCH qemu-kvm RHEL7.1] virtio: validate config_len on load +Bugzilla: 1095783 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Juan Quintela -RH-Acked-by: Vlad Yasevich RH-Acked-by: Xiao Wang Malformed input can have config_len in migration stream @@ -27,8 +26,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit a890a2f9137ac3cf5b607649e66a6f3a5512d8dc) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095782 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095783 --- hw/virtio/virtio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SOURCES/kvm-virtio-validate-num_sg-when-mapping.patch b/SOURCES/kvm-virtio-validate-num_sg-when-mapping.patch index 3d2fb95..579eb14 100644 --- a/SOURCES/kvm-virtio-validate-num_sg-when-mapping.patch +++ b/SOURCES/kvm-virtio-validate-num_sg-when-mapping.patch @@ -1,13 +1,13 @@ -From 24625e2c2eb6e259b621c7ff11671977fa705578 Mon Sep 17 00:00:00 2001 +From 89ada787b7d4c950c8bf95932c8c420d90c31c3c Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:11:56 +0200 -Subject: [PATCH 08/30] virtio: validate num_sg when mapping +Date: Wed, 14 May 2014 08:33:08 +0200 +Subject: [PATCH 16/31] virtio: validate num_sg when mapping RH-Author: Michael S. Tsirkin -Message-id: <1400054952-6106-1-git-send-email-mst@redhat.com> -Patchwork-id: 58846 -O-Subject: [PATCH qemu-kvm RHEL7.0 1/2] virtio: validate num_sg when mapping -Bugzilla: 1095765 +Message-id: <1400056377-6802-1-git-send-email-mst@redhat.com> +Patchwork-id: 58862 +O-Subject: [PATCH qemu-kvm RHEL7.1 1/2] virtio: validate num_sg when mapping +Bugzilla: 1095766 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong @@ -29,8 +29,8 @@ Signed-off-by: Juan Quintela (cherry picked from commit 36cf2a37132c7f01fa9adb5f95f5312b27742fd4) Tested: lightly on developer's box -Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 -Bugzilla:1095765 +Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 +Bugzilla:1095766 --- hw/virtio/virtio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SOURCES/kvm-vl.c-Output-error-on-invalid-machine-type.patch b/SOURCES/kvm-vl.c-Output-error-on-invalid-machine-type.patch new file mode 100644 index 0000000..a33ac0f --- /dev/null +++ b/SOURCES/kvm-vl.c-Output-error-on-invalid-machine-type.patch @@ -0,0 +1,80 @@ +From 82cd74f8a796d59fb527bea82b0557bfe558d2cc Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Wed, 11 Jun 2014 06:39:28 -0500 +Subject: [CHANGE 01/29] vl.c: Output error on invalid machine type +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Miroslav Rezanina +Message-id: <1402468768-15574-1-git-send-email-mrezanin@redhat.com> +Patchwork-id: 59190 +O-Subject: [RHEL7 qemu-kvm PATCH] vl.c: Output error on invalid machine type +Bugzilla: 990724 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Markus Armbruster +RH-Acked-by: Laszlo Ersek + +From: Miroslav Rezanina + +BZ: https://bugzilla.redhat.com/show_bug.cgi?id=990724 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7564904 + +Output error message using qemu's error_report() function when user +provides the invalid machine type on the command line. This also saves +time to find what issue is when you downgrade from one version of qemu +to another that doesn't support required machine type yet (the version +user downgraded to have to have this patch applied too, of course). + +Signed-off-by: Miroslav Rezanina +[Replace printf with error_printf, suggested by Markus Armbruster. - Paolo] +Signed-off-by: Paolo Bonzini + +Signed-off-by: jen + +Conflicts: + vl.c - missing commit 261747f176f6f2d88f8268aaebfdd1a1afe887e2 + (vl: Use MachineClass instead of global QEMUMachine list) + +Signed-off-by: Miroslav Rezanina +(cherry-picked from commit 025172d56e11ba3d86d0937933a23aab3b8606b1) +--- + vl.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +Signed-off-by: jen +--- + vl.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/vl.c b/vl.c +index 6ff06cc..a0099f6 100644 +--- a/vl.c ++++ b/vl.c +@@ -2578,13 +2578,18 @@ static QEMUMachine *machine_parse(const char *name) + if (machine) { + return machine; + } +- printf("Supported machines are:\n"); +- for (m = first_machine; m != NULL; m = m->next) { +- if (m->alias) { +- printf("%-20s %s (alias of %s)\n", m->alias, m->desc, m->name); ++ if (name && !is_help_option(name)) { ++ error_report("Unsupported machine type"); ++ error_printf("Use -machine help to list supported machines!\n"); ++ } else { ++ printf("Supported machines are:\n"); ++ for (m = first_machine; m != NULL; m = m->next) { ++ if (m->alias) { ++ printf("%-20s %s (alias of %s)\n", m->alias, m->desc, m->name); ++ } ++ printf("%-20s %s%s\n", m->name, m->desc, ++ m->is_default ? " (default)" : ""); + } +- printf("%-20s %s%s\n", m->name, m->desc, +- m->is_default ? " (default)" : ""); + } + exit(!name || !is_help_option(name)); + } +-- +1.9.3 + diff --git a/SOURCES/kvm-vmdk-Allow-vmdk_create-to-work-with-protocol.patch b/SOURCES/kvm-vmdk-Allow-vmdk_create-to-work-with-protocol.patch new file mode 100644 index 0000000..540b9be --- /dev/null +++ b/SOURCES/kvm-vmdk-Allow-vmdk_create-to-work-with-protocol.patch @@ -0,0 +1,308 @@ +From aa17f7f15bf2b0af9019a6935563d1f1a98ecc05 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:40 +0200 +Subject: [PATCH 02/20] vmdk: Allow vmdk_create to work with protocol + +Message-id: <1c4328440599c6f754b823e280f9b8212ae9c62b.1410897407.git.jcody@redhat.com> +Patchwork-id: 61206 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 01/15] vmdk: Allow vmdk_create to work with protocol +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Fam Zheng + +This improves vmdk_create to use bdrv_* functions to replace qemu_open +and other fd functions. The error handling are improved as well. One +difference is that bdrv_pwrite will round up buffer to sectors, so for +description file, an extra bdrv_truncate is used in the end to drop +inding zeros. + +Notes: + + - A bonus bug fix is correct endian is used in initializing GD entries. + + - ROUND_UP and DIV_ROUND_UP are used where possible. + +I tested that new code produces exactly the same file as previously. + +Signed-off-by: Fam Zheng +Tested-by: Peter Lieven +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 917703c179d4483d050fe112a2a81acec3d6ffd7) +Signed-off-by: Jeff Cody + +Signed-off-by: Miroslav Rezanina +--- + block/vmdk.c | 164 +++++++++++++++++++++++++++++++++------------------------ + 1 files changed, 95 insertions(+), 69 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 7532e11..4ff9531 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1464,23 +1464,33 @@ static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs, + } + + static int vmdk_create_extent(const char *filename, int64_t filesize, +- bool flat, bool compress, bool zeroed_grain) ++ bool flat, bool compress, bool zeroed_grain, ++ Error **errp) + { + int ret, i; +- int fd = 0; ++ BlockDriverState *bs = NULL; + VMDK4Header header; +- uint32_t tmp, magic, grains, gd_size, gt_size, gt_count; ++ Error *local_err; ++ uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count; ++ uint32_t *gd_buf = NULL; ++ int gd_buf_size; + +- fd = qemu_open(filename, +- O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, +- 0644); +- if (fd < 0) { +- return -errno; ++ ret = bdrv_create_file(filename, NULL, &local_err); ++ if (ret < 0) { ++ error_propagate(errp, local_err); ++ goto exit; + } ++ ++ ret = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err); ++ if (ret < 0) { ++ error_propagate(errp, local_err); ++ goto exit; ++ } ++ + if (flat) { +- ret = ftruncate(fd, filesize); ++ ret = bdrv_truncate(bs, filesize); + if (ret < 0) { +- ret = -errno; ++ error_setg(errp, "Could not truncate file"); + } + goto exit; + } +@@ -1491,24 +1501,23 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, + | (compress ? VMDK4_FLAG_COMPRESS | VMDK4_FLAG_MARKER : 0) + | (zeroed_grain ? VMDK4_FLAG_ZERO_GRAIN : 0); + header.compressAlgorithm = compress ? VMDK4_COMPRESSION_DEFLATE : 0; +- header.capacity = filesize / 512; ++ header.capacity = filesize / BDRV_SECTOR_SIZE; + header.granularity = 128; +- header.num_gtes_per_gt = 512; ++ header.num_gtes_per_gt = BDRV_SECTOR_SIZE; + +- grains = (filesize / 512 + header.granularity - 1) / header.granularity; +- gt_size = ((header.num_gtes_per_gt * sizeof(uint32_t)) + 511) >> 9; +- gt_count = +- (grains + header.num_gtes_per_gt - 1) / header.num_gtes_per_gt; +- gd_size = (gt_count * sizeof(uint32_t) + 511) >> 9; ++ grains = DIV_ROUND_UP(filesize / BDRV_SECTOR_SIZE, header.granularity); ++ gt_size = DIV_ROUND_UP(header.num_gtes_per_gt * sizeof(uint32_t), ++ BDRV_SECTOR_SIZE); ++ gt_count = DIV_ROUND_UP(grains, header.num_gtes_per_gt); ++ gd_sectors = DIV_ROUND_UP(gt_count * sizeof(uint32_t), BDRV_SECTOR_SIZE); + + header.desc_offset = 1; + header.desc_size = 20; + header.rgd_offset = header.desc_offset + header.desc_size; +- header.gd_offset = header.rgd_offset + gd_size + (gt_size * gt_count); ++ header.gd_offset = header.rgd_offset + gd_sectors + (gt_size * gt_count); + header.grain_offset = +- ((header.gd_offset + gd_size + (gt_size * gt_count) + +- header.granularity - 1) / header.granularity) * +- header.granularity; ++ ROUND_UP(header.gd_offset + gd_sectors + (gt_size * gt_count), ++ header.granularity); + /* swap endianness for all header fields */ + header.version = cpu_to_le32(header.version); + header.flags = cpu_to_le32(header.flags); +@@ -1528,48 +1537,55 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, + header.check_bytes[3] = 0xa; + + /* write all the data */ +- ret = qemu_write_full(fd, &magic, sizeof(magic)); +- if (ret != sizeof(magic)) { +- ret = -errno; ++ ret = bdrv_pwrite(bs, 0, &magic, sizeof(magic)); ++ if (ret < 0) { ++ error_set(errp, QERR_IO_ERROR); + goto exit; + } +- ret = qemu_write_full(fd, &header, sizeof(header)); +- if (ret != sizeof(header)) { +- ret = -errno; ++ ret = bdrv_pwrite(bs, sizeof(magic), &header, sizeof(header)); ++ if (ret < 0) { ++ error_set(errp, QERR_IO_ERROR); + goto exit; + } + +- ret = ftruncate(fd, le64_to_cpu(header.grain_offset) << 9); ++ ret = bdrv_truncate(bs, le64_to_cpu(header.grain_offset) << 9); + if (ret < 0) { +- ret = -errno; ++ error_setg(errp, "Could not truncate file"); + goto exit; + } + + /* write grain directory */ +- lseek(fd, le64_to_cpu(header.rgd_offset) << 9, SEEK_SET); +- for (i = 0, tmp = le64_to_cpu(header.rgd_offset) + gd_size; ++ gd_buf_size = gd_sectors * BDRV_SECTOR_SIZE; ++ gd_buf = g_malloc0(gd_buf_size); ++ for (i = 0, tmp = le64_to_cpu(header.rgd_offset) + gd_sectors; + i < gt_count; i++, tmp += gt_size) { +- ret = qemu_write_full(fd, &tmp, sizeof(tmp)); +- if (ret != sizeof(tmp)) { +- ret = -errno; +- goto exit; +- } ++ gd_buf[i] = cpu_to_le32(tmp); ++ } ++ ret = bdrv_pwrite(bs, le64_to_cpu(header.rgd_offset) * BDRV_SECTOR_SIZE, ++ gd_buf, gd_buf_size); ++ if (ret < 0) { ++ error_set(errp, QERR_IO_ERROR); ++ goto exit; + } + + /* write backup grain directory */ +- lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET); +- for (i = 0, tmp = le64_to_cpu(header.gd_offset) + gd_size; ++ for (i = 0, tmp = le64_to_cpu(header.gd_offset) + gd_sectors; + i < gt_count; i++, tmp += gt_size) { +- ret = qemu_write_full(fd, &tmp, sizeof(tmp)); +- if (ret != sizeof(tmp)) { +- ret = -errno; +- goto exit; +- } ++ gd_buf[i] = cpu_to_le32(tmp); ++ } ++ ret = bdrv_pwrite(bs, le64_to_cpu(header.gd_offset) * BDRV_SECTOR_SIZE, ++ gd_buf, gd_buf_size); ++ if (ret < 0) { ++ error_set(errp, QERR_IO_ERROR); ++ goto exit; + } + + ret = 0; +- exit: +- qemu_close(fd); ++exit: ++ if (bs) { ++ bdrv_unref(bs); ++ } ++ g_free(gd_buf); + return ret; + } + +@@ -1616,7 +1632,9 @@ static int filename_decompose(const char *filename, char *path, char *prefix, + static int vmdk_create(const char *filename, QEMUOptionParameter *options, + Error **errp) + { +- int fd, idx = 0; ++ int idx = 0; ++ BlockDriverState *new_bs = NULL; ++ Error *local_err; + char *desc = NULL; + int64_t total_size = 0, filesize; + const char *adapter_type = NULL; +@@ -1633,6 +1651,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + uint32_t parent_cid = 0xffffffff; + uint32_t number_heads = 16; + bool zeroed_grain = false; ++ uint32_t desc_offset = 0, desc_len; + const char desc_template[] = + "# Disk DescriptorFile\n" + "version=1\n" +@@ -1766,7 +1785,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + path, desc_filename); + + if (vmdk_create_extent(ext_filename, size, +- flat, compress, zeroed_grain)) { ++ flat, compress, zeroed_grain, errp)) { + ret = -EINVAL; + goto exit; + } +@@ -1774,7 +1793,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + + /* Format description line */ + snprintf(desc_line, sizeof(desc_line), +- desc_extent_line, size / 512, desc_filename); ++ desc_extent_line, size / BDRV_SECTOR_SIZE, desc_filename); + g_string_append(ext_desc_lines, desc_line); + } + /* generate descriptor file */ +@@ -1785,36 +1804,43 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + parent_desc_line, + ext_desc_lines->str, + (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), +- total_size / (int64_t)(63 * number_heads * 512), ++ total_size / ++ (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), + number_heads, + adapter_type); +- if (split || flat) { +- fd = qemu_open(filename, +- O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, +- 0644); ++ desc_len = strlen(desc); ++ /* the descriptor offset = 0x200 */ ++ if (!split && !flat) { ++ desc_offset = 0x200; + } else { +- fd = qemu_open(filename, +- O_WRONLY | O_BINARY | O_LARGEFILE, +- 0644); ++ ret = bdrv_create_file(filename, options, &local_err); ++ if (ret < 0) { ++ error_setg_errno(errp, -ret, "Could not create image file"); ++ goto exit; ++ } + } +- if (fd < 0) { +- ret = -errno; ++ ret = bdrv_file_open(&new_bs, filename, NULL, BDRV_O_RDWR, &local_err); ++ if (ret < 0) { ++ error_setg_errno(errp, -ret, "Could not write description"); + goto exit; + } +- /* the descriptor offset = 0x200 */ +- if (!split && !flat && 0x200 != lseek(fd, 0x200, SEEK_SET)) { +- ret = -errno; +- goto close_exit; ++ ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len); ++ if (ret < 0) { ++ error_setg_errno(errp, -ret, "Could not write description"); ++ goto exit; + } +- ret = qemu_write_full(fd, desc, strlen(desc)); +- if (ret != strlen(desc)) { +- ret = -errno; +- goto close_exit; ++ /* bdrv_pwrite write padding zeros to align to sector, we don't need that ++ * for description file */ ++ if (desc_offset == 0) { ++ ret = bdrv_truncate(new_bs, desc_len); ++ if (ret < 0) { ++ error_setg(errp, "Could not truncate file"); ++ } + } +- ret = 0; +-close_exit: +- qemu_close(fd); + exit: ++ if (new_bs) { ++ bdrv_unref(new_bs); ++ } + g_free(desc); + g_string_free(ext_desc_lines, true); + return ret; +-- +1.7.1 + diff --git a/SOURCES/kvm-vmdk-Check-VMFS-extent-line-field-number.patch b/SOURCES/kvm-vmdk-Check-VMFS-extent-line-field-number.patch new file mode 100644 index 0000000..610f1d5 --- /dev/null +++ b/SOURCES/kvm-vmdk-Check-VMFS-extent-line-field-number.patch @@ -0,0 +1,103 @@ +From 7322fbc37925671b3ac9e589ba8eb200b7aee7f3 Mon Sep 17 00:00:00 2001 +Message-Id: <7322fbc37925671b3ac9e589ba8eb200b7aee7f3.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:04:57 -0600 +Subject: [CHANGE 03/31] vmdk: Check VMFS extent line field number +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-4-git-send-email-famz@redhat.com> +Patchwork-id: 62676 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 03/30] vmdk: Check VMFS extent line field number +Bugzilla: 1134237 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +VMFS extent line in description file should be with 4 fields: + + RW VMFS "file-name.vmdk" + +Check the number explicitly and report error if offset is appended as +FLAT, which should be invalid format. + +Reported-by: Paolo Bonzini +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit b47053bd0359c68094d7a25a65687c0844771e34) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 9 +++++++-- + tests/qemu-iotests/059 | 14 ++++++++++++++ + tests/qemu-iotests/059.out | 5 +++++ + 3 files changed, 26 insertions(+), 2 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index a5b1f1c..d77eb37 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -750,9 +750,14 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, + return -EINVAL; + } + } else if (!strcmp(type, "VMFS")) { +- flat_offset = 0; ++ if (ret == 4) { ++ flat_offset = 0; ++ } else { ++ error_setg(errp, "Invalid extent lines:\n%s", p); ++ return -EINVAL; ++ } + } else if (ret != 4) { +- error_setg(errp, "Invalid extent lines: \n%s", p); ++ error_setg(errp, "Invalid extent lines:\n%s", p); + return -EINVAL; + } + +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index 23534c2..c8d92a0 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -81,6 +81,20 @@ IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G + $QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/' + + echo ++echo "=== Testing malformed VMFS extent description line ===" ++cat >"$TEST_IMG" < +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:01 -0600 +Subject: [CHANGE 07/31] vmdk: Check for overhead when opening +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-8-git-send-email-famz@redhat.com> +Patchwork-id: 62680 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 07/30] vmdk: Check for overhead when opening +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Report an error if file size is even smaller than metadata. + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 34ceed81f9ca31829448276dafe3d9151d66962c) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 7 +++++++ + tests/qemu-iotests/059 | 6 ++++++ + tests/qemu-iotests/059.out | 5 +++++ + 3 files changed, 18 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 4226baa..7ea3aef 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -636,6 +636,13 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + if (le32_to_cpu(header.flags) & VMDK4_FLAG_RGD) { + l1_backup_offset = le64_to_cpu(header.rgd_offset) << 9; + } ++ if (bdrv_getlength(file) < ++ le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE) { ++ error_report("File truncated, expecting at least %lld bytes", ++ le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE); ++ return -EINVAL; ++ } ++ + ret = vmdk_add_extent(bs, file, false, + le64_to_cpu(header.capacity), + le64_to_cpu(header.gd_offset) << 9, +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index dde4a59..71b7b49 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -98,6 +98,12 @@ EOF + _img_info + + echo ++echo "=== Testing truncated sparse ===" ++IMGOPTS="subformat=monolithicSparse" _make_test_img 100G ++truncate -s 10M $TEST_IMG ++_img_info ++ ++echo + echo "=== Testing version 3 ===" + _use_sample_img iotest-version3.vmdk.bz2 + _img_info +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index 75d9858..f4ca52d 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -2043,6 +2043,11 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent lines: + RW 12582912 VMFS "dummy.IMGFMT" 1 + + ++=== Testing truncated sparse === ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 ++qemu-img: File truncated, expecting at least 13172736 bytes ++qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'TEST_DIR/t.IMGFMT': Wrong medium type ++ + === Testing version 3 === + image: TEST_DIR/iotest-version3.IMGFMT + file format: IMGFMT +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Fix-big-flat-extent-IO.patch b/SOURCES/kvm-vmdk-Fix-big-flat-extent-IO.patch new file mode 100644 index 0000000..8e81401 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-big-flat-extent-IO.patch @@ -0,0 +1,152 @@ +From bacd188daed3fa0558836cbb6f7175155355c3d2 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:00 -0600 +Subject: [CHANGE 06/31] vmdk: Fix big flat extent IO +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-7-git-send-email-famz@redhat.com> +Patchwork-id: 62679 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 06/30] vmdk: Fix big flat extent IO +Bugzilla: 1134241 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Local variable "n" as int64_t avoids overflow with large sector number +calculation. See test case change for failure case. + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 585ea0c841df47c1542d33e17c5c6d532316ef74) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 4 +-- + tests/qemu-iotests/059 | 7 +++++ + tests/qemu-iotests/059.out | 74 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 83 insertions(+), 2 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index d77eb37..4226baa 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1344,8 +1344,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, + { + BDRVVmdkState *s = bs->opaque; + VmdkExtent *extent = NULL; +- int n, ret; +- int64_t index_in_cluster; ++ int ret; ++ int64_t index_in_cluster, n; + uint64_t extent_begin_sector, extent_relative_sector_num; + uint64_t cluster_offset; + VmdkMetaData m_data; +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index 9ef848b..dde4a59 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -102,6 +102,13 @@ echo "=== Testing version 3 ===" + _use_sample_img iotest-version3.vmdk.bz2 + _img_info + ++echo ++echo "=== Testing 4TB monolithicFlat creation and IO ===" ++IMGOPTS="subformat=monolithicFlat" _make_test_img 4T ++_img_info ++$QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io ++$QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io ++ + # success, all done + echo "*** done" + rm -f $seq.full +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index f161651..75d9858 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -2047,4 +2047,78 @@ RW 12582912 VMFS "dummy.IMGFMT" 1 + image: TEST_DIR/iotest-version3.IMGFMT + file format: IMGFMT + virtual size: 1.0G (1073741824 bytes) ++ ++=== Testing 4TB monolithicFlat creation and IO === ++Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104 ++image: TEST_DIR/iotest-version3.IMGFMT ++file format: IMGFMT ++virtual size: 4.0T (4398046511104 bytes) ++wrote 512/512 bytes at offset 966367641600 ++512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++e100000000: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000010: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000020: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000030: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000040: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000050: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000060: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000070: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000080: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000090: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000a0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000b0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000c0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000d0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000e0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000000f0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000100: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000110: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000120: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000130: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000140: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000150: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000160: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000170: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000180: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000190: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001a0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001b0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001c0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001d0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001e0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e1000001f0: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................ ++e100000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000002f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e100000390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++e1000003f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ++read 1024/1024 bytes at offset 966367641600 ++1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + *** done +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Fix-creating-big-description-file.patch b/SOURCES/kvm-vmdk-Fix-creating-big-description-file.patch new file mode 100644 index 0000000..c7cf1f0 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-creating-big-description-file.patch @@ -0,0 +1,2237 @@ +From 588b3f6445699e7a50fd9cde23d0997534423237 Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Thu, 31 Jul 2014 06:29:17 -0500 +Subject: [CHANGE 29/29] vmdk: Fix creating big description file +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1406788157-31723-1-git-send-email-famz@redhat.com> +Patchwork-id: 60347 +O-Subject: [RHEL-7 qemu-kvm PATCH] vmdk: Fix creating big description file +Bugzilla: 1039791 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Markus Armbruster + +The buffer for description file was 4096 which only covers a few +hundred of extents. This changes the buffer to dynamic allocated with +g_strdup_printf in order to support bigger cases. + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit af057fe74092df2e7a576448ddbdc0daac1370bf) +Signed-off-by: jen + +Conflicts: + tests/qemu-iotests/059 + tests/qemu-iotests/059.out + +Contextual conflict because vmdk version 3 sample image (981cbf5) is not +backported. + +Another one because we lack commit c9fbb99 "block: Use BDRV_O_NO_BACKING +where appropriate". + +Signed-off-by: jen +--- + block/vmdk.c | 62 +- + tests/qemu-iotests/059 | 5 + + tests/qemu-iotests/059.out | 2012 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 2055 insertions(+), 24 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 9e4b3b9..7532e11 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1617,7 +1617,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + Error **errp) + { + int fd, idx = 0; +- char desc[BUF_SIZE]; ++ char *desc = NULL; + int64_t total_size = 0, filesize; + const char *adapter_type = NULL; + const char *backing_file = NULL; +@@ -1625,7 +1625,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + int flags = 0; + int ret = 0; + bool flat, split, compress; +- char ext_desc_lines[BUF_SIZE] = ""; ++ GString *ext_desc_lines; + char path[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; + const int64_t split_size = 0x80000000; /* VMDK has constant split size */ + const char *desc_extent_line; +@@ -1653,8 +1653,11 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + "ddb.geometry.sectors = \"63\"\n" + "ddb.adapterType = \"%s\"\n"; + ++ ext_desc_lines = g_string_new(NULL); ++ + if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) { +- return -EINVAL; ++ ret = -EINVAL; ++ goto exit; + } + /* Read out options */ + while (options && options->name) { +@@ -1680,7 +1683,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + strcmp(adapter_type, "lsilogic") && + strcmp(adapter_type, "legacyESX")) { + error_setg(errp, "Unknown adapter type: '%s'", adapter_type); +- return -EINVAL; ++ ret = -EINVAL; ++ goto exit; + } + if (strcmp(adapter_type, "ide") != 0) { + /* that's the number of heads with which vmware operates when +@@ -1696,7 +1700,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + strcmp(fmt, "twoGbMaxExtentFlat") && + strcmp(fmt, "streamOptimized")) { + error_setg(errp, "Unknown subformat: '%s'", fmt); +- return -EINVAL; ++ ret = -EINVAL; ++ goto exit; + } + split = !(strcmp(fmt, "twoGbMaxExtentFlat") && + strcmp(fmt, "twoGbMaxExtentSparse")); +@@ -1710,22 +1715,25 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + } + if (flat && backing_file) { + error_setg(errp, "Flat image can't have backing file"); +- return -ENOTSUP; ++ ret = -ENOTSUP; ++ goto exit; + } + if (flat && zeroed_grain) { + error_setg(errp, "Flat image can't enable zeroed grain"); +- return -ENOTSUP; ++ ret = -ENOTSUP; ++ goto exit; + } + if (backing_file) { + BlockDriverState *bs = bdrv_new(""); + ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp); + if (ret != 0) { + bdrv_unref(bs); +- return ret; ++ goto exit; + } + if (strcmp(bs->drv->format_name, "vmdk")) { + bdrv_unref(bs); +- return -EINVAL; ++ ret = -EINVAL; ++ goto exit; + } + parent_cid = vmdk_read_cid(bs, 0); + bdrv_unref(bs); +@@ -1759,25 +1767,27 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + + if (vmdk_create_extent(ext_filename, size, + flat, compress, zeroed_grain)) { +- return -EINVAL; ++ ret = -EINVAL; ++ goto exit; + } + filesize -= size; + + /* Format description line */ + snprintf(desc_line, sizeof(desc_line), + desc_extent_line, size / 512, desc_filename); +- pstrcat(ext_desc_lines, sizeof(ext_desc_lines), desc_line); ++ g_string_append(ext_desc_lines, desc_line); + } + /* generate descriptor file */ +- snprintf(desc, sizeof(desc), desc_template, +- (unsigned int)time(NULL), +- parent_cid, +- fmt, +- parent_desc_line, +- ext_desc_lines, +- (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), +- total_size / (int64_t)(63 * number_heads * 512), number_heads, +- adapter_type); ++ desc = g_strdup_printf(desc_template, ++ (unsigned int)time(NULL), ++ parent_cid, ++ fmt, ++ parent_desc_line, ++ ext_desc_lines->str, ++ (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), ++ total_size / (int64_t)(63 * number_heads * 512), ++ number_heads, ++ adapter_type); + if (split || flat) { + fd = qemu_open(filename, + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, +@@ -1788,21 +1798,25 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + 0644); + } + if (fd < 0) { +- return -errno; ++ ret = -errno; ++ goto exit; + } + /* the descriptor offset = 0x200 */ + if (!split && !flat && 0x200 != lseek(fd, 0x200, SEEK_SET)) { + ret = -errno; +- goto exit; ++ goto close_exit; + } + ret = qemu_write_full(fd, desc, strlen(desc)); + if (ret != strlen(desc)) { + ret = -errno; +- goto exit; ++ goto close_exit; + } + ret = 0; +-exit: ++close_exit: + qemu_close(fd); ++exit: ++ g_free(desc); ++ g_string_free(ext_desc_lines, true); + return ret; + } + +diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 +index 36103e1..1ec34d5 100755 +--- a/tests/qemu-iotests/059 ++++ b/tests/qemu-iotests/059 +@@ -75,6 +75,11 @@ echo + echo "=== Testing monolithicFlat with zeroed_grain ===" + IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G + ++echo ++echo "=== Testing big twoGbMaxExtentFlat ===" ++IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G ++$QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/' ++ + # success, all done + echo "*** done" + rm -f $seq.full +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index 5829794..262e3b2 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -25,4 +25,2016 @@ virtual size: 2.0G (2147483648 bytes) + === Testing monolithicFlat with zeroed_grain === + qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 ++ ++=== Testing big twoGbMaxExtentFlat === ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 ++image: TEST_DIR/t.vmdk ++file format: vmdk ++virtual size: 1.0T (1073741824000 bytes) ++disk size: 16K ++Format specific information: ++ cid: XXXXXXXX ++ parent cid: XXXXXXXX ++ create type: twoGbMaxExtentFlat ++ extents: ++ [0]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f001.vmdk ++ format: FLAT ++ [1]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f002.vmdk ++ format: FLAT ++ [2]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f003.vmdk ++ format: FLAT ++ [3]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f004.vmdk ++ format: FLAT ++ [4]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f005.vmdk ++ format: FLAT ++ [5]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f006.vmdk ++ format: FLAT ++ [6]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f007.vmdk ++ format: FLAT ++ [7]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f008.vmdk ++ format: FLAT ++ [8]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f009.vmdk ++ format: FLAT ++ [9]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f010.vmdk ++ format: FLAT ++ [10]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f011.vmdk ++ format: FLAT ++ [11]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f012.vmdk ++ format: FLAT ++ [12]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f013.vmdk ++ format: FLAT ++ [13]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f014.vmdk ++ format: FLAT ++ [14]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f015.vmdk ++ format: FLAT ++ [15]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f016.vmdk ++ format: FLAT ++ [16]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f017.vmdk ++ format: FLAT ++ [17]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f018.vmdk ++ format: FLAT ++ [18]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f019.vmdk ++ format: FLAT ++ [19]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f020.vmdk ++ format: FLAT ++ [20]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f021.vmdk ++ format: FLAT ++ [21]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f022.vmdk ++ format: FLAT ++ [22]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f023.vmdk ++ format: FLAT ++ [23]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f024.vmdk ++ format: FLAT ++ [24]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f025.vmdk ++ format: FLAT ++ [25]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f026.vmdk ++ format: FLAT ++ [26]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f027.vmdk ++ format: FLAT ++ [27]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f028.vmdk ++ format: FLAT ++ [28]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f029.vmdk ++ format: FLAT ++ [29]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f030.vmdk ++ format: FLAT ++ [30]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f031.vmdk ++ format: FLAT ++ [31]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f032.vmdk ++ format: FLAT ++ [32]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f033.vmdk ++ format: FLAT ++ [33]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f034.vmdk ++ format: FLAT ++ [34]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f035.vmdk ++ format: FLAT ++ [35]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f036.vmdk ++ format: FLAT ++ [36]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f037.vmdk ++ format: FLAT ++ [37]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f038.vmdk ++ format: FLAT ++ [38]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f039.vmdk ++ format: FLAT ++ [39]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f040.vmdk ++ format: FLAT ++ [40]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f041.vmdk ++ format: FLAT ++ [41]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f042.vmdk ++ format: FLAT ++ [42]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f043.vmdk ++ format: FLAT ++ [43]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f044.vmdk ++ format: FLAT ++ [44]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f045.vmdk ++ format: FLAT ++ [45]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f046.vmdk ++ format: FLAT ++ [46]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f047.vmdk ++ format: FLAT ++ [47]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f048.vmdk ++ format: FLAT ++ [48]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f049.vmdk ++ format: FLAT ++ [49]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f050.vmdk ++ format: FLAT ++ [50]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f051.vmdk ++ format: FLAT ++ [51]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f052.vmdk ++ format: FLAT ++ [52]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f053.vmdk ++ format: FLAT ++ [53]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f054.vmdk ++ format: FLAT ++ [54]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f055.vmdk ++ format: FLAT ++ [55]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f056.vmdk ++ format: FLAT ++ [56]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f057.vmdk ++ format: FLAT ++ [57]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f058.vmdk ++ format: FLAT ++ [58]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f059.vmdk ++ format: FLAT ++ [59]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f060.vmdk ++ format: FLAT ++ [60]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f061.vmdk ++ format: FLAT ++ [61]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f062.vmdk ++ format: FLAT ++ [62]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f063.vmdk ++ format: FLAT ++ [63]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f064.vmdk ++ format: FLAT ++ [64]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f065.vmdk ++ format: FLAT ++ [65]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f066.vmdk ++ format: FLAT ++ [66]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f067.vmdk ++ format: FLAT ++ [67]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f068.vmdk ++ format: FLAT ++ [68]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f069.vmdk ++ format: FLAT ++ [69]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f070.vmdk ++ format: FLAT ++ [70]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f071.vmdk ++ format: FLAT ++ [71]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f072.vmdk ++ format: FLAT ++ [72]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f073.vmdk ++ format: FLAT ++ [73]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f074.vmdk ++ format: FLAT ++ [74]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f075.vmdk ++ format: FLAT ++ [75]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f076.vmdk ++ format: FLAT ++ [76]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f077.vmdk ++ format: FLAT ++ [77]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f078.vmdk ++ format: FLAT ++ [78]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f079.vmdk ++ format: FLAT ++ [79]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f080.vmdk ++ format: FLAT ++ [80]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f081.vmdk ++ format: FLAT ++ [81]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f082.vmdk ++ format: FLAT ++ [82]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f083.vmdk ++ format: FLAT ++ [83]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f084.vmdk ++ format: FLAT ++ [84]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f085.vmdk ++ format: FLAT ++ [85]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f086.vmdk ++ format: FLAT ++ [86]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f087.vmdk ++ format: FLAT ++ [87]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f088.vmdk ++ format: FLAT ++ [88]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f089.vmdk ++ format: FLAT ++ [89]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f090.vmdk ++ format: FLAT ++ [90]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f091.vmdk ++ format: FLAT ++ [91]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f092.vmdk ++ format: FLAT ++ [92]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f093.vmdk ++ format: FLAT ++ [93]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f094.vmdk ++ format: FLAT ++ [94]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f095.vmdk ++ format: FLAT ++ [95]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f096.vmdk ++ format: FLAT ++ [96]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f097.vmdk ++ format: FLAT ++ [97]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f098.vmdk ++ format: FLAT ++ [98]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f099.vmdk ++ format: FLAT ++ [99]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f100.vmdk ++ format: FLAT ++ [100]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f101.vmdk ++ format: FLAT ++ [101]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f102.vmdk ++ format: FLAT ++ [102]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f103.vmdk ++ format: FLAT ++ [103]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f104.vmdk ++ format: FLAT ++ [104]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f105.vmdk ++ format: FLAT ++ [105]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f106.vmdk ++ format: FLAT ++ [106]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f107.vmdk ++ format: FLAT ++ [107]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f108.vmdk ++ format: FLAT ++ [108]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f109.vmdk ++ format: FLAT ++ [109]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f110.vmdk ++ format: FLAT ++ [110]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f111.vmdk ++ format: FLAT ++ [111]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f112.vmdk ++ format: FLAT ++ [112]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f113.vmdk ++ format: FLAT ++ [113]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f114.vmdk ++ format: FLAT ++ [114]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f115.vmdk ++ format: FLAT ++ [115]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f116.vmdk ++ format: FLAT ++ [116]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f117.vmdk ++ format: FLAT ++ [117]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f118.vmdk ++ format: FLAT ++ [118]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f119.vmdk ++ format: FLAT ++ [119]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f120.vmdk ++ format: FLAT ++ [120]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f121.vmdk ++ format: FLAT ++ [121]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f122.vmdk ++ format: FLAT ++ [122]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f123.vmdk ++ format: FLAT ++ [123]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f124.vmdk ++ format: FLAT ++ [124]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f125.vmdk ++ format: FLAT ++ [125]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f126.vmdk ++ format: FLAT ++ [126]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f127.vmdk ++ format: FLAT ++ [127]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f128.vmdk ++ format: FLAT ++ [128]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f129.vmdk ++ format: FLAT ++ [129]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f130.vmdk ++ format: FLAT ++ [130]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f131.vmdk ++ format: FLAT ++ [131]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f132.vmdk ++ format: FLAT ++ [132]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f133.vmdk ++ format: FLAT ++ [133]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f134.vmdk ++ format: FLAT ++ [134]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f135.vmdk ++ format: FLAT ++ [135]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f136.vmdk ++ format: FLAT ++ [136]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f137.vmdk ++ format: FLAT ++ [137]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f138.vmdk ++ format: FLAT ++ [138]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f139.vmdk ++ format: FLAT ++ [139]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f140.vmdk ++ format: FLAT ++ [140]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f141.vmdk ++ format: FLAT ++ [141]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f142.vmdk ++ format: FLAT ++ [142]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f143.vmdk ++ format: FLAT ++ [143]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f144.vmdk ++ format: FLAT ++ [144]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f145.vmdk ++ format: FLAT ++ [145]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f146.vmdk ++ format: FLAT ++ [146]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f147.vmdk ++ format: FLAT ++ [147]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f148.vmdk ++ format: FLAT ++ [148]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f149.vmdk ++ format: FLAT ++ [149]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f150.vmdk ++ format: FLAT ++ [150]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f151.vmdk ++ format: FLAT ++ [151]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f152.vmdk ++ format: FLAT ++ [152]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f153.vmdk ++ format: FLAT ++ [153]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f154.vmdk ++ format: FLAT ++ [154]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f155.vmdk ++ format: FLAT ++ [155]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f156.vmdk ++ format: FLAT ++ [156]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f157.vmdk ++ format: FLAT ++ [157]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f158.vmdk ++ format: FLAT ++ [158]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f159.vmdk ++ format: FLAT ++ [159]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f160.vmdk ++ format: FLAT ++ [160]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f161.vmdk ++ format: FLAT ++ [161]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f162.vmdk ++ format: FLAT ++ [162]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f163.vmdk ++ format: FLAT ++ [163]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f164.vmdk ++ format: FLAT ++ [164]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f165.vmdk ++ format: FLAT ++ [165]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f166.vmdk ++ format: FLAT ++ [166]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f167.vmdk ++ format: FLAT ++ [167]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f168.vmdk ++ format: FLAT ++ [168]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f169.vmdk ++ format: FLAT ++ [169]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f170.vmdk ++ format: FLAT ++ [170]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f171.vmdk ++ format: FLAT ++ [171]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f172.vmdk ++ format: FLAT ++ [172]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f173.vmdk ++ format: FLAT ++ [173]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f174.vmdk ++ format: FLAT ++ [174]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f175.vmdk ++ format: FLAT ++ [175]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f176.vmdk ++ format: FLAT ++ [176]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f177.vmdk ++ format: FLAT ++ [177]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f178.vmdk ++ format: FLAT ++ [178]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f179.vmdk ++ format: FLAT ++ [179]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f180.vmdk ++ format: FLAT ++ [180]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f181.vmdk ++ format: FLAT ++ [181]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f182.vmdk ++ format: FLAT ++ [182]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f183.vmdk ++ format: FLAT ++ [183]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f184.vmdk ++ format: FLAT ++ [184]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f185.vmdk ++ format: FLAT ++ [185]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f186.vmdk ++ format: FLAT ++ [186]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f187.vmdk ++ format: FLAT ++ [187]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f188.vmdk ++ format: FLAT ++ [188]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f189.vmdk ++ format: FLAT ++ [189]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f190.vmdk ++ format: FLAT ++ [190]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f191.vmdk ++ format: FLAT ++ [191]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f192.vmdk ++ format: FLAT ++ [192]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f193.vmdk ++ format: FLAT ++ [193]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f194.vmdk ++ format: FLAT ++ [194]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f195.vmdk ++ format: FLAT ++ [195]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f196.vmdk ++ format: FLAT ++ [196]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f197.vmdk ++ format: FLAT ++ [197]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f198.vmdk ++ format: FLAT ++ [198]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f199.vmdk ++ format: FLAT ++ [199]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f200.vmdk ++ format: FLAT ++ [200]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f201.vmdk ++ format: FLAT ++ [201]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f202.vmdk ++ format: FLAT ++ [202]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f203.vmdk ++ format: FLAT ++ [203]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f204.vmdk ++ format: FLAT ++ [204]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f205.vmdk ++ format: FLAT ++ [205]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f206.vmdk ++ format: FLAT ++ [206]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f207.vmdk ++ format: FLAT ++ [207]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f208.vmdk ++ format: FLAT ++ [208]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f209.vmdk ++ format: FLAT ++ [209]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f210.vmdk ++ format: FLAT ++ [210]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f211.vmdk ++ format: FLAT ++ [211]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f212.vmdk ++ format: FLAT ++ [212]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f213.vmdk ++ format: FLAT ++ [213]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f214.vmdk ++ format: FLAT ++ [214]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f215.vmdk ++ format: FLAT ++ [215]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f216.vmdk ++ format: FLAT ++ [216]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f217.vmdk ++ format: FLAT ++ [217]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f218.vmdk ++ format: FLAT ++ [218]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f219.vmdk ++ format: FLAT ++ [219]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f220.vmdk ++ format: FLAT ++ [220]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f221.vmdk ++ format: FLAT ++ [221]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f222.vmdk ++ format: FLAT ++ [222]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f223.vmdk ++ format: FLAT ++ [223]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f224.vmdk ++ format: FLAT ++ [224]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f225.vmdk ++ format: FLAT ++ [225]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f226.vmdk ++ format: FLAT ++ [226]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f227.vmdk ++ format: FLAT ++ [227]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f228.vmdk ++ format: FLAT ++ [228]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f229.vmdk ++ format: FLAT ++ [229]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f230.vmdk ++ format: FLAT ++ [230]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f231.vmdk ++ format: FLAT ++ [231]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f232.vmdk ++ format: FLAT ++ [232]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f233.vmdk ++ format: FLAT ++ [233]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f234.vmdk ++ format: FLAT ++ [234]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f235.vmdk ++ format: FLAT ++ [235]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f236.vmdk ++ format: FLAT ++ [236]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f237.vmdk ++ format: FLAT ++ [237]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f238.vmdk ++ format: FLAT ++ [238]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f239.vmdk ++ format: FLAT ++ [239]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f240.vmdk ++ format: FLAT ++ [240]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f241.vmdk ++ format: FLAT ++ [241]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f242.vmdk ++ format: FLAT ++ [242]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f243.vmdk ++ format: FLAT ++ [243]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f244.vmdk ++ format: FLAT ++ [244]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f245.vmdk ++ format: FLAT ++ [245]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f246.vmdk ++ format: FLAT ++ [246]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f247.vmdk ++ format: FLAT ++ [247]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f248.vmdk ++ format: FLAT ++ [248]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f249.vmdk ++ format: FLAT ++ [249]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f250.vmdk ++ format: FLAT ++ [250]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f251.vmdk ++ format: FLAT ++ [251]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f252.vmdk ++ format: FLAT ++ [252]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f253.vmdk ++ format: FLAT ++ [253]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f254.vmdk ++ format: FLAT ++ [254]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f255.vmdk ++ format: FLAT ++ [255]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f256.vmdk ++ format: FLAT ++ [256]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f257.vmdk ++ format: FLAT ++ [257]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f258.vmdk ++ format: FLAT ++ [258]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f259.vmdk ++ format: FLAT ++ [259]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f260.vmdk ++ format: FLAT ++ [260]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f261.vmdk ++ format: FLAT ++ [261]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f262.vmdk ++ format: FLAT ++ [262]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f263.vmdk ++ format: FLAT ++ [263]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f264.vmdk ++ format: FLAT ++ [264]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f265.vmdk ++ format: FLAT ++ [265]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f266.vmdk ++ format: FLAT ++ [266]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f267.vmdk ++ format: FLAT ++ [267]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f268.vmdk ++ format: FLAT ++ [268]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f269.vmdk ++ format: FLAT ++ [269]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f270.vmdk ++ format: FLAT ++ [270]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f271.vmdk ++ format: FLAT ++ [271]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f272.vmdk ++ format: FLAT ++ [272]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f273.vmdk ++ format: FLAT ++ [273]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f274.vmdk ++ format: FLAT ++ [274]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f275.vmdk ++ format: FLAT ++ [275]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f276.vmdk ++ format: FLAT ++ [276]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f277.vmdk ++ format: FLAT ++ [277]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f278.vmdk ++ format: FLAT ++ [278]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f279.vmdk ++ format: FLAT ++ [279]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f280.vmdk ++ format: FLAT ++ [280]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f281.vmdk ++ format: FLAT ++ [281]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f282.vmdk ++ format: FLAT ++ [282]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f283.vmdk ++ format: FLAT ++ [283]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f284.vmdk ++ format: FLAT ++ [284]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f285.vmdk ++ format: FLAT ++ [285]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f286.vmdk ++ format: FLAT ++ [286]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f287.vmdk ++ format: FLAT ++ [287]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f288.vmdk ++ format: FLAT ++ [288]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f289.vmdk ++ format: FLAT ++ [289]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f290.vmdk ++ format: FLAT ++ [290]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f291.vmdk ++ format: FLAT ++ [291]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f292.vmdk ++ format: FLAT ++ [292]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f293.vmdk ++ format: FLAT ++ [293]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f294.vmdk ++ format: FLAT ++ [294]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f295.vmdk ++ format: FLAT ++ [295]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f296.vmdk ++ format: FLAT ++ [296]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f297.vmdk ++ format: FLAT ++ [297]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f298.vmdk ++ format: FLAT ++ [298]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f299.vmdk ++ format: FLAT ++ [299]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f300.vmdk ++ format: FLAT ++ [300]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f301.vmdk ++ format: FLAT ++ [301]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f302.vmdk ++ format: FLAT ++ [302]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f303.vmdk ++ format: FLAT ++ [303]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f304.vmdk ++ format: FLAT ++ [304]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f305.vmdk ++ format: FLAT ++ [305]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f306.vmdk ++ format: FLAT ++ [306]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f307.vmdk ++ format: FLAT ++ [307]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f308.vmdk ++ format: FLAT ++ [308]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f309.vmdk ++ format: FLAT ++ [309]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f310.vmdk ++ format: FLAT ++ [310]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f311.vmdk ++ format: FLAT ++ [311]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f312.vmdk ++ format: FLAT ++ [312]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f313.vmdk ++ format: FLAT ++ [313]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f314.vmdk ++ format: FLAT ++ [314]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f315.vmdk ++ format: FLAT ++ [315]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f316.vmdk ++ format: FLAT ++ [316]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f317.vmdk ++ format: FLAT ++ [317]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f318.vmdk ++ format: FLAT ++ [318]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f319.vmdk ++ format: FLAT ++ [319]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f320.vmdk ++ format: FLAT ++ [320]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f321.vmdk ++ format: FLAT ++ [321]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f322.vmdk ++ format: FLAT ++ [322]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f323.vmdk ++ format: FLAT ++ [323]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f324.vmdk ++ format: FLAT ++ [324]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f325.vmdk ++ format: FLAT ++ [325]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f326.vmdk ++ format: FLAT ++ [326]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f327.vmdk ++ format: FLAT ++ [327]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f328.vmdk ++ format: FLAT ++ [328]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f329.vmdk ++ format: FLAT ++ [329]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f330.vmdk ++ format: FLAT ++ [330]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f331.vmdk ++ format: FLAT ++ [331]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f332.vmdk ++ format: FLAT ++ [332]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f333.vmdk ++ format: FLAT ++ [333]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f334.vmdk ++ format: FLAT ++ [334]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f335.vmdk ++ format: FLAT ++ [335]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f336.vmdk ++ format: FLAT ++ [336]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f337.vmdk ++ format: FLAT ++ [337]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f338.vmdk ++ format: FLAT ++ [338]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f339.vmdk ++ format: FLAT ++ [339]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f340.vmdk ++ format: FLAT ++ [340]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f341.vmdk ++ format: FLAT ++ [341]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f342.vmdk ++ format: FLAT ++ [342]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f343.vmdk ++ format: FLAT ++ [343]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f344.vmdk ++ format: FLAT ++ [344]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f345.vmdk ++ format: FLAT ++ [345]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f346.vmdk ++ format: FLAT ++ [346]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f347.vmdk ++ format: FLAT ++ [347]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f348.vmdk ++ format: FLAT ++ [348]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f349.vmdk ++ format: FLAT ++ [349]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f350.vmdk ++ format: FLAT ++ [350]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f351.vmdk ++ format: FLAT ++ [351]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f352.vmdk ++ format: FLAT ++ [352]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f353.vmdk ++ format: FLAT ++ [353]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f354.vmdk ++ format: FLAT ++ [354]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f355.vmdk ++ format: FLAT ++ [355]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f356.vmdk ++ format: FLAT ++ [356]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f357.vmdk ++ format: FLAT ++ [357]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f358.vmdk ++ format: FLAT ++ [358]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f359.vmdk ++ format: FLAT ++ [359]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f360.vmdk ++ format: FLAT ++ [360]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f361.vmdk ++ format: FLAT ++ [361]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f362.vmdk ++ format: FLAT ++ [362]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f363.vmdk ++ format: FLAT ++ [363]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f364.vmdk ++ format: FLAT ++ [364]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f365.vmdk ++ format: FLAT ++ [365]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f366.vmdk ++ format: FLAT ++ [366]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f367.vmdk ++ format: FLAT ++ [367]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f368.vmdk ++ format: FLAT ++ [368]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f369.vmdk ++ format: FLAT ++ [369]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f370.vmdk ++ format: FLAT ++ [370]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f371.vmdk ++ format: FLAT ++ [371]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f372.vmdk ++ format: FLAT ++ [372]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f373.vmdk ++ format: FLAT ++ [373]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f374.vmdk ++ format: FLAT ++ [374]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f375.vmdk ++ format: FLAT ++ [375]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f376.vmdk ++ format: FLAT ++ [376]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f377.vmdk ++ format: FLAT ++ [377]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f378.vmdk ++ format: FLAT ++ [378]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f379.vmdk ++ format: FLAT ++ [379]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f380.vmdk ++ format: FLAT ++ [380]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f381.vmdk ++ format: FLAT ++ [381]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f382.vmdk ++ format: FLAT ++ [382]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f383.vmdk ++ format: FLAT ++ [383]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f384.vmdk ++ format: FLAT ++ [384]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f385.vmdk ++ format: FLAT ++ [385]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f386.vmdk ++ format: FLAT ++ [386]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f387.vmdk ++ format: FLAT ++ [387]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f388.vmdk ++ format: FLAT ++ [388]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f389.vmdk ++ format: FLAT ++ [389]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f390.vmdk ++ format: FLAT ++ [390]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f391.vmdk ++ format: FLAT ++ [391]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f392.vmdk ++ format: FLAT ++ [392]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f393.vmdk ++ format: FLAT ++ [393]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f394.vmdk ++ format: FLAT ++ [394]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f395.vmdk ++ format: FLAT ++ [395]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f396.vmdk ++ format: FLAT ++ [396]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f397.vmdk ++ format: FLAT ++ [397]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f398.vmdk ++ format: FLAT ++ [398]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f399.vmdk ++ format: FLAT ++ [399]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f400.vmdk ++ format: FLAT ++ [400]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f401.vmdk ++ format: FLAT ++ [401]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f402.vmdk ++ format: FLAT ++ [402]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f403.vmdk ++ format: FLAT ++ [403]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f404.vmdk ++ format: FLAT ++ [404]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f405.vmdk ++ format: FLAT ++ [405]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f406.vmdk ++ format: FLAT ++ [406]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f407.vmdk ++ format: FLAT ++ [407]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f408.vmdk ++ format: FLAT ++ [408]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f409.vmdk ++ format: FLAT ++ [409]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f410.vmdk ++ format: FLAT ++ [410]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f411.vmdk ++ format: FLAT ++ [411]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f412.vmdk ++ format: FLAT ++ [412]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f413.vmdk ++ format: FLAT ++ [413]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f414.vmdk ++ format: FLAT ++ [414]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f415.vmdk ++ format: FLAT ++ [415]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f416.vmdk ++ format: FLAT ++ [416]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f417.vmdk ++ format: FLAT ++ [417]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f418.vmdk ++ format: FLAT ++ [418]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f419.vmdk ++ format: FLAT ++ [419]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f420.vmdk ++ format: FLAT ++ [420]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f421.vmdk ++ format: FLAT ++ [421]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f422.vmdk ++ format: FLAT ++ [422]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f423.vmdk ++ format: FLAT ++ [423]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f424.vmdk ++ format: FLAT ++ [424]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f425.vmdk ++ format: FLAT ++ [425]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f426.vmdk ++ format: FLAT ++ [426]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f427.vmdk ++ format: FLAT ++ [427]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f428.vmdk ++ format: FLAT ++ [428]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f429.vmdk ++ format: FLAT ++ [429]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f430.vmdk ++ format: FLAT ++ [430]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f431.vmdk ++ format: FLAT ++ [431]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f432.vmdk ++ format: FLAT ++ [432]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f433.vmdk ++ format: FLAT ++ [433]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f434.vmdk ++ format: FLAT ++ [434]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f435.vmdk ++ format: FLAT ++ [435]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f436.vmdk ++ format: FLAT ++ [436]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f437.vmdk ++ format: FLAT ++ [437]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f438.vmdk ++ format: FLAT ++ [438]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f439.vmdk ++ format: FLAT ++ [439]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f440.vmdk ++ format: FLAT ++ [440]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f441.vmdk ++ format: FLAT ++ [441]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f442.vmdk ++ format: FLAT ++ [442]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f443.vmdk ++ format: FLAT ++ [443]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f444.vmdk ++ format: FLAT ++ [444]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f445.vmdk ++ format: FLAT ++ [445]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f446.vmdk ++ format: FLAT ++ [446]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f447.vmdk ++ format: FLAT ++ [447]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f448.vmdk ++ format: FLAT ++ [448]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f449.vmdk ++ format: FLAT ++ [449]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f450.vmdk ++ format: FLAT ++ [450]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f451.vmdk ++ format: FLAT ++ [451]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f452.vmdk ++ format: FLAT ++ [452]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f453.vmdk ++ format: FLAT ++ [453]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f454.vmdk ++ format: FLAT ++ [454]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f455.vmdk ++ format: FLAT ++ [455]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f456.vmdk ++ format: FLAT ++ [456]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f457.vmdk ++ format: FLAT ++ [457]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f458.vmdk ++ format: FLAT ++ [458]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f459.vmdk ++ format: FLAT ++ [459]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f460.vmdk ++ format: FLAT ++ [460]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f461.vmdk ++ format: FLAT ++ [461]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f462.vmdk ++ format: FLAT ++ [462]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f463.vmdk ++ format: FLAT ++ [463]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f464.vmdk ++ format: FLAT ++ [464]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f465.vmdk ++ format: FLAT ++ [465]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f466.vmdk ++ format: FLAT ++ [466]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f467.vmdk ++ format: FLAT ++ [467]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f468.vmdk ++ format: FLAT ++ [468]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f469.vmdk ++ format: FLAT ++ [469]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f470.vmdk ++ format: FLAT ++ [470]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f471.vmdk ++ format: FLAT ++ [471]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f472.vmdk ++ format: FLAT ++ [472]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f473.vmdk ++ format: FLAT ++ [473]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f474.vmdk ++ format: FLAT ++ [474]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f475.vmdk ++ format: FLAT ++ [475]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f476.vmdk ++ format: FLAT ++ [476]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f477.vmdk ++ format: FLAT ++ [477]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f478.vmdk ++ format: FLAT ++ [478]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f479.vmdk ++ format: FLAT ++ [479]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f480.vmdk ++ format: FLAT ++ [480]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f481.vmdk ++ format: FLAT ++ [481]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f482.vmdk ++ format: FLAT ++ [482]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f483.vmdk ++ format: FLAT ++ [483]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f484.vmdk ++ format: FLAT ++ [484]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f485.vmdk ++ format: FLAT ++ [485]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f486.vmdk ++ format: FLAT ++ [486]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f487.vmdk ++ format: FLAT ++ [487]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f488.vmdk ++ format: FLAT ++ [488]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f489.vmdk ++ format: FLAT ++ [489]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f490.vmdk ++ format: FLAT ++ [490]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f491.vmdk ++ format: FLAT ++ [491]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f492.vmdk ++ format: FLAT ++ [492]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f493.vmdk ++ format: FLAT ++ [493]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f494.vmdk ++ format: FLAT ++ [494]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f495.vmdk ++ format: FLAT ++ [495]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f496.vmdk ++ format: FLAT ++ [496]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f497.vmdk ++ format: FLAT ++ [497]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f498.vmdk ++ format: FLAT ++ [498]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f499.vmdk ++ format: FLAT ++ [499]: ++ virtual size: 2147483648 ++ filename: TEST_DIR/t-f500.vmdk ++ format: FLAT + *** done +-- +1.9.3 + diff --git a/SOURCES/kvm-vmdk-Fix-d-and-lld-to-PRI-in-format-strings.patch b/SOURCES/kvm-vmdk-Fix-d-and-lld-to-PRI-in-format-strings.patch new file mode 100644 index 0000000..622d402 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-d-and-lld-to-PRI-in-format-strings.patch @@ -0,0 +1,77 @@ +From b343626ad339c1bb1cd1867a9f9ade2067c6d345 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:10 -0600 +Subject: [CHANGE 16/31] vmdk: Fix %d and %lld to PRI* in format strings +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-17-git-send-email-famz@redhat.com> +Patchwork-id: 62689 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 16/30] vmdk: Fix %d and %lld to PRI* in format strings +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 4ab9dab5b9be0381e714d3fbe518689a72459011) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index e78a184..0a01a2b 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -640,7 +640,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + + if (le32_to_cpu(header.version) > 3) { + char buf[64]; +- snprintf(buf, sizeof(buf), "VMDK version %d", ++ snprintf(buf, sizeof(buf), "VMDK version %" PRId32, + le32_to_cpu(header.version)); + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, "vmdk", buf); +@@ -671,8 +671,9 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + } + if (bdrv_getlength(file) < + le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE) { +- error_setg(errp, "File truncated, expecting at least %lld bytes", +- le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE); ++ error_setg(errp, "File truncated, expecting at least %" PRId64 " bytes", ++ (int64_t)(le64_to_cpu(header.grain_offset) ++ * BDRV_SECTOR_SIZE)); + return -EINVAL; + } + +@@ -1717,7 +1718,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + "\n" + "ddb.virtualHWVersion = \"%d\"\n" + "ddb.geometry.cylinders = \"%" PRId64 "\"\n" +- "ddb.geometry.heads = \"%d\"\n" ++ "ddb.geometry.heads = \"%" PRIu32 "\"\n" + "ddb.geometry.sectors = \"63\"\n" + "ddb.adapterType = \"%s\"\n"; + +@@ -1777,9 +1778,9 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + strcmp(fmt, "twoGbMaxExtentFlat")); + compress = !strcmp(fmt, "streamOptimized"); + if (flat) { +- desc_extent_line = "RW %lld FLAT \"%s\" 0\n"; ++ desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n"; + } else { +- desc_extent_line = "RW %lld SPARSE \"%s\"\n"; ++ desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n"; + } + if (flat && backing_file) { + error_setg(errp, "Flat image can't have backing file"); +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Fix-format-specific-information-create-type-for.patch b/SOURCES/kvm-vmdk-Fix-format-specific-information-create-type-for.patch new file mode 100644 index 0000000..682581d --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-format-specific-information-create-type-for.patch @@ -0,0 +1,66 @@ +From a21710237f6c2cce366515fc2dacd4211bc31b7a Mon Sep 17 00:00:00 2001 +From: Fam Zheng +Date: Mon, 14 Jul 2014 02:05:27 -0500 +Subject: [CHANGE 22/29] vmdk: Fix format specific information (create type) + for streamOptimized +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1405303527-10117-1-git-send-email-famz@redhat.com> +Patchwork-id: 59872 +O-Subject: [RHEL-7 qemu-kvm PATCH] vmdk: Fix format specific information (create type) for streamOptimized +Bugzilla: 1029271 +RH-Acked-by: Markus Armbruster +RH-Acked-by: Kevin Wolf +RH-Acked-by: Stefan Hajnoczi + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1029271 +Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7695829 + +Previously the field is wrong: + + $ ./qemu-img create -f vmdk -o subformat=streamOptimized /tmp/a.vmdk 1G + + $ ./qemu-img info /tmp/a.vmdk + image: /tmp/a.vmdk + file format: vmdk + virtual size: 1.0G (1073741824 bytes) + disk size: 12K + Format specific information: + cid: 1390460459 + parent cid: 4294967295 +>>> create type: monolithicSparse + + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit d8a7b061ae01e5692cc994f05ad6480d8c170125) +Signed-off-by: Fam Zheng +--- + block/vmdk.c | 4 ++++ + 1 file changed, 4 insertions(+) + +Signed-off-by: jen +--- + block/vmdk.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index a966715..9e4b3b9 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -650,6 +650,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + } + extent->compressed = + le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE; ++ if (extent->compressed) { ++ g_free(s->create_type); ++ s->create_type = g_strdup("streamOptimized"); ++ } + extent->has_marker = le32_to_cpu(header.flags) & VMDK4_FLAG_MARKER; + extent->version = le32_to_cpu(header.version); + extent->has_zero_grain = le32_to_cpu(header.flags) & VMDK4_FLAG_ZERO_GRAIN; +-- +1.9.3 + diff --git a/SOURCES/kvm-vmdk-Fix-integer-overflow-in-offset-calculation.patch b/SOURCES/kvm-vmdk-Fix-integer-overflow-in-offset-calculation.patch new file mode 100644 index 0000000..e63a640 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-integer-overflow-in-offset-calculation.patch @@ -0,0 +1,175 @@ +From ed2a49b247a70b0e841296f5a63285390b842e06 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:24 -0600 +Subject: [CHANGE 30/31] vmdk: Fix integer overflow in offset calculation +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-31-git-send-email-famz@redhat.com> +Patchwork-id: 62703 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 30/30] vmdk: Fix integer overflow in offset calculation +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +This fixes the bug introduced by commit c6ac36e (vmdk: Optimize cluster +allocation). + +$ ~/build/master/qemu-io /stor/vm/arch.vmdk -c 'write 2G 1k' +write failed: Invalid argument + +Reported-by: Mark Cave-Ayland +Reviewed-by: Max Reitz +Signed-off-by: Fam Zheng +Message-id: 1411437381-11234-1-git-send-email-famz@redhat.com +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit d1319b077a4bd980ca1b8a167b02b519330dd26b) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson + +Conflicts: + tests/qemu-iotests/group + +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 2 +- + tests/qemu-iotests/105 | 70 ++++++++++++++++++++++++++++++++++++++++++++++ + tests/qemu-iotests/105.out | 21 ++++++++++++++ + tests/qemu-iotests/group | 1 + + 4 files changed, 93 insertions(+), 1 deletion(-) + create mode 100755 tests/qemu-iotests/105 + create mode 100644 tests/qemu-iotests/105.out + +diff --git a/block/vmdk.c b/block/vmdk.c +index 0593a1a..cfcaa84 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1116,7 +1116,7 @@ static int get_cluster_offset(BlockDriverState *bs, + uint32_t min_count, *l2_table; + bool zeroed = false; + int64_t ret; +- int32_t cluster_sector; ++ int64_t cluster_sector; + + if (m_data) { + m_data->valid = 0; +diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105 +new file mode 100755 +index 0000000..9bae49e +--- /dev/null ++++ b/tests/qemu-iotests/105 +@@ -0,0 +1,70 @@ ++#!/bin/bash ++# ++# Create, read, write big image ++# ++# Copyright (C) 2014 Red Hat, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++# creator ++owner=famz@redhat.com ++ ++seq=`basename $0` ++echo "QA output created by $seq" ++ ++here=`pwd` ++tmp=/tmp/$$ ++status=1 # failure is the default! ++ ++_cleanup() ++{ ++ _cleanup_test_img ++} ++trap "_cleanup; exit \$status" 0 1 2 3 15 ++ ++# get standard environment, filters and checks ++. ./common.rc ++. ./common.filter ++ ++_supported_fmt qcow2 vmdk vhdx qed ++_supported_proto generic ++_supported_os Linux ++_unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ ++ "subformat=twoGbMaxExtentSparse" ++ ++echo ++echo "creating large image" ++_make_test_img 16T ++ ++echo ++echo "small read" ++$QEMU_IO -c "read 1024 4096" "$TEST_IMG" | _filter_qemu_io ++ ++echo ++echo "small write" ++$QEMU_IO -c "write 8192 4096" "$TEST_IMG" | _filter_qemu_io ++ ++echo ++echo "small read at high offset" ++$QEMU_IO -c "read 14T 4096" "$TEST_IMG" | _filter_qemu_io ++ ++echo ++echo "small write at high offset" ++$QEMU_IO -c "write 14T 4096" "$TEST_IMG" | _filter_qemu_io ++ ++# success, all done ++echo "*** done" ++rm -f $seq.full ++status=0 +diff --git a/tests/qemu-iotests/105.out b/tests/qemu-iotests/105.out +new file mode 100644 +index 0000000..13ffcb5 +--- /dev/null ++++ b/tests/qemu-iotests/105.out +@@ -0,0 +1,21 @@ ++QA output created by 105 ++ ++creating large image ++Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=17592186044416 ++ ++small read ++read 4096/4096 bytes at offset 1024 ++4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++ ++small write ++wrote 4096/4096 bytes at offset 8192 ++4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++ ++small read at high offset ++read 4096/4096 bytes at offset 15393162788864 ++4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++ ++small write at high offset ++wrote 4096/4096 bytes at offset 15393162788864 ++4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ++*** done +diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group +index 572438e..cd8384a 100644 +--- a/tests/qemu-iotests/group ++++ b/tests/qemu-iotests/group +@@ -85,3 +85,4 @@ + 087 rw auto quick + 088 rw auto + 092 rw auto quick ++105 rw auto quick +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Fix-local_err-in-vmdk_create.patch b/SOURCES/kvm-vmdk-Fix-local_err-in-vmdk_create.patch new file mode 100644 index 0000000..749ece9 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-local_err-in-vmdk_create.patch @@ -0,0 +1,74 @@ +From 9602ee8eaedf151648fd8e47ce4673799ea567c3 Mon Sep 17 00:00:00 2001 +Message-Id: <9602ee8eaedf151648fd8e47ce4673799ea567c3.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:16 -0600 +Subject: [CHANGE 22/31] vmdk: Fix local_err in vmdk_create +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-23-git-send-email-famz@redhat.com> +Patchwork-id: 62695 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 22/30] vmdk: Fix local_err in vmdk_create +Bugzilla: 1134283 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +In vmdk_create and vmdk_create_extent, initialize local_err before using +it, and don't leak it on error. + +Reported-by: Markus Armbruster +Signed-off-by: Fam Zheng +Reviewed-by: Markus Armbruster +Signed-off-by: Kevin Wolf +(cherry picked from commit c13959c745a7e4965c94d19e3153d2c44459906d) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 94e8782..a625e7a 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1533,7 +1533,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, + int ret, i; + BlockDriverState *bs = NULL; + VMDK4Header header; +- Error *local_err; ++ Error *local_err = NULL; + uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count; + uint32_t *gd_buf = NULL; + int gd_buf_size; +@@ -1697,7 +1697,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + { + int idx = 0; + BlockDriverState *new_bs = NULL; +- Error *local_err; ++ Error *local_err = NULL; + char *desc = NULL; + int64_t total_size = 0, filesize; + const char *adapter_type = NULL; +@@ -1878,13 +1878,13 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + } else { + ret = bdrv_create_file(filename, options, &local_err); + if (ret < 0) { +- error_setg_errno(errp, -ret, "Could not create image file"); ++ error_propagate(errp, local_err); + goto exit; + } + } + ret = bdrv_file_open(&new_bs, filename, NULL, BDRV_O_RDWR, &local_err); + if (ret < 0) { +- error_setg_errno(errp, -ret, "Could not write description"); ++ error_propagate(errp, local_err); + goto exit; + } + ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len); +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch b/SOURCES/kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch new file mode 100644 index 0000000..2f65a69 --- /dev/null +++ b/SOURCES/kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch @@ -0,0 +1,73 @@ +From 6ddebaea406a462feec3ce5a3c04a19223ffc218 Mon Sep 17 00:00:00 2001 +Message-Id: <6ddebaea406a462feec3ce5a3c04a19223ffc218.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:11 -0600 +Subject: [CHANGE 17/31] vmdk: Fix "%x" to PRIx32 in format strings for cid +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-18-git-send-email-famz@redhat.com> +Patchwork-id: 62690 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 17/30] vmdk: Fix "%x" to PRIx32 in format strings for cid +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Signed-off-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 9b17031ac4efcf7a587f0e4eea82287a5329b6e7) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 0a01a2b..4cd2795 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -262,7 +262,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) + p_name = strstr(desc, cid_str); + if (p_name != NULL) { + p_name += cid_str_size; +- sscanf(p_name, "%x", &cid); ++ sscanf(p_name, "%" SCNx32, &cid); + } + + return cid; +@@ -290,7 +290,7 @@ static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid) + p_name = strstr(desc, "CID"); + if (p_name != NULL) { + p_name += sizeof("CID"); +- snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid); ++ snprintf(p_name, sizeof(desc) - (p_name - desc), "%" PRIx32 "\n", cid); + pstrcat(desc, sizeof(desc), tmp_desc); + } + +@@ -1705,8 +1705,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + const char desc_template[] = + "# Disk DescriptorFile\n" + "version=1\n" +- "CID=%x\n" +- "parentCID=%x\n" ++ "CID=%" PRIx32 "\n" ++ "parentCID=%" PRIx32 "\n" + "createType=\"%s\"\n" + "%s" + "\n" +@@ -1848,7 +1848,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options, + } + /* generate descriptor file */ + desc = g_strdup_printf(desc_template, +- (unsigned int)time(NULL), ++ (uint32_t)time(NULL), + parent_cid, + fmt, + parent_desc_line, +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Handle-failure-for-potentially-large-allocation.patch b/SOURCES/kvm-vmdk-Handle-failure-for-potentially-large-allocation.patch new file mode 100644 index 0000000..b26e159 --- /dev/null +++ b/SOURCES/kvm-vmdk-Handle-failure-for-potentially-large-allocation.patch @@ -0,0 +1,70 @@ +From 2db24b5a4b5a760a0cf014e7285b0f07f0a63762 Mon Sep 17 00:00:00 2001 +Message-Id: <2db24b5a4b5a760a0cf014e7285b0f07f0a63762.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:20 -0600 +Subject: [CHANGE 26/31] vmdk: Handle failure for potentially large allocations +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-27-git-send-email-famz@redhat.com> +Patchwork-id: 62699 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 26/30] vmdk: Handle failure for potentially large allocations +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Kevin Wolf + +Some code in the block layer makes potentially huge allocations. Failure +is not completely unexpected there, so avoid aborting qemu and handle +out-of-memory situations gracefully. + +This patch addresses the allocations in the vmdk block driver. + +Signed-off-by: Kevin Wolf +Reviewed-by: Stefan Hajnoczi +Reviewed-by: Benoit Canet +(cherry picked from commit d6e5993197990ff55c660714526681fa7028299e) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 70b616a..560dd43 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -456,7 +456,11 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent, + + /* read the L1 table */ + l1_size = extent->l1_size * sizeof(uint32_t); +- extent->l1_table = g_malloc(l1_size); ++ extent->l1_table = g_try_malloc(l1_size); ++ if (l1_size && extent->l1_table == NULL) { ++ return -ENOMEM; ++ } ++ + ret = bdrv_pread(extent->file, + extent->l1_table_offset, + extent->l1_table, +@@ -472,7 +476,11 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent, + } + + if (extent->l1_backup_table_offset) { +- extent->l1_backup_table = g_malloc(l1_size); ++ extent->l1_backup_table = g_try_malloc(l1_size); ++ if (l1_size && extent->l1_backup_table == NULL) { ++ ret = -ENOMEM; ++ goto fail_l1; ++ } + ret = bdrv_pread(extent->file, + extent->l1_backup_table_offset, + extent->l1_backup_table, +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Implement-.bdrv_get_info.patch b/SOURCES/kvm-vmdk-Implement-.bdrv_get_info.patch new file mode 100644 index 0000000..ce9a213 --- /dev/null +++ b/SOURCES/kvm-vmdk-Implement-.bdrv_get_info.patch @@ -0,0 +1,89 @@ +From 8783be68d7f1710ad79903bb7eb20ef12045c1e3 Mon Sep 17 00:00:00 2001 +Message-Id: <8783be68d7f1710ad79903bb7eb20ef12045c1e3.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:14 -0600 +Subject: [CHANGE 20/31] vmdk: Implement .bdrv_get_info() +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-21-git-send-email-famz@redhat.com> +Patchwork-id: 62693 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 20/30] vmdk: Implement .bdrv_get_info() +Bugzilla: 1134283 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +This will return cluster_size and needs_compressed_writes to caller, if all the +extents have the same value (or there's only one extent). Otherwise return +-ENOTSUP. + +cluster_size is only reported for sparse formats. + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 74fe188cd1a27a5565787152d8620f8b8d04c4f9) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 21 +++++++++++++++++++++ + tests/qemu-iotests/059.out | 1 + + 2 files changed, 22 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 157db7e..94e8782 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -2071,6 +2071,26 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) + return spec_info; + } + ++static int vmdk_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) ++{ ++ int i; ++ BDRVVmdkState *s = bs->opaque; ++ assert(s->num_extents); ++ bdi->needs_compressed_writes = s->extents[0].compressed; ++ if (!s->extents[0].flat) { ++ bdi->cluster_size = s->extents[0].cluster_sectors << BDRV_SECTOR_BITS; ++ } ++ /* See if we have multiple extents but they have different cases */ ++ for (i = 1; i < s->num_extents; i++) { ++ if (bdi->needs_compressed_writes != s->extents[i].compressed || ++ (bdi->cluster_size && bdi->cluster_size != ++ s->extents[i].cluster_sectors << BDRV_SECTOR_BITS)) { ++ return -ENOTSUP; ++ } ++ } ++ return 0; ++} ++ + static QEMUOptionParameter vmdk_create_options[] = { + { + .name = BLOCK_OPT_SIZE, +@@ -2127,6 +2147,7 @@ static BlockDriver bdrv_vmdk = { + .bdrv_has_zero_init = vmdk_has_zero_init, + .bdrv_get_specific_info = vmdk_get_specific_info, + .bdrv_refresh_limits = vmdk_refresh_limits, ++ .bdrv_get_info = vmdk_get_info, + + .create_options = vmdk_create_options, + }; +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index 7c9ef90..f226f71 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -2050,6 +2050,7 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least + image: TEST_DIR/iotest-version3.IMGFMT + file format: IMGFMT + virtual size: 1.0G (1073741824 bytes) ++cluster_size: 65536 + + === Testing 4TB monolithicFlat creation and IO === + Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104 +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Implement-.bdrv_write_compressed.patch b/SOURCES/kvm-vmdk-Implement-.bdrv_write_compressed.patch new file mode 100644 index 0000000..74ff08e --- /dev/null +++ b/SOURCES/kvm-vmdk-Implement-.bdrv_write_compressed.patch @@ -0,0 +1,67 @@ +From e865b795a4b0eaae50745ad7dd694447c72600c9 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:13 -0600 +Subject: [CHANGE 19/31] vmdk: Implement .bdrv_write_compressed +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-20-git-send-email-famz@redhat.com> +Patchwork-id: 62692 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 19/30] vmdk: Implement .bdrv_write_compressed +Bugzilla: 1134283 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +Add a wrapper function to support "compressed" path in qemu-img convert. +Only support streamOptimized subformat case for now (num_extents == 1 +and extent compression is true). + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit ba0ad89e2c3316ce26ca6576a3c5051f91bfc0fe) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 4cd2795..157db7e 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -1495,6 +1495,19 @@ static coroutine_fn int vmdk_co_write(BlockDriverState *bs, int64_t sector_num, + return ret; + } + ++static int vmdk_write_compressed(BlockDriverState *bs, ++ int64_t sector_num, ++ const uint8_t *buf, ++ int nb_sectors) ++{ ++ BDRVVmdkState *s = bs->opaque; ++ if (s->num_extents == 1 && s->extents[0].compressed) { ++ return vmdk_write(bs, sector_num, buf, nb_sectors, false, false); ++ } else { ++ return -ENOTSUP; ++ } ++} ++ + static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs, + int64_t sector_num, + int nb_sectors, +@@ -2104,6 +2117,7 @@ static BlockDriver bdrv_vmdk = { + .bdrv_reopen_prepare = vmdk_reopen_prepare, + .bdrv_read = vmdk_co_read, + .bdrv_write = vmdk_co_write, ++ .bdrv_write_compressed = vmdk_write_compressed, + .bdrv_co_write_zeroes = vmdk_co_write_zeroes, + .bdrv_close = vmdk_close, + .bdrv_create = vmdk_create, +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Optimize-cluster-allocation.patch b/SOURCES/kvm-vmdk-Optimize-cluster-allocation.patch new file mode 100644 index 0000000..2a201ed --- /dev/null +++ b/SOURCES/kvm-vmdk-Optimize-cluster-allocation.patch @@ -0,0 +1,475 @@ +From 5f9e1e7be5043bce75d940db098b497d3dd78813 Mon Sep 17 00:00:00 2001 +Message-Id: <5f9e1e7be5043bce75d940db098b497d3dd78813.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:19 -0600 +Subject: [CHANGE 25/31] vmdk: Optimize cluster allocation +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-26-git-send-email-famz@redhat.com> +Patchwork-id: 62698 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 25/30] vmdk: Optimize cluster allocation +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +This drops the unnecessary bdrv_truncate() from, and also improves, +cluster allocation code path. + +Before, when we need a new cluster, get_cluster_offset truncates the +image to bdrv_getlength() + cluster_size, and returns the offset of +added area, i.e. the image length before truncating. + +This is not efficient, so it's now rewritten as: + + - Save the extent file length when opening. + + - When allocating cluster, use the saved length as cluster offset. + + - Don't truncate image, because we'll anyway write data there: just + write any data at the EOF position, in descending priority: + + * New user data (cluster allocation happens in a write request). + + * Filling data in the beginning and/or ending of the new cluster, if + not covered by user data: either backing file content (COW), or + zero for standalone images. + +One major benifit of this change is, on host mounted NFS images, even +over a fast network, ftruncate is slow (see the example below). This +change significantly speeds up cluster allocation. Comparing by +converting a cirros image (296M) to VMDK on an NFS mount point, over +1Gbe LAN: + + $ time qemu-img convert cirros-0.3.1.img /mnt/a.raw -O vmdk + + Before: + real 0m21.796s + user 0m0.130s + sys 0m0.483s + + After: + real 0m2.017s + user 0m0.047s + sys 0m0.190s + +We also get rid of unchecked bdrv_getlength() and bdrv_truncate(), and +get a little more documentation in function comments. + +Tested that this passes qemu-iotests for all VMDK subformats. + +Signed-off-by: Fam Zheng +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit c6ac36e14569794b3f3e66f796dea19bc0f0b8d3) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 222 +++++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 140 insertions(+), 82 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index a625e7a..70b616a 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -106,6 +106,7 @@ typedef struct VmdkExtent { + uint32_t l2_cache_counts[L2_CACHE_SIZE]; + + int64_t cluster_sectors; ++ int64_t next_cluster_sector; + char *type; + } VmdkExtent; + +@@ -124,7 +125,6 @@ typedef struct BDRVVmdkState { + } BDRVVmdkState; + + typedef struct VmdkMetaData { +- uint32_t offset; + unsigned int l1_index; + unsigned int l2_index; + unsigned int l2_offset; +@@ -397,6 +397,7 @@ static int vmdk_add_extent(BlockDriverState *bs, + { + VmdkExtent *extent; + BDRVVmdkState *s = bs->opaque; ++ int64_t length; + + if (cluster_sectors > 0x200000) { + /* 0x200000 * 512Bytes = 1GB for one cluster is unrealistic */ +@@ -412,6 +413,11 @@ static int vmdk_add_extent(BlockDriverState *bs, + return -EFBIG; + } + ++ length = bdrv_getlength(file); ++ if (length < 0) { ++ return length; ++ } ++ + s->extents = g_realloc(s->extents, + (s->num_extents + 1) * sizeof(VmdkExtent)); + extent = &s->extents[s->num_extents]; +@@ -427,6 +433,8 @@ static int vmdk_add_extent(BlockDriverState *bs, + extent->l1_entry_sectors = l2_size * cluster_sectors; + extent->l2_size = l2_size; + extent->cluster_sectors = flat ? sectors : cluster_sectors; ++ extent->next_cluster_sector = ++ ROUND_UP(DIV_ROUND_UP(length, BDRV_SECTOR_SIZE), cluster_sectors); + + if (s->num_extents > 1) { + extent->end_sector = (*(extent - 1)).end_sector + extent->sectors; +@@ -953,57 +961,97 @@ static int vmdk_refresh_limits(BlockDriverState *bs) + return 0; + } + ++/** ++ * get_whole_cluster ++ * ++ * Copy backing file's cluster that covers @sector_num, otherwise write zero, ++ * to the cluster at @cluster_sector_num. ++ * ++ * If @skip_start_sector < @skip_end_sector, the relative range ++ * [@skip_start_sector, @skip_end_sector) is not copied or written, and leave ++ * it for call to write user data in the request. ++ */ + static int get_whole_cluster(BlockDriverState *bs, +- VmdkExtent *extent, +- uint64_t cluster_offset, +- uint64_t offset, +- bool allocate) ++ VmdkExtent *extent, ++ uint64_t cluster_sector_num, ++ uint64_t sector_num, ++ uint64_t skip_start_sector, ++ uint64_t skip_end_sector) + { + int ret = VMDK_OK; +- uint8_t *whole_grain = NULL; ++ int64_t cluster_bytes; ++ uint8_t *whole_grain; + ++ /* For COW, align request sector_num to cluster start */ ++ sector_num = QEMU_ALIGN_DOWN(sector_num, extent->cluster_sectors); ++ cluster_bytes = extent->cluster_sectors << BDRV_SECTOR_BITS; ++ whole_grain = qemu_blockalign(bs, cluster_bytes); ++ ++ if (!bs->backing_hd) { ++ memset(whole_grain, 0, skip_start_sector << BDRV_SECTOR_BITS); ++ memset(whole_grain + (skip_end_sector << BDRV_SECTOR_BITS), 0, ++ cluster_bytes - (skip_end_sector << BDRV_SECTOR_BITS)); ++ } ++ ++ assert(skip_end_sector <= extent->cluster_sectors); + /* we will be here if it's first write on non-exist grain(cluster). + * try to read from parent image, if exist */ +- if (bs->backing_hd) { +- whole_grain = +- qemu_blockalign(bs, extent->cluster_sectors << BDRV_SECTOR_BITS); +- if (!vmdk_is_cid_valid(bs)) { +- ret = VMDK_ERROR; +- goto exit; +- } ++ if (bs->backing_hd && !vmdk_is_cid_valid(bs)) { ++ ret = VMDK_ERROR; ++ goto exit; ++ } + +- /* floor offset to cluster */ +- offset -= offset % (extent->cluster_sectors * 512); +- ret = bdrv_read(bs->backing_hd, offset >> 9, whole_grain, +- extent->cluster_sectors); ++ /* Read backing data before skip range */ ++ if (skip_start_sector > 0) { ++ if (bs->backing_hd) { ++ ret = bdrv_read(bs->backing_hd, sector_num, ++ whole_grain, skip_start_sector); ++ if (ret < 0) { ++ ret = VMDK_ERROR; ++ goto exit; ++ } ++ } ++ ret = bdrv_write(extent->file, cluster_sector_num, whole_grain, ++ skip_start_sector); + if (ret < 0) { + ret = VMDK_ERROR; + goto exit; + } +- +- /* Write grain only into the active image */ +- ret = bdrv_write(extent->file, cluster_offset, whole_grain, +- extent->cluster_sectors); ++ } ++ /* Read backing data after skip range */ ++ if (skip_end_sector < extent->cluster_sectors) { ++ if (bs->backing_hd) { ++ ret = bdrv_read(bs->backing_hd, sector_num + skip_end_sector, ++ whole_grain + (skip_end_sector << BDRV_SECTOR_BITS), ++ extent->cluster_sectors - skip_end_sector); ++ if (ret < 0) { ++ ret = VMDK_ERROR; ++ goto exit; ++ } ++ } ++ ret = bdrv_write(extent->file, cluster_sector_num + skip_end_sector, ++ whole_grain + (skip_end_sector << BDRV_SECTOR_BITS), ++ extent->cluster_sectors - skip_end_sector); + if (ret < 0) { + ret = VMDK_ERROR; + goto exit; + } + } ++ + exit: + qemu_vfree(whole_grain); + return ret; + } + +-static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData *m_data) ++static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData *m_data, ++ uint32_t offset) + { +- uint32_t offset; +- QEMU_BUILD_BUG_ON(sizeof(offset) != sizeof(m_data->offset)); +- offset = cpu_to_le32(m_data->offset); ++ offset = cpu_to_le32(offset); + /* update L2 table */ + if (bdrv_pwrite_sync( + extent->file, + ((int64_t)m_data->l2_offset * 512) +- + (m_data->l2_index * sizeof(m_data->offset)), ++ + (m_data->l2_index * sizeof(offset)), + &offset, sizeof(offset)) < 0) { + return VMDK_ERROR; + } +@@ -1013,7 +1061,7 @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData *m_data) + if (bdrv_pwrite_sync( + extent->file, + ((int64_t)m_data->l2_offset * 512) +- + (m_data->l2_index * sizeof(m_data->offset)), ++ + (m_data->l2_index * sizeof(offset)), + &offset, sizeof(offset)) < 0) { + return VMDK_ERROR; + } +@@ -1025,17 +1073,41 @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData *m_data) + return VMDK_OK; + } + ++/** ++ * get_cluster_offset ++ * ++ * Look up cluster offset in extent file by sector number, and store in ++ * @cluster_offset. ++ * ++ * For flat extents, the start offset as parsed from the description file is ++ * returned. ++ * ++ * For sparse extents, look up in L1, L2 table. If allocate is true, return an ++ * offset for a new cluster and update L2 cache. If there is a backing file, ++ * COW is done before returning; otherwise, zeroes are written to the allocated ++ * cluster. Both COW and zero writing skips the sector range ++ * [@skip_start_sector, @skip_end_sector) passed in by caller, because caller ++ * has new data to write there. ++ * ++ * Returns: VMDK_OK if cluster exists and mapped in the image. ++ * VMDK_UNALLOC if cluster is not mapped and @allocate is false. ++ * VMDK_ERROR if failed. ++ */ + static int get_cluster_offset(BlockDriverState *bs, +- VmdkExtent *extent, +- VmdkMetaData *m_data, +- uint64_t offset, +- int allocate, +- uint64_t *cluster_offset) ++ VmdkExtent *extent, ++ VmdkMetaData *m_data, ++ uint64_t offset, ++ bool allocate, ++ uint64_t *cluster_offset, ++ uint64_t skip_start_sector, ++ uint64_t skip_end_sector) + { + unsigned int l1_index, l2_offset, l2_index; + int min_index, i, j; + uint32_t min_count, *l2_table; + bool zeroed = false; ++ int64_t ret; ++ int32_t cluster_sector; + + if (m_data) { + m_data->valid = 0; +@@ -1089,52 +1161,41 @@ static int get_cluster_offset(BlockDriverState *bs, + extent->l2_cache_counts[min_index] = 1; + found: + l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size; +- *cluster_offset = le32_to_cpu(l2_table[l2_index]); ++ cluster_sector = le32_to_cpu(l2_table[l2_index]); + + if (m_data) { + m_data->valid = 1; + m_data->l1_index = l1_index; + m_data->l2_index = l2_index; +- m_data->offset = *cluster_offset; + m_data->l2_offset = l2_offset; + m_data->l2_cache_entry = &l2_table[l2_index]; + } +- if (extent->has_zero_grain && *cluster_offset == VMDK_GTE_ZEROED) { ++ if (extent->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) { + zeroed = true; + } + +- if (!*cluster_offset || zeroed) { ++ if (!cluster_sector || zeroed) { + if (!allocate) { + return zeroed ? VMDK_ZEROED : VMDK_UNALLOC; + } + +- /* Avoid the L2 tables update for the images that have snapshots. */ +- *cluster_offset = bdrv_getlength(extent->file); +- if (!extent->compressed) { +- bdrv_truncate( +- extent->file, +- *cluster_offset + (extent->cluster_sectors << 9) +- ); +- } +- +- *cluster_offset >>= 9; +- l2_table[l2_index] = cpu_to_le32(*cluster_offset); ++ cluster_sector = extent->next_cluster_sector; ++ extent->next_cluster_sector += extent->cluster_sectors; + + /* First of all we write grain itself, to avoid race condition + * that may to corrupt the image. + * This problem may occur because of insufficient space on host disk + * or inappropriate VM shutdown. + */ +- if (get_whole_cluster( +- bs, extent, *cluster_offset, offset, allocate) == -1) { +- return VMDK_ERROR; +- } +- +- if (m_data) { +- m_data->offset = *cluster_offset; ++ ret = get_whole_cluster(bs, extent, ++ cluster_sector, ++ offset >> BDRV_SECTOR_BITS, ++ skip_start_sector, skip_end_sector); ++ if (ret) { ++ return ret; + } + } +- *cluster_offset <<= 9; ++ *cluster_offset = cluster_sector << BDRV_SECTOR_BITS; + return VMDK_OK; + } + +@@ -1169,7 +1230,8 @@ static int64_t coroutine_fn vmdk_co_get_block_status(BlockDriverState *bs, + } + qemu_co_mutex_lock(&s->lock); + ret = get_cluster_offset(bs, extent, NULL, +- sector_num * 512, 0, &offset); ++ sector_num * 512, false, &offset, ++ 0, 0); + qemu_co_mutex_unlock(&s->lock); + + switch (ret) { +@@ -1322,9 +1384,9 @@ static int vmdk_read(BlockDriverState *bs, int64_t sector_num, + if (!extent) { + return -EIO; + } +- ret = get_cluster_offset( +- bs, extent, NULL, +- sector_num << 9, 0, &cluster_offset); ++ ret = get_cluster_offset(bs, extent, NULL, ++ sector_num << 9, false, &cluster_offset, ++ 0, 0); + extent_begin_sector = extent->end_sector - extent->sectors; + extent_relative_sector_num = sector_num - extent_begin_sector; + index_in_cluster = extent_relative_sector_num % extent->cluster_sectors; +@@ -1405,12 +1467,17 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, + if (!extent) { + return -EIO; + } +- ret = get_cluster_offset( +- bs, +- extent, +- &m_data, +- sector_num << 9, !extent->compressed, +- &cluster_offset); ++ extent_begin_sector = extent->end_sector - extent->sectors; ++ extent_relative_sector_num = sector_num - extent_begin_sector; ++ index_in_cluster = extent_relative_sector_num % extent->cluster_sectors; ++ n = extent->cluster_sectors - index_in_cluster; ++ if (n > nb_sectors) { ++ n = nb_sectors; ++ } ++ ret = get_cluster_offset(bs, extent, &m_data, sector_num << 9, ++ !(extent->compressed || zeroed), ++ &cluster_offset, ++ index_in_cluster, index_in_cluster + n); + if (extent->compressed) { + if (ret == VMDK_OK) { + /* Refuse write to allocated cluster for streamOptimized */ +@@ -1419,24 +1486,13 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, + return -EIO; + } else { + /* allocate */ +- ret = get_cluster_offset( +- bs, +- extent, +- &m_data, +- sector_num << 9, 1, +- &cluster_offset); ++ ret = get_cluster_offset(bs, extent, &m_data, sector_num << 9, ++ true, &cluster_offset, 0, 0); + } + } + if (ret == VMDK_ERROR) { + return -EINVAL; + } +- extent_begin_sector = extent->end_sector - extent->sectors; +- extent_relative_sector_num = sector_num - extent_begin_sector; +- index_in_cluster = extent_relative_sector_num % extent->cluster_sectors; +- n = extent->cluster_sectors - index_in_cluster; +- if (n > nb_sectors) { +- n = nb_sectors; +- } + if (zeroed) { + /* Do zeroed write, buf is ignored */ + if (extent->has_zero_grain && +@@ -1444,9 +1500,9 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, + n >= extent->cluster_sectors) { + n = extent->cluster_sectors; + if (!zero_dry_run) { +- m_data.offset = VMDK_GTE_ZEROED; + /* update L2 tables */ +- if (vmdk_L2update(extent, &m_data) != VMDK_OK) { ++ if (vmdk_L2update(extent, &m_data, VMDK_GTE_ZEROED) ++ != VMDK_OK) { + return -EIO; + } + } +@@ -1462,7 +1518,9 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, + } + if (m_data.valid) { + /* update L2 tables */ +- if (vmdk_L2update(extent, &m_data) != VMDK_OK) { ++ if (vmdk_L2update(extent, &m_data, ++ cluster_offset >> BDRV_SECTOR_BITS) ++ != VMDK_OK) { + return -EIO; + } + } +@@ -2020,7 +2078,7 @@ static int vmdk_check(BlockDriverState *bs, BdrvCheckResult *result, + } + ret = get_cluster_offset(bs, extent, NULL, + sector_num << BDRV_SECTOR_BITS, +- 0, &cluster_offset); ++ false, &cluster_offset, 0, 0); + if (ret == VMDK_ERROR) { + fprintf(stderr, + "ERROR: could not get cluster_offset for sector %" +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-Use-bdrv_nb_sectors-where-sectors-not-bytes-are.patch b/SOURCES/kvm-vmdk-Use-bdrv_nb_sectors-where-sectors-not-bytes-are.patch new file mode 100644 index 0000000..15c7a10 --- /dev/null +++ b/SOURCES/kvm-vmdk-Use-bdrv_nb_sectors-where-sectors-not-bytes-are.patch @@ -0,0 +1,80 @@ +From 1d5ecdd5402c43fc20deefe64ee72172cd645486 Mon Sep 17 00:00:00 2001 +Message-Id: <1d5ecdd5402c43fc20deefe64ee72172cd645486.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:21 -0600 +Subject: [CHANGE 27/31] vmdk: Use bdrv_nb_sectors() where sectors, not bytes + are wanted +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-28-git-send-email-famz@redhat.com> +Patchwork-id: 62700 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 27/30] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Markus Armbruster + +Instead of bdrv_getlength(). + +Commit 57322b7 did this all over block, but one more bdrv_getlength() +has crept in since. + +Signed-off-by: Markus Armbruster +Reviewed-by: Fam Zheng +Reviewed-by: BenoĂ®t Canet +Signed-off-by: Kevin Wolf +(cherry picked from commit 0a156f7c750c4e4e1c5dfb2135debcf399e4e2a7) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 560dd43..b9ab89b 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -397,7 +397,7 @@ static int vmdk_add_extent(BlockDriverState *bs, + { + VmdkExtent *extent; + BDRVVmdkState *s = bs->opaque; +- int64_t length; ++ int64_t nb_sectors; + + if (cluster_sectors > 0x200000) { + /* 0x200000 * 512Bytes = 1GB for one cluster is unrealistic */ +@@ -413,9 +413,9 @@ static int vmdk_add_extent(BlockDriverState *bs, + return -EFBIG; + } + +- length = bdrv_getlength(file); +- if (length < 0) { +- return length; ++ nb_sectors = bdrv_nb_sectors(file); ++ if (nb_sectors < 0) { ++ return nb_sectors; + } + + s->extents = g_realloc(s->extents, +@@ -433,8 +433,7 @@ static int vmdk_add_extent(BlockDriverState *bs, + extent->l1_entry_sectors = l2_size * cluster_sectors; + extent->l2_size = l2_size; + extent->cluster_sectors = flat ? sectors : cluster_sectors; +- extent->next_cluster_sector = +- ROUND_UP(DIV_ROUND_UP(length, BDRV_SECTOR_SIZE), cluster_sectors); ++ extent->next_cluster_sector = ROUND_UP(nb_sectors, cluster_sectors); + + if (s->num_extents > 1) { + extent->end_sector = (*(extent - 1)).end_sector + extent->sectors; +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-correctly-propagate-errors.patch b/SOURCES/kvm-vmdk-correctly-propagate-errors.patch new file mode 100644 index 0000000..953264d --- /dev/null +++ b/SOURCES/kvm-vmdk-correctly-propagate-errors.patch @@ -0,0 +1,105 @@ +From 39a68fd720126dd9c53af4f7fdeeecc0eeacc1ce Mon Sep 17 00:00:00 2001 +Message-Id: <39a68fd720126dd9c53af4f7fdeeecc0eeacc1ce.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:08 -0600 +Subject: [CHANGE 14/31] vmdk: correctly propagate errors +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-15-git-send-email-famz@redhat.com> +Patchwork-id: 62687 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 14/30] vmdk: correctly propagate errors +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Now that we can return the "right" errors, use the Error** parameter +to pass them back instead of just printing them. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 89ac8480a8c7f73dd943dcb1313d6bd984f9a870) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 11 ++++++----- + tests/qemu-iotests/059.out | 6 ++---- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 94f7dae..c7b930f 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -572,6 +572,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + error_setg_errno(errp, -ret, + "Could not read header from file '%s'", + file->filename); ++ return -EINVAL; + } + if (header.capacity == 0) { + uint64_t desc_offset = le64_to_cpu(header.desc_offset); +@@ -641,8 +642,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + char buf[64]; + snprintf(buf, sizeof(buf), "VMDK version %d", + le32_to_cpu(header.version)); +- qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, +- bs->device_name, "vmdk", buf); ++ error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, ++ bs->device_name, "vmdk", buf); + return -ENOTSUP; + } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) { + /* VMware KB 2064959 explains that version 3 added support for +@@ -654,7 +655,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + } + + if (le32_to_cpu(header.num_gtes_per_gt) > 512) { +- error_report("L2 table size too big"); ++ error_setg(errp, "L2 table size too big"); + return -EINVAL; + } + +@@ -670,8 +671,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + } + if (bdrv_getlength(file) < + le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE) { +- error_report("File truncated, expecting at least %lld bytes", +- le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE); ++ error_setg(errp, "File truncated, expecting at least %lld bytes", ++ le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE); + return -EINVAL; + } + +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index 0220774..7c9ef90 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -7,8 +7,7 @@ no file open, try 'help open' + === Testing too big L2 table size === + + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +-L2 table size too big +-qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Invalid argument ++qemu-io: can't open device TEST_DIR/t.vmdk: L2 table size too big + no file open, try 'help open' + === Testing too big L1 table size === + +@@ -2045,8 +2044,7 @@ RW 12582912 VMFS "dummy.IMGFMT" 1 + + === Testing truncated sparse === + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 +-qemu-img: File truncated, expecting at least 13172736 bytes +-qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'TEST_DIR/t.IMGFMT': Invalid argument ++qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes + + === Testing version 3 === + image: TEST_DIR/iotest-version3.IMGFMT +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-do-not-try-opening-a-file-as-both-image-and-des.patch b/SOURCES/kvm-vmdk-do-not-try-opening-a-file-as-both-image-and-des.patch new file mode 100644 index 0000000..4c8c4a1 --- /dev/null +++ b/SOURCES/kvm-vmdk-do-not-try-opening-a-file-as-both-image-and-des.patch @@ -0,0 +1,101 @@ +From 153d5ee0b61926664684a28cdfc982f956c329a2 Mon Sep 17 00:00:00 2001 +Message-Id: <153d5ee0b61926664684a28cdfc982f956c329a2.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:07 -0600 +Subject: [CHANGE 13/31] vmdk: do not try opening a file as both image and + descriptor +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-14-git-send-email-famz@redhat.com> +Patchwork-id: 62686 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 13/30] vmdk: do not try opening a file as both image and descriptor +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +This prepares for propagating errors from vmdk_open_sparse and +vmdk_open_desc_file up to the caller of vmdk_open. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit 37f09e5e3d206e7c555d28a7755cecfa137dad22) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 22 +++++++++++++++------- + tests/qemu-iotests/059.out | 4 ++-- + 2 files changed, 17 insertions(+), 9 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 458bceb..94f7dae 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -887,20 +887,28 @@ static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, + char *buf = NULL; + int ret; + BDRVVmdkState *s = bs->opaque; ++ uint32_t magic; + + buf = vmdk_read_desc(bs->file, 0, errp); + if (!buf) { + return -EINVAL; + } + +- if (vmdk_open_sparse(bs, bs->file, flags, buf, errp) == 0) { +- s->desc_offset = 0x200; +- } else { +- ret = vmdk_open_desc_file(bs, flags, buf, errp); +- if (ret) { +- goto fail; +- } ++ magic = ldl_be_p(buf); ++ switch (magic) { ++ case VMDK3_MAGIC: ++ case VMDK4_MAGIC: ++ ret = vmdk_open_sparse(bs, bs->file, flags, buf, errp); ++ s->desc_offset = 0x200; ++ break; ++ default: ++ ret = vmdk_open_desc_file(bs, flags, buf, errp); ++ break; + } ++ if (ret) { ++ goto fail; ++ } ++ + /* try to open parent images, if exist */ + ret = vmdk_parent_open(bs); + if (ret) { +diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out +index f4ca52d..0220774 100644 +--- a/tests/qemu-iotests/059.out ++++ b/tests/qemu-iotests/059.out +@@ -8,7 +8,7 @@ no file open, try 'help open' + + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 + L2 table size too big +-qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type ++qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Invalid argument + no file open, try 'help open' + === Testing too big L1 table size === + +@@ -2046,7 +2046,7 @@ RW 12582912 VMFS "dummy.IMGFMT" 1 + === Testing truncated sparse === + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 + qemu-img: File truncated, expecting at least 13172736 bytes +-qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'TEST_DIR/t.IMGFMT': Wrong medium type ++qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'TEST_DIR/t.IMGFMT': Invalid argument + + === Testing version 3 === + image: TEST_DIR/iotest-version3.IMGFMT +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-extract-vmdk_read_desc.patch b/SOURCES/kvm-vmdk-extract-vmdk_read_desc.patch new file mode 100644 index 0000000..259d584 --- /dev/null +++ b/SOURCES/kvm-vmdk-extract-vmdk_read_desc.patch @@ -0,0 +1,99 @@ +From 09b91873d124019c0ddfc5c714191443a010f581 Mon Sep 17 00:00:00 2001 +Message-Id: <09b91873d124019c0ddfc5c714191443a010f581.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:05 -0600 +Subject: [CHANGE 11/31] vmdk: extract vmdk_read_desc +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-12-git-send-email-famz@redhat.com> +Patchwork-id: 62684 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 11/30] vmdk: extract vmdk_read_desc +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit a8842e6d2acc815e9660cc743bd0b0daba18c935) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 41 ++++++++++++++++++++++++++++++----------- + 1 file changed, 30 insertions(+), 11 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index eda2962..425064c 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -529,6 +529,32 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, + static int vmdk_open_desc_file(BlockDriverState *bs, int flags, + uint64_t desc_offset, Error **errp); + ++static char *vmdk_read_desc(BlockDriverState *file, uint64_t desc_offset, ++ Error **errp) ++{ ++ int64_t size; ++ char *buf; ++ int ret; ++ ++ size = bdrv_getlength(file); ++ if (size < 0) { ++ error_setg_errno(errp, -size, "Could not access file"); ++ return NULL; ++ } ++ ++ size = MIN(size, 1 << 20); /* avoid unbounded allocation */ ++ buf = g_malloc0(size + 1); ++ ++ ret = bdrv_pread(file, desc_offset, buf, size); ++ if (ret < 0) { ++ error_setg_errno(errp, -ret, "Could not read from file"); ++ g_free(buf); ++ return NULL; ++ } ++ ++ return buf; ++} ++ + static int vmdk_open_vmdk4(BlockDriverState *bs, + BlockDriverState *file, + int flags, Error **errp) +@@ -823,23 +849,16 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, + uint64_t desc_offset, Error **errp) + { + int ret; +- char *buf = NULL; ++ char *buf; + char ct[128]; + BDRVVmdkState *s = bs->opaque; +- int64_t size; + +- size = bdrv_getlength(bs->file); +- if (size < 0) { ++ buf = vmdk_read_desc(bs->file, desc_offset, errp); ++ if (!buf) { + return -EINVAL; +- } +- +- size = MIN(size, 1 << 20); /* avoid unbounded allocation */ +- buf = g_malloc0(size + 1); +- +- ret = bdrv_pread(bs->file, desc_offset, buf, size); +- if (ret < 0) { + goto exit; + } ++ + if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) { + error_setg(errp, "invalid VMDK image descriptor"); + ret = -EINVAL; +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-fix-buf-leak-in-vmdk_parse_extents.patch b/SOURCES/kvm-vmdk-fix-buf-leak-in-vmdk_parse_extents.patch new file mode 100644 index 0000000..c567e9d --- /dev/null +++ b/SOURCES/kvm-vmdk-fix-buf-leak-in-vmdk_parse_extents.patch @@ -0,0 +1,51 @@ +From 56d77f768a5aa2b35ba645ae05d56e9908457c92 Mon Sep 17 00:00:00 2001 +Message-Id: <56d77f768a5aa2b35ba645ae05d56e9908457c92.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:23 -0600 +Subject: [CHANGE 29/31] vmdk: fix buf leak in vmdk_parse_extents() +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-30-git-send-email-famz@redhat.com> +Patchwork-id: 62702 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 29/30] vmdk: fix buf leak in vmdk_parse_extents() +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Stefan Hajnoczi + +vmdk_open_sparse() does not take ownership of buf so the caller always +needs to free it. + +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Max Reitz +Reviewed-by: Fam Zheng +(cherry picked from commit b6b1d31f098eef8cd13556d343e46c213fac972a) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index ddd06f0..0593a1a 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -847,8 +847,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, + } else { + ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp); + } ++ g_free(buf); + if (ret) { +- g_free(buf); + bdrv_unref(extent_file); + return ret; + } +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-fix-vmdk_parse_extents-extent_file-leaks.patch b/SOURCES/kvm-vmdk-fix-vmdk_parse_extents-extent_file-leaks.patch new file mode 100644 index 0000000..8d8d4c0 --- /dev/null +++ b/SOURCES/kvm-vmdk-fix-vmdk_parse_extents-extent_file-leaks.patch @@ -0,0 +1,54 @@ +From 6b65120986e94f9f48ce92263b9660786038984b Mon Sep 17 00:00:00 2001 +Message-Id: <6b65120986e94f9f48ce92263b9660786038984b.1418766606.git.jen@redhat.com> +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:22 -0600 +Subject: [CHANGE 28/31] vmdk: fix vmdk_parse_extents() extent_file leaks +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-29-git-send-email-famz@redhat.com> +Patchwork-id: 62701 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 28/30] vmdk: fix vmdk_parse_extents() extent_file leaks +Bugzilla: 1002493 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Stefan Hajnoczi + +Signed-off-by: Stefan Hajnoczi +Reviewed-by: Max Reitz +Reviewed-by: Fam Zheng +(cherry picked from commit ff74f33c310892c90c4439d963a6ce67f47ce18c) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/block/vmdk.c b/block/vmdk.c +index b9ab89b..ddd06f0 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -835,6 +835,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, + ret = vmdk_add_extent(bs, extent_file, true, sectors, + 0, 0, 0, 0, 0, &extent, errp); + if (ret < 0) { ++ bdrv_unref(extent_file); + return ret; + } + extent->flat_start_offset = flat_offset << 9; +@@ -854,6 +855,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, + extent = &s->extents[s->num_extents - 1]; + } else { + error_setg(errp, "Unsupported extent type '%s'", type); ++ bdrv_unref(extent_file); + return -ENOTSUP; + } + extent->type = g_strdup(type); +-- +2.1.0 + diff --git a/SOURCES/kvm-vmdk-push-vmdk_read_desc-up-to-caller.patch b/SOURCES/kvm-vmdk-push-vmdk_read_desc-up-to-caller.patch new file mode 100644 index 0000000..bec77ef --- /dev/null +++ b/SOURCES/kvm-vmdk-push-vmdk_read_desc-up-to-caller.patch @@ -0,0 +1,170 @@ +From feb051e6d8bc62e6b9e162ada4dc576c59edc00f Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com> +From: Fam Zheng +Date: Thu, 4 Dec 2014 00:05:06 -0600 +Subject: [CHANGE 12/31] vmdk: push vmdk_read_desc up to caller +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Fam Zheng +Message-id: <1417651524-18041-13-git-send-email-famz@redhat.com> +Patchwork-id: 62685 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 12/30] vmdk: push vmdk_read_desc up to caller +Bugzilla: 1134251 +RH-Acked-by: Jeffrey Cody +RH-Acked-by: Markus Armbruster +RH-Acked-by: Max Reitz + +From: Paolo Bonzini + +Currently, we just try reading a VMDK file as both image and descriptor. +This makes it hard to choose which of the two attempts gave the best error. +We'll decide in advance if the file looks like an image or a descriptor, +and this patch is the first step to that end. + +Signed-off-by: Paolo Bonzini +Reviewed-by: Fam Zheng +Signed-off-by: Kevin Wolf +(cherry picked from commit d1833ef52be349e41d17e9c5ddaea8bb4ad3a7fb) +Signed-off-by: Fam Zheng +Signed-off-by: Jeff E. Nelson +--- + block/vmdk.c | 55 +++++++++++++++++++++++++++++++------------------------ + 1 file changed, 31 insertions(+), 24 deletions(-) + +diff --git a/block/vmdk.c b/block/vmdk.c +index 425064c..458bceb 100644 +--- a/block/vmdk.c ++++ b/block/vmdk.c +@@ -526,8 +526,8 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, + return ret; + } + +-static int vmdk_open_desc_file(BlockDriverState *bs, int flags, +- uint64_t desc_offset, Error **errp); ++static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, ++ Error **errp); + + static char *vmdk_read_desc(BlockDriverState *file, uint64_t desc_offset, + Error **errp) +@@ -576,7 +576,13 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, + if (header.capacity == 0) { + uint64_t desc_offset = le64_to_cpu(header.desc_offset); + if (desc_offset) { +- return vmdk_open_desc_file(bs, flags, desc_offset << 9, errp); ++ char *buf = vmdk_read_desc(file, desc_offset << 9, errp); ++ if (!buf) { ++ return -EINVAL; ++ } ++ ret = vmdk_open_desc_file(bs, flags, buf, errp); ++ g_free(buf); ++ return ret; + } + } + +@@ -727,16 +733,12 @@ static int vmdk_parse_description(const char *desc, const char *opt_name, + + /* Open an extent file and append to bs array */ + static int vmdk_open_sparse(BlockDriverState *bs, +- BlockDriverState *file, +- int flags, Error **errp) ++ BlockDriverState *file, int flags, ++ char *buf, Error **errp) + { + uint32_t magic; + +- if (bdrv_pread(file, 0, &magic, sizeof(magic)) != sizeof(magic)) { +- return -EIO; +- } +- +- magic = be32_to_cpu(magic); ++ magic = ldl_be_p(buf); + switch (magic) { + case VMDK3_MAGIC: + return vmdk_open_vmfs_sparse(bs, file, flags, errp); +@@ -821,8 +823,14 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, + extent->flat_start_offset = flat_offset << 9; + } else if (!strcmp(type, "SPARSE") || !strcmp(type, "VMFSSPARSE")) { + /* SPARSE extent and VMFSSPARSE extent are both "COWD" sparse file*/ +- ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, errp); ++ char *buf = vmdk_read_desc(extent_file, 0, errp); ++ if (!buf) { ++ ret = -EINVAL; ++ } else { ++ ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp); ++ } + if (ret) { ++ g_free(buf); + bdrv_unref(extent_file); + return ret; + } +@@ -845,20 +853,13 @@ next_line: + return 0; + } + +-static int vmdk_open_desc_file(BlockDriverState *bs, int flags, +- uint64_t desc_offset, Error **errp) ++static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, ++ Error **errp) + { + int ret; +- char *buf; + char ct[128]; + BDRVVmdkState *s = bs->opaque; + +- buf = vmdk_read_desc(bs->file, desc_offset, errp); +- if (!buf) { +- return -EINVAL; +- goto exit; +- } +- + if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) { + error_setg(errp, "invalid VMDK image descriptor"); + ret = -EINVAL; +@@ -877,20 +878,25 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, + s->desc_offset = 0; + ret = vmdk_parse_extents(buf, bs, bs->file->filename, errp); + exit: +- g_free(buf); + return ret; + } + + static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, + Error **errp) + { ++ char *buf = NULL; + int ret; + BDRVVmdkState *s = bs->opaque; + +- if (vmdk_open_sparse(bs, bs->file, flags, errp) == 0) { ++ buf = vmdk_read_desc(bs->file, 0, errp); ++ if (!buf) { ++ return -EINVAL; ++ } ++ ++ if (vmdk_open_sparse(bs, bs->file, flags, buf, errp) == 0) { + s->desc_offset = 0x200; + } else { +- ret = vmdk_open_desc_file(bs, flags, 0, errp); ++ ret = vmdk_open_desc_file(bs, flags, buf, errp); + if (ret) { + goto fail; + } +@@ -909,10 +915,11 @@ static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, + QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, + "vmdk", bs->device_name, "live migration"); + migrate_add_blocker(s->migration_blocker); +- ++ g_free(buf); + return 0; + + fail: ++ g_free(buf); + g_free(s->create_type); + s->create_type = NULL; + vmdk_free_extents(bs); +-- +2.1.0 + diff --git a/SOURCES/kvm-vmstate-add-VMSTATE_VALIDATE.patch b/SOURCES/kvm-vmstate-add-VMSTATE_VALIDATE.patch index 1c5da7e..653d053 100644 --- a/SOURCES/kvm-vmstate-add-VMSTATE_VALIDATE.patch +++ b/SOURCES/kvm-vmstate-add-VMSTATE_VALIDATE.patch @@ -1,13 +1,13 @@ -From 1886b0146de0847ff5f81e5d89ba3893bbab63fc Mon Sep 17 00:00:00 2001 +From 9d268999694b9743808fb9454a4f1ab7a941b8a6 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:24:33 +0200 -Subject: [PATCH 11/30] vmstate: add VMSTATE_VALIDATE +Date: Wed, 14 May 2014 08:52:51 +0200 +Subject: [PATCH 22/31] vmstate: add VMSTATE_VALIDATE RH-Author: Michael S. Tsirkin -Message-id: <1400055633-6261-3-git-send-email-mst@redhat.com> -Patchwork-id: 58850 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 3/5] vmstate: add VMSTATE_VALIDATE -Bugzilla: 1095706 +Message-id: <1400057538-6975-4-git-send-email-mst@redhat.com> +Patchwork-id: 58870 +O-Subject: [PATCH qemu-kvm RHEL7.1 3/5] vmstate: add VMSTATE_VALIDATE +Bugzilla: 1095716 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini diff --git a/SOURCES/kvm-vmstate-add-VMS_MUST_EXIST.patch b/SOURCES/kvm-vmstate-add-VMS_MUST_EXIST.patch index a32264c..b5f39ae 100644 --- a/SOURCES/kvm-vmstate-add-VMS_MUST_EXIST.patch +++ b/SOURCES/kvm-vmstate-add-VMS_MUST_EXIST.patch @@ -1,13 +1,13 @@ -From 939cbb6cf8128369e0ca2ec21b33d2fc40699142 Mon Sep 17 00:00:00 2001 +From 0aa1a1886452bb26cc60ac482f70d0ef78b85165 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:24:29 +0200 -Subject: [PATCH 10/30] vmstate: add VMS_MUST_EXIST +Date: Wed, 14 May 2014 08:52:47 +0200 +Subject: [PATCH 21/31] vmstate: add VMS_MUST_EXIST RH-Author: Michael S. Tsirkin -Message-id: <1400055633-6261-2-git-send-email-mst@redhat.com> -Patchwork-id: 58849 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 2/5] vmstate: add VMS_MUST_EXIST -Bugzilla: 1095706 +Message-id: <1400057538-6975-3-git-send-email-mst@redhat.com> +Patchwork-id: 58869 +O-Subject: [PATCH qemu-kvm RHEL7.1 2/5] vmstate: add VMS_MUST_EXIST +Bugzilla: 1095716 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini @@ -44,10 +44,10 @@ index 11d93e1..95d1ce6 100644 typedef struct { diff --git a/savevm.c b/savevm.c -index 6efbb75..5d1b563 100644 +index 707caac..94512dd 100644 --- a/savevm.c +++ b/savevm.c -@@ -1740,6 +1740,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, +@@ -1764,6 +1764,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, return ret; } } @@ -58,7 +58,7 @@ index 6efbb75..5d1b563 100644 } field++; } -@@ -1800,6 +1804,12 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, +@@ -1804,6 +1808,12 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, field->info->put(f, addr, size); } } diff --git a/SOURCES/kvm-vmstate-reduce-code-duplication.patch b/SOURCES/kvm-vmstate-reduce-code-duplication.patch index e41edad..dbd6e84 100644 --- a/SOURCES/kvm-vmstate-reduce-code-duplication.patch +++ b/SOURCES/kvm-vmstate-reduce-code-duplication.patch @@ -1,16 +1,17 @@ -From 8f92bf7e5891ec22b84b7969f24e6918ee5a9e38 Mon Sep 17 00:00:00 2001 +From 2bf018e4c436e31188ea61fb767dbcec16495cfd Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin -Date: Wed, 14 May 2014 08:24:25 +0200 -Subject: [PATCH 01/10] vmstate: reduce code duplication +Date: Wed, 14 May 2014 08:52:43 +0200 +Subject: [PATCH 20/31] vmstate: reduce code duplication -Message-id: <1400055633-6261-1-git-send-email-mst@redhat.com> -Patchwork-id: 58848 -O-Subject: [PATCH qemu-kvm RHEL7.0.z 1/5] vmstate: reduce code duplication -Bugzilla: 1095706 -RH-Acked-by: Juan Quintela -RH-Acked-by: Paolo Bonzini -RH-Acked-by: Marcel Apfelbaum +RH-Author: Michael S. Tsirkin +Message-id: <1400057538-6975-2-git-send-email-mst@redhat.com> +Patchwork-id: 58868 +O-Subject: [PATCH qemu-kvm RHEL7.1 1/5] vmstate: reduce code duplication +Bugzilla: 1095716 RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Marcel Apfelbaum +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Juan Quintela move size offset and number of elements math out to functions, to reduce code duplication. @@ -29,7 +30,7 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 52 insertions(+), 48 deletions(-) diff --git a/savevm.c b/savevm.c -index 5d1b563..94512dd 100644 +index 6efbb75..707caac 100644 --- a/savevm.c +++ b/savevm.c @@ -1675,6 +1675,50 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, @@ -118,7 +119,7 @@ index 5d1b563..94512dd 100644 for (i = 0; i < n_elems; i++) { void *addr = base_addr + size * i; -@@ -1768,30 +1792,10 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, +@@ -1764,30 +1788,10 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, while(field->name) { if (!field->field_exists || field->field_exists(opaque, vmsd->version_id)) { diff --git a/SOURCES/kvm-vmstate-static-checker-script-to-validate-vmstate-ch.patch b/SOURCES/kvm-vmstate-static-checker-script-to-validate-vmstate-ch.patch new file mode 100644 index 0000000..116fc98 --- /dev/null +++ b/SOURCES/kvm-vmstate-static-checker-script-to-validate-vmstate-ch.patch @@ -0,0 +1,409 @@ +From 09e0354d2f25424042427ba8875a84f365a45ba9 Mon Sep 17 00:00:00 2001 +From: Amit Shah +Date: Fri, 11 Jul 2014 10:08:59 -0500 +Subject: [CHANGE 03/29] vmstate-static-checker: script to validate vmstate + changes +To: rhvirt-patches@redhat.com, + jen@redhat.com + +RH-Author: Amit Shah +Message-id: +Patchwork-id: 59783 +O-Subject: [RHEL7.1 qemu-kvm PATCH 02/18] vmstate-static-checker: script to validate vmstate changes +Bugzilla: 1118707 +RH-Acked-by: Juan Quintela +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Dr. David Alan Gilbert (git) + +This script compares the vmstate dumps in JSON format as output by QEMU +with the -dump-vmstate option. + +It flags various errors, like version mismatch, sections going away, +size mismatches, etc. + +This script is tolerant of a few changes that do not change the on-wire +format, like embedding a few fields within substructs. + +The script takes -s/--src and -d/--dest parameters, to which filenames +are given as arguments. + +Example: + +(in a qemu 2.0 tree): +./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json + +(in a qemu 2.2 tree:) +./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-i440fx-2.0 \ + qemu-2.2-m2.0.json + +./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json + +The script also takes a --reverse parameter to switch the src and dest +jsons. This is just a shorthand for reversing the src and dest. + +The --help parameter shows usage information. + +Signed-off-by: Amit Shah +Signed-off-by: Juan Quintela +(cherry picked from commit 426d1d016a494c978a513afcd03aa000fcbd5b3c) +Signed-off-by: Amit Shah +Signed-off-by: jen +--- + scripts/vmstate-static-checker.py | 345 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 345 insertions(+) + create mode 100755 scripts/vmstate-static-checker.py + +diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py +new file mode 100755 +index 0000000..1604e68 +--- /dev/null ++++ b/scripts/vmstate-static-checker.py +@@ -0,0 +1,345 @@ ++#!/usr/bin/python ++# ++# Compares vmstate information stored in JSON format, obtained from ++# the -dump-vmstate QEMU command. ++# ++# Copyright 2014 Amit Shah ++# Copyright 2014 Red Hat, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License along ++# with this program; if not, see . ++ ++import argparse ++import json ++import sys ++ ++# Count the number of errors found ++taint = 0 ++ ++def bump_taint(): ++ global taint ++ ++ # Ensure we don't wrap around or reset to 0 -- the shell only has ++ # an 8-bit return value. ++ if taint < 255: ++ taint = taint + 1 ++ ++ ++def check_fields_match(name, s_field, d_field): ++ if s_field == d_field: ++ return True ++ ++ # Some fields changed names between qemu versions. This list ++ # is used to whitelist such changes in each section / description. ++ changed_names = { ++ 'e1000': ['dev', 'parent_obj'], ++ 'ehci': ['dev', 'pcidev'], ++ 'I440FX': ['dev', 'parent_obj'], ++ 'ich9_ahci': ['card', 'parent_obj'], ++ 'ioh-3240-express-root-port': ['port.br.dev', ++ 'parent_obj.parent_obj.parent_obj', ++ 'port.br.dev.exp.aer_log', ++ 'parent_obj.parent_obj.parent_obj.exp.aer_log'], ++ 'mch': ['d', 'parent_obj'], ++ 'pci_bridge': ['bridge.dev', 'parent_obj', 'bridge.dev.shpc', 'shpc'], ++ 'pcnet': ['pci_dev', 'parent_obj'], ++ 'PIIX3': ['pci_irq_levels', 'pci_irq_levels_vmstate'], ++ 'piix4_pm': ['dev', 'parent_obj', 'pci0_status', ++ 'acpi_pci_hotplug.acpi_pcihp_pci_status[0x0]'], ++ 'rtl8139': ['dev', 'parent_obj'], ++ 'qxl': ['num_surfaces', 'ssd.num_surfaces'], ++ 'usb-host': ['dev', 'parent_obj'], ++ 'usb-mouse': ['usb-ptr-queue', 'HIDPointerEventQueue'], ++ 'usb-tablet': ['usb-ptr-queue', 'HIDPointerEventQueue'], ++ 'xhci': ['pci_dev', 'parent_obj'], ++ 'xio3130-express-downstream-port': ['port.br.dev', ++ 'parent_obj.parent_obj.parent_obj', ++ 'port.br.dev.exp.aer_log', ++ 'parent_obj.parent_obj.parent_obj.exp.aer_log'], ++ 'xio3130-express-upstream-port': ['br.dev', 'parent_obj.parent_obj', ++ 'br.dev.exp.aer_log', ++ 'parent_obj.parent_obj.exp.aer_log'], ++ } ++ ++ if not name in changed_names: ++ return False ++ ++ if s_field in changed_names[name] and d_field in changed_names[name]: ++ return True ++ ++ return False ++ ++ ++def exists_in_substruct(fields, item): ++ # Some QEMU versions moved a few fields inside a substruct. This ++ # kept the on-wire format the same. This function checks if ++ # something got shifted inside a substruct. For example, the ++ # change in commit 1f42d22233b4f3d1a2933ff30e8d6a6d9ee2d08f ++ ++ if not "Description" in fields: ++ return False ++ ++ if not "Fields" in fields["Description"]: ++ return False ++ ++ substruct_fields = fields["Description"]["Fields"] ++ ++ if substruct_fields == []: ++ return False ++ ++ return check_fields_match(fields["Description"]["name"], ++ substruct_fields[0]["field"], item) ++ ++ ++def check_fields(src_fields, dest_fields, desc, sec): ++ # This function checks for all the fields in a section. If some ++ # fields got embedded into a substruct, this function will also ++ # attempt to check inside the substruct. ++ ++ d_iter = iter(dest_fields) ++ s_iter = iter(src_fields) ++ ++ # Using these lists as stacks to store previous value of s_iter ++ # and d_iter, so that when time comes to exit out of a substruct, ++ # we can go back one level up and continue from where we left off. ++ ++ s_iter_list = [] ++ d_iter_list = [] ++ ++ advance_src = True ++ advance_dest = True ++ ++ while True: ++ if advance_src: ++ try: ++ s_item = s_iter.next() ++ except StopIteration: ++ if s_iter_list == []: ++ break ++ ++ s_iter = s_iter_list.pop() ++ continue ++ else: ++ # We want to avoid advancing just once -- when entering a ++ # dest substruct, or when exiting one. ++ advance_src = True ++ ++ if advance_dest: ++ try: ++ d_item = d_iter.next() ++ except StopIteration: ++ if d_iter_list == []: ++ # We were not in a substruct ++ print "Section \"" + sec + "\",", ++ print "Description " + "\"" + desc + "\":", ++ print "expected field \"" + s_item["field"] + "\",", ++ print "while dest has no further fields" ++ bump_taint() ++ break ++ ++ d_iter = d_iter_list.pop() ++ advance_src = False ++ continue ++ else: ++ advance_dest = True ++ ++ if not check_fields_match(desc, s_item["field"], d_item["field"]): ++ # Some fields were put in substructs, keeping the ++ # on-wire format the same, but breaking static tools ++ # like this one. ++ ++ # First, check if dest has a new substruct. ++ if exists_in_substruct(d_item, s_item["field"]): ++ # listiterators don't have a prev() function, so we ++ # have to store our current location, descend into the ++ # substruct, and ensure we come out as if nothing ++ # happened when the substruct is over. ++ # ++ # Essentially we're opening the substructs that got ++ # added which didn't change the wire format. ++ d_iter_list.append(d_iter) ++ substruct_fields = d_item["Description"]["Fields"] ++ d_iter = iter(substruct_fields) ++ advance_src = False ++ continue ++ ++ # Next, check if src has substruct that dest removed ++ # (can happen in backward migration: 2.0 -> 1.5) ++ if exists_in_substruct(s_item, d_item["field"]): ++ s_iter_list.append(s_iter) ++ substruct_fields = s_item["Description"]["Fields"] ++ s_iter = iter(substruct_fields) ++ advance_dest = False ++ continue ++ ++ print "Section \"" + sec + "\",", ++ print "Description \"" + desc + "\":", ++ print "expected field \"" + s_item["field"] + "\",", ++ print "got \"" + d_item["field"] + "\"; skipping rest" ++ bump_taint() ++ break ++ ++ check_version(s_item, d_item, sec, desc) ++ ++ if not "Description" in s_item: ++ # Check size of this field only if it's not a VMSTRUCT entry ++ check_size(s_item, d_item, sec, desc, s_item["field"]) ++ ++ check_description_in_list(s_item, d_item, sec, desc) ++ ++ ++def check_subsections(src_sub, dest_sub, desc, sec): ++ for s_item in src_sub: ++ found = False ++ for d_item in dest_sub: ++ if s_item["name"] != d_item["name"]: ++ continue ++ ++ found = True ++ check_descriptions(s_item, d_item, sec) ++ ++ if not found: ++ print "Section \"" + sec + "\", Description \"" + desc + "\":", ++ print "Subsection \"" + s_item["name"] + "\" not found" ++ bump_taint() ++ ++ ++def check_description_in_list(s_item, d_item, sec, desc): ++ if not "Description" in s_item: ++ return ++ ++ if not "Description" in d_item: ++ print "Section \"" + sec + "\", Description \"" + desc + "\",", ++ print "Field \"" + s_item["field"] + "\": missing description" ++ bump_taint() ++ return ++ ++ check_descriptions(s_item["Description"], d_item["Description"], sec) ++ ++ ++def check_descriptions(src_desc, dest_desc, sec): ++ check_version(src_desc, dest_desc, sec, src_desc["name"]) ++ ++ if not check_fields_match(sec, src_desc["name"], dest_desc["name"]): ++ print "Section \"" + sec + "\":", ++ print "Description \"" + src_desc["name"] + "\"", ++ print "missing, got \"" + dest_desc["name"] + "\" instead; skipping" ++ bump_taint() ++ return ++ ++ for f in src_desc: ++ if not f in dest_desc: ++ print "Section \"" + sec + "\"", ++ print "Description \"" + src_desc["name"] + "\":", ++ print "Entry \"" + f + "\" missing" ++ bump_taint() ++ continue ++ ++ if f == 'Fields': ++ check_fields(src_desc[f], dest_desc[f], src_desc["name"], sec) ++ ++ if f == 'Subsections': ++ check_subsections(src_desc[f], dest_desc[f], src_desc["name"], sec) ++ ++ ++def check_version(s, d, sec, desc=None): ++ if s["version_id"] > d["version_id"]: ++ print "Section \"" + sec + "\"", ++ if desc: ++ print "Description \"" + desc + "\":", ++ print "version error:", s["version_id"], ">", d["version_id"] ++ bump_taint() ++ ++ if not "minimum_version_id" in d: ++ return ++ ++ if s["version_id"] < d["minimum_version_id"]: ++ print "Section \"" + sec + "\"", ++ if desc: ++ print "Description \"" + desc + "\":", ++ print "minimum version error:", s["version_id"], "<", ++ print d["minimum_version_id"] ++ bump_taint() ++ ++ ++def check_size(s, d, sec, desc=None, field=None): ++ if s["size"] != d["size"]: ++ print "Section \"" + sec + "\"", ++ if desc: ++ print "Description \"" + desc + "\"", ++ if field: ++ print "Field \"" + field + "\"", ++ print "size mismatch:", s["size"], ",", d["size"] ++ bump_taint() ++ ++ ++def check_machine_type(s, d): ++ if s["Name"] != d["Name"]: ++ print "Warning: checking incompatible machine types:", ++ print "\"" + s["Name"] + "\", \"" + d["Name"] + "\"" ++ return ++ ++ ++def main(): ++ help_text = "Parse JSON-formatted vmstate dumps from QEMU in files SRC and DEST. Checks whether migration from SRC to DEST QEMU versions would break based on the VMSTATE information contained within the JSON outputs. The JSON output is created from a QEMU invocation with the -dump-vmstate parameter and a filename argument to it. Other parameters to QEMU do not matter, except the -M (machine type) parameter." ++ ++ parser = argparse.ArgumentParser(description=help_text) ++ parser.add_argument('-s', '--src', type=file, required=True, ++ help='json dump from src qemu') ++ parser.add_argument('-d', '--dest', type=file, required=True, ++ help='json dump from dest qemu') ++ parser.add_argument('--reverse', required=False, default=False, ++ action='store_true', ++ help='reverse the direction') ++ args = parser.parse_args() ++ ++ src_data = json.load(args.src) ++ dest_data = json.load(args.dest) ++ args.src.close() ++ args.dest.close() ++ ++ if args.reverse: ++ temp = src_data ++ src_data = dest_data ++ dest_data = temp ++ ++ for sec in src_data: ++ if not sec in dest_data: ++ print "Section \"" + sec + "\" does not exist in dest" ++ bump_taint() ++ continue ++ ++ s = src_data[sec] ++ d = dest_data[sec] ++ ++ if sec == "vmschkmachine": ++ check_machine_type(s, d) ++ continue ++ ++ check_version(s, d, sec) ++ ++ for entry in s: ++ if not entry in d: ++ print "Section \"" + sec + "\": Entry \"" + entry + "\"", ++ print "missing" ++ bump_taint() ++ continue ++ ++ if entry == "Description": ++ check_descriptions(s[entry], d[entry], sec) ++ ++ return taint ++ ++ ++if __name__ == '__main__': ++ sys.exit(main()) +-- +1.9.3 + diff --git a/SOURCES/kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch b/SOURCES/kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch index 8ed9288..f95a245 100644 --- a/SOURCES/kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch +++ b/SOURCES/kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch @@ -1,12 +1,12 @@ -From a0a7c88ceec2443192ec27242b176b66f82dd74a Mon Sep 17 00:00:00 2001 +From 713d4d69d84774949c7306289724c2463dbeab1d Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 1 Sep 2014 13:36:53 +0200 -Subject: [PATCH 2/6] vmstate_xhci_event: bug compat with RHEL-7.0 (RHEL only) +Subject: [PATCH 06/12] vmstate_xhci_event: bug compat with RHEL-7.0 (RHEL only) Message-id: <1409578613-11909-3-git-send-email-lersek@redhat.com> Patchwork-id: 60782 O-Subject: [PATCH RHEL-7.0.z/RHEL-7.1.0 qemu-kvm 2/2] vmstate_xhci_event: bug compat with RHEL-7.0 (RHEL only) -Bugzilla: 1145055 +Bugzilla: 1122147 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Amit Shah RH-Acked-by: Paolo Bonzini @@ -84,14 +84,13 @@ Suggested-by: Amit Shah Suggested-by: Dr. David Alan Gilbert Suggested-by: Markus Armbruster Signed-off-by: Laszlo Ersek - Signed-off-by: Miroslav Rezanina --- hw/usb/hcd-xhci.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c -index dbdf6b1..9f97167 100644 +index 0ef2bc4..2c9e36a 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -420,6 +420,8 @@ typedef struct XHCIEvent { diff --git a/SOURCES/kvm-vmstate_xhci_event-fix-unterminated-field-list.patch b/SOURCES/kvm-vmstate_xhci_event-fix-unterminated-field-list.patch index 92795b5..1b7c52f 100644 --- a/SOURCES/kvm-vmstate_xhci_event-fix-unterminated-field-list.patch +++ b/SOURCES/kvm-vmstate_xhci_event-fix-unterminated-field-list.patch @@ -1,12 +1,12 @@ -From 41d2d56a0fda46b582eab0845f064ba85c9c2456 Mon Sep 17 00:00:00 2001 +From 00beaa541050bcbf399e116772db3746cb0c0278 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 1 Sep 2014 13:36:52 +0200 -Subject: [PATCH 1/6] vmstate_xhci_event: fix unterminated field list +Subject: [PATCH 05/12] vmstate_xhci_event: fix unterminated field list Message-id: <1409578613-11909-2-git-send-email-lersek@redhat.com> Patchwork-id: 60781 O-Subject: [PATCH RHEL-7.0.z/RHEL-7.1.0 qemu-kvm 1/2] vmstate_xhci_event: fix unterminated field list -Bugzilla: 1145055 +Bugzilla: 1122147 RH-Acked-by: Amit Shah RH-Acked-by: Juan Quintela RH-Acked-by: Paolo Bonzini @@ -48,7 +48,7 @@ Signed-off-by: Miroslav Rezanina 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c -index 87ba7af..dbdf6b1 100644 +index fd1bd89..0ef2bc4 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3526,6 +3526,7 @@ static const VMStateDescription vmstate_xhci_event = { diff --git a/SOURCES/kvm-vnc-sanitize-bits_per_pixel-from-the-client.patch b/SOURCES/kvm-vnc-sanitize-bits_per_pixel-from-the-client.patch new file mode 100644 index 0000000..8c486fb --- /dev/null +++ b/SOURCES/kvm-vnc-sanitize-bits_per_pixel-from-the-client.patch @@ -0,0 +1,60 @@ +From 9aeb00acc02f49c754f0bbde5894b45b41407f63 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Tue, 18 Nov 2014 11:58:56 +0100 +Subject: [PATCH 33/41] vnc: sanitize bits_per_pixel from the client + +Message-id: <1416311936-5001-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 62424 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] vnc: sanitize bits_per_pixel from the client +Bugzilla: 1157645 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Markus Armbruster +RH-Acked-by: Dr. David Alan Gilbert (git) + +From: Petr Matousek + +bits_per_pixel that are less than 8 could result in accessing +non-initialized buffers later in the code due to the expectation +that bytes_per_pixel value that is used to initialize these buffers is +never zero. + +To fix this check that bits_per_pixel from the client is one of the +values that the rfb protocol specification allows. + +This is CVE-2014-7815. + +Signed-off-by: Petr Matousek + +[ kraxel: apply codestyle fix ] + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit e6908bfe8e07f2b452e78e677da1b45b1c0f6829) +Signed-off-by: Miroslav Rezanina +--- + ui/vnc.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/ui/vnc.c b/ui/vnc.c +index 3726352..a0e2d33 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -2024,6 +2024,16 @@ static void set_pixel_format(VncState *vs, + return; + } + ++ switch (bits_per_pixel) { ++ case 8: ++ case 16: ++ case 32: ++ break; ++ default: ++ vnc_client_error(vs); ++ return; ++ } ++ + vs->client_pf.rmax = red_max; + vs->client_pf.rbits = hweight_long(red_max); + vs->client_pf.rshift = red_shift; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-vpc-Implement-.bdrv_has_zero_init.patch b/SOURCES/kvm-vpc-Implement-.bdrv_has_zero_init.patch new file mode 100644 index 0000000..ef172f3 --- /dev/null +++ b/SOURCES/kvm-vpc-Implement-.bdrv_has_zero_init.patch @@ -0,0 +1,86 @@ +From 0e4b156f5e4c928c2f98c21d029b0b1c361bd2a8 Mon Sep 17 00:00:00 2001 +From: Jeffrey Cody +Date: Tue, 16 Sep 2014 20:11:48 +0200 +Subject: [PATCH 10/20] vpc: Implement .bdrv_has_zero_init + +Message-id: +Patchwork-id: 61214 +O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 09/15] vpc: Implement .bdrv_has_zero_init +Bugzilla: 1098086 +RH-Acked-by: Fam Zheng +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Max Reitz + +From: Kevin Wolf + +Depending on the subformat, has_zero_init on VHD must behave like raw +and query the underlying storage (fixed) or like other sparse formats +that can always return 1 (dynamic, differencing). + +Signed-off-by: Kevin Wolf +(cherry picked from commit 72c6cc94daa727f41ecfc2b2ff94aa6f0e459b7f) + +Conflicts: + block/vpc.c + +RHEL7 Notes: Conflict due to out of order commits + +Signed-off-by: Jeff Cody +Signed-off-by: Miroslav Rezanina +--- + block/vpc.c | 28 +++++++++++++++++++++------- + 1 files changed, 21 insertions(+), 7 deletions(-) + +diff --git a/block/vpc.c b/block/vpc.c +index 6e8fb33..2f3d4ac 100644 +--- a/block/vpc.c ++++ b/block/vpc.c +@@ -826,6 +826,18 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, + return ret; + } + ++static int vpc_has_zero_init(BlockDriverState *bs) ++{ ++ BDRVVPCState *s = bs->opaque; ++ struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf; ++ ++ if (cpu_to_be32(footer->type) == VHD_FIXED) { ++ return bdrv_has_zero_init(bs->file); ++ } else { ++ return 1; ++ } ++} ++ + static void vpc_close(BlockDriverState *bs) + { + BDRVVPCState *s = bs->opaque; +@@ -858,17 +870,19 @@ static BlockDriver bdrv_vpc = { + .format_name = "vpc", + .instance_size = sizeof(BDRVVPCState), + +- .bdrv_probe = vpc_probe, +- .bdrv_open = vpc_open, +- .bdrv_close = vpc_close, +- .bdrv_reopen_prepare = vpc_reopen_prepare, +- .bdrv_create = vpc_create, ++ .bdrv_probe = vpc_probe, ++ .bdrv_open = vpc_open, ++ .bdrv_close = vpc_close, ++ .bdrv_reopen_prepare = vpc_reopen_prepare, ++ .bdrv_create = vpc_create, + + .bdrv_read = vpc_co_read, + .bdrv_write = vpc_co_write, + +- .create_options = vpc_create_options, +- .bdrv_get_info = vpc_get_info, ++ .bdrv_get_info = vpc_get_info, ++ ++ .create_options = vpc_create_options, ++ .bdrv_has_zero_init = vpc_has_zero_init, + }; + + static void bdrv_vpc_init(void) +-- +1.7.1 + diff --git a/SOURCES/kvm-xhci-Add-a-few-missing-checks-for-disconnected-devic.patch b/SOURCES/kvm-xhci-Add-a-few-missing-checks-for-disconnected-devic.patch new file mode 100644 index 0000000..e926e80 --- /dev/null +++ b/SOURCES/kvm-xhci-Add-a-few-missing-checks-for-disconnected-devic.patch @@ -0,0 +1,79 @@ +From d6c5ce73edbc928cce19a095a27e2feff9db8884 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:52 +0200 +Subject: [PATCH 18/43] xhci: Add a few missing checks for disconnected devices + +Message-id: <1405088470-24115-20-git-send-email-kraxel@redhat.com> +Patchwork-id: 59827 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 19/37] xhci: Add a few missing checks for disconnected devices +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +One of the reworks of qemu's usb core made changes to usb-port's disconnect +handling. Now ports with a device will always have a non 0 dev member, but +if the device is not attached (which is possible with usb redirection), +dev->attached will be 0. + +So supplement all checks for dev to also check dev->attached, and add an +extra check in a path where a device check was completely missing. + +This fixes various crashes (asserts triggering) I've been seeing when xhci +attached usb devices get disconnected at the wrong time. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit de9de157fbb9aa66380ab1973dd6ecf12fbd8b25) +--- + hw/usb/hcd-xhci.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index ef0c073..944b255 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1498,7 +1498,8 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid, + } + + if (!xhci->slots[slotid-1].uport || +- !xhci->slots[slotid-1].uport->dev) { ++ !xhci->slots[slotid-1].uport->dev || ++ !xhci->slots[slotid-1].uport->dev->attached) { + return CC_USB_TRANSACTION_ERROR; + } + +@@ -1985,6 +1986,14 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + return; + } + ++ /* If the device has been detached, but the guest has not noticed this ++ yet the 2 above checks will succeed, but we must NOT continue */ ++ if (!xhci->slots[slotid - 1].uport || ++ !xhci->slots[slotid - 1].uport->dev || ++ !xhci->slots[slotid - 1].uport->dev->attached) { ++ return; ++ } ++ + if (epctx->retry) { + XHCITransfer *xfer = epctx->retry; + +@@ -2209,7 +2218,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + trace_usb_xhci_slot_address(slotid, uport->path); + + dev = uport->dev; +- if (!dev) { ++ if (!dev || !dev->attached) { + fprintf(stderr, "xhci: port %s not connected\n", uport->path); + return CC_USB_TRANSACTION_ERROR; + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-Add-xhci_epid_to_usbep-helper-function.patch b/SOURCES/kvm-xhci-Add-xhci_epid_to_usbep-helper-function.patch new file mode 100644 index 0000000..b78fde9 --- /dev/null +++ b/SOURCES/kvm-xhci-Add-xhci_epid_to_usbep-helper-function.patch @@ -0,0 +1,134 @@ +From 36b1f983a244521a4dd7293b36b152222aa953ed Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:44 +0200 +Subject: [PATCH 10/43] xhci: Add xhci_epid_to_usbep helper function + +Message-id: <1405088470-24115-12-git-send-email-kraxel@redhat.com> +Patchwork-id: 59837 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 11/37] xhci: Add xhci_epid_to_usbep helper function +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +And use it instead of prying the USBEndpoint out of the packet struct +in various places. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 518ad5f2a0754f0a5ce4e478b79f4926ce46111b) +--- + hw/usb/hcd-xhci.c | 32 ++++++++++++++++++++++---------- + 1 file changed, 22 insertions(+), 10 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 32 ++++++++++++++++++++++---------- + 1 file changed, 22 insertions(+), 10 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 2daf334..56145a5 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -511,6 +511,8 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, + unsigned int epid); + static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v); + static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v); ++static USBEndpoint *xhci_epid_to_usbep(XHCIState *xhci, ++ unsigned int slotid, unsigned int epid); + + static const char *TRBType_names[] = { + [TRB_RESERVED] = "TRB_RESERVED", +@@ -1363,13 +1365,12 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid, + + xferi = epctx->next_xfer; + for (i = 0; i < TD_QUEUE; i++) { +- if (epctx->transfers[xferi].packet.ep) { +- ep = epctx->transfers[xferi].packet.ep; +- } + killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi]); + epctx->transfers[xferi].packet.ep = NULL; + xferi = (xferi + 1) % TD_QUEUE; + } ++ ++ ep = xhci_epid_to_usbep(xhci, slotid, epid); + if (ep) { + usb_device_ep_stopped(ep->dev, ep); + } +@@ -1701,7 +1702,6 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, + static int xhci_setup_packet(XHCITransfer *xfer) + { + XHCIState *xhci = xfer->xhci; +- USBDevice *dev; + USBEndpoint *ep; + int dir; + +@@ -1709,15 +1709,13 @@ static int xhci_setup_packet(XHCITransfer *xfer) + + if (xfer->packet.ep) { + ep = xfer->packet.ep; +- dev = ep->dev; + } else { +- if (!xhci->slots[xfer->slotid-1].uport) { ++ ep = xhci_epid_to_usbep(xhci, xfer->slotid, xfer->epid); ++ if (!ep) { + fprintf(stderr, "xhci: slot %d has no device\n", + xfer->slotid); + return -1; + } +- dev = xhci->slots[xfer->slotid-1].uport->dev; +- ep = usb_ep_get(dev, dir, xfer->epid >> 1); + } + + xhci_xfer_create_sgl(xfer, dir == USB_TOKEN_IN); /* Also sets int_req */ +@@ -1725,7 +1723,7 @@ static int xhci_setup_packet(XHCITransfer *xfer) + xfer->trbs[0].addr, false, xfer->int_req); + usb_packet_map(&xfer->packet, &xfer->sgl); + DPRINTF("xhci: setup packet pid 0x%x addr %d ep %d\n", +- xfer->packet.pid, dev->addr, ep->nr); ++ xfer->packet.pid, ep->dev->addr, ep->nr); + return 0; + } + +@@ -2077,7 +2075,6 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + } else { + if (xhci_fire_transfer(xhci, xfer, epctx) >= 0) { + epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; +- ep = xfer->packet.ep; + } else { + if (!xfer->timed_xfer) { + fprintf(stderr, "xhci: error firing data transfer\n"); +@@ -2094,6 +2091,8 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + break; + } + } ++ ++ ep = xhci_epid_to_usbep(xhci, slotid, epid); + if (ep) { + usb_device_flush_ep_queue(ep->dev, ep); + } +@@ -3331,6 +3330,19 @@ static int xhci_find_epid(USBEndpoint *ep) + } + } + ++static USBEndpoint *xhci_epid_to_usbep(XHCIState *xhci, ++ unsigned int slotid, unsigned int epid) ++{ ++ assert(slotid >= 1 && slotid <= xhci->numslots); ++ ++ if (!xhci->slots[slotid - 1].uport) { ++ return NULL; ++ } ++ ++ return usb_ep_get(xhci->slots[slotid - 1].uport->dev, ++ (epid & 1) ? USB_TOKEN_IN : USB_TOKEN_OUT, epid >> 1); ++} ++ + static void xhci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep, + unsigned int stream) + { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-Call-usb_device_alloc-free_streams.patch b/SOURCES/kvm-xhci-Call-usb_device_alloc-free_streams.patch new file mode 100644 index 0000000..3fcf698 --- /dev/null +++ b/SOURCES/kvm-xhci-Call-usb_device_alloc-free_streams.patch @@ -0,0 +1,178 @@ +From da332a238d28a29821dc57437f43feed54a3f418 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:55 +0200 +Subject: [PATCH 21/43] xhci: Call usb_device_alloc/free_streams + +Message-id: <1405088470-24115-23-git-send-email-kraxel@redhat.com> +Patchwork-id: 59834 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 22/37] xhci: Call usb_device_alloc/free_streams +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Note this code is not as KISS as I would like, the reason for this is that +the Linux kernel interface wants streams on eps belonging to one interface +to be allocated in one call. Things will also work if we do this one ep at a +time (as long as all eps support the same amount of streams), but lets stick +to the kernel API. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 72391da50621c9f11bb8c57193ab2d1ad8bc5ad8) +--- + hw/usb/hcd-xhci.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 117 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 117 insertions(+) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 944b255..5f0840b 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1153,6 +1153,111 @@ static void xhci_free_streams(XHCIEPContext *epctx) + epctx->nr_pstreams = 0; + } + ++static int xhci_epmask_to_eps_with_streams(XHCIState *xhci, ++ unsigned int slotid, ++ uint32_t epmask, ++ XHCIEPContext **epctxs, ++ USBEndpoint **eps) ++{ ++ XHCISlot *slot; ++ XHCIEPContext *epctx; ++ USBEndpoint *ep; ++ int i, j; ++ ++ assert(slotid >= 1 && slotid <= xhci->numslots); ++ ++ slot = &xhci->slots[slotid - 1]; ++ ++ for (i = 2, j = 0; i <= 31; i++) { ++ if (!(epmask & (1 << i))) { ++ continue; ++ } ++ ++ epctx = slot->eps[i - 1]; ++ ep = xhci_epid_to_usbep(xhci, slotid, i); ++ if (!epctx || !epctx->nr_pstreams || !ep) { ++ continue; ++ } ++ ++ if (epctxs) { ++ epctxs[j] = epctx; ++ } ++ eps[j++] = ep; ++ } ++ return j; ++} ++ ++static void xhci_free_device_streams(XHCIState *xhci, unsigned int slotid, ++ uint32_t epmask) ++{ ++ USBEndpoint *eps[30]; ++ int nr_eps; ++ ++ nr_eps = xhci_epmask_to_eps_with_streams(xhci, slotid, epmask, NULL, eps); ++ if (nr_eps) { ++ usb_device_free_streams(eps[0]->dev, eps, nr_eps); ++ } ++} ++ ++static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid, ++ uint32_t epmask) ++{ ++ XHCIEPContext *epctxs[30]; ++ USBEndpoint *eps[30]; ++ int i, r, nr_eps, req_nr_streams, dev_max_streams; ++ ++ nr_eps = xhci_epmask_to_eps_with_streams(xhci, slotid, epmask, epctxs, ++ eps); ++ if (nr_eps == 0) { ++ return CC_SUCCESS; ++ } ++ ++ req_nr_streams = epctxs[0]->nr_pstreams; ++ dev_max_streams = eps[0]->max_streams; ++ ++ for (i = 1; i < nr_eps; i++) { ++ /* ++ * HdG: I don't expect these to ever trigger, but if they do we need ++ * to come up with another solution, ie group identical endpoints ++ * together and make an usb_device_alloc_streams call per group. ++ */ ++ if (epctxs[i]->nr_pstreams != req_nr_streams) { ++ FIXME("guest streams config not identical for all eps"); ++ return CC_RESOURCE_ERROR; ++ } ++ if (eps[i]->max_streams != dev_max_streams) { ++ FIXME("device streams config not identical for all eps"); ++ return CC_RESOURCE_ERROR; ++ } ++ } ++ ++ /* ++ * max-streams in both the device descriptor and in the controller is a ++ * power of 2. But stream id 0 is reserved, so if a device can do up to 4 ++ * streams the guest will ask for 5 rounded up to the next power of 2 which ++ * becomes 8. For emulated devices usb_device_alloc_streams is a nop. ++ * ++ * For redirected devices however this is an issue, as there we must ask ++ * the real xhci controller to alloc streams, and the host driver for the ++ * real xhci controller will likely disallow allocating more streams then ++ * the device can handle. ++ * ++ * So we limit the requested nr_streams to the maximum number the device ++ * can handle. ++ */ ++ if (req_nr_streams > dev_max_streams) { ++ req_nr_streams = dev_max_streams; ++ } ++ ++ r = usb_device_alloc_streams(eps[0]->dev, eps, nr_eps, req_nr_streams); ++ if (r != 0) { ++ fprintf(stderr, "xhci: alloc streams failed\n"); ++ return CC_RESOURCE_ERROR; ++ } ++ ++ return CC_SUCCESS; ++} ++ + static XHCIStreamContext *xhci_find_stream(XHCIEPContext *epctx, + unsigned int streamid, + uint32_t *cc_error) +@@ -2325,6 +2430,8 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid, + return CC_CONTEXT_STATE_ERROR; + } + ++ xhci_free_device_streams(xhci, slotid, ictl_ctx[0] | ictl_ctx[1]); ++ + for (i = 2; i <= 31; i++) { + if (ictl_ctx[0] & (1< +Date: Fri, 11 Jul 2014 14:20:45 +0200 +Subject: [PATCH 11/43] xhci: Fix memory leak on xhci_disable_ep + +Message-id: <1405088470-24115-13-git-send-email-kraxel@redhat.com> +Patchwork-id: 59821 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 12/37] xhci: Fix memory leak on xhci_disable_ep +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +The USBPacket-s in the transfers need to be cleaned up so that the memory +allocated by the iovec in there gets freed. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit b21da4e504fbdb907543a918b190783dc896d8e1) +--- + hw/usb/hcd-xhci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 56145a5..bb3bba3 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1382,6 +1382,7 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, + { + XHCISlot *slot; + XHCIEPContext *epctx; ++ int i; + + trace_usb_xhci_ep_disable(slotid, epid); + assert(slotid >= 1 && slotid <= xhci->numslots); +@@ -1402,6 +1403,10 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, + xhci_free_streams(epctx); + } + ++ for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { ++ usb_packet_cleanup(&epctx->transfers[i].packet); ++ } ++ + xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); + + qemu_free_timer(epctx->kick_timer); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-Init-a-transfers-xhci-slotid-and-epid-member-on.patch b/SOURCES/kvm-xhci-Init-a-transfers-xhci-slotid-and-epid-member-on.patch new file mode 100644 index 0000000..28cfbb3 --- /dev/null +++ b/SOURCES/kvm-xhci-Init-a-transfers-xhci-slotid-and-epid-member-on.patch @@ -0,0 +1,61 @@ +From 0302db9f99761bc53e99cd1c3fbdcec3a3fd13c5 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:43 +0200 +Subject: [PATCH 09/43] xhci: Init a transfers xhci, slotid and epid member on + epctx alloc + +Message-id: <1405088470-24115-11-git-send-email-kraxel@redhat.com> +Patchwork-id: 59823 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 10/37] xhci: Init a transfers xhci, slotid and epid member on epctx alloc +Bugzilla: 1075846 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +From: Hans de Goede + +Transfers are part of an epctx, which is part of a slot, which is part of +a xhci. Transfers cannot dynamically be moved from one epctx to another, +so once created their xhci, slotid and epid are constant, so lets set these +up at creation time, rather then re-initializing them with the same +value each time a transfer gets submitted. + +Signed-off-by: Hans de Goede +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 4c5d82ecf1e8fd0720137f7d09fc77d65b51b4d0) +--- + hw/usb/hcd-xhci.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 61f5329..2daf334 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1247,6 +1247,9 @@ static XHCIEPContext *xhci_alloc_epctx(XHCIState *xhci, + epctx->epid = epid; + + for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { ++ epctx->transfers[i].xhci = xhci; ++ epctx->transfers[i].slotid = slotid; ++ epctx->transfers[i].epid = epid; + usb_packet_init(&epctx->transfers[i].packet); + } + epctx->kick_timer = qemu_new_timer_ns(vm_clock, xhci_ep_kick_timer, epctx); +@@ -2062,9 +2065,6 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + for (i = 0; i < length; i++) { + assert(xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL)); + } +- xfer->xhci = xhci; +- xfer->epid = epid; +- xfer->slotid = slotid; + xfer->streamid = streamid; + + if (epid == 1) { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-add-port-to-slot_address-tracepoint.patch b/SOURCES/kvm-xhci-add-port-to-slot_address-tracepoint.patch new file mode 100644 index 0000000..7c7873e --- /dev/null +++ b/SOURCES/kvm-xhci-add-port-to-slot_address-tracepoint.patch @@ -0,0 +1,62 @@ +From 69cd7d87b208e842a7b283c90cc3113fac244e29 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:40 +0200 +Subject: [PATCH 07/43] xhci: add port to slot_address tracepoint + +Message-id: <1405088470-24115-8-git-send-email-kraxel@redhat.com> +Patchwork-id: 59830 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 07/37] xhci: add port to slot_address tracepoint +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 65d81ed402d3b78b6ffbade36a09ea53e41614d2) +--- + hw/usb/hcd-xhci.c | 2 +- + trace-events | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 +- + trace-events | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index e8fa26c..61f5329 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -2168,7 +2168,6 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + int i; + TRBCCode res; + +- trace_usb_xhci_slot_address(slotid); + assert(slotid >= 1 && slotid <= xhci->numslots); + + dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); +@@ -2201,6 +2200,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + fprintf(stderr, "xhci: port not found\n"); + return CC_TRB_ERROR; + } ++ trace_usb_xhci_slot_address(slotid, uport->path); + + dev = uport->dev; + if (!dev) { +diff --git a/trace-events b/trace-events +index 4058dd5..117c2ce 100644 +--- a/trace-events ++++ b/trace-events +@@ -368,7 +368,7 @@ usb_xhci_port_link(uint32_t port, uint32_t pls) "port %d, pls %d" + usb_xhci_port_notify(uint32_t port, uint32_t pls) "port %d, bits %x" + usb_xhci_slot_enable(uint32_t slotid) "slotid %d" + usb_xhci_slot_disable(uint32_t slotid) "slotid %d" +-usb_xhci_slot_address(uint32_t slotid) "slotid %d" ++usb_xhci_slot_address(uint32_t slotid, const char *port) "slotid %d, port %s" + usb_xhci_slot_configure(uint32_t slotid) "slotid %d" + usb_xhci_slot_evaluate(uint32_t slotid) "slotid %d" + usb_xhci_slot_reset(uint32_t slotid) "slotid %d" +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-add-sanity-checks-to-xhci_lookup_uport.patch b/SOURCES/kvm-xhci-add-sanity-checks-to-xhci_lookup_uport.patch new file mode 100644 index 0000000..19caa40 --- /dev/null +++ b/SOURCES/kvm-xhci-add-sanity-checks-to-xhci_lookup_uport.patch @@ -0,0 +1,52 @@ +From 0ebce8809c6cf12e4df5fe9fdf441b280176412e Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Tue, 18 Nov 2014 11:42:20 +0100 +Subject: [PATCH 1/5] xhci: add sanity checks to xhci_lookup_uport + +Message-id: <1416310940-10391-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 62418 +O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 1/1] xhci: add sanity checks to xhci_lookup_uport +Bugzilla: 1074219 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Marcel Apfelbaum +RH-Acked-by: Markus Armbruster + +Also catch xhci_lookup_uport failures in post_load. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit f2ad97ff81da51c064b9e87720ff48a0874f45d4) +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 32568cb..ce81632 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -2254,6 +2254,9 @@ static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx) + int i, pos, port; + + port = (slot_ctx[1]>>16) & 0xFF; ++ if (port < 1 || port > xhci->numports) { ++ return NULL; ++ } + port = xhci->ports[port-1].uport->index+1; + pos = snprintf(path, sizeof(path), "%d", port); + for (i = 0; i < 5; i++) { +@@ -3637,6 +3640,12 @@ static int usb_xhci_post_load(void *opaque, int version_id) + xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid)); + xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); + slot->uport = xhci_lookup_uport(xhci, slot_ctx); ++ if (!slot->uport) { ++ /* should not happen, but may trigger on guest bugs */ ++ slot->enabled = 0; ++ slot->addressed = 0; ++ continue; ++ } + assert(slot->uport && slot->uport->dev); + + for (epid = 1; epid <= 31; epid++) { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch b/SOURCES/kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch new file mode 100644 index 0000000..8edf370 --- /dev/null +++ b/SOURCES/kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch @@ -0,0 +1,85 @@ +From 808711fd7cfcd6daca455db6dbd9d0f1f17a8b96 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:39 +0200 +Subject: [PATCH 06/43] xhci: add tracepoint for endpoint state changes + +Message-id: <1405088470-24115-7-git-send-email-kraxel@redhat.com> +Patchwork-id: 59843 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 06/37] xhci: add tracepoint for endpoint state changes +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 1c82392a158471355aa6d1922df2d1545bb16b95) +--- + hw/usb/hcd-xhci.c | 19 +++++++++++++++++++ + trace-events | 1 + + 2 files changed, 20 insertions(+) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 19 +++++++++++++++++++ + trace-events | 1 + + 2 files changed, 20 insertions(+) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 00623f9..e8fa26c 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -589,6 +589,14 @@ static const char *TRBCCode_names[] = { + [CC_SPLIT_TRANSACTION_ERROR] = "CC_SPLIT_TRANSACTION_ERROR", + }; + ++static const char *ep_state_names[] = { ++ [EP_DISABLED] = "disabled", ++ [EP_RUNNING] = "running", ++ [EP_HALTED] = "halted", ++ [EP_STOPPED] = "stopped", ++ [EP_ERROR] = "error", ++}; ++ + static const char *lookup_name(uint32_t index, const char **list, uint32_t llen) + { + if (index >= llen || list[index] == NULL) { +@@ -609,6 +617,12 @@ static const char *event_name(XHCIEvent *event) + ARRAY_SIZE(TRBCCode_names)); + } + ++static const char *ep_state_name(uint32_t state) ++{ ++ return lookup_name(state, ep_state_names, ++ ARRAY_SIZE(ep_state_names)); ++} ++ + static uint64_t xhci_mfindex_get(XHCIState *xhci) + { + int64_t now = qemu_get_clock_ns(vm_clock); +@@ -1206,6 +1220,11 @@ static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx, + } + + xhci_dma_write_u32s(xhci, epctx->pctx, ctx, sizeof(ctx)); ++ if (epctx->state != state) { ++ trace_usb_xhci_ep_state(epctx->slotid, epctx->epid, ++ ep_state_name(epctx->state), ++ ep_state_name(state)); ++ } + epctx->state = state; + } + +diff --git a/trace-events b/trace-events +index b9144b2..4058dd5 100644 +--- a/trace-events ++++ b/trace-events +@@ -378,6 +378,7 @@ usb_xhci_ep_set_dequeue(uint32_t slotid, uint32_t epid, uint32_t streamid, uint6 + usb_xhci_ep_kick(uint32_t slotid, uint32_t epid, uint32_t streamid) "slotid %d, epid %d, streamid %d" + usb_xhci_ep_stop(uint32_t slotid, uint32_t epid) "slotid %d, epid %d" + usb_xhci_ep_reset(uint32_t slotid, uint32_t epid) "slotid %d, epid %d" ++usb_xhci_ep_state(uint32_t slotid, uint32_t epid, const char *os, const char *ns) "slotid %d, epid %d, %s -> %s" + usb_xhci_xfer_start(void *xfer, uint32_t slotid, uint32_t epid, uint32_t streamid) "%p: slotid %d, epid %d, streamid %d" + usb_xhci_xfer_async(void *xfer) "%p" + usb_xhci_xfer_nak(void *xfer) "%p" +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-child-detach-fix.patch b/SOURCES/kvm-xhci-child-detach-fix.patch new file mode 100644 index 0000000..93cdffb --- /dev/null +++ b/SOURCES/kvm-xhci-child-detach-fix.patch @@ -0,0 +1,47 @@ +From 524882651970113d0b375a99362bd5b9e9b7f7a7 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:21:01 +0200 +Subject: [PATCH 27/43] xhci: child detach fix + +Message-id: <1405088470-24115-29-git-send-email-kraxel@redhat.com> +Patchwork-id: 59841 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 28/37] xhci: child detach fix +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +xhci_child_detach() zaps the wrong slot when unplugging a device +connected via usb-hub: Instead of the device's slot the slot of the +usb-hub is used. Fix it. + +https://bugzilla.redhat.com/show_bug.cgi?id=1075846 + +Signed-off-by: Gerd Hoffmann +Reviewed-by: Gonglei +(cherry picked from commit 463c534db516701ac732ac606c33c7101cf22e56) +--- + hw/usb/hcd-xhci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 2352b12..dc10ab0 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -3438,7 +3438,7 @@ static void xhci_child_detach(USBPort *uport, USBDevice *child) + USBBus *bus = usb_bus_from_device(child); + XHCIState *xhci = container_of(bus, XHCIState, bus); + +- xhci_detach_slot(xhci, uport); ++ xhci_detach_slot(xhci, child->port); + } + + static USBPortOps xhci_uport_ops = { +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-fix-overflow-in-usb_xhci_post_load.patch b/SOURCES/kvm-xhci-fix-overflow-in-usb_xhci_post_load.patch new file mode 100644 index 0000000..a6c3e2d --- /dev/null +++ b/SOURCES/kvm-xhci-fix-overflow-in-usb_xhci_post_load.patch @@ -0,0 +1,44 @@ +From e7f5ba3d995dde13369b53a61e65cb718ab585b3 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 10 Mar 2014 14:40:49 +0100 +Subject: [PATCH 01/13] xhci: fix overflow in usb_xhci_post_load + +RH-Author: Gerd Hoffmann +Message-id: <1394462449-19999-2-git-send-email-kraxel@redhat.com> +Patchwork-id: 58065 +O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] xhci: fix overflow in usb_xhci_post_load +Bugzilla: 1074219 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Radim Krcmar +RH-Acked-by: Juan Quintela + +Found by Coverity. + +Reported-by: Markus Armbruster +Signed-off-by: Gerd Hoffmann +(cherry picked from commit f6969b9fef543da1ffa975d24f4d7b75dc369b03) +--- + hw/usb/hcd-xhci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 87ba7af..fd1bd89 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -3457,7 +3457,7 @@ static int usb_xhci_post_load(void *opaque, int version_id) + slot->uport = xhci_lookup_uport(xhci, slot_ctx); + assert(slot->uport && slot->uport->dev); + +- for (epid = 1; epid <= 32; epid++) { ++ for (epid = 1; epid <= 31; epid++) { + pctx = slot->ctx + 32 * epid; + xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx)); + state = ep_ctx[0] & EP_STATE_MASK; +-- +1.7.1 + diff --git a/SOURCES/kvm-xhci-iso-allow-for-some-latency.patch b/SOURCES/kvm-xhci-iso-allow-for-some-latency.patch new file mode 100644 index 0000000..0d938ce --- /dev/null +++ b/SOURCES/kvm-xhci-iso-allow-for-some-latency.patch @@ -0,0 +1,46 @@ +From 7bb437f63758a301ae64ff0ef56b7d107eaa7d99 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:58 +0200 +Subject: [PATCH 24/43] xhci iso: allow for some latency + +Message-id: <1405088470-24115-26-git-send-email-kraxel@redhat.com> +Patchwork-id: 59829 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 25/37] xhci iso: allow for some latency +Bugzilla: 949385 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Allow the scheduled transfer time be a bit behind, to +compensate for latencies. Without this xhci will wait +way to often for the mfindex wraparound, assuming the +scheduled time is in the future just because qemu is +a bit behind in processing the iso transfer requests. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit cc03ff9d0a147a399a11c9f513afa5e06ceee453) +--- + hw/usb/hcd-xhci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 2799539..75da33d 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1980,7 +1980,7 @@ static void xhci_calc_iso_kick(XHCIState *xhci, XHCITransfer *xfer, + xfer->mfindex_kick = ((xfer->trbs[0].control >> TRB_TR_FRAMEID_SHIFT) + & TRB_TR_FRAMEID_MASK) << 3; + xfer->mfindex_kick |= mfindex & ~0x3fff; +- if (xfer->mfindex_kick < mfindex) { ++ if (xfer->mfindex_kick + 0x100 < mfindex) { + xfer->mfindex_kick += 0x4000; + } + } +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-iso-fix-time-calculation.patch b/SOURCES/kvm-xhci-iso-fix-time-calculation.patch new file mode 100644 index 0000000..5aaf9ce --- /dev/null +++ b/SOURCES/kvm-xhci-iso-fix-time-calculation.patch @@ -0,0 +1,45 @@ +From 38134ed684f0ec9eb40e3051e3052e5fd3bad000 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:57 +0200 +Subject: [PATCH 23/43] xhci iso: fix time calculation + +Message-id: <1405088470-24115-25-git-send-email-kraxel@redhat.com> +Patchwork-id: 59852 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 24/37] xhci iso: fix time calculation +Bugzilla: 949385 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Frameid specifies frames not microframes, so we +need to shift it to get the microframe index. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 786ad214c72226fa5bd4ebf18aeb4c6b54d3ba80) +--- + hw/usb/hcd-xhci.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 5f0840b..2799539 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1977,8 +1977,8 @@ static void xhci_calc_iso_kick(XHCIState *xhci, XHCITransfer *xfer, + xfer->mfindex_kick = asap; + } + } else { +- xfer->mfindex_kick = (xfer->trbs[0].control >> TRB_TR_FRAMEID_SHIFT) +- & TRB_TR_FRAMEID_MASK; ++ xfer->mfindex_kick = ((xfer->trbs[0].control >> TRB_TR_FRAMEID_SHIFT) ++ & TRB_TR_FRAMEID_MASK) << 3; + xfer->mfindex_kick |= mfindex & ~0x3fff; + if (xfer->mfindex_kick < mfindex) { + xfer->mfindex_kick += 0x4000; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-make-port-reset-trace-point-more-verbose.patch b/SOURCES/kvm-xhci-make-port-reset-trace-point-more-verbose.patch new file mode 100644 index 0000000..aea0c97 --- /dev/null +++ b/SOURCES/kvm-xhci-make-port-reset-trace-point-more-verbose.patch @@ -0,0 +1,55 @@ +From 41b79f8a3a86f20b45b073f9f28e3a6f9f4dc6d9 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:21:09 +0200 +Subject: [PATCH 29/43] xhci: make port reset trace point more verbose + +Message-id: <1405088470-24115-37-git-send-email-kraxel@redhat.com> +Patchwork-id: 59840 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 36/37] xhci: make port reset trace point more verbose +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 7bd3055ffd5f87d83f04659e496c91fbfc839143) +--- + hw/usb/hcd-xhci.c | 2 +- + trace-events | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 +- + trace-events | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index dc10ab0..32568cb 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -2854,7 +2854,7 @@ static void xhci_port_update(XHCIPort *port, int is_detach) + + static void xhci_port_reset(XHCIPort *port, bool warm_reset) + { +- trace_usb_xhci_port_reset(port->portnr); ++ trace_usb_xhci_port_reset(port->portnr, warm_reset); + + if (!xhci_port_have_device(port)) { + return; +diff --git a/trace-events b/trace-events +index 117c2ce..e7bb7e0 100644 +--- a/trace-events ++++ b/trace-events +@@ -363,7 +363,7 @@ usb_xhci_irq_msix_use(uint32_t nr) "nr %d" + usb_xhci_irq_msix_unuse(uint32_t nr) "nr %d" + usb_xhci_queue_event(uint32_t vector, uint32_t idx, const char *trb, const char *evt, uint64_t param, uint32_t status, uint32_t control) "v %d, idx %d, %s, %s, p %016" PRIx64 ", s %08x, c 0x%08x" + usb_xhci_fetch_trb(uint64_t addr, const char *name, uint64_t param, uint32_t status, uint32_t control) "addr %016" PRIx64 ", %s, p %016" PRIx64 ", s %08x, c 0x%08x" +-usb_xhci_port_reset(uint32_t port) "port %d" ++usb_xhci_port_reset(uint32_t port, bool warm) "port %d, warm %d" + usb_xhci_port_link(uint32_t port, uint32_t pls) "port %d, pls %d" + usb_xhci_port_notify(uint32_t port, uint32_t pls) "port %d, bits %x" + usb_xhci_slot_enable(uint32_t slotid) "slotid %d" +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-remove-leftover-debug-printf.patch b/SOURCES/kvm-xhci-remove-leftover-debug-printf.patch new file mode 100644 index 0000000..738fc4b --- /dev/null +++ b/SOURCES/kvm-xhci-remove-leftover-debug-printf.patch @@ -0,0 +1,40 @@ +From cac7f36f9ae8317a33bc353fd0c18275898526bb Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:38 +0200 +Subject: [PATCH 05/43] xhci: remove leftover debug printf + +Message-id: <1405088470-24115-6-git-send-email-kraxel@redhat.com> +Patchwork-id: 59825 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 05/37] xhci: remove leftover debug printf +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 5219042274fa2f993c25202680eeaea42193389d) +--- + hw/usb/hcd-xhci.c | 2 -- + 1 file changed, 2 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 724c412..00623f9 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -1167,8 +1167,6 @@ static XHCIStreamContext *xhci_find_stream(XHCIEPContext *epctx, + + if (sctx->sct == -1) { + xhci_dma_read_u32s(epctx->xhci, sctx->pctx, ctx, sizeof(ctx)); +- fprintf(stderr, "%s: init sctx #%d @ " DMA_ADDR_FMT ": %08x %08x\n", +- __func__, streamid, sctx->pctx, ctx[0], ctx[1]); + sct = (ctx[0] >> 1) & 0x07; + if (epctx->lsa && sct != 1) { + *cc_error = CC_INVALID_STREAM_TYPE_ERROR; +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-switch-debug-printf-to-tracepoint.patch b/SOURCES/kvm-xhci-switch-debug-printf-to-tracepoint.patch new file mode 100644 index 0000000..ce19eea --- /dev/null +++ b/SOURCES/kvm-xhci-switch-debug-printf-to-tracepoint.patch @@ -0,0 +1,42 @@ +From fb9a90622fec7d8207962b7e8b58dfe8decc94ae Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:20:59 +0200 +Subject: [PATCH 25/43] xhci: switch debug printf to tracepoint + +Message-id: <1405088470-24115-27-git-send-email-kraxel@redhat.com> +Patchwork-id: 59853 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 26/37] xhci: switch debug printf to tracepoint +Bugzilla: 980747 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 4f9cc7342281bfbbc1bfccc155c59551c06d63db) +--- + hw/usb/hcd-xhci.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index 75da33d..f937b4e 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -2041,9 +2041,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx + } + break; + default: +- fprintf(stderr, "xhci: unknown or unhandled EP " +- "(type %d, in %d, ep %02x)\n", +- epctx->type, xfer->in_xfer, xfer->epid); ++ trace_usb_xhci_unimplemented("endpoint type", epctx->type); + return -1; + } + +-- +1.8.3.1 + diff --git a/SOURCES/kvm-xhci-use-DPRINTF-instead-of-fprintf-stderr.patch b/SOURCES/kvm-xhci-use-DPRINTF-instead-of-fprintf-stderr.patch new file mode 100644 index 0000000..03ba9b1 --- /dev/null +++ b/SOURCES/kvm-xhci-use-DPRINTF-instead-of-fprintf-stderr.patch @@ -0,0 +1,396 @@ +From 120f0850e08e429f7782df32412ce7cbb626a654 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 11 Jul 2014 14:21:00 +0200 +Subject: [PATCH 26/43] xhci: use DPRINTF() instead of fprintf(stderr, ...) + +Message-id: <1405088470-24115-28-git-send-email-kraxel@redhat.com> +Patchwork-id: 59856 +O-Subject: [RHEL-7.1 qemu-kvm PATCH 27/37] xhci: use DPRINTF() instead of fprintf(stderr, ...) +Bugzilla: 980833 +RH-Acked-by: Dr. David Alan Gilbert (git) +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Laszlo Ersek + +So we don't spam stderr with (guest-triggerable) messages by default. + +Signed-off-by: Gerd Hoffmann +(cherry picked from commit d6bb65fcd24c8cb8c37ffe324c360f3b0c94b902) +--- + hw/usb/hcd-xhci.c | 90 +++++++++++++++++++++++++++---------------------------- + 1 file changed, 45 insertions(+), 45 deletions(-) + +Signed-off-by: Miroslav Rezanina +--- + hw/usb/hcd-xhci.c | 90 +++++++++++++++++++++++++++---------------------------- + 1 file changed, 45 insertions(+), 45 deletions(-) + +diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c +index f937b4e..2352b12 100644 +--- a/hw/usb/hcd-xhci.c ++++ b/hw/usb/hcd-xhci.c +@@ -810,7 +810,7 @@ static inline int xhci_running(XHCIState *xhci) + static void xhci_die(XHCIState *xhci) + { + xhci->usbsts |= USBSTS_HCE; +- fprintf(stderr, "xhci: asserted controller error\n"); ++ DPRINTF("xhci: asserted controller error\n"); + } + + static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v) +@@ -857,8 +857,8 @@ static void xhci_events_update(XHCIState *xhci, int v) + erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); + if (erdp < intr->er_start || + erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { +- fprintf(stderr, "xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); +- fprintf(stderr, "xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", ++ DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); ++ DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", + v, intr->er_start, intr->er_size); + xhci_die(xhci); + return; +@@ -926,7 +926,7 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) + if (intr->er_full) { + DPRINTF("xhci_event(): ER full, queueing\n"); + if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { +- fprintf(stderr, "xhci: event queue full, dropping event!\n"); ++ DPRINTF("xhci: event queue full, dropping event!\n"); + return; + } + intr->ev_buffer[intr->ev_buffer_put++] = *event; +@@ -939,8 +939,8 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) + erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); + if (erdp < intr->er_start || + erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { +- fprintf(stderr, "xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); +- fprintf(stderr, "xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", ++ DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); ++ DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", + v, intr->er_start, intr->er_size); + xhci_die(xhci); + return; +@@ -957,7 +957,7 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) + #endif + intr->er_full = 1; + if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { +- fprintf(stderr, "xhci: event queue full, dropping event!\n"); ++ DPRINTF("xhci: event queue full, dropping event!\n"); + return; + } + intr->ev_buffer[intr->ev_buffer_put++] = *event; +@@ -1075,7 +1075,7 @@ static void xhci_er_reset(XHCIState *xhci, int v) + } + /* cache the (sole) event ring segment location */ + if (intr->erstsz != 1) { +- fprintf(stderr, "xhci: invalid value for ERSTSZ: %d\n", intr->erstsz); ++ DPRINTF("xhci: invalid value for ERSTSZ: %d\n", intr->erstsz); + xhci_die(xhci); + return; + } +@@ -1085,7 +1085,7 @@ static void xhci_er_reset(XHCIState *xhci, int v) + le32_to_cpus(&seg.addr_high); + le32_to_cpus(&seg.size); + if (seg.size < 16 || seg.size > 4096) { +- fprintf(stderr, "xhci: invalid value for segment size: %d\n", seg.size); ++ DPRINTF("xhci: invalid value for segment size: %d\n", seg.size); + xhci_die(xhci); + return; + } +@@ -1251,7 +1251,7 @@ static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid, + + r = usb_device_alloc_streams(eps[0]->dev, eps, nr_eps, req_nr_streams); + if (r != 0) { +- fprintf(stderr, "xhci: alloc streams failed\n"); ++ DPRINTF("xhci: alloc streams failed\n"); + return CC_RESOURCE_ERROR; + } + +@@ -1535,7 +1535,7 @@ static TRBCCode xhci_stop_ep(XHCIState *xhci, unsigned int slotid, + assert(slotid >= 1 && slotid <= xhci->numslots); + + if (epid < 1 || epid > 31) { +- fprintf(stderr, "xhci: bad ep %d\n", epid); ++ DPRINTF("xhci: bad ep %d\n", epid); + return CC_TRB_ERROR; + } + +@@ -1547,7 +1547,7 @@ static TRBCCode xhci_stop_ep(XHCIState *xhci, unsigned int slotid, + } + + if (xhci_ep_nuke_xfers(xhci, slotid, epid, CC_STOPPED) > 0) { +- fprintf(stderr, "xhci: FIXME: endpoint stopped w/ xfers running, " ++ DPRINTF("xhci: FIXME: endpoint stopped w/ xfers running, " + "data might be lost\n"); + } + +@@ -1572,7 +1572,7 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid, + assert(slotid >= 1 && slotid <= xhci->numslots); + + if (epid < 1 || epid > 31) { +- fprintf(stderr, "xhci: bad ep %d\n", epid); ++ DPRINTF("xhci: bad ep %d\n", epid); + return CC_TRB_ERROR; + } + +@@ -1586,13 +1586,13 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid, + epctx = slot->eps[epid-1]; + + if (epctx->state != EP_HALTED) { +- fprintf(stderr, "xhci: reset EP while EP %d not halted (%d)\n", ++ DPRINTF("xhci: reset EP while EP %d not halted (%d)\n", + epid, epctx->state); + return CC_CONTEXT_STATE_ERROR; + } + + if (xhci_ep_nuke_xfers(xhci, slotid, epid, 0) > 0) { +- fprintf(stderr, "xhci: FIXME: endpoint reset w/ xfers running, " ++ DPRINTF("xhci: FIXME: endpoint reset w/ xfers running, " + "data might be lost\n"); + } + +@@ -1629,7 +1629,7 @@ static TRBCCode xhci_set_ep_dequeue(XHCIState *xhci, unsigned int slotid, + assert(slotid >= 1 && slotid <= xhci->numslots); + + if (epid < 1 || epid > 31) { +- fprintf(stderr, "xhci: bad ep %d\n", epid); ++ DPRINTF("xhci: bad ep %d\n", epid); + return CC_TRB_ERROR; + } + +@@ -1646,7 +1646,7 @@ static TRBCCode xhci_set_ep_dequeue(XHCIState *xhci, unsigned int slotid, + epctx = slot->eps[epid-1]; + + if (epctx->state != EP_STOPPED) { +- fprintf(stderr, "xhci: set EP dequeue pointer while EP %d not stopped\n", epid); ++ DPRINTF("xhci: set EP dequeue pointer while EP %d not stopped\n", epid); + return CC_CONTEXT_STATE_ERROR; + } + +@@ -1688,7 +1688,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer) + switch (TRB_TYPE(*trb)) { + case TR_DATA: + if ((!(trb->control & TRB_TR_DIR)) != (!in_xfer)) { +- fprintf(stderr, "xhci: data direction mismatch for TR_DATA\n"); ++ DPRINTF("xhci: data direction mismatch for TR_DATA\n"); + goto err; + } + /* fallthrough */ +@@ -1698,7 +1698,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer) + chunk = trb->status & 0x1ffff; + if (trb->control & TRB_TR_IDT) { + if (chunk > 8 || in_xfer) { +- fprintf(stderr, "xhci: invalid immediate data TRB\n"); ++ DPRINTF("xhci: invalid immediate data TRB\n"); + goto err; + } + qemu_sglist_add(&xfer->sgl, trb->addr, chunk); +@@ -1827,7 +1827,7 @@ static int xhci_setup_packet(XHCITransfer *xfer) + } else { + ep = xhci_epid_to_usbep(xhci, xfer->slotid, xfer->epid); + if (!ep) { +- fprintf(stderr, "xhci: slot %d has no device\n", ++ DPRINTF("xhci: slot %d has no device\n", + xfer->slotid); + return -1; + } +@@ -1890,7 +1890,7 @@ static int xhci_complete_packet(XHCITransfer *xfer) + xhci_stall_ep(xfer); + break; + default: +- fprintf(stderr, "%s: FIXME: status = %d\n", __func__, ++ DPRINTF("%s: FIXME: status = %d\n", __func__, + xfer->packet.status); + FIXME("unhandled USB_RET_*"); + } +@@ -1914,21 +1914,21 @@ static int xhci_fire_ctl_transfer(XHCIState *xhci, XHCITransfer *xfer) + + /* do some sanity checks */ + if (TRB_TYPE(*trb_setup) != TR_SETUP) { +- fprintf(stderr, "xhci: ep0 first TD not SETUP: %d\n", ++ DPRINTF("xhci: ep0 first TD not SETUP: %d\n", + TRB_TYPE(*trb_setup)); + return -1; + } + if (TRB_TYPE(*trb_status) != TR_STATUS) { +- fprintf(stderr, "xhci: ep0 last TD not STATUS: %d\n", ++ DPRINTF("xhci: ep0 last TD not STATUS: %d\n", + TRB_TYPE(*trb_status)); + return -1; + } + if (!(trb_setup->control & TRB_TR_IDT)) { +- fprintf(stderr, "xhci: Setup TRB doesn't have IDT set\n"); ++ DPRINTF("xhci: Setup TRB doesn't have IDT set\n"); + return -1; + } + if ((trb_setup->status & 0x1ffff) != 8) { +- fprintf(stderr, "xhci: Setup TRB has bad length (%d)\n", ++ DPRINTF("xhci: Setup TRB has bad length (%d)\n", + (trb_setup->status & 0x1ffff)); + return -1; + } +@@ -2079,12 +2079,12 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + assert(epid >= 1 && epid <= 31); + + if (!xhci->slots[slotid-1].enabled) { +- fprintf(stderr, "xhci: xhci_kick_ep for disabled slot %d\n", slotid); ++ DPRINTF("xhci: xhci_kick_ep for disabled slot %d\n", slotid); + return; + } + epctx = xhci->slots[slotid-1].eps[epid-1]; + if (!epctx) { +- fprintf(stderr, "xhci: xhci_kick_ep for disabled endpoint %d,%d\n", ++ DPRINTF("xhci: xhci_kick_ep for disabled endpoint %d,%d\n", + epid, slotid); + return; + } +@@ -2189,14 +2189,14 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, + epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; + ep = xfer->packet.ep; + } else { +- fprintf(stderr, "xhci: error firing CTL transfer\n"); ++ DPRINTF("xhci: error firing CTL transfer\n"); + } + } else { + if (xhci_fire_transfer(xhci, xfer, epctx) >= 0) { + epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; + } else { + if (!xfer->timed_xfer) { +- fprintf(stderr, "xhci: error firing data transfer\n"); ++ DPRINTF("xhci: error firing data transfer\n"); + } + } + } +@@ -2299,7 +2299,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx)); + + if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) { +- fprintf(stderr, "xhci: invalid input context control %08x %08x\n", ++ DPRINTF("xhci: invalid input context control %08x %08x\n", + ictl_ctx[0], ictl_ctx[1]); + return CC_TRB_ERROR; + } +@@ -2315,14 +2315,14 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + + uport = xhci_lookup_uport(xhci, slot_ctx); + if (uport == NULL) { +- fprintf(stderr, "xhci: port not found\n"); ++ DPRINTF("xhci: port not found\n"); + return CC_TRB_ERROR; + } + trace_usb_xhci_slot_address(slotid, uport->path); + + dev = uport->dev; + if (!dev || !dev->attached) { +- fprintf(stderr, "xhci: port %s not connected\n", uport->path); ++ DPRINTF("xhci: port %s not connected\n", uport->path); + return CC_USB_TRANSACTION_ERROR; + } + +@@ -2331,7 +2331,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, + continue; + } + if (xhci->slots[i].uport == uport) { +- fprintf(stderr, "xhci: port %s already assigned to slot %d\n", ++ DPRINTF("xhci: port %s already assigned to slot %d\n", + uport->path, i+1); + return CC_TRB_ERROR; + } +@@ -2415,7 +2415,7 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid, + xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx)); + + if ((ictl_ctx[0] & 0x3) != 0x0 || (ictl_ctx[1] & 0x3) != 0x1) { +- fprintf(stderr, "xhci: invalid input context control %08x %08x\n", ++ DPRINTF("xhci: invalid input context control %08x %08x\n", + ictl_ctx[0], ictl_ctx[1]); + return CC_TRB_ERROR; + } +@@ -2424,7 +2424,7 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid, + xhci_dma_read_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx)); + + if (SLOT_STATE(slot_ctx[3]) < SLOT_ADDRESSED) { +- fprintf(stderr, "xhci: invalid slot state %08x\n", slot_ctx[3]); ++ DPRINTF("xhci: invalid slot state %08x\n", slot_ctx[3]); + return CC_CONTEXT_STATE_ERROR; + } + +@@ -2497,7 +2497,7 @@ static TRBCCode xhci_evaluate_slot(XHCIState *xhci, unsigned int slotid, + xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx)); + + if (ictl_ctx[0] != 0x0 || ictl_ctx[1] & ~0x3) { +- fprintf(stderr, "xhci: invalid input context control %08x %08x\n", ++ DPRINTF("xhci: invalid input context control %08x %08x\n", + ictl_ctx[0], ictl_ctx[1]); + return CC_TRB_ERROR; + } +@@ -2576,11 +2576,11 @@ static unsigned int xhci_get_slot(XHCIState *xhci, XHCIEvent *event, XHCITRB *tr + unsigned int slotid; + slotid = (trb->control >> TRB_CR_SLOTID_SHIFT) & TRB_CR_SLOTID_MASK; + if (slotid < 1 || slotid > xhci->numslots) { +- fprintf(stderr, "xhci: bad slot id %d\n", slotid); ++ DPRINTF("xhci: bad slot id %d\n", slotid); + event->ccode = CC_TRB_ERROR; + return 0; + } else if (!xhci->slots[slotid-1].enabled) { +- fprintf(stderr, "xhci: slot id %d not enabled\n", slotid); ++ DPRINTF("xhci: slot id %d not enabled\n", slotid); + event->ccode = CC_SLOT_NOT_ENABLED_ERROR; + return 0; + } +@@ -2696,7 +2696,7 @@ static void xhci_process_commands(XHCIState *xhci) + } + } + if (i >= xhci->numslots) { +- fprintf(stderr, "xhci: no device slots available\n"); ++ DPRINTF("xhci: no device slots available\n"); + event.ccode = CC_NO_SLOTS_ERROR; + } else { + slotid = i+1; +@@ -2888,7 +2888,7 @@ static void xhci_reset(DeviceState *dev) + + trace_usb_xhci_reset(); + if (!(xhci->usbsts & USBSTS_HCH)) { +- fprintf(stderr, "xhci: reset while running!\n"); ++ DPRINTF("xhci: reset while running!\n"); + } + + xhci->usbcmd = 0; +@@ -3066,7 +3066,7 @@ static void xhci_port_write(void *ptr, hwaddr reg, + /* windows does this for some reason, don't spam stderr */ + break; + default: +- fprintf(stderr, "%s: ignore pls write (old %d, new %d)\n", ++ DPRINTF("%s: ignore pls write (old %d, new %d)\n", + __func__, old_pls, new_pls); + break; + } +@@ -3317,7 +3317,7 @@ static void xhci_doorbell_write(void *ptr, hwaddr reg, + trace_usb_xhci_doorbell_write(reg, val); + + if (!xhci_running(xhci)) { +- fprintf(stderr, "xhci: wrote doorbell while xHC stopped or paused\n"); ++ DPRINTF("xhci: wrote doorbell while xHC stopped or paused\n"); + return; + } + +@@ -3327,16 +3327,16 @@ static void xhci_doorbell_write(void *ptr, hwaddr reg, + if (val == 0) { + xhci_process_commands(xhci); + } else { +- fprintf(stderr, "xhci: bad doorbell 0 write: 0x%x\n", ++ DPRINTF("xhci: bad doorbell 0 write: 0x%x\n", + (uint32_t)val); + } + } else { + epid = val & 0xff; + streamid = (val >> 16) & 0xffff; + if (reg > xhci->numslots) { +- fprintf(stderr, "xhci: bad doorbell %d\n", (int)reg); ++ DPRINTF("xhci: bad doorbell %d\n", (int)reg); + } else if (epid > 31) { +- fprintf(stderr, "xhci: bad doorbell %d write: 0x%x\n", ++ DPRINTF("xhci: bad doorbell %d write: 0x%x\n", + (int)reg, (uint32_t)val); + } else { + xhci_kick_ep(xhci, reg, epid, streamid); +-- +1.8.3.1 + diff --git a/SOURCES/kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch b/SOURCES/kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch index 8876661..3f4f460 100644 --- a/SOURCES/kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch +++ b/SOURCES/kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch @@ -1,4 +1,4 @@ -From c878c42b892a18de84888766f14107005b4c4466 Mon Sep 17 00:00:00 2001 +From 2dd33300d200746f86301516a7d04800ac96653d Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin Date: Mon, 19 May 2014 09:57:37 +0200 Subject: [PATCH 1/2] kvm: zero-initialize KVM_SET_GSI_ROUTING input @@ -7,7 +7,7 @@ RH-Author: Michael S. Tsirkin Message-id: <1400493448-29146-2-git-send-email-mst@redhat.com> Patchwork-id: 58948 O-Subject: [PATCH qemu-kvm RHEL7.1 1/2] kvm: zero-initialize KVM_SET_GSI_ROUTING input -Bugzilla: 1110693 +Bugzilla: 1098976 RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek RH-Acked-by: Marcel Apfelbaum diff --git a/SPECS/qemu-kvm.spec b/SPECS/qemu-kvm.spec index 5fc3aaf..5210912 100644 --- a/SPECS/qemu-kvm.spec +++ b/SPECS/qemu-kvm.spec @@ -1,11 +1,7 @@ # Build time setting %define rhev 0 -%if %{rhev} - %bcond_with guest_agent # disabled -%else - %bcond_without guest_agent # enabled -%endif +%bcond_with guest_agent # disabled %global SLOF_gittagdate 20120731 @@ -73,7 +69,7 @@ Obsoletes: %1 < %{obsoletes_version} \ Summary: QEMU is a FAST! processor emulator Name: %{pkgname}%{?pkgsuffix} Version: 1.5.3 -Release: 60%{?dist}.11 +Release: 86%{?dist} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 10 License: GPLv2+ and LGPLv2+ and BSD @@ -81,7 +77,7 @@ Group: Development/Tools URL: http://www.qemu.org/ # RHEV will build Qemu only on x86_64: %if %{rhev} -ExclusiveArch: x86_64 +ExclusiveArch: %{power64} x86_64 %endif Requires: seabios-bin >= 1.7.2.2-5 Requires: sgabios-bin @@ -91,7 +87,9 @@ Requires: %{pkgname}-common%{?pkgsuffix} = %{epoch}:%{version}-%{release} %if 0%{?have_seccomp:1} Requires: libseccomp >= 1.0.0 %endif - +%if 0%{!?build_only_sub:1} +Requires: glusterfs-api >= 3.6.0 +%endif # OOM killer breaks builds with parallel make on s390(x) %ifarch s390 s390x %define _smp_mflags %{nil} @@ -2202,174 +2200,634 @@ Patch1076: kvm-fix-machine-check-propagation.patch Patch1077: kvm-qcow2-fix-dangling-refcount-table-entry.patch # For bz#1081393 - qemu-img will prompt that 'leaked clusters were found' while creating images with '-o preallocation=metadata,cluster_size<=1024' Patch1078: kvm-qcow2-link-all-L2-meta-updates-in-preallocate.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1079: kvm-iscsi-fix-indentation.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1080: kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1081: kvm-block-iscsi-query-for-supported-VPD-pages.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1082: kvm-block-iscsi-fix-segfault-if-writesame-fails.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1083: kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1084: kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1085: kvm-iscsi-always-query-max-WRITE-SAME-length.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1086: kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch -# For bz#1090978 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) +# For bz#1083413 - qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400) Patch1087: kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch -# For bz#1091322 - fail to reboot guest after migration from RHEL6.5 host to RHEL7.0 host +# For bz#1027565 - fail to reboot guest after migration from RHEL6.5 host to RHEL7.0 host Patch1088: kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch -# For bz#1090981 - Guest hits call trace migrate from RHEL6.5 to RHEL7.0 host with -M 6.1 & balloon & uhci device +# For bz#1085701 - Guest hits call trace migrate from RHEL6.5 to RHEL7.0 host with -M 6.1 & balloon & uhci device Patch1089: kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch -# For bz#1093612 - CVE-2014-2894 qemu-kvm: QEMU: out of bounds buffer accesses, guest triggerable via IDE SMART [rhel-7.0.z] +# For bz#1087980 - CVE-2014-2894 qemu-kvm: QEMU: out of bounds buffer accesses, guest triggerable via IDE SMART [rhel-7.1] Patch1090: kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch -# For bz#1094820 - Hot plug CPU not working with RHEL6 machine types running on RHEL7 host. +# For bz#1094285 - Hot plug CPU not working with RHEL6 machine types running on RHEL7 host. Patch1091: kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch -# For bz#1095677 - CVE-2013-4148 qemu-kvm: qemu: virtio-net: buffer overflow on invalid state load [rhel-7.0.z] -Patch1092: kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch -# For bz#1095684 - CVE-2013-4149 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on load [rhel-7.0.z] -Patch1093: kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch -# For bz#1095689 - CVE-2013-4150 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on invalid state load [rhel-7.0.z] -Patch1094: kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch -# For bz#1095694 - CVE-2013-4151 qemu-kvm: qemu: virtio: out-of-bounds buffer write on invalid state load [rhel-7.0.z] -Patch1095: kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch -# For bz#1095737 - CVE-2013-6399 qemu-kvm: qemu: virtio: buffer overrun on incoming migration [rhel-7.0.z] -Patch1096: kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch -# For bz#1095741 - CVE-2013-4542 qemu-kvm: qemu: virtio-scsi: buffer overrun on invalid state load [rhel-7.0.z] -Patch1097: kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch -# For bz#1095782 - CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.0.z] -Patch1098: kvm-virtio-validate-config_len-on-load.patch -# For bz#1095765 - CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.0.z] -Patch1099: kvm-virtio-validate-num_sg-when-mapping.patch -# For bz#1095765 - CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.0.z] -Patch1100: kvm-virtio-allow-mapping-up-to-max-queue-size.patch -# For bz#1095706 - CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.0.z] -Patch1101: kvm-vmstate-add-VMS_MUST_EXIST.patch -# For bz#1095706 - CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.0.z] -Patch1102: kvm-vmstate-add-VMSTATE_VALIDATE.patch -# For bz#1095706 - CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.0.z] -Patch1103: kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch -# For bz#1095714 - CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.0.z] -Patch1104: kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch -# For bz#1095746 - CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.0.z] -Patch1105: kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch -# For bz#1095746 - CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.0.z] -Patch1106: kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch -# For bz#1096828 - CVE-2014-3461 qemu-kvm: Qemu: usb: fix up post load checks [rhel-7.0.z] -Patch1107: kvm-usb-fix-up-post-load-checks.patch -# For bz#1110191 - Reduce the migrate cache size during migration causes qemu segment fault -Patch1108: kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch -# For bz#1110191 - Reduce the migrate cache size during migration causes qemu segment fault -Patch1109: kvm-Provide-init-function-for-ram-migration.patch -# For bz#1110191 - Reduce the migrate cache size during migration causes qemu segment fault -Patch1110: kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch -# For bz#1110191 - Reduce the migrate cache size during migration causes qemu segment fault -Patch1111: kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch -# For bz#1110189 - migration can not finish with 1024k 'remaining ram' left after hotunplug 4 nics -Patch1112: kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch -# For bz#1097229 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.0.z] -Patch1113: kvm-qcow-correctly-propagate-errors.patch -# For bz#1097229 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.0.z] -Patch1114: kvm-qcow1-Make-padding-in-the-header-explicit.patch -# For bz#1097229 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.0.z] -Patch1115: kvm-qcow1-Check-maximum-cluster-size.patch -# For bz#1097229 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.0.z] -Patch1116: kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch -# For bz#1097236 - CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.0.z] -Patch1117: kvm-qcow1-Validate-image-size-CVE-2014-0223.patch -# For bz#1097236 - CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.0.z] -Patch1118: kvm-qcow1-Stricter-backing-file-length-check.patch -# For bz#1110219 - Guest can't receive any character transmitted from host after hot unplugging virtserialport then hot plugging again -Patch1119: kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch -# For bz#1110188 - qcow2 corruptions (leaked clusters after installing a rhel7 guest using virtio_scsi) -Patch1120: kvm-qcow2-Free-preallocated-zero-clusters.patch -# For bz#1110188 - qcow2 corruptions (leaked clusters after installing a rhel7 guest using virtio_scsi) -Patch1121: kvm-qemu-iotests-Discard-preallocated-zero-clusters.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1122: kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1123: kvm-skip-system-call-when-msi-route-is-unchanged.patch -# For bz#1095782 - CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.0.z] -Patch1124: kvm-Allow-mismatched-virtio-config-len.patch -# For bz#1095706 - CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.0.z] -Patch1125: kvm-vmstate-reduce-code-duplication.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1126: kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1127: kvm-vfio-correct-debug-macro-typo.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1128: kvm-vfio-pci-Fix-MSI-X-debug-code.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1129: kvm-vfio-pci-Fix-MSI-X-masking-performance.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1130: kvm-vfio-Fix-MSI-X-vector-expansion.patch -# For bz#1110693 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -# For bz#1110695 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput -Patch1131: kvm-vfio-Don-t-cache-MSIMessage.patch -# For bz#1130149 - rx filter incorrect when guest disables VLAN filtering -Patch1132: kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch -# For bz#1130149 - rx filter incorrect when guest disables VLAN filtering -Patch1133: kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch -# For bz#1124660 - [FJ7.0 Bug] RHEL7.0 guest attaching 150 or more virtio-blk disks fails to start up -Patch1134: kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1135: kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1136: kvm-blockjob-Add-block_job_yield.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1137: kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1138: kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1139: kvm-block-make-top-argument-to-block-commit-optional.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1140: kvm-qemu-iotests-Test-0-length-image-for-mirror.patch -# For bz#1132806 - advertise active commit to libvirt -Patch1141: kvm-mirror-Fix-qiov-size-for-short-requests.patch -# For bz#1145055 - vmstate_xhci_event: fix unterminated field list [rhel-7.0.z] -Patch1142: kvm-vmstate_xhci_event-fix-unterminated-field-list.patch -# For bz#1145055 - vmstate_xhci_event: fix unterminated field list [rhel-7.0.z] -Patch1143: kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch -# For bz#1139117 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.0.z] -Patch1144: kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch -# For bz#1139117 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.0.z] -Patch1145: kvm-vbe-rework-sanity-checks.patch -# For bz#1139117 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.0.z] -Patch1146: kvm-spice-display-add-display-channel-id-to-the-debug-me.patch -# For bz#1139117 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.0.z] -Patch1147: kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch -# For bz#1141189 - bug in scsi_block_new_request() function introduced by upstream commit 137745c5c60f083ec982fe9e861e8c16ebca1ba8 -Patch1148: kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch +# For bz#1038914 - Guest can't receive any character transmitted from host after hot unplugging virtserialport then hot plugging again +Patch1092: kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch +# For bz#1052093 - qcow2 corruptions (leaked clusters after installing a rhel7 guest using virtio_scsi) +Patch1093: kvm-qcow2-Free-preallocated-zero-clusters.patch +# For bz#1052093 - qcow2 corruptions (leaked clusters after installing a rhel7 guest using virtio_scsi) +Patch1094: kvm-qemu-iotests-Discard-preallocated-zero-clusters.patch +# For bz#1066338 - Reduce the migrate cache size during migration causes qemu segment fault +Patch1095: kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch +# For bz#1066338 - Reduce the migrate cache size during migration causes qemu segment fault +Patch1096: kvm-Provide-init-function-for-ram-migration.patch +# For bz#1066338 - Reduce the migrate cache size during migration causes qemu segment fault +Patch1097: kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch +# For bz#1066338 - Reduce the migrate cache size during migration causes qemu segment fault +Patch1098: kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch +# For bz#1074913 - migration can not finish with 1024k 'remaining ram' left after hotunplug 4 nics +Patch1099: kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch +# For bz#1095678 - CVE-2013-4148 qemu-kvm: qemu: virtio-net: buffer overflow on invalid state load [rhel-7.1] +Patch1100: kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch +# For bz#1095690 - CVE-2013-4150 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on invalid state load [rhel-7.1] +Patch1101: kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch +# For bz#1095685 - CVE-2013-4149 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on load [rhel-7.1] +Patch1102: kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch +# For bz#1095695 - CVE-2013-4151 qemu-kvm: qemu: virtio: out-of-bounds buffer write on invalid state load [rhel-7.1] +Patch1103: kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch +# For bz#1095738 - CVE-2013-6399 qemu-kvm: qemu: virtio: buffer overrun on incoming migration [rhel-7.1] +Patch1104: kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch +# For bz#1095742 - CVE-2013-4542 qemu-kvm: qemu: virtio-scsi: buffer overrun on invalid state load [rhel-7.1] +Patch1105: kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch +# For bz#1095783 - CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.1] +Patch1106: kvm-virtio-validate-config_len-on-load.patch +# For bz#1095766 - CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.1] +Patch1107: kvm-virtio-validate-num_sg-when-mapping.patch +# For bz#1095766 - CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.1] +Patch1108: kvm-virtio-allow-mapping-up-to-max-queue-size.patch +# For bz#1095747 - CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.1] +Patch1109: kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch +# For bz#1095743 - CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-6.5.z] +# For bz#1095747 - CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.1] +Patch1110: kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch +# For bz#1095716 - CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.1] +Patch1111: kvm-vmstate-reduce-code-duplication.patch +# For bz#1095716 - CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.1] +Patch1112: kvm-vmstate-add-VMS_MUST_EXIST.patch +# For bz#1095716 - CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.1] +Patch1113: kvm-vmstate-add-VMSTATE_VALIDATE.patch +# For bz#1095707 - CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.1] +Patch1114: kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch +# For bz#1095716 - CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.1] +Patch1115: kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch +# For bz#1096829 - CVE-2014-3461 qemu-kvm: Qemu: usb: fix up post load checks [rhel-7.1] +Patch1116: kvm-usb-fix-up-post-load-checks.patch +# For bz#1097230 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.1] +Patch1117: kvm-qcow-correctly-propagate-errors.patch +# For bz#1097230 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.1] +Patch1118: kvm-qcow1-Make-padding-in-the-header-explicit.patch +# For bz#1097230 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.1] +Patch1119: kvm-qcow1-Check-maximum-cluster-size.patch +# For bz#1097230 - CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.1] +Patch1120: kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch +# For bz#1097237 - CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.1] +Patch1121: kvm-qcow1-Validate-image-size-CVE-2014-0223.patch +# For bz#1097237 - CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.1] +Patch1122: kvm-qcow1-Stricter-backing-file-length-check.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1123: kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1124: kvm-skip-system-call-when-msi-route-is-unchanged.patch +# For bz#1113009 - Migration failed with virtio-blk from RHEL6.5.0 host to RHEL7.0 host +Patch1125: kvm-Allow-mismatched-virtio-config-len.patch +# For bz#1074219 - qemu core dump when install a RHEL.7 guest(xhci) with migration +Patch1126: kvm-xhci-fix-overflow-in-usb_xhci_post_load.patch +# For bz#1086598 - migrate_cancel wont take effect on previouly wrong migrate -d cmd +Patch1127: kvm-migration-qmp_migrate-keep-working-after-syntax-erro.patch +# For bz#1026314 - qemu-kvm hang when use '-sandbox on'+'vnc'+'hda' +Patch1128: kvm-seccomp-add-shmctl-mlock-and-munlock-to-the-syscall-.patch +# For bz#1076326 - qemu-kvm does not quit when booting guest w/ 161 vcpus and "-no-kvm" +Patch1129: kvm-exit-when-no-kvm-and-vcpu-count-160.patch +# For bz#1086987 - src qemu crashed when starting migration in inmigrate mode +Patch1130: kvm-Disallow-outward-migration-while-awaiting-incoming-m.patch +# For bz#1088695 - there are four "gluster" in qemu-img supported format list +# For bz#1093983 - there are three "nbd" in qemu-img supported format list +Patch1131: kvm-block-Ignore-duplicate-or-NULL-format_name-in-bdrv_i.patch +# For bz#1097020 - [RFE] qemu-img: Add/improve Disk2VHD tools creating VHDX images +Patch1132: kvm-block-vhdx-account-for-identical-header-sections.patch +# For bz#1095877 - segmentation fault in qemu-kvm due to use-after-free of a SCSIGenericReq (host device pass-through) +Patch1133: kvm-aio-Fix-use-after-free-in-cancellation-path.patch +# For bz#1021788 - the error message "scsi generic interface too old" is wrong more often than not +Patch1134: kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch +# For bz#1021788 - the error message "scsi generic interface too old" is wrong more often than not +Patch1135: kvm-scsi-Improve-error-messages-more.patch +# For bz#1096645 - [FJ7.0 Bug] RHEL7.0 guest attaching 150 or more virtio-blk disks fails to start up +Patch1136: kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +Patch1137: kvm-kvmclock-Ensure-time-in-migration-never-goes-backwar.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +Patch1138: kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock_cu.patch +# For bz#990724 - qemu-kvm failing when invalid machine type is provided +Patch1139: kvm-vl.c-Output-error-on-invalid-machine-type.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1140: kvm-migration-dump-vmstate-info-as-a-json-file-for-stati.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1141: kvm-vmstate-static-checker-script-to-validate-vmstate-ch.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1142: kvm-tests-vmstate-static-checker-add-dump1-and-dump2-fil.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1143: kvm-tests-vmstate-static-checker-incompat-machine-types.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1144: kvm-tests-vmstate-static-checker-add-version-error-in-ma.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1145: kvm-tests-vmstate-static-checker-version-mismatch-inside.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1146: kvm-tests-vmstate-static-checker-minimum_version_id-chec.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1147: kvm-tests-vmstate-static-checker-remove-a-section.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1148: kvm-tests-vmstate-static-checker-remove-a-field.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1149: kvm-tests-vmstate-static-checker-remove-last-field-in-a-.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1150: kvm-tests-vmstate-static-checker-change-description-name.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1151: kvm-tests-vmstate-static-checker-remove-Fields.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1152: kvm-tests-vmstate-static-checker-remove-Description.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1153: kvm-tests-vmstate-static-checker-remove-Description-insi.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1154: kvm-tests-vmstate-static-checker-remove-a-subsection.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1155: kvm-tests-vmstate-static-checker-remove-Subsections.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1156: kvm-tests-vmstate-static-checker-add-substructure-for-us.patch +# For bz#1118707 - VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info +Patch1157: kvm-tests-vmstate-static-checker-add-size-mismatch-insid.patch +# For bz#1116728 - Backport qemu_bh_schedule() race condition fix +Patch1158: kvm-aio-fix-qemu_bh_schedule-bh-ctx-race-condition.patch +# For bz#999789 - qemu should give a more friendly prompt when didn't specify read-only for VMDK format disk +Patch1159: kvm-block-Improve-driver-whitelist-checks.patch +# For bz#1029271 - Format specific information (create type) was wrong when create it specified subformat='streamOptimized' +Patch1160: kvm-vmdk-Fix-format-specific-information-create-type-for.patch +# For bz#1095645 - vectors of virtio-scsi-pci will be 0 when set vectors>=129 +Patch1161: kvm-virtio-pci-Report-an-error-when-msix-vectors-init-fa.patch +# For bz#1096576 - QEMU core dumped when boot up two scsi-hd disk on the same virtio-scsi-pci controller in Intel host +Patch1162: kvm-scsi-Report-error-when-lun-number-is-in-use.patch +# For bz#1017685 - Gluster etc. should not be a dependency of vscclient and libcacard +Patch1163: kvm-util-Split-out-exec_dir-from-os_find_datadir.patch +# For bz#1017685 - Gluster etc. should not be a dependency of vscclient and libcacard +Patch1164: kvm-rules.mak-fix-obj-to-a-real-relative-path.patch +# For bz#1017685 - Gluster etc. should not be a dependency of vscclient and libcacard +Patch1165: kvm-rules.mak-allow-per-object-cflags-and-libs.patch +# For bz#1017685 - Gluster etc. should not be a dependency of vscclient and libcacard +Patch1166: kvm-block-use-per-object-cflags-and-libs.patch +# For bz#1039791 - qemu-img creates truncated VMDK image with subformat=twoGbMaxExtentFlat +Patch1167: kvm-vmdk-Fix-creating-big-description-file.patch +# For bz#1065724 - rx filter incorrect when guest disables VLAN filtering +Patch1168: kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch +# For bz#1065724 - rx filter incorrect when guest disables VLAN filtering +Patch1169: kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch +# For bz#1116941 - Return value of virtio_load not checked in virtio_rng_load +Patch1170: kvm-virtio-rng-check-return-value-of-virtio_load.patch +# For bz#1074403 - qemu-kvm can not give any warning hint when set sndbuf with negative value +Patch1171: kvm-qapi-treat-all-negative-return-of-strtosz_suffix-as-.patch +# For bz#1107821 - rdma migration: seg if destination isn't listening +Patch1172: kvm-rdma-bug-fixes.patch +# For bz#1122151 - Pass close from qemu-ga +Patch1173: kvm-virtio-serial-report-frontend-connection-state-via-m.patch +# For bz#1122151 - Pass close from qemu-ga +Patch1174: kvm-char-report-frontend-open-closed-state-in-query-char.patch +# For bz#1129552 - backport "acpi: fix tables for no-hpet configuration" +Patch1175: kvm-acpi-fix-tables-for-no-hpet-configuration.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1176: kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1177: kvm-blockjob-Add-block_job_yield.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1178: kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1179: kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1180: kvm-block-make-top-argument-to-block-commit-optional.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1181: kvm-qemu-iotests-Test-0-length-image-for-mirror.patch +# For bz#1130603 - advertise active commit to libvirt +Patch1182: kvm-mirror-Fix-qiov-size-for-short-requests.patch +# For bz#1064260 - Handle properly --enable-fstack-protector option +Patch1183: kvm-Enforce-stack-protector-usage.patch +# For bz#1134408 - [HP 7.1 FEAT] Increase qemu-kvm's VCPU limit to 240 +Patch1184: kvm-pc-increase-maximal-VCPU-count-to-240.patch +# For bz#1136534 - glusterfs backend does not support discard +Patch1185: kvm-gluster-Add-discard-support-for-GlusterFS-block-driv.patch +# For bz#1088150 - qemu-img coredumpd when try to create a gluster format image +Patch1186: kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch +# For bz#996011 - vlan and queues options cause core dumped when qemu-kvm process quit(or ctrl+c) +Patch1187: kvm-qdev-properties-system.c-Allow-vlan-or-netdev-for-de.patch +# For bz#1054077 - qemu crash when reboot win7 guest with spice display +Patch1189: kvm-spice-move-qemu_spice_display_-from-spice-graphics-t.patch +# For bz#1054077 - qemu crash when reboot win7 guest with spice display +Patch1190: kvm-spice-move-spice_server_vm_-start-stop-calls-into-qe.patch +# For bz#1054077 - qemu crash when reboot win7 guest with spice display +Patch1191: kvm-spice-stop-server-for-qxl-hard-reset.patch +# For bz#1064156 - [qxl] The guest show black screen while resumed guest which managedsaved in pmsuspended status. +Patch1192: kvm-qemu-Adjust-qemu-wakeup.patch +# For bz#1122147 - CVE-2014-5263 vmstate_xhci_event: fix unterminated field list +Patch1193: kvm-vmstate_xhci_event-fix-unterminated-field-list.patch +# For bz#1122147 - CVE-2014-5263 vmstate_xhci_event: fix unterminated field list +Patch1194: kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch +# For bz#1139702 - pflash (UEFI varstore) migration shortcut for libvirt [RHEL] +Patch1195: kvm-pflash_cfi01-write-flash-contents-to-bdrv-on-incomin.patch +# For bz#1123372 - qemu-kvm crashed when doing iofuzz testing +Patch1196: kvm-ide-test-Add-enum-value-for-DEV.patch +# For bz#1123372 - qemu-kvm crashed when doing iofuzz testing +Patch1197: kvm-ide-test-Add-FLUSH-CACHE-test-case.patch +# For bz#1123372 - qemu-kvm crashed when doing iofuzz testing +Patch1198: kvm-ide-Fix-segfault-when-flushing-a-device-that-doesn-t.patch +# For bz#1139118 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.1] +Patch1201: kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch +# For bz#1139118 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.1] +Patch1202: kvm-vbe-rework-sanity-checks.patch +# For bz#1139118 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.1] +Patch1203: kvm-spice-display-add-display-channel-id-to-the-debug-me.patch +# For bz#1139118 - CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.1] +Patch1204: kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch +# For bz#1105880 - bug in scsi_block_new_request() function introduced by upstream commit 137745c5c60f083ec982fe9e861e8c16ebca1ba8 +Patch1205: kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch +# For bz#1131316 - fail to specify wwn for virtual IDE CD-ROM +Patch1206: kvm-ide-Add-wwn-support-to-IDE-ATAPI-drive.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1207: kvm-vmdk-Allow-vmdk_create-to-work-with-protocol.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1208: kvm-block-make-vdi-bounds-check-match-upstream.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1209: kvm-vdi-say-why-an-image-is-bad.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1210: kvm-block-do-not-abuse-EMEDIUMTYPE.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1211: kvm-cow-correctly-propagate-errors.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1212: kvm-block-Use-correct-width-in-format-strings.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1213: kvm-vdi-remove-double-conversion.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1214: kvm-block-vdi-Error-out-immediately-in-vdi_create.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1215: kvm-vpc-Implement-.bdrv_has_zero_init.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1216: kvm-block-vpc-use-QEMU_PACKED-for-on-disk-structures.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1217: kvm-block-allow-bdrv_unref-to-be-passed-NULL-pointers.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1218: kvm-block-vdi-use-block-layer-ops-in-vdi_create-instead-.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1219: kvm-block-use-the-standard-ret-instead-of-result.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1220: kvm-block-vpc-use-block-layer-ops-in-vpc_create-instead-.patch +# For bz#1098086 - RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs) +Patch1221: kvm-block-iotest-update-084-to-test-static-VDI-image-cre.patch # For bz#1122925 - Maintain relative path to backing file image during live merge (block-commit) -Patch1149: kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch +Patch1222: kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch # For bz#1122925 - Maintain relative path to backing file image during live merge (block-commit) -Patch1150: kvm-block-extend-block-commit-to-accept-a-string-for-the.patch +Patch1223: kvm-block-extend-block-commit-to-accept-a-string-for-the.patch # For bz#1122925 - Maintain relative path to backing file image during live merge (block-commit) -Patch1151: kvm-block-add-backing-file-option-to-block-stream.patch +Patch1224: kvm-block-add-backing-file-option-to-block-stream.patch # For bz#1122925 - Maintain relative path to backing file image during live merge (block-commit) -Patch1152: kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1153: kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1154: kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1155: kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1156: kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1157: kvm-raw-posix-raw_co_get_block_status-return-value.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1158: kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch -# For bz#1166605 - qemu-img convert intermittently corrupts output images -Patch1159: kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch +Patch1225: kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch +# For bz#1116117 - [Intel 7.1 FEAT] Broadwell new instructions support for KVM - qemu-kvm +Patch1226: kvm-target-i386-Broadwell-CPU-model.patch +# For bz#1116117 - [Intel 7.1 FEAT] Broadwell new instructions support for KVM - qemu-kvm +Patch1227: kvm-pc-Add-Broadwell-CPUID-compatibility-bits.patch +# For bz#1142290 - guest is stuck when setting balloon memory with large guest-stats-polling-interval +Patch1228: kvm-virtio-balloon-fix-integer-overflow-in-memory-stats-.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1229: kvm-usb-hcd-xhci-QOM-Upcast-Sweep.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1230: kvm-usb-hcd-xhci-QOM-parent-field-cleanup.patch +# For bz#1046873 - fail to be recognized the hotpluging usb-storage device with xhci controller in win2012R2 guest +Patch1231: kvm-uhci-egsm-fix.patch +# For bz#1046574 - fail to passthrough the USB speaker redirected from usb-redir with xhci controller +# For bz#1088116 - qemu crash when device_del usb-redir +Patch1232: kvm-usb-redir-fix-use-after-free.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1233: kvm-xhci-remove-leftover-debug-printf.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1234: kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1235: kvm-xhci-add-port-to-slot_address-tracepoint.patch +# For bz#1075846 - qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times +Patch1236: kvm-usb-parallelize-usb3-streams.patch +# For bz#1075846 - qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times +Patch1237: kvm-xhci-Init-a-transfers-xhci-slotid-and-epid-member-on.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1238: kvm-xhci-Add-xhci_epid_to_usbep-helper-function.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1239: kvm-xhci-Fix-memory-leak-on-xhci_disable_ep.patch +# For bz#1075846 - qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times +Patch1240: kvm-usb-Also-reset-max_packet_size-on-ep_reset.patch +# For bz#1075846 - qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times +Patch1241: kvm-usb-Fix-iovec-memleak-on-combined-packet-free.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1242: kvm-usb-hcd-xhci-Remove-unused-sstreamsm-member-from-XHC.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1243: kvm-usb-hcd-xhci-Remove-unused-cancelled-member-from-XHC.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1244: kvm-usb-hcd-xhci-Report-completion-of-active-transfer-wi.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1245: kvm-usb-hcd-xhci-Update-endpoint-context-dequeue-pointer.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1246: kvm-xhci-Add-a-few-missing-checks-for-disconnected-devic.patch +# For bz#1111450 - Guest crash when hotplug usb while disable virt_use_usb +Patch1247: kvm-usb-Add-max_streams-attribute-to-endpoint-info.patch +# For bz#1111450 - Guest crash when hotplug usb while disable virt_use_usb +Patch1248: kvm-usb-Add-usb_device_alloc-free_streams.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1249: kvm-xhci-Call-usb_device_alloc-free_streams.patch +# For bz#1111450 - Guest crash when hotplug usb while disable virt_use_usb +Patch1250: kvm-uhci-invalidate-queue-on-device-address-changes.patch +# For bz#949385 - passthrough USB speaker to win2012 guest fail to work well +Patch1251: kvm-xhci-iso-fix-time-calculation.patch +# For bz#949385 - passthrough USB speaker to win2012 guest fail to work well +Patch1252: kvm-xhci-iso-allow-for-some-latency.patch +# For bz#980747 - flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller +Patch1253: kvm-xhci-switch-debug-printf-to-tracepoint.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1254: kvm-xhci-use-DPRINTF-instead-of-fprintf-stderr.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1255: kvm-xhci-child-detach-fix.patch +# For bz#1075846 - qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times +Patch1256: kvm-usb-add-usb_pick_speed.patch +# For bz#980833 - xhci: FIXME: endpoint stopped w/ xfers running, data might be lost +Patch1257: kvm-xhci-make-port-reset-trace-point-more-verbose.patch +# For bz#1111450 - Guest crash when hotplug usb while disable virt_use_usb +Patch1258: kvm-usb-initialize-libusb_device-to-avoid-crash.patch +# For bz#1097363 - qemu ' KVM internal error. Suberror: 1' when query cpu frequently during pxe boot in Intel "Q95xx" host +Patch1259: kvm-target-i386-get-CPL-from-SS.DPL.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1260: kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1261: kvm-trace-add-pid-field-to-simpletrace-record.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1262: kvm-simpletrace-add-support-for-trace-record-pid-field.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1263: kvm-simpletrace-add-simpletrace.py-no-header-option.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1264: kvm-trace-extract-stap_escape-function-for-reuse.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1265: kvm-trace-add-tracetool-simpletrace_stap-format.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1266: kvm-trace-install-simpletrace-SystemTap-tapset.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1267: kvm-trace-install-trace-events-file.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1268: kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch +# For bz#1088112 - [Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing +Patch1269: kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch +# For bz#1152969 - Qemu-kvm got stuck when migrate to wrong RDMA ip +Patch1270: kvm-rdma-Fix-block-during-rdma-migration.patch +# For bz#1026314 - BUG: qemu-kvm hang when use '-sandbox on'+'vnc'+'hda' +Patch1271: kvm-seccomp-add-semctl-to-the-syscall-whitelist.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +# For bz#1130428 - After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang +Patch1272: kvm-Revert-kvmclock-Ensure-proper-env-tsc-value-for-kvmc.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +# For bz#1130428 - After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang +Patch1273: kvm-Revert-kvmclock-Ensure-time-in-migration-never-goes-.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +# For bz#1130428 - After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang +Patch1274: kvm-Introduce-cpu_clean_all_dirty.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +# For bz#1130428 - After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang +Patch1275: kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock.v2.patch +# For bz#1098602 - kvmclock: Ensure time in migration never goes backward (backport) +# For bz#1130428 - After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang +Patch1276: kvm-kvmclock-Ensure-time-in-migration-never-goes-back.v2.patch +# For bz#1144820 - CVE-2014-3640 qemu-kvm: qemu: slirp: NULL pointer deref in sosendto() [rhel-7.1] +Patch1277: kvm-slirp-udp-fix-NULL-pointer-dereference-because-of-un.patch +# For bz#1049734 - PCI: QEMU crash on illegal operation: attaching a function to a non multi-function device +Patch1278: kvm-hw-pci-fix-error-flow-in-pci-multifunction-init.patch +# For bz#1111107 - Remove Q35 machine type from qemu-kvm +Patch1279: kvm-rhel-Drop-machine-type-pc-q35-rhel7.0.0.patch +# For bz#1088822 - hot-plug a virtio-scsi disk via 'blockdev-add' always cause QEMU quit +Patch1280: kvm-virtio-scsi-Plug-memory-leak-on-virtio_scsi_push_eve.patch +# For bz#1089606 - QEMU will not reject invalid number of queues (num_queues = 0) specified for virtio-scsi +Patch1281: kvm-virtio-scsi-Report-error-if-num_queues-is-0-or-too-l.patch +# For bz#1089606 - QEMU will not reject invalid number of queues (num_queues = 0) specified for virtio-scsi +Patch1282: kvm-virtio-scsi-Fix-memory-leak-when-realize-failed.patch +# For bz#1089606 - QEMU will not reject invalid number of queues (num_queues = 0) specified for virtio-scsi +Patch1283: kvm-virtio-scsi-Fix-num_queue-input-validation.patch +# For bz#1104748 - 48% reduction in IO performance for KVM guest, io=native +Patch1284: kvm-Revert-linux-aio-use-event-notifiers.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1285: kvm-libcacard-link-against-qemu-error.o-for-error_report.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1286: kvm-error-Add-error_abort.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1287: kvm-blockdev-Fail-blockdev-add-with-encrypted-images.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1288: kvm-blockdev-Fix-NULL-pointer-dereference-in-blockdev-ad.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1289: kvm-qemu-iotests-Test-a-few-blockdev-add-error-cases.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1290: kvm-block-Add-errp-to-bdrv_new.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1291: kvm-qemu-img-Avoid-duplicate-block-device-IDs.patch +# For bz#1088176 - QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug +Patch1292: kvm-block-Catch-duplicate-IDs-in-bdrv_new.patch +# For bz#1138691 - Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend) +Patch1293: kvm-qemu-img-Allow-source-cache-mode-specification.patch +# For bz#1138691 - Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend) +Patch1294: kvm-qemu-img-Allow-cache-mode-specification-for-amend.patch +# For bz#1138691 - Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend) +Patch1295: kvm-qemu-img-clarify-src_cache-option-documentation.patch +# For bz#1138691 - Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend) +Patch1296: kvm-qemu-img-fix-rebase-src_cache-option-documentation.patch +# For bz#1138691 - Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend) +Patch1297: kvm-qemu-img-fix-img_compare-flags-error-path.patch +# For bz#1141667 - Qemu crashed if reboot guest after hot remove AC97 sound device +Patch1298: kvm-ac97-register-reset-via-qom.patch +# For bz#1085232 - Ilegal guest requests on block devices pause the VM +Patch1299: kvm-virtio-blk-Factor-common-checks-out-of-virtio_blk_ha.patch +# For bz#1085232 - Ilegal guest requests on block devices pause the VM +Patch1300: kvm-virtio-blk-Bypass-error-action-and-I-O-accounting-on.patch +# For bz#1085232 - Ilegal guest requests on block devices pause the VM +Patch1301: kvm-virtio-blk-Treat-read-write-beyond-end-as-invalid.patch +# For bz#1085232 - Ilegal guest requests on block devices pause the VM +Patch1302: kvm-ide-Treat-read-write-beyond-end-as-invalid.patch +# For bz#1085232 - Ilegal guest requests on block devices pause the VM +Patch1303: kvm-ide-only-constrain-read-write-requests-to-drive-size.patch +# For bz#1161563 - invalid QEMU NOTEs in vmcore that is dumped for multi-VCPU guests +Patch1304: kvm-dump-RHEL-specific-fix-for-CPUState-bug-introduced-b.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1305: kvm-dump-guest-memory-Check-for-the-correct-return-value.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1306: kvm-dump-const-qualify-the-buf-of-WriteCoreDumpFunction.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1307: kvm-dump-add-argument-to-write_elfxx_notes.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1308: kvm-dump-add-API-to-write-header-of-flatten-format.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1309: kvm-dump-add-API-to-write-vmcore.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1310: kvm-dump-add-API-to-write-elf-notes-to-buffer.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1311: kvm-dump-add-support-for-lzo-snappy.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1312: kvm-dump-add-members-to-DumpState-and-init-some-of-them.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1313: kvm-dump-add-API-to-write-dump-header.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1314: kvm-dump-add-API-to-write-dump_bitmap.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1315: kvm-dump-add-APIs-to-operate-DataCache.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1316: kvm-dump-add-API-to-write-dump-pages.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1317: kvm-dump-Drop-qmp_dump_guest_memory-stub-and-build-for-a.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1318: kvm-dump-make-kdump-compressed-format-available-for-dump.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1319: kvm-Define-the-architecture-for-compressed-dump-format.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1320: kvm-dump-add-query-dump-guest-memory-capability-command.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1321: kvm-dump-Drop-pointless-error_is_set-DumpState-member-er.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1322: kvm-dump-fill-in-the-flat-header-signature-more-pleasing.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1323: kvm-dump-simplify-write_start_flat_header.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1324: kvm-dump-eliminate-DumpState.page_shift-guest-s-page-shi.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1325: kvm-dump-eliminate-DumpState.page_size-guest-s-page-size.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1326: kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1327: kvm-dump-hoist-lzo_init-from-get_len_buf_out-to-dump_ini.patch +# For bz#1157798 - [FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command +Patch1328: kvm-dump-simplify-get_len_buf_out.patch +# For bz#1087724 - [Fujitsu 7.1 FEAT]: qemu-img should use fallocate() system call for "preallocation=full" option +Patch1329: kvm-rename-parse_enum_option-to-qapi_enum_parse-and-make.patch +# For bz#1087724 - [Fujitsu 7.1 FEAT]: qemu-img should use fallocate() system call for "preallocation=full" option +Patch1330: kvm-qapi-introduce-PreallocMode-and-new-PreallocModes-fu.patch +# For bz#1087724 - [Fujitsu 7.1 FEAT]: qemu-img should use fallocate() system call for "preallocation=full" option +Patch1331: kvm-raw-posix-Add-falloc-and-full-preallocation-option.patch +# For bz#1087724 - [Fujitsu 7.1 FEAT]: qemu-img should use fallocate() system call for "preallocation=full" option +Patch1332: kvm-qcow2-Add-falloc-and-full-preallocation-option.patch +# For bz#1161890 - [abrt] qemu-kvm: pixman_image_get_data(): qemu-kvm killed by SIGSEGV +Patch1333: kvm-vga-fix-invalid-read-after-free.patch +# For bz#1140618 - Should replace "qemu-system-i386" by "/usr/libexec/qemu-kvm" in manpage of qemu-kvm for our official qemu-kvm build +Patch1334: kvm-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch +# For bz#1157645 - CVE-2014-7815 qemu-kvm: qemu: vnc: insufficient bits_per_pixel from the client sanitization [rhel-7.1] +Patch1335: kvm-vnc-sanitize-bits_per_pixel-from-the-client.patch +# For bz#1138639 - fail to login spice session with password + expire time +Patch1336: kvm-spice-call-qemu_spice_set_passwd-during-init.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1337: kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1338: kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1339: kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1340: kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1341: kvm-raw-posix-raw_co_get_block_status-return-value.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1342: kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch +# For bz#1160237 - qemu-img convert intermittently corrupts output images +Patch1343: kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch +# For bz#1071776 - Migration "expected downtime" does not refresh after reset to a new value +Patch1344: kvm-migration-static-variables-will-not-be-reset-at-seco.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1345: kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1346: kvm-vfio-correct-debug-macro-typo.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1347: kvm-vfio-pci-Fix-MSI-X-debug-code.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1348: kvm-vfio-pci-Fix-MSI-X-masking-performance.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1349: kvm-vfio-Fix-MSI-X-vector-expansion.patch +# For bz#1098976 - 2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput +Patch1350: kvm-vfio-Don-t-cache-MSIMessage.patch +# For bz#1046007 - qemu-kvm aborted when hot plug PCI device to guest with romfile and rombar=0 +Patch1351: kvm-hw-pci-fixed-error-flow-in-pci_qdev_init.patch +# For bz#1046007 - qemu-kvm aborted when hot plug PCI device to guest with romfile and rombar=0 +Patch1352: kvm-hw-pci-fixed-hotplug-crash-when-using-rombar-0-with-.patch +# For bz#1074219 - qemu core dump when install a RHEL.7 guest(xhci) with migration +Patch1353: kvm-xhci-add-sanity-checks-to-xhci_lookup_uport.patch +# For bz#1140742 - Enable native support for Ceph +Patch1354: kvm-Revert-Build-ceph-rbd-only-for-rhev.patch +# For bz#1140742 - Enable native support for Ceph +Patch1355: kvm-Revert-rbd-Only-look-for-qemu-specific-copy-of-librb.patch +# For bz#1140742 - Enable native support for Ceph +Patch1356: kvm-Revert-rbd-link-and-load-librbd-dynamically.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1357: kvm-qemu-iotests-Test-case-for-backing-file-deletion.patch +# For bz#1134237 - Opening malformed VMDK description file should fail +Patch1358: kvm-qemu-iotests-Add-sample-image-and-test-for-VMDK-vers.patch +# For bz#1134237 - Opening malformed VMDK description file should fail +Patch1359: kvm-vmdk-Check-VMFS-extent-line-field-number.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1360: kvm-qemu-iotests-Introduce-_unsupported_imgopts.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1361: kvm-qemu-iotests-Add-_unsupported_imgopts-for-vmdk-subfo.patch +# For bz#1134241 - QEMU fails to correctly read/write on VMDK with big flat extent +Patch1362: kvm-vmdk-Fix-big-flat-extent-IO.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1363: kvm-vmdk-Check-for-overhead-when-opening.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1364: kvm-block-vmdk-add-basic-.bdrv_check-support.patch +# For bz#1134237 - Opening malformed VMDK description file should fail +Patch1365: kvm-qemu-iotest-Make-077-raw-only.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1366: kvm-qemu-iotests-Don-t-run-005-on-vmdk-split-formats.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1367: kvm-vmdk-extract-vmdk_read_desc.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1368: kvm-vmdk-push-vmdk_read_desc-up-to-caller.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1369: kvm-vmdk-do-not-try-opening-a-file-as-both-image-and-des.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1370: kvm-vmdk-correctly-propagate-errors.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1371: kvm-block-vmdk-do-not-report-file-offset-for-compressed-.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1372: kvm-vmdk-Fix-d-and-lld-to-PRI-in-format-strings.patch +# For bz#1134251 - Opening an obviously truncated VMDK image should fail +Patch1373: kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch +# For bz#1134283 - qemu-img convert from ISO to streamOptimized fails +Patch1374: kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch +# For bz#1134283 - qemu-img convert from ISO to streamOptimized fails +Patch1375: kvm-vmdk-Implement-.bdrv_write_compressed.patch +# For bz#1134283 - qemu-img convert from ISO to streamOptimized fails +Patch1376: kvm-vmdk-Implement-.bdrv_get_info.patch +# For bz#1134283 - qemu-img convert from ISO to streamOptimized fails +Patch1377: kvm-qemu-iotests-Test-converting-to-streamOptimized-from.patch +# For bz#1134283 - qemu-img convert from ISO to streamOptimized fails +Patch1378: kvm-vmdk-Fix-local_err-in-vmdk_create.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1379: kvm-fpu-softfloat-drop-INLINE-macro.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1380: kvm-block-New-bdrv_nb_sectors.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1381: kvm-vmdk-Optimize-cluster-allocation.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1382: kvm-vmdk-Handle-failure-for-potentially-large-allocation.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1383: kvm-vmdk-Use-bdrv_nb_sectors-where-sectors-not-bytes-are.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1384: kvm-vmdk-fix-vmdk_parse_extents-extent_file-leaks.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1385: kvm-vmdk-fix-buf-leak-in-vmdk_parse_extents.patch +# For bz#1002493 - qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file +Patch1386: kvm-vmdk-Fix-integer-overflow-in-offset-calculation.patch +# For bz#1163078 - CVE-2014-7840 qemu-kvm: qemu: insufficient parameter validation during ram load [rhel-7.1] +Patch1387: kvm-migration-fix-parameter-validation-on-ram-load-CVE-2.patch +# For bz#1175325 - Delete cow block driver +Patch1388: kvm-block-delete-cow-block-driver.patch +# For bz#1180942 - qemu core dumped when unhotplug gpu card assigned to guest +Patch1389: kvm-vfio-pci-Fix-interrupt-disabling.patch +# For bz#1169456 - CVE-2014-8106 qemu-kvm: qemu: cirrus: insufficient blit region checks [rhel-7.1] +Patch1390: kvm-cirrus-fix-blit-region-check.patch +# For bz#1169456 - CVE-2014-8106 qemu-kvm: qemu: cirrus: insufficient blit region checks [rhel-7.1] +Patch1391: kvm-cirrus-don-t-overflow-CirrusVGAState-cirrus_bltbuf.patch BuildRequires: zlib-devel @@ -2403,9 +2861,13 @@ BuildRequires: libseccomp-devel >= 1.0.0 %endif # For network block driver BuildRequires: libcurl-devel +%ifarch x86_64 +BuildRequires: librados2-devel +BuildRequires: librbd1-devel +%endif %if 0%{!?build_only_sub:1} # For gluster block driver -BuildRequires: glusterfs-api-devel +BuildRequires: glusterfs-api-devel >= 3.6.0 BuildRequires: glusterfs-devel %endif # We need both because the 'stap' binary is probed for by configure @@ -2443,6 +2905,11 @@ BuildRequires: librdmacm-devel BuildRequires: iasl BuildRequires: cpp %endif +%if 0%{!?build_only_sub:1} +# For compressed guest memory dumps +BuildRequires: lzo-devel snappy-devel +%endif + %if 0%{!?build_only_sub:1} Requires: qemu-img = %{epoch}:%{version}-%{release} @@ -3731,6 +4198,235 @@ cp %{SOURCE18} pc-bios # keep "make check" happy %patch1157 -p1 %patch1158 -p1 %patch1159 -p1 +%patch1160 -p1 +%patch1161 -p1 +%patch1162 -p1 +%patch1163 -p1 +%patch1164 -p1 +%patch1165 -p1 +%patch1166 -p1 +%patch1167 -p1 +%patch1168 -p1 +%patch1169 -p1 +%patch1170 -p1 +%patch1171 -p1 +%patch1172 -p1 +%patch1173 -p1 +%patch1174 -p1 +%patch1175 -p1 +%patch1176 -p1 +%patch1177 -p1 +%patch1178 -p1 +%patch1179 -p1 +%patch1180 -p1 +%patch1181 -p1 +%patch1182 -p1 +%patch1183 -p1 +%patch1184 -p1 +%patch1185 -p1 +%patch1186 -p1 +%patch1187 -p1 +%patch1189 -p1 +%patch1190 -p1 +%patch1191 -p1 +%patch1192 -p1 +%patch1193 -p1 +%patch1194 -p1 +%patch1195 -p1 +%patch1196 -p1 +%patch1197 -p1 +%patch1198 -p1 +%patch1201 -p1 +%patch1202 -p1 +%patch1203 -p1 +%patch1204 -p1 +%patch1205 -p1 +%patch1206 -p1 +%patch1207 -p1 +%patch1208 -p1 +%patch1209 -p1 +%patch1210 -p1 +%patch1211 -p1 +%patch1212 -p1 +%patch1213 -p1 +%patch1214 -p1 +%patch1215 -p1 +%patch1216 -p1 +%patch1217 -p1 +%patch1218 -p1 +%patch1219 -p1 +%patch1220 -p1 +%patch1221 -p1 +%patch1222 -p1 +%patch1223 -p1 +%patch1224 -p1 +%patch1225 -p1 +%patch1226 -p1 +%patch1227 -p1 +%patch1228 -p1 +%patch1229 -p1 +%patch1230 -p1 +%patch1231 -p1 +%patch1232 -p1 +%patch1233 -p1 +%patch1234 -p1 +%patch1235 -p1 +%patch1236 -p1 +%patch1237 -p1 +%patch1238 -p1 +%patch1239 -p1 +%patch1240 -p1 +%patch1241 -p1 +%patch1242 -p1 +%patch1243 -p1 +%patch1244 -p1 +%patch1245 -p1 +%patch1246 -p1 +%patch1247 -p1 +%patch1248 -p1 +%patch1249 -p1 +%patch1250 -p1 +%patch1251 -p1 +%patch1252 -p1 +%patch1253 -p1 +%patch1254 -p1 +%patch1255 -p1 +%patch1256 -p1 +%patch1257 -p1 +%patch1258 -p1 +%patch1259 -p1 +%patch1260 -p1 +%patch1261 -p1 +%patch1262 -p1 +%patch1263 -p1 +%patch1264 -p1 +%patch1265 -p1 +%patch1266 -p1 +%patch1267 -p1 +%patch1268 -p1 +%patch1269 -p1 +%patch1270 -p1 +%patch1271 -p1 +%patch1272 -p1 +%patch1273 -p1 +%patch1274 -p1 +%patch1275 -p1 +%patch1276 -p1 +%patch1277 -p1 +%patch1278 -p1 +%patch1279 -p1 +%patch1280 -p1 +%patch1281 -p1 +%patch1282 -p1 +%patch1283 -p1 +%patch1284 -p1 +%patch1285 -p1 +%patch1286 -p1 +%patch1287 -p1 +%patch1288 -p1 +%patch1289 -p1 +%patch1290 -p1 +%patch1291 -p1 +%patch1292 -p1 +%patch1293 -p1 +%patch1294 -p1 +%patch1295 -p1 +%patch1296 -p1 +%patch1297 -p1 +%patch1298 -p1 +%patch1299 -p1 +%patch1300 -p1 +%patch1301 -p1 +%patch1302 -p1 +%patch1303 -p1 +%patch1304 -p1 +%patch1305 -p1 +%patch1306 -p1 +%patch1307 -p1 +%patch1308 -p1 +%patch1309 -p1 +%patch1310 -p1 +%patch1311 -p1 +%patch1312 -p1 +%patch1313 -p1 +%patch1314 -p1 +%patch1315 -p1 +%patch1316 -p1 +%patch1317 -p1 +%patch1318 -p1 +%patch1319 -p1 +%patch1320 -p1 +%patch1321 -p1 +%patch1322 -p1 +%patch1323 -p1 +%patch1324 -p1 +%patch1325 -p1 +%patch1326 -p1 +%patch1327 -p1 +%patch1328 -p1 +%patch1329 -p1 +%patch1330 -p1 +%patch1331 -p1 +%patch1332 -p1 +%patch1333 -p1 +%patch1334 -p1 +%patch1335 -p1 +%patch1336 -p1 +%patch1337 -p1 +%patch1338 -p1 +%patch1339 -p1 +%patch1340 -p1 +%patch1341 -p1 +%patch1342 -p1 +%patch1343 -p1 +%patch1344 -p1 +%patch1345 -p1 +%patch1346 -p1 +%patch1347 -p1 +%patch1348 -p1 +%patch1349 -p1 +%patch1350 -p1 +%patch1351 -p1 +%patch1352 -p1 +%patch1353 -p1 +%patch1354 -p1 +%patch1355 -p1 +%patch1356 -p1 +%patch1357 -p1 +%patch1358 -p1 +%patch1359 -p1 +%patch1360 -p1 +%patch1361 -p1 +%patch1362 -p1 +%patch1363 -p1 +%patch1364 -p1 +%patch1365 -p1 +%patch1366 -p1 +%patch1367 -p1 +%patch1368 -p1 +%patch1369 -p1 +%patch1370 -p1 +%patch1371 -p1 +%patch1372 -p1 +%patch1373 -p1 +%patch1374 -p1 +%patch1375 -p1 +%patch1376 -p1 +%patch1377 -p1 +%patch1378 -p1 +%patch1379 -p1 +%patch1380 -p1 +%patch1381 -p1 +%patch1382 -p1 +%patch1383 -p1 +%patch1384 -p1 +%patch1385 -p1 +%patch1386 -p1 +%patch1387 -p1 +%patch1388 -p1 +%patch1389 -p1 +%patch1390 -p1 +%patch1391 -p1 %build buildarch="%{kvm_target}-softmmu" @@ -3783,6 +4479,8 @@ dobuild() { --enable-vnc-sasl \ --enable-linux-aio \ --enable-smartcard-nss \ + --enable-lzo \ + --enable-snappy \ --enable-usb-redir \ --enable-vnc-png \ --disable-vnc-jpeg \ @@ -3796,18 +4494,15 @@ dobuild() { %endif %if %{rhev} --enable-live-block-ops \ - --enable-ceph-support \ %else --disable-live-block-ops \ - --disable-ceph-support \ %endif --disable-live-block-migration \ - --enable-glusterfs \ -%if %{rhev} - --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster,rbd \ -%else - --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster \ +%ifarch x86_64 + --enable-rbd \ %endif + --enable-glusterfs \ + --block-drv-rw-whitelist=qcow2,raw,file,host_device,blkdebug,nbd,iscsi,gluster,rbd \ --block-drv-ro-whitelist=vmdk,vhdx,vpc \ "$@" @@ -3831,7 +4526,9 @@ dobuild() { make qemu-nbd %{?_smp_mflags} $buildldflags make qemu-img.1 %{?_smp_mflags} $buildldflags make qemu-nbd.8 %{?_smp_mflags} $buildldflags - make qemu-ga %{?_smp_mflags} $buildldflags + %if %{with guest_agent} + make qemu-ga %{?_smp_mflags} $buildldflags + %endif %endif } @@ -3844,6 +4541,11 @@ dobuild --target-list="$buildarch" --target-type system --probe-prefix \ qemu.kvm < ./trace-events > qemu-kvm.stp + ./scripts/tracetool.py --backend dtrace --format simpletrace-stap \ + --binary %{_libexecdir}/qemu-kvm --target-arch %{kvm_target} \ + --target-type system --probe-prefix \ + qemu.kvm < ./trace-events > qemu-kvm-simpletrace.stp + cp -a %{kvm_target}-softmmu/qemu-system-%{kvm_target} qemu-kvm @@ -3885,12 +4587,23 @@ dobuild --target-list="$buildarch" install -m 0755 qemu-kvm $RPM_BUILD_ROOT%{_libexecdir}/ install -m 0644 qemu-kvm.stp $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/ + install -m 0644 qemu-kvm-simpletrace.stp $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/ rm $RPM_BUILD_ROOT%{_bindir}/qemu-system-%{kvm_target} rm $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/qemu-system-%{kvm_target}.stp + rm $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/qemu-system-%{kvm_target}-simpletrace.stp + + # Install simpletrace + install -m 0755 scripts/simpletrace.py $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/simpletrace.py + mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool + install -m 0644 -t $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool scripts/tracetool/*.py + mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool/backend + install -m 0644 -t $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool/backend scripts/tracetool/backend/*.py + mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool/format + install -m 0644 -t $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/tracetool/format scripts/tracetool/format/*.py mkdir -p $RPM_BUILD_ROOT%{qemudocdir} - install -p -m 0644 -t ${RPM_BUILD_ROOT}%{qemudocdir} Changelog README COPYING COPYING.LIB LICENSE %{SOURCE19} + install -p -m 0644 -t ${RPM_BUILD_ROOT}%{qemudocdir} Changelog README README.systemtap COPYING COPYING.LIB LICENSE %{SOURCE19} mv ${RPM_BUILD_ROOT}%{_docdir}/qemu/qemu-doc.html $RPM_BUILD_ROOT%{qemudocdir} mv ${RPM_BUILD_ROOT}%{_docdir}/qemu/qemu-tech.html $RPM_BUILD_ROOT%{qemudocdir} mv ${RPM_BUILD_ROOT}%{_docdir}/qemu/qmp-commands.txt $RPM_BUILD_ROOT%{qemudocdir} @@ -4004,7 +4717,9 @@ find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f install -m 0755 qemu-nbd $RPM_BUILD_ROOT%{_bindir}/qemu-nbd install -c -m 0644 qemu-img.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/qemu-img.1 install -c -m 0644 qemu-nbd.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/qemu-nbd.8 - install -c -m 0755 qemu-ga ${RPM_BUILD_ROOT}%{_bindir}/qemu-ga + %if %{with guest_agent} + install -c -m 0755 qemu-ga ${RPM_BUILD_ROOT}%{_bindir}/qemu-ga + %endif chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/* chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man8/* %endif @@ -4045,7 +4760,11 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %global qemu_kvm_files \ %{_libexecdir}/qemu-kvm \ -%{_datadir}/systemtap/tapset/qemu-kvm.stp +%{_datadir}/systemtap/tapset/qemu-kvm.stp \ +%{_datadir}/systemtap/tapset/qemu-kvm-simpletrace.stp \ +%{_datadir}/%{pkgname}/trace-events \ +%{_datadir}/%{pkgname}/systemtap/script.d/qemu_kvm.stp \ +%{_datadir}/%{pkgname}/systemtap/conf.d/qemu_kvm.conf %if 0%{!?build_only_sub:1} %files -n qemu-kvm-common%{?pkgsuffix} @@ -4060,6 +4779,7 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %doc %{qemudocdir}/COPYING.LIB %doc %{qemudocdir}/LICENSE %doc %{qemudocdir}/README.rhel6-gpxe-source + %doc %{qemudocdir}/README.systemtap %dir %{_datadir}/%{pkgname}/ %{_datadir}/%{pkgname}/keymaps/ %{_mandir}/man1/%{pkgname}.1* @@ -4073,6 +4793,10 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %config(noreplace) %{_sysconfdir}/ksmtuned.conf %dir %{_sysconfdir}/%{pkgname} %config(noreplace) %{_sysconfdir}/%{pkgname}/bridge.conf + %{_datadir}/%{pkgname}/simpletrace.py* + %{_datadir}/%{pkgname}/tracetool/*.py* + %{_datadir}/%{pkgname}/tracetool/backend/*.py* + %{_datadir}/%{pkgname}/tracetool/format/*.py* %endif %if %{with guest_agent} @@ -4147,178 +4871,612 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %{_libdir}/pkgconfig/libcacard.pc %changelog -* Mon Nov 24 2014 Miroslav Rezanina - 1.5.3-60.el7_0.11 -- kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch [bz#1166605] -- kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch [bz#1166605] -- kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch [bz#1166605] -- kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch [bz#1166605] -- kvm-raw-posix-raw_co_get_block_status-return-value.patch [bz#1166605] -- kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch [bz#1166605] -- kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch [bz#1166605] -- Resolves: bz#1166605 - (qemu-img convert intermittently corrupts output images) +* Sun Jan 25 2015 Miroslav Rezanina - 1.5.3-86.el7 +- kvm-vfio-pci-Fix-interrupt-disabling.patch [bz#1180942] +- kvm-cirrus-fix-blit-region-check.patch [bz#1169456] +- kvm-cirrus-don-t-overflow-CirrusVGAState-cirrus_bltbuf.patch [bz#1169456] +- Resolves: bz#1169456 + (CVE-2014-8106 qemu-kvm: qemu: cirrus: insufficient blit region checks [rhel-7.1]) +- Resolves: bz#1180942 + (qemu core dumped when unhotplug gpu card assigned to guest) + +* Wed Jan 07 2015 Jeff E. Nelson - 1.5.3-85.el7 +- kvm-block-delete-cow-block-driver.patch [bz#1175325] +- Resolves: bz#1175325 + (Delete cow block driver) + +* Tue Dec 16 2014 Jeff E. Nelson - 1.5.3-84.el7 +- kvm-qemu-iotests-Test-case-for-backing-file-deletion.patch [bz#1002493] +- kvm-qemu-iotests-Add-sample-image-and-test-for-VMDK-vers.patch [bz#1134237] +- kvm-vmdk-Check-VMFS-extent-line-field-number.patch [bz#1134237] +- kvm-qemu-iotests-Introduce-_unsupported_imgopts.patch [bz#1002493] +- kvm-qemu-iotests-Add-_unsupported_imgopts-for-vmdk-subfo.patch [bz#1002493] +- kvm-vmdk-Fix-big-flat-extent-IO.patch [bz#1134241] +- kvm-vmdk-Check-for-overhead-when-opening.patch [bz#1134251] +- kvm-block-vmdk-add-basic-.bdrv_check-support.patch [bz#1134251] +- kvm-qemu-iotest-Make-077-raw-only.patch [bz#1134237] +- kvm-qemu-iotests-Don-t-run-005-on-vmdk-split-formats.patch [bz#1002493] +- kvm-vmdk-extract-vmdk_read_desc.patch [bz#1134251] +- kvm-vmdk-push-vmdk_read_desc-up-to-caller.patch [bz#1134251] +- kvm-vmdk-do-not-try-opening-a-file-as-both-image-and-des.patch [bz#1134251] +- kvm-vmdk-correctly-propagate-errors.patch [bz#1134251] +- kvm-block-vmdk-do-not-report-file-offset-for-compressed-.patch [bz#1134251] +- kvm-vmdk-Fix-d-and-lld-to-PRI-in-format-strings.patch [bz#1134251] +- kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch [bz#1134251] +- kvm-qemu-img-Convert-by-cluster-size-if-target-is-compre.patch [bz#1134283] +- kvm-vmdk-Implement-.bdrv_write_compressed.patch [bz#1134283] +- kvm-vmdk-Implement-.bdrv_get_info.patch [bz#1134283] +- kvm-qemu-iotests-Test-converting-to-streamOptimized-from.patch [bz#1134283] +- kvm-vmdk-Fix-local_err-in-vmdk_create.patch [bz#1134283] +- kvm-fpu-softfloat-drop-INLINE-macro.patch [bz#1002493] +- kvm-block-New-bdrv_nb_sectors.patch [bz#1002493] +- kvm-vmdk-Optimize-cluster-allocation.patch [bz#1002493] +- kvm-vmdk-Handle-failure-for-potentially-large-allocation.patch [bz#1002493] +- kvm-vmdk-Use-bdrv_nb_sectors-where-sectors-not-bytes-are.patch [bz#1002493] +- kvm-vmdk-fix-vmdk_parse_extents-extent_file-leaks.patch [bz#1002493] +- kvm-vmdk-fix-buf-leak-in-vmdk_parse_extents.patch [bz#1002493] +- kvm-vmdk-Fix-integer-overflow-in-offset-calculation.patch [bz#1002493] +- kvm-migration-fix-parameter-validation-on-ram-load-CVE-2.patch [bz#1163078] +- Resolves: bz#1002493 + (qemu-img convert rate about 100k/second from qcow2/raw to vmdk format on nfs system file) +- Resolves: bz#1134237 + (Opening malformed VMDK description file should fail) +- Resolves: bz#1134241 + (QEMU fails to correctly read/write on VMDK with big flat extent) +- Resolves: bz#1134251 + (Opening an obviously truncated VMDK image should fail) +- Resolves: bz#1134283 + (qemu-img convert from ISO to streamOptimized fails) +- Resolves: bz#1163078 + (CVE-2014-7840 qemu-kvm: qemu: insufficient parameter validation during ram load [rhel-7.1]) + +* Thu Nov 27 2014 Miroslav Rezanina - 1.5.3-83.el7 +- kvm-xhci-add-sanity-checks-to-xhci_lookup_uport.patch [bz#1074219] +- kvm-Revert-Build-ceph-rbd-only-for-rhev.patch [bz#1140742] +- kvm-Revert-rbd-Only-look-for-qemu-specific-copy-of-librb.patch [bz#1140742] +- kvm-Revert-rbd-link-and-load-librbd-dynamically.patch [bz#1140742] +- kvm-spec-Enable-rbd-driver-add-dependency.patch [bz#1140742] +- Resolves: bz#1074219 + (qemu core dump when install a RHEL.7 guest(xhci) with migration) +- Resolves: bz#1140742 + (Enable native support for Ceph) + +* Tue Nov 25 2014 Miroslav Rezanina - 1.5.3-82.el7 +- kvm-hw-pci-fixed-error-flow-in-pci_qdev_init.patch [bz#1046007] +- kvm-hw-pci-fixed-hotplug-crash-when-using-rombar-0-with-.patch [bz#1046007] +- Resolves: bz#1046007 + (qemu-kvm aborted when hot plug PCI device to guest with romfile and rombar=0) + +* Fri Nov 21 2014 Miroslav Rezanina - 1.5.3-81.el7 +- kvm-migration-static-variables-will-not-be-reset-at-seco.patch [bz#1071776] +- kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch [bz#1098976] +- kvm-vfio-correct-debug-macro-typo.patch [bz#1098976] +- kvm-vfio-pci-Fix-MSI-X-debug-code.patch [bz#1098976] +- kvm-vfio-pci-Fix-MSI-X-masking-performance.patch [bz#1098976] +- kvm-vfio-Fix-MSI-X-vector-expansion.patch [bz#1098976] +- kvm-vfio-Don-t-cache-MSIMessage.patch [bz#1098976] +- Resolves: bz#1071776 + (Migration "expected downtime" does not refresh after reset to a new value) +- Resolves: bz#1098976 + (2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput) -* Mon Sep 29 2014 Miroslav Rezanina - 1.5.3-60.el7_0.10 +* Fri Nov 21 2014 Miroslav Rezanina - 1.5.3-80.el7 +- kvm-dump-RHEL-specific-fix-for-CPUState-bug-introduced-b.patch [bz#1161563] +- kvm-dump-guest-memory-Check-for-the-correct-return-value.patch [bz#1157798] +- kvm-dump-const-qualify-the-buf-of-WriteCoreDumpFunction.patch [bz#1157798] +- kvm-dump-add-argument-to-write_elfxx_notes.patch [bz#1157798] +- kvm-dump-add-API-to-write-header-of-flatten-format.patch [bz#1157798] +- kvm-dump-add-API-to-write-vmcore.patch [bz#1157798] +- kvm-dump-add-API-to-write-elf-notes-to-buffer.patch [bz#1157798] +- kvm-dump-add-support-for-lzo-snappy.patch [bz#1157798] +- kvm-RPM-spec-build-qemu-kvm-with-lzo-and-snappy-enabled-.patch [bz#1157798] +- kvm-dump-add-members-to-DumpState-and-init-some-of-them.patch [bz#1157798] +- kvm-dump-add-API-to-write-dump-header.patch [bz#1157798] +- kvm-dump-add-API-to-write-dump_bitmap.patch [bz#1157798] +- kvm-dump-add-APIs-to-operate-DataCache.patch [bz#1157798] +- kvm-dump-add-API-to-write-dump-pages.patch [bz#1157798] +- kvm-dump-Drop-qmp_dump_guest_memory-stub-and-build-for-a.patch [bz#1157798] +- kvm-dump-make-kdump-compressed-format-available-for-dump.patch [bz#1157798] +- kvm-Define-the-architecture-for-compressed-dump-format.patch [bz#1157798] +- kvm-dump-add-query-dump-guest-memory-capability-command.patch [bz#1157798] +- kvm-dump-Drop-pointless-error_is_set-DumpState-member-er.patch [bz#1157798] +- kvm-dump-fill-in-the-flat-header-signature-more-pleasing.patch [bz#1157798] +- kvm-dump-simplify-write_start_flat_header.patch [bz#1157798] +- kvm-dump-eliminate-DumpState.page_shift-guest-s-page-shi.patch [bz#1157798] +- kvm-dump-eliminate-DumpState.page_size-guest-s-page-size.patch [bz#1157798] +- kvm-dump-select-header-bitness-based-on-ELF-class-not-EL.patch [bz#1157798] +- kvm-dump-hoist-lzo_init-from-get_len_buf_out-to-dump_ini.patch [bz#1157798] +- kvm-dump-simplify-get_len_buf_out.patch [bz#1157798] +- kvm-rename-parse_enum_option-to-qapi_enum_parse-and-make.patch [bz#1087724] +- kvm-qapi-introduce-PreallocMode-and-new-PreallocModes-fu.patch [bz#1087724] +- kvm-raw-posix-Add-falloc-and-full-preallocation-option.patch [bz#1087724] +- kvm-qcow2-Add-falloc-and-full-preallocation-option.patch [bz#1087724] +- kvm-vga-fix-invalid-read-after-free.patch [bz#1161890] +- kvm-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch [bz#1140618] +- kvm-vnc-sanitize-bits_per_pixel-from-the-client.patch [bz#1157645] +- kvm-spice-call-qemu_spice_set_passwd-during-init.patch [bz#1138639] +- kvm-block-raw-posix-Try-both-FIEMAP-and-SEEK_HOLE.patch [bz#1160237] +- kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch [bz#1160237] +- kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch [bz#1160237] +- kvm-raw-posix-Fix-raw_co_get_block_status-after-EOF.patch [bz#1160237] +- kvm-raw-posix-raw_co_get_block_status-return-value.patch [bz#1160237] +- kvm-raw-posix-SEEK_HOLE-suffices-get-rid-of-FIEMAP.patch [bz#1160237] +- kvm-raw-posix-The-SEEK_HOLE-code-is-flawed-rewrite-it.patch [bz#1160237] +- Resolves: bz#1087724 + ([Fujitsu 7.1 FEAT]: qemu-img should use fallocate() system call for "preallocation=full" option) +- Resolves: bz#1138639 + (fail to login spice session with password + expire time) +- Resolves: bz#1140618 + (Should replace "qemu-system-i386" by "/usr/libexec/qemu-kvm" in manpage of qemu-kvm for our official qemu-kvm build) +- Resolves: bz#1157645 + (CVE-2014-7815 qemu-kvm: qemu: vnc: insufficient bits_per_pixel from the client sanitization [rhel-7.1]) +- Resolves: bz#1157798 + ([FEAT RHEL7.1]: qemu: Support compression for dump-guest-memory command) +- Resolves: bz#1160237 + (qemu-img convert intermittently corrupts output images) +- Resolves: bz#1161563 + (invalid QEMU NOTEs in vmcore that is dumped for multi-VCPU guests) +- Resolves: bz#1161890 + ([abrt] qemu-kvm: pixman_image_get_data(): qemu-kvm killed by SIGSEGV) + +* Wed Nov 12 2014 Miroslav Rezanina - 1.5.3-79.el7 +- kvm-libcacard-link-against-qemu-error.o-for-error_report.patch [bz#1088176] +- kvm-error-Add-error_abort.patch [bz#1088176] +- kvm-blockdev-Fail-blockdev-add-with-encrypted-images.patch [bz#1088176] +- kvm-blockdev-Fix-NULL-pointer-dereference-in-blockdev-ad.patch [bz#1088176] +- kvm-qemu-iotests-Test-a-few-blockdev-add-error-cases.patch [bz#1088176] +- kvm-block-Add-errp-to-bdrv_new.patch [bz#1088176] +- kvm-qemu-img-Avoid-duplicate-block-device-IDs.patch [bz#1088176] +- kvm-block-Catch-duplicate-IDs-in-bdrv_new.patch [bz#1088176] +- kvm-qemu-img-Allow-source-cache-mode-specification.patch [bz#1138691] +- kvm-qemu-img-Allow-cache-mode-specification-for-amend.patch [bz#1138691] +- kvm-qemu-img-clarify-src_cache-option-documentation.patch [bz#1138691] +- kvm-qemu-img-fix-rebase-src_cache-option-documentation.patch [bz#1138691] +- kvm-qemu-img-fix-img_compare-flags-error-path.patch [bz#1138691] +- kvm-ac97-register-reset-via-qom.patch [bz#1141667] +- kvm-virtio-blk-Factor-common-checks-out-of-virtio_blk_ha.patch [bz#1085232] +- kvm-virtio-blk-Bypass-error-action-and-I-O-accounting-on.patch [bz#1085232] +- kvm-virtio-blk-Treat-read-write-beyond-end-as-invalid.patch [bz#1085232] +- kvm-ide-Treat-read-write-beyond-end-as-invalid.patch [bz#1085232] +- kvm-ide-only-constrain-read-write-requests-to-drive-size.patch [bz#1085232] +- Resolves: bz#1085232 + (Ilegal guest requests on block devices pause the VM) +- Resolves: bz#1088176 + (QEMU fail to check whether duplicate ID for block device drive using 'blockdev-add' to hotplug) +- Resolves: bz#1138691 + (Allow qemu-img to bypass the host cache (check, compare, convert, rebase, amend)) +- Resolves: bz#1141667 + (Qemu crashed if reboot guest after hot remove AC97 sound device) + +* Mon Nov 10 2014 Miroslav Rezanina - 1.5.3-78.el7 +- kvm-slirp-udp-fix-NULL-pointer-dereference-because-of-un.patch [bz#1144820] +- kvm-hw-pci-fix-error-flow-in-pci-multifunction-init.patch [bz#1049734] +- kvm-rhel-Drop-machine-type-pc-q35-rhel7.0.0.patch [bz#1111107] +- kvm-virtio-scsi-Plug-memory-leak-on-virtio_scsi_push_eve.patch [bz#1088822] +- kvm-virtio-scsi-Report-error-if-num_queues-is-0-or-too-l.patch [bz#1089606] +- kvm-virtio-scsi-Fix-memory-leak-when-realize-failed.patch [bz#1089606] +- kvm-virtio-scsi-Fix-num_queue-input-validation.patch [bz#1089606] +- kvm-Revert-linux-aio-use-event-notifiers.patch [bz#1104748] +- kvm-specfile-Require-glusterfs-api-3.6.patch [bz#1155518] +- Resolves: bz#1049734 + (PCI: QEMU crash on illegal operation: attaching a function to a non multi-function device) +- Resolves: bz#1088822 + (hot-plug a virtio-scsi disk via 'blockdev-add' always cause QEMU quit) +- Resolves: bz#1089606 + (QEMU will not reject invalid number of queues (num_queues = 0) specified for virtio-scsi) +- Resolves: bz#1104748 + (48% reduction in IO performance for KVM guest, io=native) +- Resolves: bz#1111107 + (Remove Q35 machine type from qemu-kvm) +- Resolves: bz#1144820 + (CVE-2014-3640 qemu-kvm: qemu: slirp: NULL pointer deref in sosendto() [rhel-7.1]) +- Resolves: bz#1155518 + (qemu-kvm: undefined symbol: glfs_discard_async) + +* Fri Oct 24 2014 Miroslav Rezanina - 1.5.3-77.el7 +- kvm-seccomp-add-semctl-to-the-syscall-whitelist.patch [bz#1026314] +- kvm-Revert-kvmclock-Ensure-proper-env-tsc-value-for-kvmc.patch [bz#1098602 bz#1130428] +- kvm-Revert-kvmclock-Ensure-time-in-migration-never-goes-.patch [bz#1098602 bz#1130428] +- kvm-Introduce-cpu_clean_all_dirty.patch [bz#1098602 bz#1130428] +- kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock.v2.patch [bz#1098602 bz#1130428] +- kvm-kvmclock-Ensure-time-in-migration-never-goes-back.v2.patch [bz#1098602 bz#1130428] +- Resolves: bz#1026314 + (BUG: qemu-kvm hang when use '-sandbox on'+'vnc'+'hda') +- Resolves: bz#1098602 + (kvmclock: Ensure time in migration never goes backward (backport)) +- Resolves: bz#1130428 + (After migration of RHEL7.1 guest with "-vga qxl", GUI console is hang) + +* Tue Oct 21 2014 Miroslav Rezanina - 1.5.3-76.el7 +- kvm-usb-hcd-xhci-QOM-Upcast-Sweep.patch [bz#980747] +- kvm-usb-hcd-xhci-QOM-parent-field-cleanup.patch [bz#980747] +- kvm-uhci-egsm-fix.patch [bz#1046873] +- kvm-usb-redir-fix-use-after-free.patch [bz#1046574 bz#1088116] +- kvm-xhci-remove-leftover-debug-printf.patch [bz#980833] +- kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch [bz#980833] +- kvm-xhci-add-port-to-slot_address-tracepoint.patch [bz#980833] +- kvm-usb-parallelize-usb3-streams.patch [bz#1075846] +- kvm-xhci-Init-a-transfers-xhci-slotid-and-epid-member-on.patch [bz#1075846] +- kvm-xhci-Add-xhci_epid_to_usbep-helper-function.patch [bz#980833] +- kvm-xhci-Fix-memory-leak-on-xhci_disable_ep.patch [bz#980833] +- kvm-usb-Also-reset-max_packet_size-on-ep_reset.patch [bz#1075846] +- kvm-usb-Fix-iovec-memleak-on-combined-packet-free.patch [bz#1075846] +- kvm-usb-hcd-xhci-Remove-unused-sstreamsm-member-from-XHC.patch [bz#980747] +- kvm-usb-hcd-xhci-Remove-unused-cancelled-member-from-XHC.patch [bz#980747] +- kvm-usb-hcd-xhci-Report-completion-of-active-transfer-wi.patch [bz#980747] +- kvm-usb-hcd-xhci-Update-endpoint-context-dequeue-pointer.patch [bz#980747] +- kvm-xhci-Add-a-few-missing-checks-for-disconnected-devic.patch [bz#980833] +- kvm-usb-Add-max_streams-attribute-to-endpoint-info.patch [bz#1111450] +- kvm-usb-Add-usb_device_alloc-free_streams.patch [bz#1111450] +- kvm-xhci-Call-usb_device_alloc-free_streams.patch [bz#980833] +- kvm-uhci-invalidate-queue-on-device-address-changes.patch [bz#1111450] +- kvm-xhci-iso-fix-time-calculation.patch [bz#949385] +- kvm-xhci-iso-allow-for-some-latency.patch [bz#949385] +- kvm-xhci-switch-debug-printf-to-tracepoint.patch [bz#980747] +- kvm-xhci-use-DPRINTF-instead-of-fprintf-stderr.patch [bz#980833] +- kvm-xhci-child-detach-fix.patch [bz#980833] +- kvm-usb-add-usb_pick_speed.patch [bz#1075846] +- kvm-xhci-make-port-reset-trace-point-more-verbose.patch [bz#980833] +- kvm-usb-initialize-libusb_device-to-avoid-crash.patch [bz#1111450] +- kvm-target-i386-get-CPL-from-SS.DPL.patch [bz#1097363] +- kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch [bz#1088112] +- kvm-trace-add-pid-field-to-simpletrace-record.patch [bz#1088112] +- kvm-simpletrace-add-support-for-trace-record-pid-field.patch [bz#1088112] +- kvm-simpletrace-add-simpletrace.py-no-header-option.patch [bz#1088112] +- kvm-trace-extract-stap_escape-function-for-reuse.patch [bz#1088112] +- kvm-trace-add-tracetool-simpletrace_stap-format.patch [bz#1088112] +- kvm-trace-install-simpletrace-SystemTap-tapset.patch [bz#1088112] +- kvm-trace-install-trace-events-file.patch [bz#1088112] +- kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch [bz#1088112] +- kvm-simpletrace-install-simpletrace.py.patch [bz#1088112] +- kvm-trace-add-systemtap-initscript-README-file-to-RPM.patch [bz#1088112] +- kvm-rdma-Fix-block-during-rdma-migration.patch [bz#1152969] +- Resolves: bz#1046574 + (fail to passthrough the USB speaker redirected from usb-redir with xhci controller) +- Resolves: bz#1046873 + (fail to be recognized the hotpluging usb-storage device with xhci controller in win2012R2 guest) +- Resolves: bz#1075846 + (qemu-kvm core dumped when hotplug/unhotplug USB3.0 device multi times) +- Resolves: bz#1088112 + ([Fujitsu 7.1 FEAT]:QEMU: capturing trace data all the time using ftrace-based tracing) +- Resolves: bz#1088116 + (qemu crash when device_del usb-redir) +- Resolves: bz#1097363 + (qemu ' KVM internal error. Suberror: 1' when query cpu frequently during pxe boot in Intel "Q95xx" host) +- Resolves: bz#1111450 + (Guest crash when hotplug usb while disable virt_use_usb) +- Resolves: bz#1152969 + (Qemu-kvm got stuck when migrate to wrong RDMA ip) +- Resolves: bz#949385 + (passthrough USB speaker to win2012 guest fail to work well) +- Resolves: bz#980747 + (flood with 'xhci: wrote doorbell while xHC stopped or paused' when redirected USB Webcam from usb-host with xHCI controller) +- Resolves: bz#980833 + (xhci: FIXME: endpoint stopped w/ xfers running, data might be lost) + +* Wed Oct 08 2014 Miroslav Rezanina - 1.5.3-75.el7 +- kvm-target-i386-Broadwell-CPU-model.patch [bz#1116117] +- kvm-pc-Add-Broadwell-CPUID-compatibility-bits.patch [bz#1116117] +- kvm-virtio-balloon-fix-integer-overflow-in-memory-stats-.patch [bz#1142290] +- Resolves: bz#1116117 + ([Intel 7.1 FEAT] Broadwell new instructions support for KVM - qemu-kvm) +- Resolves: bz#1142290 + (guest is stuck when setting balloon memory with large guest-stats-polling-interval) + +* Mon Sep 29 2014 Miroslav Rezanina - 1.5.3-74.el7 +- kvm-ide-Add-wwn-support-to-IDE-ATAPI-drive.patch [bz#1131316] +- kvm-vmdk-Allow-vmdk_create-to-work-with-protocol.patch [bz#1098086] +- kvm-block-make-vdi-bounds-check-match-upstream.patch [bz#1098086] +- kvm-vdi-say-why-an-image-is-bad.patch [bz#1098086] +- kvm-block-do-not-abuse-EMEDIUMTYPE.patch [bz#1098086] +- kvm-cow-correctly-propagate-errors.patch [bz#1098086] +- kvm-block-Use-correct-width-in-format-strings.patch [bz#1098086] +- kvm-vdi-remove-double-conversion.patch [bz#1098086] +- kvm-block-vdi-Error-out-immediately-in-vdi_create.patch [bz#1098086] +- kvm-vpc-Implement-.bdrv_has_zero_init.patch [bz#1098086] +- kvm-block-vpc-use-QEMU_PACKED-for-on-disk-structures.patch [bz#1098086] +- kvm-block-allow-bdrv_unref-to-be-passed-NULL-pointers.patch [bz#1098086] +- kvm-block-vdi-use-block-layer-ops-in-vdi_create-instead-.patch [bz#1098086] +- kvm-block-use-the-standard-ret-instead-of-result.patch [bz#1098086] +- kvm-block-vpc-use-block-layer-ops-in-vpc_create-instead-.patch [bz#1098086] +- kvm-block-iotest-update-084-to-test-static-VDI-image-cre.patch [bz#1098086] - kvm-block-add-helper-function-to-determine-if-a-BDS-is-i.patch [bz#1122925] - kvm-block-extend-block-commit-to-accept-a-string-for-the.patch [bz#1122925] - kvm-block-add-backing-file-option-to-block-stream.patch [bz#1122925] - kvm-block-add-__com.redhat_change-backing-file-qmp-comma.patch [bz#1122925] +- Resolves: bz#1098086 + (RFE: Supporting creating vmdk/vdi/vpc format disk with protocols (glusterfs)) - Resolves: bz#1122925 (Maintain relative path to backing file image during live merge (block-commit)) +- Resolves: bz#1131316 + (fail to specify wwn for virtual IDE CD-ROM) -* Tue Sep 23 2014 Miroslav Rezanina - 1.5.3-60.el7_0.9 -- kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch [bz#1141189] -- Resolves: bz#1141189 +* Tue Sep 23 2014 Miroslav Rezanina - 1.5.3-73.el7 +- kvm-scsi-disk-fix-bug-in-scsi_block_new_request-introduc.patch [bz#1105880] +- Resolves: bz#1105880 (bug in scsi_block_new_request() function introduced by upstream commit 137745c5c60f083ec982fe9e861e8c16ebca1ba8) -* Mon Sep 22 2014 Miroslav Rezanina - 1.5.3-60.el7_0.8 -- kvm-vmstate_xhci_event-fix-unterminated-field-list.patch [bz#1145055] -- kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch [bz#1145055] -- kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch [bz#1139117] -- kvm-vbe-rework-sanity-checks.patch [bz#1139117] -- kvm-spice-display-add-display-channel-id-to-the-debug-me.patch [bz#1139117] -- kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch [bz#1139117] -- Resolves: bz#1139117 - (CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.0.z]) -- Resolves: bz#1145055 - (vmstate_xhci_event: fix unterminated field list [rhel-7.0.z]) - -* Tue Aug 26 2014 Miroslav Rezanina - 1.5.3-60.el7_0.7 -- kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch [bz#1132806] -- kvm-blockjob-Add-block_job_yield.patch [bz#1132806] -- kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch [bz#1132806] -- kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch [bz#1132806] -- kvm-block-make-top-argument-to-block-commit-optional.patch [bz#1132806] -- kvm-qemu-iotests-Test-0-length-image-for-mirror.patch [bz#1132806] -- kvm-mirror-Fix-qiov-size-for-short-requests.patch [bz#1132806] -- Resolves: bz#1132806 +* Mon Sep 22 2014 Miroslav Rezanina - 1.5.3-72.el7 +- kvm-vbe-make-bochs-dispi-interface-return-the-correct-me.patch [bz#1139118] +- kvm-vbe-rework-sanity-checks.patch [bz#1139118] +- kvm-spice-display-add-display-channel-id-to-the-debug-me.patch [bz#1139118] +- kvm-spice-make-sure-we-don-t-overflow-ssd-buf.patch [bz#1139118] +- Resolves: bz#1139118 + (CVE-2014-3615 qemu-kvm: Qemu: crash when guest sets high resolution [rhel-7.1]) + +* Thu Sep 18 2014 Miroslav Rezanina - 1.5.3-71.el7 +- kvm-spice-move-qemu_spice_display_-from-spice-graphics-t.patch [bz#1054077] +- kvm-spice-move-spice_server_vm_-start-stop-calls-into-qe.patch [bz#1054077] +- kvm-spice-stop-server-for-qxl-hard-reset.patch [bz#1054077] +- kvm-qemu-Adjust-qemu-wakeup.patch [bz#1064156] +- kvm-vmstate_xhci_event-fix-unterminated-field-list.patch [bz#1122147] +- kvm-vmstate_xhci_event-bug-compat-with-RHEL-7.0-RHEL-onl.patch [bz#1122147] +- kvm-pflash_cfi01-write-flash-contents-to-bdrv-on-incomin.patch [bz#1139702] +- kvm-ide-test-Add-enum-value-for-DEV.patch [bz#1123372] +- kvm-ide-test-Add-FLUSH-CACHE-test-case.patch [bz#1123372] +- kvm-ide-Fix-segfault-when-flushing-a-device-that-doesn-t.patch [bz#1123372] +- kvm-IDE-Fill-the-IDENTIFY-request-consistently.patch [bz#852348] +- kvm-ide-Add-resize-callback-to-ide-core.patch [bz#852348] +- Resolves: bz#1054077 + (qemu crash when reboot win7 guest with spice display) +- Resolves: bz#1064156 + ([qxl] The guest show black screen while resumed guest which managedsaved in pmsuspended status.) +- Resolves: bz#1122147 + (CVE-2014-5263 vmstate_xhci_event: fix unterminated field list) +- Resolves: bz#1123372 + (qemu-kvm crashed when doing iofuzz testing) +- Resolves: bz#1139702 + (pflash (UEFI varstore) migration shortcut for libvirt [RHEL]) +- Resolves: bz#852348 + (fail to block_resize local data disk with IDE/AHCI disk_interface) + +* Fri Sep 12 2014 Miroslav Rezanina - 1.5.3-70.el7 +- kvm-Enforce-stack-protector-usage.patch [bz#1064260] +- kvm-pc-increase-maximal-VCPU-count-to-240.patch [bz#1134408] +- kvm-gluster-Add-discard-support-for-GlusterFS-block-driv.patch [bz#1136534] +- kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch [bz#1088150] +- kvm-qdev-properties-system.c-Allow-vlan-or-netdev-for-de.patch [bz#996011] +- kvm-vl-process-object-after-other-backend-options.patch [bz#1128095] +- Resolves: bz#1064260 + (Handle properly --enable-fstack-protector option) +- Resolves: bz#1088150 + (qemu-img coredumpd when try to create a gluster format image) +- Resolves: bz#1128095 + (chardev 'chr0' isn't initialized when we try to open rng backend) +- Resolves: bz#1134408 + ([HP 7.1 FEAT] Increase qemu-kvm's VCPU limit to 240) +- Resolves: bz#1136534 + (glusterfs backend does not support discard) +- Resolves: bz#996011 + (vlan and queues options cause core dumped when qemu-kvm process quit(or ctrl+c)) + +* Tue Aug 26 2014 Miroslav Rezanina - 1.5.3-69.el7 +- kvm-rdma-bug-fixes.patch [bz#1107821] +- kvm-virtio-serial-report-frontend-connection-state-via-m.patch [bz#1122151] +- kvm-char-report-frontend-open-closed-state-in-query-char.patch [bz#1122151] +- kvm-acpi-fix-tables-for-no-hpet-configuration.patch [bz#1129552] +- kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch [bz#1130603] +- kvm-blockjob-Add-block_job_yield.patch [bz#1130603] +- kvm-mirror-Go-through-ready-complete-process-for-0-len-i.patch [bz#1130603] +- kvm-qemu-iotests-Test-BLOCK_JOB_READY-event-for-0Kb-imag.patch [bz#1130603] +- kvm-block-make-top-argument-to-block-commit-optional.patch [bz#1130603] +- kvm-qemu-iotests-Test-0-length-image-for-mirror.patch [bz#1130603] +- kvm-mirror-Fix-qiov-size-for-short-requests.patch [bz#1130603] +- Resolves: bz#1107821 + (rdma migration: seg if destination isn't listening) +- Resolves: bz#1122151 + (Pass close from qemu-ga) +- Resolves: bz#1129552 + (backport "acpi: fix tables for no-hpet configuration") +- Resolves: bz#1130603 (advertise active commit to libvirt) -* Fri Aug 15 2014 Miroslav Rezanina - 1.5.3-60.el7_0.6 -- kvm-vmstate-reduce-code-duplication.patch [bz#1095706] -- kvm-vfio-pci-Add-debug-config-options-to-disable-MSI-X-K.patch [bz#1110693 bz#1110695] -- kvm-vfio-correct-debug-macro-typo.patch [bz#1110693 bz#1110695] -- kvm-vfio-pci-Fix-MSI-X-debug-code.patch [bz#1110693 bz#1110695] -- kvm-vfio-pci-Fix-MSI-X-masking-performance.patch [bz#1110693 bz#1110695] -- kvm-vfio-Fix-MSI-X-vector-expansion.patch [bz#1110693 bz#1110695] -- kvm-vfio-Don-t-cache-MSIMessage.patch [bz#1110693 bz#1110695] -- kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch [bz#1130149] -- kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch [bz#1130149] -- kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch [bz#1124660] -- Resolves: bz#1110693 - (2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput) -- Resolves: bz#1110695 - (2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput) -- Resolves: bz#1124660 - ([FJ7.0 Bug] RHEL7.0 guest attaching 150 or more virtio-blk disks fails to start up) -- Resolves: bz#1130149 +* Fri Aug 15 2014 Miroslav Rezanina - 1.5.3-68.el7 +- kvm-virtio-net-Do-not-filter-VLANs-without-F_CTRL_VLAN.patch [bz#1065724] +- kvm-virtio-net-add-vlan-receive-state-to-RxFilterInfo.patch [bz#1065724] +- kvm-virtio-rng-check-return-value-of-virtio_load.patch [bz#1116941] +- kvm-qapi-treat-all-negative-return-of-strtosz_suffix-as-.patch [bz#1074403] +- Resolves: bz#1065724 (rx filter incorrect when guest disables VLAN filtering) - -* Wed Jul 02 2014 Miroslav Rezanina - 1.5.3-60.el7_0.5 -- kvm-Allow-mismatched-virtio-config-len.patch [bz#1095782] -- Resolves: bz#1095782 - (CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.0.z]) - -* Wed Jun 18 2014 Miroslav Rezanina - 1.5.3-60.el7_0.4 -- kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch [bz#1110693] -- kvm-skip-system-call-when-msi-route-is-unchanged.patch [bz#1110693] -- Resolves: bz#1110693 +- Resolves: bz#1074403 + (qemu-kvm can not give any warning hint when set sndbuf with negative value) +- Resolves: bz#1116941 + (Return value of virtio_load not checked in virtio_rng_load) + +* Thu Aug 07 2014 Jeff E. Nelson - 1.5.3-67.el7 +- kvm-vl.c-Output-error-on-invalid-machine-type.patch [bz#990724] +- kvm-migration-dump-vmstate-info-as-a-json-file-for-stati.patch [bz#1118707] +- kvm-vmstate-static-checker-script-to-validate-vmstate-ch.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-add-dump1-and-dump2-fil.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-incompat-machine-types.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-add-version-error-in-ma.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-version-mismatch-inside.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-minimum_version_id-chec.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-a-section.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-a-field.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-last-field-in-a-.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-change-description-name.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-Fields.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-Description.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-Description-insi.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-a-subsection.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-remove-Subsections.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-add-substructure-for-us.patch [bz#1118707] +- kvm-tests-vmstate-static-checker-add-size-mismatch-insid.patch [bz#1118707] +- kvm-aio-fix-qemu_bh_schedule-bh-ctx-race-condition.patch [bz#1116728] +- kvm-block-Improve-driver-whitelist-checks.patch [bz#999789] +- kvm-vmdk-Fix-format-specific-information-create-type-for.patch [bz#1029271] +- kvm-virtio-pci-Report-an-error-when-msix-vectors-init-fa.patch [bz#1095645] +- kvm-scsi-Report-error-when-lun-number-is-in-use.patch [bz#1096576] +- kvm-util-Split-out-exec_dir-from-os_find_datadir.patch [bz#1017685] +- kvm-rules.mak-fix-obj-to-a-real-relative-path.patch [bz#1017685] +- kvm-rules.mak-allow-per-object-cflags-and-libs.patch [bz#1017685] +- kvm-block-use-per-object-cflags-and-libs.patch [bz#1017685] +- kvm-vmdk-Fix-creating-big-description-file.patch [bz#1039791] +- Resolves: bz#1017685 + (Gluster etc. should not be a dependency of vscclient and libcacard) +- Resolves: bz#1029271 + (Format specific information (create type) was wrong when create it specified subformat='streamOptimized') +- Resolves: bz#1039791 + (qemu-img creates truncated VMDK image with subformat=twoGbMaxExtentFlat) +- Resolves: bz#1095645 + (vectors of virtio-scsi-pci will be 0 when set vectors>=129) +- Resolves: bz#1096576 + (QEMU core dumped when boot up two scsi-hd disk on the same virtio-scsi-pci controller in Intel host) +- Resolves: bz#1116728 + (Backport qemu_bh_schedule() race condition fix) +- Resolves: bz#1118707 + (VMstate static checker: backport -dump-vmstate feature to export json-encoded vmstate info) +- Resolves: bz#990724 + (qemu-kvm failing when invalid machine type is provided) +- Resolves: bz#999789 + (qemu should give a more friendly prompt when didn't specify read-only for VMDK format disk) + +* Wed Jul 09 2014 Miroslav Rezanina - 1.5.3-66.el7 +- kvm-xhci-fix-overflow-in-usb_xhci_post_load.patch [bz#1074219] +- kvm-migration-qmp_migrate-keep-working-after-syntax-erro.patch [bz#1086598] +- kvm-seccomp-add-shmctl-mlock-and-munlock-to-the-syscall-.patch [bz#1026314] +- kvm-exit-when-no-kvm-and-vcpu-count-160.patch [bz#1076326] +- kvm-Disallow-outward-migration-while-awaiting-incoming-m.patch [bz#1086987] +- kvm-block-Ignore-duplicate-or-NULL-format_name-in-bdrv_i.patch [bz#1088695 bz#1093983] +- kvm-block-vhdx-account-for-identical-header-sections.patch [bz#1097020] +- kvm-aio-Fix-use-after-free-in-cancellation-path.patch [bz#1095877] +- kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch [bz#1021788] +- kvm-scsi-Improve-error-messages-more.patch [bz#1021788] +- kvm-memory-Don-t-call-memory_region_update_coalesced_ran.patch [bz#1096645] +- kvm-kvmclock-Ensure-time-in-migration-never-goes-backwar.patch [bz#1098602] +- kvm-kvmclock-Ensure-proper-env-tsc-value-for-kvmclock_cu.patch [bz#1098602] +- Resolves: bz#1021788 + (the error message "scsi generic interface too old" is wrong more often than not) +- Resolves: bz#1026314 + (qemu-kvm hang when use '-sandbox on'+'vnc'+'hda') +- Resolves: bz#1074219 + (qemu core dump when install a RHEL.7 guest(xhci) with migration) +- Resolves: bz#1076326 + (qemu-kvm does not quit when booting guest w/ 161 vcpus and "-no-kvm") +- Resolves: bz#1086598 + (migrate_cancel wont take effect on previouly wrong migrate -d cmd) +- Resolves: bz#1086987 + (src qemu crashed when starting migration in inmigrate mode) +- Resolves: bz#1088695 + (there are four "gluster" in qemu-img supported format list) +- Resolves: bz#1093983 + (there are three "nbd" in qemu-img supported format list) +- Resolves: bz#1095877 + (segmentation fault in qemu-kvm due to use-after-free of a SCSIGenericReq (host device pass-through)) +- Resolves: bz#1096645 + ([FJ7.0 Bug] RHEL7.0 guest attaching 150 or more virtio-blk disks fails to start up) +- Resolves: bz#1097020 + ([RFE] qemu-img: Add/improve Disk2VHD tools creating VHDX images) +- Resolves: bz#1098602 + (kvmclock: Ensure time in migration never goes backward (backport)) + +* Wed Jul 02 2014 Miroslav Rezanina - 1.5.3-65.el7 +- kvm-Allow-mismatched-virtio-config-len.patch [bz#1113009] +- Resolves: bz#1113009 + (Migration failed with virtio-blk from RHEL6.5.0 host to RHEL7.0 host) + +* Wed Jun 18 2014 Miroslav Rezanina - 1.5.3-64.el7 +- kvm-zero-initialize-KVM_SET_GSI_ROUTING-input.patch [bz#1098976] +- kvm-skip-system-call-when-msi-route-is-unchanged.patch [bz#1098976] +- Resolves: bz#1098976 (2x RHEL 5.10 VM running on RHEL 7 KVM have low TCP_STREAM throughput) -* Tue Jun 17 2014 Miroslav Rezanina - 1.5.3-60.el7_0.3 -- kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch [bz#1095677] -- kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch [bz#1095684] -- kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch [bz#1095689] -- kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch [bz#1095694] -- kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch [bz#1095737] -- kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch [bz#1095741] -- kvm-virtio-validate-config_len-on-load.patch [bz#1095782] -- kvm-virtio-validate-num_sg-when-mapping.patch [bz#1095765] -- kvm-virtio-allow-mapping-up-to-max-queue-size.patch [bz#1095765] -- kvm-vmstate-add-VMS_MUST_EXIST.patch [bz#1095706] -- kvm-vmstate-add-VMSTATE_VALIDATE.patch [bz#1095706] -- kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch [bz#1095706] -- kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch [bz#1095714] -- kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch [bz#1095746] -- kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch [bz#1095746] -- kvm-usb-fix-up-post-load-checks.patch [bz#1096828] -- kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch [bz#1110191] -- kvm-Provide-init-function-for-ram-migration.patch [bz#1110191] -- kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch [bz#1110191] -- kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch [bz#1110191] -- kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch [bz#1110189] -- kvm-qcow-correctly-propagate-errors.patch [bz#1097229] -- kvm-qcow1-Make-padding-in-the-header-explicit.patch [bz#1097229] -- kvm-qcow1-Check-maximum-cluster-size.patch [bz#1097229] -- kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch [bz#1097229] -- kvm-qcow1-Validate-image-size-CVE-2014-0223.patch [bz#1097236] -- kvm-qcow1-Stricter-backing-file-length-check.patch [bz#1097236] -- kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch [bz#1110219] -- kvm-qcow2-Free-preallocated-zero-clusters.patch [bz#1110188] -- kvm-qemu-iotests-Discard-preallocated-zero-clusters.patch [bz#1110188] -- Resolves: bz#1095677 - (CVE-2013-4148 qemu-kvm: qemu: virtio-net: buffer overflow on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095684 - (CVE-2013-4149 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on load [rhel-7.0.z]) -- Resolves: bz#1095689 - (CVE-2013-4150 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095694 - (CVE-2013-4151 qemu-kvm: qemu: virtio: out-of-bounds buffer write on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095706 - (CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095714 - (CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095737 - (CVE-2013-6399 qemu-kvm: qemu: virtio: buffer overrun on incoming migration [rhel-7.0.z]) -- Resolves: bz#1095741 - (CVE-2013-4542 qemu-kvm: qemu: virtio-scsi: buffer overrun on invalid state load [rhel-7.0.z]) -- Resolves: bz#1095746 - (CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.0.z]) -- Resolves: bz#1095765 - (CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.0.z]) -- Resolves: bz#1095782 - (CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.0.z]) -- Resolves: bz#1096828 - (CVE-2014-3461 qemu-kvm: Qemu: usb: fix up post load checks [rhel-7.0.z]) -- Resolves: bz#1097229 - (CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.0.z]) -- Resolves: bz#1097236 - (CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.0.z]) -- Resolves: bz#1110188 +* Tue Jun 17 2014 Miroslav Rezanina - 1.5.3-63.el7 +- kvm-char-restore-read-callback-on-a-reattached-hotplug-c.patch [bz#1038914] +- kvm-qcow2-Free-preallocated-zero-clusters.patch [bz#1052093] +- kvm-qemu-iotests-Discard-preallocated-zero-clusters.patch [bz#1052093] +- kvm-XBZRLE-Fix-qemu-crash-when-resize-the-xbzrle-cache.patch [bz#1066338] +- kvm-Provide-init-function-for-ram-migration.patch [bz#1066338] +- kvm-Init-the-XBZRLE.lock-in-ram_mig_init.patch [bz#1066338] +- kvm-XBZRLE-Fix-one-XBZRLE-corruption-issues.patch [bz#1066338] +- kvm-Count-used-RAMBlock-pages-for-migration_dirty_pages.patch [bz#1074913] +- kvm-virtio-net-fix-buffer-overflow-on-invalid-state-load.patch [bz#1095678] +- kvm-virtio-net-out-of-bounds-buffer-write-on-invalid-sta.patch [bz#1095690] +- kvm-virtio-net-out-of-bounds-buffer-write-on-load.patch [bz#1095685] +- kvm-virtio-out-of-bounds-buffer-write-on-invalid-state-l.patch [bz#1095695] +- kvm-virtio-avoid-buffer-overrun-on-incoming-migration.patch [bz#1095738] +- kvm-virtio-scsi-fix-buffer-overrun-on-invalid-state-load.patch [bz#1095742] +- kvm-virtio-validate-config_len-on-load.patch [bz#1095783] +- kvm-virtio-validate-num_sg-when-mapping.patch [bz#1095766] +- kvm-virtio-allow-mapping-up-to-max-queue-size.patch [bz#1095766] +- kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch [bz#1095747] +- kvm-usb-sanity-check-setup_index-setup_len-in-post_l2.patch [bz#1095747] +- kvm-vmstate-reduce-code-duplication.patch [bz#1095716] +- kvm-vmstate-add-VMS_MUST_EXIST.patch [bz#1095716] +- kvm-vmstate-add-VMSTATE_VALIDATE.patch [bz#1095716] +- kvm-hpet-fix-buffer-overrun-on-invalid-state-load.patch [bz#1095707] +- kvm-hw-pci-pcie_aer.c-fix-buffer-overruns-on-invalid-sta.patch [bz#1095716] +- kvm-usb-fix-up-post-load-checks.patch [bz#1096829] +- kvm-qcow-correctly-propagate-errors.patch [bz#1097230] +- kvm-qcow1-Make-padding-in-the-header-explicit.patch [bz#1097230] +- kvm-qcow1-Check-maximum-cluster-size.patch [bz#1097230] +- kvm-qcow1-Validate-L2-table-size-CVE-2014-0222.patch [bz#1097230] +- kvm-qcow1-Validate-image-size-CVE-2014-0223.patch [bz#1097237] +- kvm-qcow1-Stricter-backing-file-length-check.patch [bz#1097237] +- Resolves: bz#1038914 + (Guest can't receive any character transmitted from host after hot unplugging virtserialport then hot plugging again) +- Resolves: bz#1052093 (qcow2 corruptions (leaked clusters after installing a rhel7 guest using virtio_scsi)) -- Resolves: bz#1110189 - (migration can not finish with 1024k 'remaining ram' left after hotunplug 4 nics) -- Resolves: bz#1110191 +- Resolves: bz#1066338 (Reduce the migrate cache size during migration causes qemu segment fault) -- Resolves: bz#1110219 - (Guest can't receive any character transmitted from host after hot unplugging virtserialport then hot plugging again) - -* Wed May 07 2014 Miroslav Rezanina - 1.5.3-60.el7_0.2 -- kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch [bz#1094820] -- Resolves: bz#1094820 +- Resolves: bz#1074913 + (migration can not finish with 1024k 'remaining ram' left after hotunplug 4 nics) +- Resolves: bz#1095678 + (CVE-2013-4148 qemu-kvm: qemu: virtio-net: buffer overflow on invalid state load [rhel-7.1]) +- Resolves: bz#1095685 + (CVE-2013-4149 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on load [rhel-7.1]) +- Resolves: bz#1095690 + (CVE-2013-4150 qemu-kvm: qemu: virtio-net: out-of-bounds buffer write on invalid state load [rhel-7.1]) +- Resolves: bz#1095695 + (CVE-2013-4151 qemu-kvm: qemu: virtio: out-of-bounds buffer write on invalid state load [rhel-7.1]) +- Resolves: bz#1095707 + (CVE-2013-4527 qemu-kvm: qemu: hpet: buffer overrun on invalid state load [rhel-7.1]) +- Resolves: bz#1095716 + (CVE-2013-4529 qemu-kvm: qemu: hw/pci/pcie_aer.c: buffer overrun on invalid state load [rhel-7.1]) +- Resolves: bz#1095738 + (CVE-2013-6399 qemu-kvm: qemu: virtio: buffer overrun on incoming migration [rhel-7.1]) +- Resolves: bz#1095742 + (CVE-2013-4542 qemu-kvm: qemu: virtio-scsi: buffer overrun on invalid state load [rhel-7.1]) +- Resolves: bz#1095747 + (CVE-2013-4541 qemu-kvm: qemu: usb: insufficient sanity checking of setup_index+setup_len in post_load [rhel-7.1]) +- Resolves: bz#1095766 + (CVE-2013-4535 CVE-2013-4536 qemu-kvm: qemu: virtio: insufficient validation of num_sg when mapping [rhel-7.1]) +- Resolves: bz#1095783 + (CVE-2014-0182 qemu-kvm: qemu: virtio: out-of-bounds buffer write on state load with invalid config_len [rhel-7.1]) +- Resolves: bz#1096829 + (CVE-2014-3461 qemu-kvm: Qemu: usb: fix up post load checks [rhel-7.1]) +- Resolves: bz#1097230 + (CVE-2014-0222 qemu-kvm: Qemu: qcow1: validate L2 table size to avoid integer overflows [rhel-7.1]) +- Resolves: bz#1097237 + (CVE-2014-0223 qemu-kvm: Qemu: qcow1: validate image size to avoid out-of-bounds memory access [rhel-7.1]) + +* Wed May 07 2014 Miroslav Rezanina - 1.5.3-62.el7 +- kvm-pc-add-hot_add_cpu-callback-to-all-machine-types.patch [bz#1094285] +- Resolves: bz#1094285 (Hot plug CPU not working with RHEL6 machine types running on RHEL7 host.) -* Fri May 02 2014 Miroslav Rezanina - 1.5.3-60.el7_0.1 -- kvm-iscsi-fix-indentation.patch [bz#1090978] -- kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch [bz#1090978] -- kvm-block-iscsi-query-for-supported-VPD-pages.patch [bz#1090978] -- kvm-block-iscsi-fix-segfault-if-writesame-fails.patch [bz#1090978] -- kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch [bz#1090978] -- kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch [bz#1090978] -- kvm-iscsi-always-query-max-WRITE-SAME-length.patch [bz#1090978] -- kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch [bz#1090978] -- kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch [bz#1090978] -- kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch [1091322] -- kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch [bz#1090981] -- kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch [bz#1093612] -- Resolves: bz#1091322 +* Fri May 02 2014 Miroslav Rezanina - 1.5.3-61.el7 +- kvm-iscsi-fix-indentation.patch [bz#1083413] +- kvm-iscsi-correctly-propagate-errors-in-iscsi_open.patch [bz#1083413] +- kvm-block-iscsi-query-for-supported-VPD-pages.patch [bz#1083413] +- kvm-block-iscsi-fix-segfault-if-writesame-fails.patch [bz#1083413] +- kvm-iscsi-recognize-invalid-field-ASCQ-from-WRITE-SAME-c.patch [bz#1083413] +- kvm-iscsi-ignore-flushes-on-scsi-generic-devices.patch [bz#1083413] +- kvm-iscsi-always-query-max-WRITE-SAME-length.patch [bz#1083413] +- kvm-iscsi-Don-t-set-error-if-already-set-in-iscsi_do_inq.patch [bz#1083413] +- kvm-iscsi-Remember-to-set-ret-for-iscsi_open-in-error-ca.patch [bz#1083413] +- kvm-qemu_loadvm_state-shadow-SeaBIOS-for-VM-incoming-fro.patch [bz#1027565] +- kvm-uhci-UNfix-irq-routing-for-RHEL-6-machtypes-RHEL-onl.patch [bz#1085701] +- kvm-ide-Correct-improper-smart-self-test-counter-reset-i.patch [bz#1087980] +- Resolves: bz#1027565 (fail to reboot guest after migration from RHEL6.5 host to RHEL7.0 host) -- Resolves: bz#1090981 - (Guest hits call trace migrate from RHEL6.5 to RHEL7.0 host with -M 6.1 & balloon & uhci device) -- Resolves: bz#1090978 +- Resolves: bz#1083413 (qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)) -- Resolves: bz#1093612 - (CVE-2014-2894 qemu-kvm: QEMU: out of bounds buffer accesses, guest triggerable via IDE SMART [rhel-7.0.z]) +- Resolves: bz#1085701 + (Guest hits call trace migrate from RHEL6.5 to RHEL7.0 host with -M 6.1 & balloon & uhci device) +- Resolves: bz#1087980 + (CVE-2014-2894 qemu-kvm: QEMU: out of bounds buffer accesses, guest triggerable via IDE SMART [rhel-7.1]) * Wed Apr 02 2014 Miroslav Rezanina - 1.5.3-60.el7 - kvm-qcow2-fix-dangling-refcount-table-entry.patch [bz#1081793]