Skip to contentSkip to conversation

pc,vhost,virtio fixes, test

GIT PULL Applied Michael S. Tsirkin 2 participants 15 messages Jul 7, 2014 – Jul 15, 2014

lore
Share & tools
lore
#0 lore raw

I will merge only high priority fixes from here on. High priority means regression fixes or fixes in a new feature if there is no workaround.

The following changes since commit 9d9de254c2b81b68cd48f2324cc753a570a4cdd8:

MAINTAINERS: seccomp: change email contact for Eduardo Otubo (2014-07-03 12:36:15 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 3f0838ab8557c6071a5931183b2d7fed568cd35c:

qemu-char: add chr_add_watch support in mux chardev (2014-07-06 09:13:54 +0300)

----------------------------------------------------------------
pc,vhost,virtio fixes, test

Bugfixes all over the place.

There's a non bugfix here: re-enabling the vhost-user test, though the patch just brings back functionality that I disabled earlier to fix mingw build failures. This is now sorted, and keeping the unit test enabled seems important since the feature relies on an external server to work, so isn't easy to test.

----------------------------------------------------------------
Eduardo Habkost (2):
qdev: Don't abort() in case globals can't be set
qdev: Fix crash when using non-device class name on -global

Hu Tao (1):
numa: check for busy memory backend

Igor Mammedov (2):
pc-dimm: error out if memory hotplug is not enabled
acpi: fix typo in memory hotplug MMIO region name

Kirill Batuzov (2):
Handle G_IO_HUP in tcp_chr_read for tcp chardev
qemu-char: add chr_add_watch support in mux chardev

Le Tan (1):
pci: assign devfn to pci_dev before calling pci_device_iommu_address_space()

Ming Lei (2):
virtio: move common virtio properties to bus class device hw/virtio: enable common virtio feature for mmio device

Nikolay Nikolaev (1):
qtest: enable vhost-user-test

Paolo Bonzini (1):
virtio-pci: fix MSI memory region use after free

 include/hw/virtio/virtio-blk.h   |  3 ---
 include/hw/virtio/virtio-net.h   |  1 -
 include/hw/virtio/virtio-scsi.h  |  1 -
 include/sysemu/char.h            |  1 -
 hw/acpi/memory_hotplug.c         |  2 +-
 hw/core/qdev-properties-system.c |  3 ++-
 hw/core/qdev.c                   |  8 +++++++-
 hw/mem/pc-dimm.c                 |  8 +++++++-
 hw/pci/pci.c                     |  2 +-
 hw/s390x/s390-virtio-bus.c       |  2 ++
 hw/s390x/virtio-ccw.c            | 11 ++++++-----
 hw/virtio/virtio-mmio.c          |  6 ++++++
 hw/virtio/virtio-pci.c           | 16 ++++++++--------
 numa.c                           |  8 ++++++++
 qemu-char.c                      | 36 +++++++++++++++---------------------
 tests/Makefile                   |  8 +++++---
 16 files changed, 68 insertions(+), 48 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 01/12] qtest: enable vhost-user-test

From: Nikolay Nikolaev <[email protected]>

Use qtest-obj-y to get the right library order. CONFIG_POSIX ensures mingw compilation won't break.

MST: whitespace tweak

---
 tests/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tests/Makefile +5 -3
index 7e53d0d..1fcd633 100644
@@ -158,7 +158,7 @@ gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
-#check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
+check-qtest-i386-$(CONFIG_POSIX) += tests/vhost-user-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -333,11 +333,13 @@ tests/es1370-test$(EXESUF): tests/es1370-test.o
 tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
-tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o libqemuutil.a libqemustub.a
+tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
 
-#LIBS+= -lutil
+ifeq ($(CONFIG_POSIX),y)
+LIBS += -lutil
+endif
 
 # QTest rules
 
Signature · 1 line
MST
#3 lore raw

[Qemu-devel] [PULL 02/12] numa: check for busy memory backend

In reply to Michael S. Tsirkin

From: Hu Tao <[email protected]>

Specifying the same memory backend twice leads to an assert:

./x86_64-softmmu/qemu-system-x86_64 -m 512M -enable-kvm -object memory-backend-ram,size=256M,id=ram0 -numa node,nodeid=0,memdev=ram0 -numa node,nodeid=1,memdev=ram0
qemu-system-x86_64: /scm/qemu/memory.c:1506:
memory_region_add_subregion_common: Assertion `!subregion->container' failed.
Aborted (core dumped)

Detect and exit with an error message instead.

---
 numa.c | 8 ++++++++
 1 file changed, 8 insertions(+)
numa.c +8 -0
index 2fde740..7bf7834 100644
@@ -301,6 +301,14 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
             exit(1);
         }
 
+        if (memory_region_is_mapped(seg)) {
+            char *path = object_get_canonical_path_component(OBJECT(backend));
+            error_report("memory backend %s is used multiple times. Each "
+                         "-numa option must use a different memdev value.",
+                         path);
+            exit(1);
+        }
+
         memory_region_add_subregion(mr, addr, seg);
         vmstate_register_ram_global(seg);
         addr += size;
Signature · 1 line
MST
#4 lore raw

[Qemu-devel] [PULL 03/12] pc-dimm: error out if memory hotplug is not enabled

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

fixes QEMU abort in case it's started without memory hotplug enabled.

as result of fix it will print following messages:
"
-device pc-dimm,id=d1,memdev=m1: memory hotplug is not enabled, enable it on startup -device pc-dimm,id=d1,memdev=m1: Device 'pc-dimm' could not be initialized "

Also fixup assert condition to detect hotplug address space overflow.

---
 hw/mem/pc-dimm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/mem/pc-dimm.c +7 -1
index ad176b7..08f49ed 100644
@@ -146,7 +146,13 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
     uint64_t new_addr, ret = 0;
     uint64_t address_space_end = address_space_start + address_space_size;
 
-    assert(address_space_end > address_space_size);
+    if (!address_space_size) {
+        error_setg(errp, "memory hotplug is not enabled, "
+                         "please add maxmem option");
+        goto out;
+    }
+
+    assert(address_space_end > address_space_start);
     object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &list);
 
     if (hint) {
Signature · 1 line
MST
#5 lore raw

[Qemu-devel] [PULL 05/12] Handle G_IO_HUP in tcp_chr_read for tcp chardev

In reply to Michael S. Tsirkin

From: Kirill Batuzov <[email protected]>

Since commit cdaa86a54b232572bba594bf87a7416e527e460c ("Add G_IO_HUP handler for socket chardev")
GLib limitation results in a bug on Windows host. Steps to reproduce:

Start qemu: qemu-system-i386 -qmp tcp:127.0.0.1:4444:server:nowait Connect with telnet: telnet 127.0.0.1 4444
Try sending some data from telnet.
Expected result: answers from QEMU.
Observed result: no answers (actually tcp_chr_read is not called at all).

Due to GLib limitations it is not possible to create several watches on one channel on Windows hosts. See bug #338943 in GNOME bugzilla for details:
https://bugzilla.gnome.org/show_bug.cgi?id=338943

This reimplements commit cdaa86a54b232572bba594bf87a7416e527e460c ("Add G_IO_HUP handler for socket chardev") using a single watch:

Handle G_IO_HUP in tcp_chr_read instead. It is already watched by a corresponding watch. Remove the second watch with its handler.

---
 include/sysemu/char.h |  1 -
 qemu-char.c           | 27 ++++++---------------------
 2 files changed, 6 insertions(+), 22 deletions(-)
include/sysemu/char.h +0 -1
index c8b15f9..0bbd631 100644
@@ -84,7 +84,6 @@ struct CharDriverState {
     int avail_connections;
     int is_mux;
     guint fd_in_tag;
-    guint fd_hup_tag;
     QemuOpts *opts;
     QTAILQ_ENTRY(CharDriverState) next;
 };
qemu-char.c +6 -21
index 51917de..22a9777 100644
@@ -2673,6 +2673,12 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
     uint8_t buf[READ_BUF_LEN];
     int len, size;
 
+    if (cond & G_IO_HUP) {
+        /* connection closed */
+        tcp_chr_disconnect(chr);
+        return TRUE;
+    }
+
     if (!s->connected || s->max_size <= 0) {
         return TRUE;
     }
@@ -2724,25 +2730,6 @@ CharDriverState *qemu_chr_open_eventfd(int eventfd)
 }
 #endif
 
-static gboolean tcp_chr_chan_close(GIOChannel *channel, GIOCondition cond,
-                                   void *opaque)
-{
-    CharDriverState *chr = opaque;
-
-    if (cond != G_IO_HUP) {
-        return FALSE;
-    }
-
-    /* connection closed */
-    tcp_chr_disconnect(chr);
-    if (chr->fd_hup_tag) {
-        g_source_remove(chr->fd_hup_tag);
-        chr->fd_hup_tag = 0;
-    }
-
-    return TRUE;
-}
-
 static void tcp_chr_connect(void *opaque)
 {
     CharDriverState *chr = opaque;
@@ -2752,8 +2739,6 @@ static void tcp_chr_connect(void *opaque)
     if (s->chan) {
         chr->fd_in_tag = io_add_watch_poll(s->chan, tcp_chr_read_poll,
                                            tcp_chr_read, chr);
-        chr->fd_hup_tag = g_io_add_watch(s->chan, G_IO_HUP, tcp_chr_chan_close,
-                                         chr);
     }
     qemu_chr_be_generic_open(chr);
 }
Signature · 1 line
MST
#6 lore raw

[Qemu-devel] [PULL 06/12] pci: assign devfn to pci_dev before calling pci_device_iommu_address_space()

In reply to Michael S. Tsirkin

From: Le Tan <[email protected]>

In function do_pci_register_device() in file hw/pci/pci.c, move the assignment of pci_dev->devfn to the position before the call to pci_device_iommu_address_space(pci_dev) which will use the value of pci_dev->devfn.

Fixes 9eda7d373e9c691c070eddcbe3467b991f67f6bd

pci: Introduce helper to retrieve a PCI device's DMA address space

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 17ed510..351d320 100644
@@ -827,6 +827,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     }
 
     pci_dev->bus = bus;
+    pci_dev->devfn = devfn;
     dma_as = pci_device_iommu_address_space(pci_dev);
 
     memory_region_init_alias(&pci_dev->bus_master_enable_region,
@@ -836,7 +837,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_enable_region,
                        name);
 
-    pci_dev->devfn = devfn;
     pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
Signature · 1 line
MST
#7 lore raw

[Qemu-devel] [PULL 04/12] virtio: move common virtio properties to bus class device

In reply to Michael S. Tsirkin

From: Ming Lei <[email protected]>

The two common virtio features can be defined per bus, so move all into bus class device to make code more clean.

As discussed with cornelia, s390-virtio-blk doesn't support the two features at all, so keep s390-virtio as it.

MST: rebase and resolve conflicts

---
 include/hw/virtio/virtio-blk.h  |  3 ---
 include/hw/virtio/virtio-net.h  |  1 -
 include/hw/virtio/virtio-scsi.h |  1 -
 hw/s390x/s390-virtio-bus.c      |  2 ++
 hw/s390x/virtio-ccw.c           | 11 ++++++-----
 hw/virtio/virtio-pci.c          | 12 ++++++------
 6 files changed, 14 insertions(+), 16 deletions(-)
include/hw/virtio/virtio-blk.h +0 -3
index 223530e..b3080a2 100644
@@ -152,9 +152,6 @@ typedef struct VirtIOBlockReq {
     BlockAcctCookie acct;
 } VirtIOBlockReq;
 
-#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
-        DEFINE_VIRTIO_COMMON_FEATURES(_state, _field)
-
 int virtio_blk_handle_scsi_req(VirtIOBlock *blk,
                                VirtQueueElement *elem);
 
include/hw/virtio/virtio-net.h +0 -1
index f7fccc0..6ceb5aa 100644
@@ -258,7 +258,6 @@ struct virtio_net_ctrl_mq {
  #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET        0
 
 #define DEFINE_VIRTIO_NET_FEATURES(_state, _field) \
-        DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
         DEFINE_PROP_BIT("any_layout", _state, _field, VIRTIO_F_ANY_LAYOUT, true), \
         DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \
         DEFINE_PROP_BIT("guest_csum", _state, _field, VIRTIO_NET_F_GUEST_CSUM, true), \
include/hw/virtio/virtio-scsi.h +0 -1
index a8f6185..0419ee4 100644
@@ -178,7 +178,6 @@ typedef struct {
     DEFINE_PROP_UINT32("cmd_per_lun", _state, _conf_field.cmd_per_lun, 128)
 
 #define DEFINE_VIRTIO_SCSI_FEATURES(_state, _feature_field)                    \
-    DEFINE_VIRTIO_COMMON_FEATURES(_state, _feature_field),                     \
     DEFINE_PROP_BIT("hotplug", _state, _feature_field, VIRTIO_SCSI_F_HOTPLUG,  \
                                                        true),                  \
     DEFINE_PROP_BIT("param_change", _state, _feature_field,                    \
hw/s390x/s390-virtio-bus.c +2 -0
index c0dc365..6b6fb61 100644
@@ -494,6 +494,7 @@ static unsigned virtio_s390_get_features(DeviceState *d)
 
 static Property s390_virtio_net_properties[] = {
     DEFINE_NIC_PROPERTIES(VirtIONetS390, vdev.nic_conf),
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
     DEFINE_VIRTIO_NET_FEATURES(VirtIOS390Device, host_features),
     DEFINE_VIRTIO_NET_PROPERTIES(VirtIONetS390, vdev.net_conf),
     DEFINE_PROP_END_OF_LIST(),
@@ -614,6 +615,7 @@ static const TypeInfo virtio_s390_device_info = {
 
 static Property s390_virtio_scsi_properties[] = {
     DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOSCSIS390, vdev.parent_obj.conf),
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
     DEFINE_VIRTIO_SCSI_FEATURES(VirtIOS390Device, host_features),
     DEFINE_PROP_END_OF_LIST(),
 };
hw/s390x/virtio-ccw.c +6 -5
index c279968..33a1d86 100644
@@ -1402,7 +1402,6 @@ static const TypeInfo virtio_ccw_net = {
 
 static Property virtio_ccw_blk_properties[] = {
     DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
-    DEFINE_VIRTIO_BLK_FEATURES(VirtioCcwDevice, host_features[0]),
     DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
                     VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_END_OF_LIST(),
@@ -1430,7 +1429,6 @@ static const TypeInfo virtio_ccw_blk = {
 static Property virtio_ccw_serial_properties[] = {
     DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
     DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtioSerialCcw, vdev.serial),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]),
     DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
                     VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_END_OF_LIST(),
@@ -1457,7 +1455,6 @@ static const TypeInfo virtio_ccw_serial = {
 
 static Property virtio_ccw_balloon_properties[] = {
     DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]),
     DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
                     VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_END_OF_LIST(),
@@ -1514,7 +1511,6 @@ static const TypeInfo virtio_ccw_scsi = {
 static Property vhost_ccw_scsi_properties[] = {
     DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
     DEFINE_VHOST_SCSI_PROPERTIES(VirtIOSCSICcw, vdev.parent_obj.conf),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -1551,7 +1547,6 @@ static void virtio_ccw_rng_instance_init(Object *obj)
 
 static Property virtio_ccw_rng_properties[] = {
     DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]),
     DEFINE_VIRTIO_RNG_PROPERTIES(VirtIORNGCcw, vdev.conf),
     DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
                     VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
@@ -1617,10 +1612,16 @@ static int virtio_ccw_busdev_unplug(DeviceState *dev)
     return 0;
 }
 
+static Property virtio_ccw_properties[] = {
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtioCcwDevice, host_features[0]),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->props = virtio_ccw_properties;
     dc->init = virtio_ccw_busdev_init;
     dc->exit = virtio_ccw_busdev_exit;
     dc->unplug = virtio_ccw_busdev_unplug;
hw/virtio/virtio-pci.c +6 -6
index 3c42cda..7102728 100644
@@ -914,7 +914,6 @@ static Property virtio_9p_pci_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_VIRTIO_9P_PROPERTIES(V9fsPCIState, vdev.fsconf),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -1037,11 +1036,17 @@ static void virtio_pci_reset(DeviceState *qdev)
     proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
 }
 
+static Property virtio_pci_properties[] = {
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void virtio_pci_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    dc->props = virtio_pci_properties;
     k->init = virtio_pci_init;
     k->exit = virtio_pci_exit;
     k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
@@ -1066,7 +1071,6 @@ static Property virtio_blk_pci_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
-    DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -1191,7 +1195,6 @@ static const TypeInfo virtio_scsi_pci_info = {
 static Property vhost_scsi_pci_properties[] = {
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
                        DEV_NVECTORS_UNSPECIFIED),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_VHOST_SCSI_PROPERTIES(VHostSCSIPCI, vdev.parent_obj.conf),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -1272,7 +1275,6 @@ static void balloon_pci_stats_set_poll_interval(Object *obj, struct Visitor *v,
 }
 
 static Property virtio_balloon_pci_properties[] = {
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -1375,7 +1377,6 @@ static Property virtio_serial_pci_properties[] = {
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
     DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtIOSerialPCI, vdev.serial),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -1471,7 +1472,6 @@ static const TypeInfo virtio_net_pci_info = {
 /* virtio-rng-pci */
 
 static Property virtio_rng_pci_properties[] = {
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_VIRTIO_RNG_PROPERTIES(VirtIORngPCI, vdev.conf),
     DEFINE_PROP_END_OF_LIST(),
 };
Signature · 1 line
MST
#8 lore raw

[Qemu-devel] [PULL 07/12] acpi: fix typo in memory hotplug MMIO region name

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

---
 hw/acpi/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/memory_hotplug.c +1 -1
index 38ca415..ed39241 100644
@@ -159,7 +159,7 @@ void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
 
     state->devs = g_malloc0(sizeof(*state->devs) * state->dev_count);
     memory_region_init_io(&state->io, owner, &acpi_memory_hotplug_ops, state,
-                          "apci-mem-hotplug", ACPI_MEMORY_HOTPLUG_IO_LEN);
+                          "acpi-mem-hotplug", ACPI_MEMORY_HOTPLUG_IO_LEN);
     memory_region_add_subregion(as, ACPI_MEMORY_HOTPLUG_BASE, &state->io);
 }
 
Signature · 1 line
MST
#9 lore raw

[Qemu-devel] [PULL 08/12] hw/virtio: enable common virtio feature for mmio device

In reply to Michael S. Tsirkin

From: Ming Lei <[email protected]>

Both 'indirect_desc' and 'event_idx' are bus independent features, and they should be enabled for mmio devices too.

On arm64 quad core VM(qemu-kvm), the patch can increase block I/O performance a lot with latest linux tree:
- without the patch: 14K IOPS
- with the patch: 34K IOPS

fio script:

        [global]
        direct=1
        bsrange=4k-4k
        timeout=10
        numjobs=4
        ioengine=libaio
        iodepth=64

        filename=/dev/vdc
        group_reporting=1

        [f1]
        rw=randread
---
 hw/virtio/virtio-mmio.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/virtio/virtio-mmio.c +6 -0
index 8829eb0..18c6e5b 100644
@@ -369,10 +369,16 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
     sysbus_init_mmio(sbd, &proxy->iomem);
 }
 
+static Property virtio_mmio_properties[] = {
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtIOMMIOProxy, host_features),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void virtio_mmio_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->props = virtio_mmio_properties;
     dc->realize = virtio_mmio_realizefn;
     dc->reset = virtio_mmio_reset;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
Signature · 1 line
MST
#10 lore raw

[Qemu-devel] [PULL 09/12] qdev: Don't abort() in case globals can't be set

In reply to Michael S. Tsirkin

From: Eduardo Habkost <[email protected]>

It would be much better if we didn't terminate QEMU inside device_post_init(), but at least exiting cleanly is better than aborting and dumping core.

Before this patch:

    $ qemu-system-x86_64 -global cpu.xxx=y
    qemu-system-x86_64: Property '.xxx' not found
    Aborted (core dumped)

After this patch:

    $ qemu-system-x86_64 -global cpu.xxx=y
    qemu-system-x86_64: Property '.xxx' not found
---
 hw/core/qdev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/core/qdev.c +7 -1
index 3bdda8e..da1ba48 100644
@@ -957,7 +957,13 @@ static void device_initfn(Object *obj)
 
 static void device_post_init(Object *obj)
 {
-    qdev_prop_set_globals(DEVICE(obj), &error_abort);
+    Error *err = NULL;
+    qdev_prop_set_globals(DEVICE(obj), &err);
+    if (err) {
+        qerror_report_err(err);
+        error_free(err);
+        exit(EXIT_FAILURE);
+    }
 }
 
 /* Unlink device from bus and free the structure.  */
Signature · 1 line
MST
#11 lore raw

[Qemu-devel] [PULL 10/12] qdev: Fix crash when using non-device class name on -global

In reply to Michael S. Tsirkin

From: Eduardo Habkost <[email protected]>

This fixes the following crash:

    $ qemu-system-x86_64 -global container.xxx=y
    hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device
    Aborted (core dumped)

New behavior will be to just warn, just like when non-existing clas names are used:

    $ qemu-system-x86_64 -global container.xxx=y
    qemu-system-x86_64: Warning: "-global container.xxx=y" not used
---
 hw/core/qdev-properties-system.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/qdev-properties-system.c +2 -1
index 8e140af..ae0900f 100644
@@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque)
     g->driver   = qemu_opt_get(opts, "driver");
     g->property = qemu_opt_get(opts, "property");
     g->value    = qemu_opt_get(opts, "value");
-    oc = object_class_by_name(g->driver);
+    oc = object_class_dynamic_cast(object_class_by_name(g->driver),
+                                   TYPE_DEVICE);
     if (oc) {
         DeviceClass *dc = DEVICE_CLASS(oc);
 
Signature · 1 line
MST
#12 lore raw

[Qemu-devel] [PULL 11/12] virtio-pci: fix MSI memory region use after free

In reply to Michael S. Tsirkin

From: Paolo Bonzini <[email protected]>

After memory region QOMification QEMU is stricter in detecting wrong usage of the memory region API. Here it detected a memory_region_destroy done before the corresponding memory_region_del_subregion; the memory_region_destroy is done by msix_uninit_exclusive_bar, the memory_region_del_subregion is done by the PCI core's pci_unregister_io_regions before pc->exit is called.

The problem was introduced by
commit 06a1307379fcd6c551185ad87679cd7ed896b9ea
virtio-pci: add device_unplugged callback
As noted in that commit log, virtio device kick callbacks need to be stopped before generic virtio is cleaned up. This is because these are notifications from pci proxy to the generic virtio device so they need to be stopped in the unplug call before the virtio device is unrealized. However interrupts are notifications from the virtio device to the pci proxy so they need to stay around while the device is realized.

The memory API misuse caused an assertion when hot-unplugging virtio devices. Using the API correctly fixes the assertion.

---
 hw/virtio/virtio-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/virtio-pci.c +2 -2
index 7102728..3007319 100644
@@ -1002,11 +1002,9 @@ static void virtio_pci_device_plugged(DeviceState *d)
 
 static void virtio_pci_device_unplugged(DeviceState *d)
 {
-    PCIDevice *pci_dev = PCI_DEVICE(d);
     VirtIOPCIProxy *proxy = VIRTIO_PCI(d);
 
     virtio_pci_stop_ioeventfd(proxy);
-    msix_uninit_exclusive_bar(pci_dev);
 }
 
 static int virtio_pci_init(PCIDevice *pci_dev)
@@ -1023,6 +1021,8 @@ static int virtio_pci_init(PCIDevice *pci_dev)
 static void virtio_pci_exit(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
+
+    msix_uninit_exclusive_bar(pci_dev);
     memory_region_destroy(&proxy->bar);
 }
 
Signature · 1 line
MST
#13 lore raw

[Qemu-devel] [PULL 12/12] qemu-char: add chr_add_watch support in mux chardev

In reply to Michael S. Tsirkin

From: Kirill Batuzov <[email protected]>

Forward chr_add_watch call from mux chardev to underlying implementation.

This should fix bug #1335444

---
 qemu-char.c | 9 +++++++++
 1 file changed, 9 insertions(+)
qemu-char.c +9 -0
index 22a9777..55e372c 100644
@@ -581,6 +581,12 @@ static Notifier muxes_realize_notify = {
     .notify = muxes_realize_done,
 };
 
+static GSource *mux_chr_add_watch(CharDriverState *s, GIOCondition cond)
+{
+    MuxDriver *d = s->opaque;
+    return d->drv->chr_add_watch(d->drv, cond);
+}
+
 static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
 {
     CharDriverState *chr;
@@ -597,6 +603,9 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
     chr->chr_accept_input = mux_chr_accept_input;
     /* Frontend guest-open / -close notification is not support with muxes */
     chr->chr_set_fe_open = NULL;
+    if (drv->chr_add_watch) {
+        chr->chr_add_watch = mux_chr_add_watch;
+    }
     /* only default to opened state if we've realized the initial
      * set of muxes
      */
Signature · 1 line
MST
#14 lore raw
In reply to Michael S. Tsirkin
Quoted 20 lines · Michael S. Tsirkin

I will merge only high priority fixes from here on. High priority means regression fixes or fixes in a new feature if there is no workaround.

The following changes since commit 9d9de254c2b81b68cd48f2324cc753a570a4cdd8:

MAINTAINERS: seccomp: change email contact for Eduardo Otubo (2014-07-03 12:36:15 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 3f0838ab8557c6071a5931183b2d7fed568cd35c:

qemu-char: add chr_add_watch support in mux chardev (2014-07-06 09:13:54 +0300)

----------------------------------------------------------------
pc,vhost,virtio fixes, test

Bugfixes all over the place.

Quoted 8 lines

There's a non bugfix here: re-enabling the vhost-user test, though the patch just brings back functionality that I disabled earlier to fix mingw build failures. This is now sorted, and keeping the unit test enabled seems important since the feature relies on an external server to work, so isn't easy to test.

Applied, thanks.

-- PMM

#2 lore raw

Re: [Qemu-devel] [PULL 01/12] qtest: enable vhost-user-test

In reply to Michael S. Tsirkin
Quoted 19 lines · Michael S. Tsirkin

From: Nikolay Nikolaev <[email protected]>

Use qtest-obj-y to get the right library order. CONFIG_POSIX ensures mingw compilation won't break.

MST: whitespace tweak

---
 tests/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tests/Makefile +0 -0
index 7e53d0d..1fcd633 100644

tests/Makefile gcov-files-i386-y += hw/usb/hcd-ehci.c · line 161

Quoted 5 lines
tests/Makefile +1 -1
@@ -158,7 +158,7 @@ gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
-#check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
+check-qtest-i386-$(CONFIG_POSIX) += tests/vhost-user-test$(EXESUF)

This breaks 'make check' on MacOSX -- we're CONFIG_POSIX but the vhost-user-test includes linux/vhost.h, which obviously doesn't exist. You wanted CONFIG_LINUX; I'll send a patch to fix this.

thanks
-- PMM