From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PATCH 63/67] vhost-user-test: Use libqos instead of pxe-virtio.rom
Date: Wed, 14 Dec 2016 18:44:57 -0600 [thread overview]
Message-ID: <1481762701-4587-64-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1481762701-4587-1-git-send-email-mdroth@linux.vnet.ibm.com>
From: Eduardo Habkost <ehabkost@redhat.com>
vhost-user-test relies on iPXE just to initialize the virtio-net
device, and doesn't do any actual packet tx/rx testing.
In addition to that, the test relies on TCG, which is
imcompatible with vhost. The test only worked by accident: a bug
the memory backend initialization made memory regions not have
the DIRTY_MEMORY_CODE bit set in dirty_log_mask.
This changes vhost-user-test to initialize the virtio-net device
using libqos, and not use TCG nor pxe-virtio.rom.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit cdafe929615ec5eca71bcd5a3d12bab5678e5886)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
tests/Makefile.include | 2 +-
tests/vhost-user-test.c | 37 ++++++++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 14be491..03382b5 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -622,7 +622,7 @@ tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y)
tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o
tests/postcopy-test$(EXESUF): tests/postcopy-test.o
-tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y)
+tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-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 $(test-util-obj-y)
tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 27b10c1..b89a551 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -16,8 +16,13 @@
#include "qemu/sockets.h"
#include "sysemu/char.h"
#include "sysemu/sysemu.h"
+#include "libqos/libqos.h"
+#include "libqos/pci-pc.h"
+#include "libqos/virtio-pci.h"
#include <linux/vhost.h>
+#include <linux/virtio_ids.h>
+#include <linux/virtio_net.h>
#include <sys/vfs.h>
/* GLIB version compatibility flags */
@@ -29,14 +34,13 @@
#define HAVE_MONOTONIC_TIME
#endif
-#define QEMU_CMD_ACCEL " -machine accel=tcg"
#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM,"\
"mem-path=%s,share=on -numa node,memdev=mem"
#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s"
#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=%s,vhostforce"
-#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0,romfile=./pc-bios/pxe-virtio.rom"
+#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0"
-#define QEMU_CMD QEMU_CMD_ACCEL QEMU_CMD_MEM QEMU_CMD_CHR \
+#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \
QEMU_CMD_NETDEV QEMU_CMD_NET
#define HUGETLBFS_MAGIC 0x958458f6
@@ -136,6 +140,30 @@ typedef struct TestServer {
static const char *tmpfs;
static const char *root;
+static void init_virtio_dev(TestServer *s)
+{
+ QPCIBus *bus;
+ QVirtioPCIDevice *dev;
+ uint32_t features;
+
+ bus = qpci_init_pc();
+ g_assert_nonnull(bus);
+
+ dev = qvirtio_pci_device_find(bus, VIRTIO_ID_NET);
+ g_assert_nonnull(dev);
+
+ qvirtio_pci_device_enable(dev);
+ qvirtio_reset(&qvirtio_pci, &dev->vdev);
+ qvirtio_set_acknowledge(&qvirtio_pci, &dev->vdev);
+ qvirtio_set_driver(&qvirtio_pci, &dev->vdev);
+
+ features = qvirtio_get_features(&qvirtio_pci, &dev->vdev);
+ features = features & VIRTIO_NET_F_MAC;
+ qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);
+
+ qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);
+}
+
static void wait_for_fds(TestServer *s)
{
gint64 end_time;
@@ -548,6 +576,7 @@ static void test_migrate(void)
from = qtest_start(cmd);
g_free(cmd);
+ init_virtio_dev(s);
wait_for_fds(s);
size = get_log_size(s);
g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8));
@@ -662,6 +691,7 @@ static void test_reconnect_subprocess(void)
qtest_start(cmd);
g_free(cmd);
+ init_virtio_dev(s);
wait_for_fds(s);
wait_for_rings_started(s, 2);
@@ -728,6 +758,7 @@ int main(int argc, char **argv)
s = qtest_start(qemu_cmd);
g_free(qemu_cmd);
+ init_virtio_dev(server);
qtest_add_data_func("/vhost-user/read-guest-mem", server, read_guest_mem);
qtest_add_func("/vhost-user/migrate", test_migrate);
--
1.9.1
next prev parent reply other threads:[~2016-12-15 0:47 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 0:43 [Qemu-devel] [PATCH 00/67] Patch Round-up for stable 2.7.1, freeze on 2016-12-20 Michael Roth
2016-12-15 0:43 ` [Qemu-devel] [PATCH 01/67] linux-headers: update Michael Roth
2016-12-15 0:43 ` [Qemu-devel] [PATCH 02/67] hw/ppc/spapr: Move code related to "ibm, pa-features" to a separate function Michael Roth
2016-12-15 0:43 ` [Qemu-devel] [PATCH 03/67] hw/ppc/spapr: Fix the selection of the processor features Michael Roth
2016-12-15 0:43 ` [Qemu-devel] [PATCH 04/67] ppc: Check the availability of transactional memory Michael Roth
2016-12-15 0:43 ` [Qemu-devel] [PATCH 05/67] virtio: zero vq->inuse in virtio_reset() Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 06/67] virtio-balloon: discard virtqueue element on reset Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 07/67] vnc: fix qemu crash because of SIGSEGV Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 08/67] 9pfs: fix potential segfault during walk Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 09/67] scsi: mptsas: use g_new0 to allocate MPTSASRequest object Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 10/67] scsi: pvscsi: limit process IO loop to ring size Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 11/67] qemu-char: avoid segfault if user lacks of permisson of a given logfile Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 12/67] scsi-disk: change disk serial length from 20 to 36 Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 13/67] vmw_pvscsi: check page count while initialising descriptor rings Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 14/67] scsi: mptconfig: fix an assert expression Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 15/67] scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 16/67] crypto: ensure XTS is only used with ciphers with 16 byte blocks Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 17/67] iothread: Stop threads before main() quits Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 18/67] scsi-disk: Cleaning up around tray open state Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 19/67] virtio-scsi: Don't abort when media is ejected Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 20/67] ahci: clear aiocb in ncq_cb Michael Roth
2016-12-19 23:07 ` John Snow
2016-12-21 16:56 ` Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 21/67] s390x/css: handle cssid 255 correctly Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 22/67] vfio/pci: Fix regression in MSI routing configuration Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 23/67] qcow2: fix encryption during cow of sectors Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 24/67] iscsi: Fix divide-by-zero regression on raw SG devices Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 25/67] block: reintroduce bdrv_flush_all Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 26/67] qemu: use bdrv_flush_all for vm_stop et al Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 27/67] block-backend: remove blk_flush_all Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 28/67] migrate: Fix cpu-throttle-increment regression in HMP Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 29/67] qht: simplify qht_reset_size Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 30/67] qht: fix unlock-after-free segfault upon resizing Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 31/67] char: fix missing return in error path for chardev TLS init Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 32/67] qmp: fix object-add assert() without props Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 33/67] qapi: Fix crash when 'any' or 'null' parameter is missing Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing struct members Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 35/67] rbd: shift byte count as a 64-bit value Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 36/67] ppc/kvm: Mark 64kB page size support as disabled if not available Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 37/67] throttle: Correct access to wrong BlockBackendPublic structures Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 38/67] qemu-iotests: Test I/O in a single drive from a throttling group Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 39/67] net: rtl8139: limit processing of ring descriptors Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 40/67] memory: Replace skip_dump flag with "ram_device" Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 41/67] memory: Don't use memcpy for ram_device regions Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 42/67] acpi/ipmi: Initialize the fwinfo before fetching it Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 43/67] net: fix sending of data with -net socket, listen backend Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 44/67] target-ppc: Fix CPU migration from qemu-2.6 <-> later versions Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 45/67] virtio: allow per-device-class legacy features Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 46/67] virtio-net: mark VIRTIO_NET_F_GSO as legacy Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 47/67] block: Don't mark node clean after failed flush Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 48/67] vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 49/67] slirp: Fix access to freed memory Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 50/67] qcow2: Inform block layer about discard boundaries Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 51/67] block: Let write zeroes fallback work even with small max_transfer Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 52/67] block: Return -ENOTSUP rather than assert on unaligned discards Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 53/67] block: Pass unaligned discard requests to drivers Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 54/67] block/curl: Use BDRV_SECTOR_SIZE Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 55/67] block/curl: Fix return value from curl_read_cb Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 56/67] block/curl: Remember all sockets Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 57/67] block/curl: Do not wait for data beyond EOF Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 58/67] vhost: drop legacy vring layout bits Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 59/67] ivshmem: Fix 64 bit memory bar configuration Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 60/67] pci-assign: sync MSI/MSI-X cap and table with PCIDevice Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 61/67] rules.mak: Use -r instead of -Wl, -r to fix building when PIE is default Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 62/67] intel_iommu: fix incorrect device invalidate Michael Roth
2016-12-15 0:44 ` Michael Roth [this message]
2016-12-15 0:44 ` [Qemu-devel] [PATCH 64/67] vl: Delay initialization of memory backends Michael Roth
2016-12-15 0:44 ` [Qemu-devel] [PATCH 65/67] Revert "megasas: remove useless check for cmd->frame" Michael Roth
2016-12-15 0:45 ` [Qemu-devel] [PATCH 66/67] msmouse: Fix segfault caused by free the chr before chardev cleanup Michael Roth
2016-12-15 0:45 ` [Qemu-devel] [PATCH 67/67] vfio/pci: Fix vfio_rtl8168_quirk_data_read address offset Michael Roth
2016-12-15 6:14 ` [Qemu-devel] [PATCH 00/67] Patch Round-up for stable 2.7.1, freeze on 2016-12-20 Stefan Weil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481762701-4587-64-git-send-email-mdroth@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).