From 502ffeebf7165ab4d383f4ee0a57c321988e0c0f Mon Sep 17 00:00:00 2001 From: Justin M. Forbes Date: Oct 19 2010 04:05:18 +0000 Subject: - Update to 0.13.0 release final - Fixes for vhost - Fix mouse in certain guests (#636887) - Fix issues with WinXP guest install (#579348) - Resolve build issues with S390 (#639471) - Fix Windows XP on Raw Devices (#631591) --- diff --git a/.gitignore b/.gitignore index 07e3a9e..617e247 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ qemu-kvm-0.13.0-b81fe95.tar.gz qemu-kvm-0.13.0-25fdf4a.tar.gz /qemu-kvm-0.13.0-rc1.tar.gz +/qemu-kvm-0.13.0.tar.gz diff --git a/0041-vmmouse-adapt-to-mouse-handler-changes.patch b/0041-vmmouse-adapt-to-mouse-handler-changes.patch new file mode 100644 index 0000000..8914831 --- /dev/null +++ b/0041-vmmouse-adapt-to-mouse-handler-changes.patch @@ -0,0 +1,116 @@ +From ff53b62094b009f34dd3312e32a637ca73c752e3 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Fri, 8 Oct 2010 00:30:13 +0000 +Subject: [PATCH 41/42] vmmouse: adapt to mouse handler changes. + +This patch updates the vmmouse handler registration and activation. + +Old behavior: + vmmouse_read_id, vmmouse_request_relative and vmmouse_request_absolute + unregister the handler and re-register it. + +New behavior: + vmmouse_request_relative and vmmouse_request_absolute will unregister + the handler in case the mode did change. Then register and active the + handler with current mode if needed. + +Note that the old code never ever *activates* the handler, so the +vmmouse doesn't receive events. This trips up Fedora 14 for example: +Boot a default install without usb tablet, watch the X-Server activating +the vmmouse then, enjoy a non-functional mouse. + +Signed-off-by: Gerd Hoffmann +--- + hw/vmmouse.c | 31 +++++++++++++++++++++---------- + 1 files changed, 21 insertions(+), 10 deletions(-) + +diff --git a/hw/vmmouse.c b/hw/vmmouse.c +index f359304..2097119 100644 +--- a/hw/vmmouse.c ++++ b/hw/vmmouse.c +@@ -100,16 +100,29 @@ static void vmmouse_mouse_event(void *opaque, int x, int y, int dz, int buttons_ + i8042_isa_mouse_fake_event(s->ps2_mouse); + } + +-static void vmmouse_update_handler(VMMouseState *s) ++static void vmmouse_remove_handler(VMMouseState *s) + { + if (s->entry) { + qemu_remove_mouse_event_handler(s->entry); + s->entry = NULL; + } +- if (s->status == 0) ++} ++ ++static void vmmouse_update_handler(VMMouseState *s, int absolute) ++{ ++ if (s->status != 0) { ++ return; ++ } ++ if (s->absolute != absolute) { ++ s->absolute = absolute; ++ vmmouse_remove_handler(s); ++ } ++ if (s->entry == NULL) { + s->entry = qemu_add_mouse_event_handler(vmmouse_mouse_event, + s, s->absolute, + "vmmouse"); ++ qemu_activate_mouse_event_handler(s->entry); ++ } + } + + static void vmmouse_read_id(VMMouseState *s) +@@ -121,28 +134,25 @@ static void vmmouse_read_id(VMMouseState *s) + + s->queue[s->nb_queue++] = VMMOUSE_VERSION; + s->status = 0; +- vmmouse_update_handler(s); + } + + static void vmmouse_request_relative(VMMouseState *s) + { + DPRINTF("vmmouse_request_relative()\n"); +- s->absolute = 0; +- vmmouse_update_handler(s); ++ vmmouse_update_handler(s, 0); + } + + static void vmmouse_request_absolute(VMMouseState *s) + { + DPRINTF("vmmouse_request_absolute()\n"); +- s->absolute = 1; +- vmmouse_update_handler(s); ++ vmmouse_update_handler(s, 1); + } + + static void vmmouse_disable(VMMouseState *s) + { + DPRINTF("vmmouse_disable()\n"); + s->status = 0xffff; +- vmmouse_update_handler(s); ++ vmmouse_remove_handler(s); + } + + static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size) +@@ -154,7 +164,7 @@ static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size) + if (size == 0 || size > 6 || size > s->nb_queue) { + printf("vmmouse: driver requested too much data %d\n", size); + s->status = 0xffff; +- vmmouse_update_handler(s); ++ vmmouse_remove_handler(s); + return; + } + +@@ -239,7 +249,8 @@ static int vmmouse_post_load(void *opaque, int version_id) + { + VMMouseState *s = opaque; + +- vmmouse_update_handler(s); ++ vmmouse_remove_handler(s); ++ vmmouse_update_handler(s, s->absolute); + return 0; + } + +-- +1.7.2.3 + diff --git a/0042-vhost-net-patches-for-qemu-0.13.0-tarball.patch b/0042-vhost-net-patches-for-qemu-0.13.0-tarball.patch new file mode 100644 index 0000000..d8478d7 --- /dev/null +++ b/0042-vhost-net-patches-for-qemu-0.13.0-tarball.patch @@ -0,0 +1,316 @@ +From 2ed38f61f1054e188838bae9244fc1c327f8cda4 Mon Sep 17 00:00:00 2001 +From: Marcelo Tosatti +Date: Mon, 18 Oct 2010 16:17:00 -0200 +Subject: [PATCH 42/42] vhost-net patches for qemu-0.13.0 tarball + +Justin, + +Attached are the patches to fix vhost-net on the 0.13.0 tarball. +Untested. + +commit f76cfc6f0882f227101f21d5a5b80804710b88cb +Author: Michael S. Tsirkin +Date: Wed Oct 6 07:22:00 2010 +0200 + + vhost: fix up irqfd support + + vhost irqfd support: case where many vqs are + mapped to a single msix vector is currently broken. + Fix it up. + + Includes this patch from qemu.git: + + virtio: change set guest notifier to per-device + + When using irqfd with vhost-net to inject interrupts, + a single evenfd might inject multiple interrupts. + Implementing this is much easier with a single + per-device callback to set guest notifiers. + + Signed-off-by: Michael S. Tsirkin +--- + hw/msix.c | 82 +++++++++++++++++++++++++++++++----------------------- + hw/msix.h | 4 +- + hw/pci.h | 3 +- + hw/virtio-pci.c | 56 +++++++++++++++++++++++++++++++------ + 4 files changed, 97 insertions(+), 48 deletions(-) + +diff --git a/hw/msix.c b/hw/msix.c +index 3dd0456..c0c6b50 100644 +--- a/hw/msix.c ++++ b/hw/msix.c +@@ -300,10 +300,8 @@ static void msix_mmio_writel(void *opaque, target_phys_addr_t addr, + if (kvm_enabled() && kvm_irqchip_in_kernel()) { + kvm_msix_update(dev, vector, was_masked, msix_is_masked(dev, vector)); + } +- if (was_masked != msix_is_masked(dev, vector) && +- dev->msix_mask_notifier && dev->msix_mask_notifier_opaque[vector]) { ++ if (was_masked != msix_is_masked(dev, vector) && dev->msix_mask_notifier) { + int r = dev->msix_mask_notifier(dev, vector, +- dev->msix_mask_notifier_opaque[vector], + msix_is_masked(dev, vector)); + assert(r >= 0); + } +@@ -351,9 +349,8 @@ static void msix_mask_all(struct PCIDevice *dev, unsigned nentries) + int was_masked = msix_is_masked(dev, vector); + dev->msix_table_page[offset] |= MSIX_VECTOR_MASK; + if (was_masked != msix_is_masked(dev, vector) && +- dev->msix_mask_notifier && dev->msix_mask_notifier_opaque[vector]) { ++ dev->msix_mask_notifier) { + r = dev->msix_mask_notifier(dev, vector, +- dev->msix_mask_notifier_opaque[vector], + msix_is_masked(dev, vector)); + assert(r >= 0); + } +@@ -379,8 +376,6 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries, + sizeof *dev->msix_irq_entries); + } + #endif +- dev->msix_mask_notifier_opaque = +- qemu_mallocz(nentries * sizeof *dev->msix_mask_notifier_opaque); + dev->msix_mask_notifier = NULL; + dev->msix_entry_used = qemu_mallocz(MSIX_MAX_ENTRIES * + sizeof *dev->msix_entry_used); +@@ -444,8 +439,6 @@ int msix_uninit(PCIDevice *dev) + dev->msix_entry_used = NULL; + qemu_free(dev->msix_irq_entries); + dev->msix_irq_entries = NULL; +- qemu_free(dev->msix_mask_notifier_opaque); +- dev->msix_mask_notifier_opaque = NULL; + dev->cap_present &= ~QEMU_PCI_CAP_MSIX; + return 0; + } +@@ -590,46 +583,65 @@ void msix_unuse_all_vectors(PCIDevice *dev) + msix_free_irq_entries(dev); + } + +-int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque) ++/* Invoke the notifier if vector entry is used and unmasked. */ ++static int msix_notify_if_unmasked(PCIDevice *dev, unsigned vector, int masked) + { +- int r = 0; +- if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector]) ++ assert(dev->msix_mask_notifier); ++ if (!dev->msix_entry_used[vector] || msix_is_masked(dev, vector)) { + return 0; ++ } ++ return dev->msix_mask_notifier(dev, vector, masked); ++} + +- assert(dev->msix_mask_notifier); +- assert(opaque); +- assert(!dev->msix_mask_notifier_opaque[vector]); ++static int msix_set_mask_notifier_for_vector(PCIDevice *dev, unsigned vector) ++{ ++ /* Notifier has been set. Invoke it on unmasked vectors. */ ++ return msix_notify_if_unmasked(dev, vector, 0); ++} ++ ++static int msix_unset_mask_notifier_for_vector(PCIDevice *dev, unsigned vector) ++{ ++ /* Notifier will be unset. Invoke it to mask unmasked entries. */ ++ return msix_notify_if_unmasked(dev, vector, 1); ++} + +- /* Unmask the new notifier unless vector is masked. */ +- if (!msix_is_masked(dev, vector)) { +- r = dev->msix_mask_notifier(dev, vector, opaque, false); ++int msix_set_mask_notifier(PCIDevice *dev, msix_mask_notifier_func f) ++{ ++ int r, n; ++ assert(!dev->msix_mask_notifier); ++ dev->msix_mask_notifier = f; ++ for (n = 0; n < dev->msix_entries_nr; ++n) { ++ r = msix_set_mask_notifier_for_vector(dev, n); + if (r < 0) { +- return r; ++ goto undo; + } + } +- dev->msix_mask_notifier_opaque[vector] = opaque; ++ return 0; ++ ++undo: ++ while (--n >= 0) { ++ msix_unset_mask_notifier_for_vector(dev, n); ++ } ++ dev->msix_mask_notifier = NULL; + return r; + } + +-int msix_unset_mask_notifier(PCIDevice *dev, unsigned vector) ++int msix_unset_mask_notifier(PCIDevice *dev) + { +- int r = 0; +- void *opaque; +- if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector]) +- return 0; +- +- opaque = dev->msix_mask_notifier_opaque[vector]; +- ++ int r, n; + assert(dev->msix_mask_notifier); +- assert(opaque); +- +- /* Mask the old notifier unless it is already masked. */ +- if (!msix_is_masked(dev, vector)) { +- r = dev->msix_mask_notifier(dev, vector, opaque, true); ++ for (n = 0; n < dev->msix_entries_nr; ++n) { ++ r = msix_unset_mask_notifier_for_vector(dev, n); + if (r < 0) { +- return r; ++ goto undo; + } + } +- dev->msix_mask_notifier_opaque[vector] = NULL; ++ dev->msix_mask_notifier = NULL; ++ return 0; ++ ++undo: ++ while (--n >= 0) { ++ msix_set_mask_notifier_for_vector(dev, n); ++ } + return r; + } +diff --git a/hw/msix.h b/hw/msix.h +index 6b21ffb..5a81df5 100644 +--- a/hw/msix.h ++++ b/hw/msix.h +@@ -33,6 +33,6 @@ void msix_reset(PCIDevice *dev); + + extern int msix_supported; + +-int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque); +-int msix_unset_mask_notifier(PCIDevice *dev, unsigned vector); ++int msix_set_mask_notifier(PCIDevice *dev, msix_mask_notifier_func); ++int msix_unset_mask_notifier(PCIDevice *dev); + #endif +diff --git a/hw/pci.h b/hw/pci.h +index ccb99d0..a40dc14 100644 +--- a/hw/pci.h ++++ b/hw/pci.h +@@ -131,7 +131,7 @@ enum { + #define PCI_CAPABILITY_CONFIG_MSIX_LENGTH 0x10 + + typedef int (*msix_mask_notifier_func)(PCIDevice *, unsigned vector, +- void *opaque, int masked); ++ int masked); + + struct PCIDevice { + DeviceState qdev; +@@ -198,7 +198,6 @@ struct PCIDevice { + + struct kvm_irq_routing_entry *msix_irq_entries; + +- void **msix_mask_notifier_opaque; + msix_mask_notifier_func msix_mask_notifier; + + /* Device capability configuration space */ +diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c +index 83b7871..72bc80e 100644 +--- a/hw/virtio-pci.c ++++ b/hw/virtio-pci.c +@@ -427,11 +427,10 @@ static void virtio_pci_guest_notifier_read(void *opaque) + } + } + +-static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector, +- void *opaque, int masked) ++static int virtio_pci_mask_vq(PCIDevice *dev, unsigned vector, ++ VirtQueue *vq, int masked) + { + #ifdef CONFIG_KVM +- VirtQueue *vq = opaque; + EventNotifier *notifier = virtio_queue_get_guest_notifier(vq); + int r = kvm_set_irqfd(dev->msix_irq_entries[vector].gsi, + event_notifier_get_fd(notifier), +@@ -452,6 +451,34 @@ static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector, + #endif + } + ++static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector, ++ int masked) ++{ ++ VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); ++ VirtIODevice *vdev = proxy->vdev; ++ int r, n; ++ ++ for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { ++ if (!virtio_queue_get_num(vdev, n)) { ++ break; ++ } ++ if (virtio_queue_vector(vdev, n) != vector) { ++ continue; ++ } ++ r = virtio_pci_mask_vq(dev, vector, virtio_get_queue(vdev, n), masked); ++ if (r < 0) { ++ goto undo; ++ } ++ } ++ return 0; ++undo: ++ while (--n >= 0) { ++ virtio_pci_mask_vq(dev, vector, virtio_get_queue(vdev, n), !masked); ++ } ++ return r; ++} ++ ++ + static int virtio_pci_set_guest_notifier(void *opaque, int n, bool assign) + { + VirtIOPCIProxy *proxy = opaque; +@@ -465,11 +492,7 @@ static int virtio_pci_set_guest_notifier(void *opaque, int n, bool assign) + } + qemu_set_fd_handler(event_notifier_get_fd(notifier), + virtio_pci_guest_notifier_read, NULL, vq); +- msix_set_mask_notifier(&proxy->pci_dev, +- virtio_queue_vector(proxy->vdev, n), vq); + } else { +- msix_unset_mask_notifier(&proxy->pci_dev, +- virtio_queue_vector(proxy->vdev, n)); + qemu_set_fd_handler(event_notifier_get_fd(notifier), + NULL, NULL, NULL); + /* Test and clear notifier before closing it, +@@ -487,6 +510,13 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign) + VirtIODevice *vdev = proxy->vdev; + int r, n; + ++ /* Must unset mask notifier while guest notifier ++ * is still assigned */ ++ if (!assign) { ++ r = msix_unset_mask_notifier(&proxy->pci_dev); ++ assert(r >= 0); ++ } ++ + for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { + if (!virtio_queue_get_num(vdev, n)) { + break; +@@ -498,6 +528,16 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign) + } + } + ++ /* Must set mask notifier after guest notifier ++ * has been assigned */ ++ if (assign) { ++ r = msix_set_mask_notifier(&proxy->pci_dev, ++ virtio_pci_mask_notifier); ++ if (r < 0) { ++ goto assign_error; ++ } ++ } ++ + return 0; + + assign_error: +@@ -583,8 +623,6 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, + + proxy->pci_dev.config_write = virtio_write_config; + +- proxy->pci_dev.msix_mask_notifier = virtio_pci_mask_notifier; +- + size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + vdev->config_len; + if (size & (size-1)) + size = 1 << qemu_fls(size); +-- +1.7.2.3 + diff --git a/ksmtuned.init b/ksmtuned.init index e055785..5cd6090 100644 --- a/ksmtuned.init +++ b/ksmtuned.init @@ -77,8 +77,14 @@ case "$1" in condrestart ;; retune) - kill -SIGUSR1 `cat ${pidfile}` + pid=`cat ${pidfile} 2> /dev/null` RETVAL=$? + if [ -z "$pid" ]; then + echo $"Cannot retune, service is not running." + else + kill -SIGUSR1 $pid + RETVAL=$? + fi ;; *) echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|retune|help}" diff --git a/qemu.spec b/qemu.spec index 097bdb0..9575815 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,7 +1,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 0.13.0 -Release: 0.7.rc1%{?dist} +Release: 1%{?dist} # Epoch because we pushed a qemu-1.0 package Epoch: 2 License: GPLv2+ and LGPLv2+ and BSD @@ -17,7 +17,7 @@ URL: http://www.qemu.org/ %define _smp_mflags %{nil} %endif -Source0: http://downloads.sourceforge.net/sourceforge/kvm/qemu-kvm-%{version}-rc1.tar.gz +Source0: http://downloads.sourceforge.net/sourceforge/kvm/qemu-kvm-%{version}.tar.gz Source1: qemu.init # Loads kvm kernel modules at boot @@ -78,6 +78,8 @@ Patch37: 0037-Revert-spice-add-virtio-serial-based-vdi-port-backen.patch Patch38: 0038-spice-add-virtio-serial-based-spice-vmchannel-backen.patch Patch39: 0039-qxl-fix-release-ring-overrun.patch Patch40: 0040-qxl-flip-default-to-stable-pci-revision.patch +Patch41: 0041-vmmouse-adapt-to-mouse-handler-changes.patch +Patch42: 0042-vhost-net-patches-for-qemu-0.13.0-tarball.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel @@ -272,7 +274,7 @@ such as kvm_stat. %endif %prep -%setup -q -n qemu-kvm-%{version}-rc1 +%setup -q -n qemu-kvm-%{version} %patch00 -p1 %patch01 -p1 @@ -315,6 +317,8 @@ such as kvm_stat. %patch38 -p1 %patch39 -p1 %patch40 -p1 +%patch41 -p1 +%patch42 -p1 %build # By default we build everything, but allow x86 to build a minimal version @@ -337,6 +341,12 @@ such as kvm_stat. extraldflags="-Wl,--build-id"; buildldflags="VL_LDFLAGS=-Wl,--build-id" +ifarch s390 +# drop -g flag to prevent memory exhaustion by linker +%global optflags %(echo %{optflags} | sed 's/-g//') +sed -i.debug 's/-g//g' configure +%endif + %ifarch %{ix86} x86_64 # sdl outputs to alsa or pulseaudio depending on system config, but it's broken (#495964) # alsa works, but causes huge CPU load due to bugs @@ -347,7 +357,7 @@ buildldflags="VL_LDFLAGS=-Wl,--build-id" --audio-drv-list=pa,sdl,alsa,oss \ --disable-strip \ --extra-ldflags=$extraldflags \ - --extra-cflags="$RPM_OPT_FLAGS" \ + --extra-cflags="%{optflags}" \ %ifarch x86_64 --enable-spice \ %endif @@ -373,7 +383,7 @@ make clean --disable-kvm \ --disable-strip \ --extra-ldflags=$extraldflags \ - --extra-cflags="$RPM_OPT_FLAGS" \ + --extra-cflags=="%{optflags}" \ --disable-xen \ %ifarch x86_64 --enable-spice \ @@ -629,6 +639,14 @@ fi %{_mandir}/man1/qemu-img.1* %changelog +* Mon Oct 18 2010 Justin M. Forbes - 2:0.13.0-1 +- Update to 0.13.0 upstream release +- Fixes for vhost +- Fix mouse in certain guests (#636887) +- Fix issues with WinXP guest install (#579348) +- Resolve build issues with S390 (#639471) +- Fix Windows XP on Raw Devices (#631591) + * Tue Sep 21 2010 Justin M. Forbes - 2:0.13.0-0.7.rc1 - Flip qxl pci id from unstable to stable (#634535) - KSM Fixes from upstream (#558281) diff --git a/sources b/sources index d6e74dd..5298816 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b00b0206a49bd962024931b57781dea2 qemu-kvm-0.13.0-rc1.tar.gz +68d100da381284a3dee486d3b9690e6d qemu-kvm-0.13.0.tar.gz