[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#680693: unblock: qemu-kvm/1.1.0+dfsg-1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package qemu-kvm.  Please note that the package has
already been uploaded to unstable, because I incorrectly assumed it
is the way to go during the freeze time.  Please excuse me for that,
it was made due to my lack of understanding of the process.

As I wrote in email on Jul-14 <4FD9FC84.3050906@msgid.tls.msk.ru>,
https://lists.debian.org/debian-release/2012/06/msg00370.html ,
upstream delayed the final release of next stable qemu-kvm version
due to a few last-minute regressions found there.  The actual
release happened 2 Jul, ie, after the wheezy freeze.

I managed to upload a prerelease of the package before freeze,
numbered 1.1~z0+dfsg-1 -- in last 40 minutes before freeze,
when I returned from my vacation.  However, this was based on
a prerelease (which happened to become a release 2 days later),
and it had a few glitches which are now sorted.

The new uploaded package is based on the actual 1.1.0 upstream
tarball, which is different from the "fake upstream" tarball
I had previously only in one file, KVM_VERSION, -- previous
version had an -rc4 in it, new version has proper 1.1.0.  So
the current orig.tar didn't really changed.

This Debian release of the package includes fixes of a number
of bugs too.  These are:


#679788 - http://bugs.debian.org/679788 (serious)
kvm-1.0 segfaults with -M pc-1.0 (and older) and vhost-net
(and a few others merged with it)

Another rather trivial regression found - trivial to fix
but affecting many users already, I've got 3 separate bugreports
for it.  Fixed by 2 patches applied to upstream master and
stable branches:

  qemu-kvm-Add-missing-default-machine-options.patch
  qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch

This is the most important change in this release.


#680609 - http://bugs.debian.org/680609
wrong cpus-x86_64.conf file location

This is a mistake on my part.  When packaging 1.1 version,
I placed upstream file with various x86 CPU definitions
to a wrong directory -- to /etc/kvm/ instead of /usr/share/kvm/.
The resulting conffile (in dpkg terms) has never been used
by this package, and is very unlikely to exists (or be modified)
on any system.  This release of the package puts this file into
proper location, and removes the leftover from /etc/kvm/ if
it is there and if we're upgrading from qemu-kvm older than
1.1.0~.  There were just 2 releases (one in experimental and
one in unstable) which shipped that file.


#677528 - http://bugs.debian.org/677528
qemu-kvm: "KVM internal error" for some values of -m

kvm guest segfaults during boot (in bios) when specified amount
of guest memory (-m xxx) is not a multiple of page size.  The
fix - till upstream will find a more generic way (ie, working
for all the different platforms and architectures qemu emulates -
this does not affect qemu-kvm since it is x86-only) - is to
truncate the amount of guest memory to a multiple of 8192
(as per upstream suggestion), and print a warning if such a
truncation actually happened.  This is in the patch

  align-ram_size-to-8k-boundary.patch

the check is performed while parsing the command line, so it
does not affect anything else.


#680551 - http://bugs.debian.org/680551 (important)
Hotplugging CPU causes kvm/qemu process (and guest) to crash

kvm process segfaults when attempting to hotplug a virtual
CPU. The CPU hotplug has never really worked in qemu-kvm.
The patch (taken from Ubuntu) merely disables the feature
when it is used, printing a warning saying just that,
instead of segfaulting.


Also I mentioned closure of more bugs in the changelog --
bugs which were closed by 1.1 version.


Each change has been extensively tested to not cause
regressions, on a set of various guest images.  Each
code patch presented here is either a clear bugfix,
or a non-working feature removal (cpu hotplug), or
an enforcer of something which is assumed but not
enforced (the memsize change).

Please consider unblocking.  And please excuse me for
doing it wrong - uploading before asking - it happened
solely because I didn't understand the procedure, and
now I do.

The debdiff is below.

unblock qemu-kvm/1.1.0+dfsg-1

Thank you!

/mjt

---- debdiff ----
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/changelog qemu-kvm-1.1.0+dfsg/debian/changelog
--- qemu-kvm-1.1~z0+dfsg/debian/changelog	2012-06-30 23:21:49.000000000 +0400
+++ qemu-kvm-1.1.0+dfsg/debian/changelog	2012-07-07 16:15:07.000000000 +0400
@@ -1,3 +1,22 @@
+qemu-kvm (1.1.0+dfsg-1) unstable; urgency=low
+
+  * 1.1.0 upstream release, finally.  No changes from the previous source.
+  * added two patches from upstream qemu-kvm/stable-1.1 branch:
+     qemu-kvm-Add-missing-default-machine-options.patch
+     qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
+   (Closes: #679788)
+  * mention closing of #640139, #672112 by 1.1
+  * store cpus-x86_64.conf in /usr/share/kvm not /etc/kvm (Closes: #680609)
+  * align-ram_size-to-8k-boundary.patch - force guest memory size to be a
+    multiple of 8KiB, to stop SIGSEGV when guest tries to access last partial
+    memory page.  (Closes: #677528)
+  * dont-try-to-hotplug-cpu.patch (from Ubuntu package).  CPU hot-plug
+    never really worked in qemu-kvm correctly.  This temporary patch
+    disables this feature, returning an error instead of crashing.
+    (Closes: #680551)
+
+ -- Michael Tokarev <mjt@tls.msk.ru>  Tue, 03 Jul 2012 18:01:33 +0400
+
 qemu-kvm (1.1~z0+dfsg-1) unstable; urgency=low
 
   * merge a few more stable-1.1 upstream commits
@@ -7,7 +26,7 @@
 
 qemu-kvm (1.1~rc+dfsg-1) experimental; urgency=low
 
-  * new upstream prerelease: 1.1  (Closes: #652329, #672287)
+  * new upstream prerelease: 1.1  (Closes: #652329, #672287, #640139, #672112)
     (This is not official release yet, it is based on 1.1-rc4 plus a few fixes
      from upstream stable-1.1 git branch.  The release isn't out due to some
      last-minute regression issue, once the regression will be dealt with
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/patches/align-ram_size-to-8k-boundary.patch qemu-kvm-1.1.0+dfsg/debian/patches/align-ram_size-to-8k-boundary.patch
--- qemu-kvm-1.1~z0+dfsg/debian/patches/align-ram_size-to-8k-boundary.patch	1970-01-01 03:00:00.000000000 +0300
+++ qemu-kvm-1.1.0+dfsg/debian/patches/align-ram_size-to-8k-boundary.patch	2012-07-07 15:45:53.000000000 +0400
@@ -0,0 +1,80 @@
+Date: Fri, 06 Jul 2012 22:50:11 +0400
+From: Michael Tokarev <mjt@tls.msk.ru>
+Subject: align ram_size to 8k boundary
+Forwarded: yes
+Bugs: http://bugs.debian.org/677528
+References:
+ <4FF73363.1080409@msgid.tls.msk.ru>
+ <4FDDD818.4030700@redhat.com>
+ <1339922831-23002-1-git-send-email-avi@redhat.com>
+ <4FDDB981.8070309@web.de>
+ <4FDDBFCD.3000608@redhat.com>
+ <4FDDC3C8.5020205@web.de>
+ <4FDDC4B6.5030202@redhat.com>
+ <CAAu8pHtgapr1NwX7YZvZpKDUQ0C6xBHYJjGMwW3rK8LcpXDEpg@mail.gmail.com>
+ <4FDDD39D.9090800@redhat.com>
+ <CAAu8pHsNk8P0r9PO+DyO_8Ov7uJdFnxdwWx0nSsM3oCgGGoRrQ@mail.gmail.com>
+ <4FDDD818.4030700@redhat.com>
+
+This is a temp workaround, until upstream will decide on
+the right solution.  The problem is that currently, qemu
+allows to specify any guest memory size, including some
+odd values like 54321 bytes.  But such odd values results
+in SIGSEGV when components (bios, guest, etc) tries to
+access memory by pages, and hits last partial page.  The
+memory size must be page-aligned.  The 8k appears to be
+a more or less sane alignment.
+
+On 17.06.2012 17:14, Avi Kivity wrote:
+> On 06/17/2012 04:06 PM, Blue Swirl wrote:
+> 
+>>> strtosz() is much too general.  We could do it in vl.c without trouble.
+>>>  However, it takes away our ability to emulate a "640k should be enough
+>>> for everyone" machine.
+>>
+>> Then how about current max of target page sizes: 8k? No machine should
+>> want less than that.
+> 
+> Okay by me, but I can hear the we-should-have-a-generic-mechanism crowd
+> charging their megaphone batteries.
+
+So, is there some bottom line in that?  I think I'll put a (temp)
+fix/workaround for the debian package to require memory size to be
+a multiple of 8K, and to produce a warning if that requiriment hasn't
+met.
+
+Something like this:
+
+diff --git a/vl.c b/vl.c
+index 5d9fc55..db98a4a 100644
+--- a/vl.c
++++ b/vl.c
+@@ -2671,7 +2675,15 @@ int main(int argc, char **argv, char **envp)
+                     fprintf(stderr, "qemu: ram size too large\n");
+                     exit(1);
+                 }
+-                ram_size = value;
++#define RAM_SIZE_GRANULARITY (8*1024)
++                ram_size = value / RAM_SIZE_GRANULARITY;
++                ram_size *= RAM_SIZE_GRANULARITY;
++                if (ram_size != value) {
++                    fprintf(stderr,
++                            "warning: requested memory size (%" PRIu64 " bytes) "
++                            "truncated to %" PRIu64 " bytes\n",
++                            value, (uint64_t)ram_size);
++                }
+                 break;
+             }
+             case QEMU_OPTION_mempath:
+
+
+With this patch, running
+  qemu-system-x86_64 -m 1.4g
+produces the following:
+
+warning: requested memory size (1503238553 bytes) truncated to 1503232000 bytes
+
+
+Thanks,
+
+/mjt
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/patches/dont-try-to-hotplug-cpu.patch qemu-kvm-1.1.0+dfsg/debian/patches/dont-try-to-hotplug-cpu.patch
--- qemu-kvm-1.1~z0+dfsg/debian/patches/dont-try-to-hotplug-cpu.patch	1970-01-01 03:00:00.000000000 +0300
+++ qemu-kvm-1.1.0+dfsg/debian/patches/dont-try-to-hotplug-cpu.patch	2012-07-07 15:50:50.000000000 +0400
@@ -0,0 +1,35 @@
+Description: don't try to hotplug a cpu
+ qemu-kvm will end up crashing when qdev finds hotplug is not enabled.  Let's
+ instead gracefully refuse.
+Author: Serge Hallyn <serge.hallyn@ubuntu.com>
+Forwarded: yes
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/878422
+
+Index: qemu-kvm-1.1~rc+dfsg/hw/acpi_piix4.c
+===================================================================
+--- qemu-kvm-1.1~rc+dfsg.orig/hw/acpi_piix4.c	2012-06-01 01:19:22.000000000 +0000
++++ qemu-kvm-1.1~rc+dfsg/hw/acpi_piix4.c	2012-06-12 19:39:06.980254166 +0000
+@@ -613,16 +613,23 @@
+ 
+ void qemu_system_cpu_hot_add(int cpu, int state)
+ {
++#if 0
+     CPUArchState *env;
++#endif
+     PIIX4PMState *s = global_piix4_pm_state;
+ 
+     if (state && !qemu_get_cpu(cpu)) {
++#if 1
++        fprintf(stderr, "cpu hotplug not supported\n");
++        return;
++#else
+         env = pc_new_cpu(global_cpu_model);
+         if (!env) {
+             fprintf(stderr, "cpu %d creation failed\n", cpu);
+             return;
+         }
+         env->cpuid_apic_id = cpu;
++#endif
+     }
+ 
+     if (state)
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/patches/qemu-kvm-Add-missing-default-machine-options.patch qemu-kvm-1.1.0+dfsg/debian/patches/qemu-kvm-Add-missing-default-machine-options.patch
--- qemu-kvm-1.1~z0+dfsg/debian/patches/qemu-kvm-Add-missing-default-machine-options.patch	1970-01-01 03:00:00.000000000 +0300
+++ qemu-kvm-1.1.0+dfsg/debian/patches/qemu-kvm-Add-missing-default-machine-options.patch	2012-07-03 18:04:55.000000000 +0400
@@ -0,0 +1,36 @@
+From 398b87f4ef3426569bdda2da2c9c2b89f4ba906f Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka@siemens.com>
+Date: Mon, 2 Jul 2012 09:34:46 +0200
+Subject: [PATCH 1/2] qemu-kvm: Add missing default machine options
+
+qemu-kvm-specific machine defaults were missing for pc-0.15 and pc-1.0.
+
+Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
+Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
+---
+ hw/pc_piix.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/hw/pc_piix.c b/hw/pc_piix.c
+index c3fb74e..4e8a280 100644
+--- a/hw/pc_piix.c
++++ b/hw/pc_piix.c
+@@ -393,6 +393,7 @@ static QEMUMachine pc_machine_v1_0 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
++    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_1_0,
+         { /* end of list */ }
+@@ -407,6 +408,7 @@ static QEMUMachine pc_machine_v0_15 = {
+     .desc = "Standard PC",
+     .init = pc_init_pci,
+     .max_cpus = 255,
++    .default_machine_opts = "accel=kvm,kernel_irqchip=on",
+     .compat_props = (GlobalProperty[]) {
+         PC_COMPAT_0_15,
+         { /* end of list */ }
+-- 
+1.7.10
+
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/patches/qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch qemu-kvm-1.1.0+dfsg/debian/patches/qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
--- qemu-kvm-1.1~z0+dfsg/debian/patches/qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch	1970-01-01 03:00:00.000000000 +0300
+++ qemu-kvm-1.1.0+dfsg/debian/patches/qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch	2012-07-03 18:04:55.000000000 +0400
@@ -0,0 +1,41 @@
+From 6f82a5ea52302bab33287b0191538be6f9138637 Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka@siemens.com>
+Date: Mon, 2 Jul 2012 10:05:39 +0200
+Subject: [PATCH 2/2] qemu-kvm: virtio: Do not register mask notifiers without
+ in-kernel irqchip support
+
+We crash if we registers mask notifiers without backing in-kernel
+irqchip. This corresponds to the check in QEMU upstream after 1.1 now.
+
+Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
+Acked-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
+---
+ hw/virtio-pci.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
+index a0c2ca7..5b64356 100644
+--- a/hw/virtio-pci.c
++++ b/hw/virtio-pci.c
+@@ -629,7 +629,7 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
+ 
+     /* Must unset mask notifier while guest notifier
+      * is still assigned */
+-    if (!assign) {
++    if (kvm_irqchip_in_kernel() && !assign) {
+ 	    r = msix_unset_mask_notifier(&proxy->pci_dev);
+             assert(r >= 0);
+     }
+@@ -647,7 +647,7 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
+ 
+     /* Must set mask notifier after guest notifier
+      * has been assigned */
+-    if (assign) {
++    if (kvm_irqchip_in_kernel() && assign) {
+         r = msix_set_mask_notifier(&proxy->pci_dev,
+                                    virtio_pci_mask_notifier);
+         if (r < 0) {
+-- 
+1.7.10
+
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/patches/series qemu-kvm-1.1.0+dfsg/debian/patches/series
--- qemu-kvm-1.1~z0+dfsg/debian/patches/series	2012-06-30 22:48:54.000000000 +0400
+++ qemu-kvm-1.1.0+dfsg/debian/patches/series	2012-07-07 16:11:28.000000000 +0400
@@ -3,3 +3,7 @@
 resurrect-extboot.diff
 disable-hpet-for-tcg.patch
 use-libexecdir.patch
+qemu-kvm-Add-missing-default-machine-options.patch
+qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
+align-ram_size-to-8k-boundary.patch
+dont-try-to-hotplug-cpu.patch
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/qemu-kvm.postinst qemu-kvm-1.1.0+dfsg/debian/qemu-kvm.postinst
--- qemu-kvm-1.1~z0+dfsg/debian/qemu-kvm.postinst	2012-06-12 12:29:53.000000000 +0400
+++ qemu-kvm-1.1.0+dfsg/debian/qemu-kvm.postinst	2012-07-07 15:31:28.000000000 +0400
@@ -56,6 +56,20 @@
 	    update-rc.d -f qemu-kvm remove >/dev/null
 	fi
 
+	# 1.1~* shipped /etc/kvm/cpus-x86_64.conf which is never used there,
+	# it is expected to be in /usr/share/kvm/ instead.  Just remove it.
+	# We can't do that only when upgrading from 1.1~, since it is
+	# possible to install 1.1~, which will create that file, downgrade
+	# to previous version (this file will be kept), and upgrade to
+	# current version: in this case, the version we're upgrading from
+	# ($2) will be less than 1.1, but the file will be there anyway.
+	file=/etc/kvm/cpus-x86_64.conf
+	if dpkg --compare-versions "$2" lt 1.1.0~ && [ -f $file ]
+	then
+		echo "Removing wrongly placed (and never used) $file"
+		rm $file
+	fi
+
     ;;
 
     abort-upgrade)
diff -Nru qemu-kvm-1.1~z0+dfsg/debian/rules qemu-kvm-1.1.0+dfsg/debian/rules
--- qemu-kvm-1.1~z0+dfsg/debian/rules	2012-06-30 22:48:54.000000000 +0400
+++ qemu-kvm-1.1.0+dfsg/debian/rules	2012-07-07 15:04:04.000000000 +0400
@@ -152,10 +152,8 @@
 	 $(ipxe)/virtio-net.rom $(bdir)/pxe-virtio.rom \
 
 # x86 cpu definitions
-	install -Dp -m 0644 \
-	  sysconfigs/target/target-x86_64.conf \
-	  sysconfigs/target/cpus-x86_64.conf \
-	  ${tdir}/etc/kvm/
+	install -Dpm 0644 sysconfigs/target/target-x86_64.conf ${tdir}/etc/kvm/
+	install -Dpm 0644 sysconfigs/target/cpus-x86_64.conf ${tbdir}/
 endif
 
 ifeq (powerpc,$(BASE_ARCH))
diff -Nru qemu-kvm-1.1~z0+dfsg/KVM_VERSION qemu-kvm-1.1.0+dfsg/KVM_VERSION
--- qemu-kvm-1.1~z0+dfsg/KVM_VERSION	2012-06-01 05:19:22.000000000 +0400
+++ qemu-kvm-1.1.0+dfsg/KVM_VERSION	2012-06-30 06:14:15.000000000 +0400
@@ -1 +1 @@
-qemu-kvm-1.1-rc4
+qemu-kvm-1.1.0



Reply to: