* [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes
@ 2014-06-19 15:06 Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:06 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
The following series enables vhost-user-test in make check.
The first patch adds a new CONFIG_VHOST_NET_USED in configure
to be used in net.c to enable vhost-user netdev backend.
Fifth patch fixes an error when calling erro_setg in vhost_dev_init.
---
Nikolay Nikolaev (6):
configure: add new config define CONFIG_VHOST_NET_USED
libqemustub: add more stubs for qemu-char
qtest: fix qtest for vhost-user
qtest: fix vhost-user-test unbalanced mutex locks
vhost: fix migration_blocker initialization
qtest: enable vhost-user-test
configure | 3 +
hw/virtio/vhost.c | 3 -
net/net.c | 4 +
stubs/Makefile.objs | 2 +
stubs/chr-baum-init.c | 7 ++
stubs/qemu-chr-open-spice.c | 12 ++++
tests/Makefile | 6 +-
tests/vhost-user-test.c | 128 ++++++++++++++++++++++++++++++++++++++-----
8 files changed, 143 insertions(+), 22 deletions(-)
create mode 100644 stubs/chr-baum-init.c
create mode 100644 stubs/qemu-chr-open-spice.c
--
Signature
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
@ 2014-06-19 15:07 ` Nikolay Nikolaev
2014-06-19 15:35 ` Michael S. Tsirkin
2014-06-19 15:07 ` [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char Nikolay Nikolaev
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:07 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
This will be used in net.c (for now) to enable vhos-user netdev backend.
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
configure | 3 +++
net/net.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 9f4ba45..fb3c856 100755
--- a/configure
+++ b/configure
@@ -4543,6 +4543,9 @@ fi
if test "$vhost_scsi" = "yes" ; then
echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
fi
+if test "$vhost_net" = "yes" ; then
+ echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
+fi
if test "$blobs" = "yes" ; then
echo "INSTALL_BLOBS=yes" >> $config_host_mak
fi
diff --git a/net/net.c b/net/net.c
index 0c30414..3dac29b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -803,7 +803,7 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
[NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
#endif
[NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
[NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
#endif
};
@@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
case NET_CLIENT_OPTIONS_KIND_BRIDGE:
#endif
case NET_CLIENT_OPTIONS_KIND_HUBPORT:
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
#endif
break;
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
@ 2014-06-19 15:07 ` Nikolay Nikolaev
2014-06-19 16:06 ` Andrew Jones
2014-06-19 15:07 ` [Qemu-devel] [PATCH 3/6] qtest: fix qtest for vhost-user Nikolay Nikolaev
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:07 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
Additional stubs:
- chr_baum_init
- qemu_chr_open_spice_vmc
- qemu_chr_open_spice_port
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
stubs/Makefile.objs | 2 ++
stubs/chr-baum-init.c | 7 +++++++
stubs/qemu-chr-open-spice.c | 12 ++++++++++++
3 files changed, 21 insertions(+)
create mode 100644 stubs/chr-baum-init.c
create mode 100644 stubs/qemu-chr-open-spice.c
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 997d68d..2312076 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -1,5 +1,6 @@
stub-obj-y += arch-query-cpu-def.o
stub-obj-y += bdrv-commit-all.o
+stub-obj-y += chr-baum-init.o
stub-obj-y += chr-msmouse.o
stub-obj-y += clock-warp.o
stub-obj-y += cpu-get-clock.o
@@ -24,6 +25,7 @@ stub-obj-y += mon-set-error.o
stub-obj-y += monitor-init.o
stub-obj-y += notify-event.o
stub-obj-y += pci-drive-hot-add.o
+stub-obj-y += qemu-chr-open-spice.o
stub-obj-y += qtest.o
stub-obj-y += reset.o
stub-obj-y += runstate-check.o
diff --git a/stubs/chr-baum-init.c b/stubs/chr-baum-init.c
new file mode 100644
index 0000000..f5cc6ce
--- /dev/null
+++ b/stubs/chr-baum-init.c
@@ -0,0 +1,7 @@
+#include "qemu-common.h"
+#include "sysemu/char.h"
+
+CharDriverState *chr_baum_init(void)
+{
+ return NULL;
+}
diff --git a/stubs/qemu-chr-open-spice.c b/stubs/qemu-chr-open-spice.c
new file mode 100644
index 0000000..40a29a9
--- /dev/null
+++ b/stubs/qemu-chr-open-spice.c
@@ -0,0 +1,12 @@
+#include "qemu-common.h"
+#include "ui/qemu-spice.h"
+
+CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+{
+ return NULL;
+}
+
+CharDriverState *qemu_chr_open_spice_port(const char *name)
+{
+ return NULL;
+}
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 3/6] qtest: fix qtest for vhost-user
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char Nikolay Nikolaev
@ 2014-06-19 15:07 ` Nikolay Nikolaev
2014-06-19 15:08 ` [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks Nikolay Nikolaev
` (3 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:07 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
Fix compile for older glib, provide conditionally compiled versions of the
used glib APIs.
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
tests/vhost-user-test.c | 128 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 113 insertions(+), 15 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 7c826b4..2934379 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -8,17 +8,30 @@
*
*/
+#define QEMU_GLIB_COMPAT_H
+#include <glib.h>
+
#include "libqtest.h"
#include "qemu/option.h"
#include "sysemu/char.h"
#include "sysemu/sysemu.h"
-#include <glib.h>
#include <linux/vhost.h>
#include <sys/mman.h>
#include <sys/vfs.h>
#include <qemu/sockets.h>
+/* GLIB version compatibility flags */
+#if GLIB_CHECK_VERSION(2, 28, 0)
+#define HAVE_MONOTONIC_TIME
+#endif
+
+#if GLIB_CHECK_VERSION(2, 32, 0)
+#define HAVE_MUTEX_INIT
+#define HAVE_COND_INIT
+#define HAVE_THREAD_NEW
+#endif
+
#define QEMU_CMD_ACCEL " -machine accel=tcg"
#define QEMU_CMD_MEM " -m 512 -object memory-backend-file,id=mem,size=512M,"\
"mem-path=%s,share=on -numa node,memdev=mem"
@@ -95,8 +108,93 @@ static VhostUserMsg m __attribute__ ((unused));
int fds_num = 0, fds[VHOST_MEMORY_MAX_NREGIONS];
static VhostUserMemory memory;
-static GMutex data_mutex;
-static GCond data_cond;
+static GMutex *data_mutex;
+static GCond *data_cond;
+
+static gint64 _get_time(void)
+{
+#ifdef HAVE_MONOTONIC_TIME
+ return g_get_monotonic_time();
+#else
+ GTimeVal time;
+ g_get_current_time(&time);
+
+ return time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec;
+#endif
+}
+
+static GMutex *_mutex_new(void)
+{
+ GMutex *mutex;
+
+#ifdef HAVE_MUTEX_INIT
+ mutex = g_new(GMutex, 1);
+ g_mutex_init(mutex);
+#else
+ mutex = g_mutex_new();
+#endif
+
+ return mutex;
+}
+
+static void _mutex_free(GMutex *mutex)
+{
+#ifdef HAVE_MUTEX_INIT
+ g_mutex_clear(mutex);
+ g_free(mutex);
+#else
+ g_mutex_free(mutex);
+#endif
+}
+
+static GCond *_cond_new(void)
+{
+ GCond *cond;
+
+#ifdef HAVE_COND_INIT
+ cond = g_new(GCond, 1);
+ g_cond_init(cond);
+#else
+ cond = g_cond_new();
+#endif
+
+ return cond;
+}
+
+static gboolean _cond_wait_until(GCond *cond, GMutex *mutex, gint64 end_time)
+{
+ gboolean ret = FALSE;
+#ifdef HAVE_COND_INIT
+ ret = g_cond_wait_until(cond, mutex, end_time);
+#else
+ GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
+ end_time % G_TIME_SPAN_SECOND };
+ ret = g_cond_timed_wait(cond, mutex, &time);
+#endif
+ return ret;
+}
+
+static void _cond_free(GCond *cond)
+{
+#ifdef HAVE_COND_INIT
+ g_cond_clear(cond);
+ g_free(cond);
+#else
+ g_cond_free(cond);
+#endif
+}
+
+static GThread *_thread_new(const gchar *name, GThreadFunc func, gpointer data)
+{
+ GThread *thread = NULL;
+ GError *error = NULL;
+#ifdef HAVE_THREAD_NEW
+ thread = g_thread_try_new(name, func, data, &error);
+#else
+ thread = g_thread_create(func, data, TRUE, &error);
+#endif
+ return thread;
+}
static void read_guest_mem(void)
{
@@ -104,11 +202,11 @@ static void read_guest_mem(void)
gint64 end_time;
int i, j;
- g_mutex_lock(&data_mutex);
+ g_mutex_lock(data_mutex);
- end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
+ end_time = _get_time() + 5 * G_TIME_SPAN_SECOND;
while (!fds_num) {
- if (!g_cond_wait_until(&data_cond, &data_mutex, end_time)) {
+ if (!_cond_wait_until(data_cond, data_mutex, end_time)) {
/* timeout has passed */
g_assert(fds_num);
break;
@@ -143,7 +241,7 @@ static void read_guest_mem(void)
}
g_assert_cmpint(1, ==, 1);
- g_mutex_unlock(&data_mutex);
+ g_mutex_unlock(data_mutex);
}
static void *thread_function(void *data)
@@ -203,8 +301,8 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
fds_num = qemu_chr_fe_get_msgfds(chr, fds, sizeof(fds) / sizeof(int));
/* signal the test that it can continue */
- g_cond_signal(&data_cond);
- g_mutex_unlock(&data_mutex);
+ g_cond_signal(data_cond);
+ g_mutex_unlock(data_mutex);
break;
case VHOST_USER_SET_VRING_KICK:
@@ -285,10 +383,10 @@ int main(int argc, char **argv)
qemu_chr_add_handlers(chr, chr_can_read, chr_read, NULL, chr);
/* run the main loop thread so the chardev may operate */
- g_mutex_init(&data_mutex);
- g_cond_init(&data_cond);
- g_mutex_lock(&data_mutex);
- g_thread_new(NULL, thread_function, NULL);
+ data_mutex = _mutex_new();
+ data_cond = _cond_new();
+ g_mutex_lock(data_mutex);
+ _thread_new(NULL, thread_function, NULL);
qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
s = qtest_start(qemu_cmd);
@@ -305,8 +403,8 @@ int main(int argc, char **argv)
/* cleanup */
unlink(socket_path);
g_free(socket_path);
- g_cond_clear(&data_cond);
- g_mutex_clear(&data_mutex);
+ _cond_free(data_cond);
+ _mutex_free(data_mutex);
return ret;
}
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
` (2 preceding siblings ...)
2014-06-19 15:07 ` [Qemu-devel] [PATCH 3/6] qtest: fix qtest for vhost-user Nikolay Nikolaev
@ 2014-06-19 15:08 ` Nikolay Nikolaev
2014-06-19 15:08 ` [Qemu-devel] [PATCH 5/6] vhost: fix migration_blocker initialization Nikolay Nikolaev
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:08 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
tests/vhost-user-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 2934379..2af2381 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -269,6 +269,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
return;
}
+ g_mutex_lock(data_mutex);
memcpy(p, buf, VHOST_USER_HDR_SIZE);
if (msg.size) {
@@ -302,7 +303,6 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
/* signal the test that it can continue */
g_cond_signal(data_cond);
- g_mutex_unlock(data_mutex);
break;
case VHOST_USER_SET_VRING_KICK:
@@ -319,6 +319,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
default:
break;
}
+ g_mutex_unlock(data_mutex);
}
static const char *init_hugepagefs(void)
@@ -385,7 +386,6 @@ int main(int argc, char **argv)
/* run the main loop thread so the chardev may operate */
data_mutex = _mutex_new();
data_cond = _cond_new();
- g_mutex_lock(data_mutex);
_thread_new(NULL, thread_function, NULL);
qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 5/6] vhost: fix migration_blocker initialization
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
` (3 preceding siblings ...)
2014-06-19 15:08 ` [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks Nikolay Nikolaev
@ 2014-06-19 15:08 ` Nikolay Nikolaev
2014-06-19 15:09 ` [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test Nikolay Nikolaev
2014-06-19 15:48 ` [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Michael S. Tsirkin
6 siblings, 0 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:08 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
error_set expect errp to be a NULL initialized pointer.
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
hw/virtio/vhost.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index c44c15c..e55fe1c 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -857,12 +857,11 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
+ hdev->migration_blocker = NULL;
if (!(hdev->features & (0x1 << VHOST_F_LOG_ALL))) {
error_setg(&hdev->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
migrate_add_blocker(hdev->migration_blocker);
- } else {
- hdev->migration_blocker = NULL;
}
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
hdev->n_mem_sections = 0;
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
` (4 preceding siblings ...)
2014-06-19 15:08 ` [Qemu-devel] [PATCH 5/6] vhost: fix migration_blocker initialization Nikolay Nikolaev
@ 2014-06-19 15:09 ` Nikolay Nikolaev
2014-06-19 15:41 ` Michael S. Tsirkin
2014-06-19 15:48 ` [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Michael S. Tsirkin
6 siblings, 1 reply; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:09 UTC (permalink / raw)
To: snabb-devel, qemu-devel, mst; +Cc: tech, n.nikolaev
Also use qtest-obj-y to get the right library order.
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
---
tests/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
index 4caf7de..db4accf 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -156,7 +156,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-y += 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))
@@ -323,11 +323,11 @@ 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
+LIBS+= -lutil
# QTest rules
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
@ 2014-06-19 15:35 ` Michael S. Tsirkin
2014-06-19 15:38 ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
0 siblings, 1 reply; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-06-19 15:35 UTC (permalink / raw)
To: Nikolay Nikolaev; +Cc: snabb-devel, qemu-devel, tech
On Thu, Jun 19, 2014 at 06:07:15PM +0300, Nikolay Nikolaev wrote:
> This will be used in net.c (for now) to enable vhos-user netdev backend.
>
> Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Did you test this with mingw?
> ---
> configure | 3 +++
> net/net.c | 4 ++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 9f4ba45..fb3c856 100755
> --- a/configure
> +++ b/configure
> @@ -4543,6 +4543,9 @@ fi
> if test "$vhost_scsi" = "yes" ; then
> echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
> fi
> +if test "$vhost_net" = "yes" ; then
> + echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
> +fi
> if test "$blobs" = "yes" ; then
> echo "INSTALL_BLOBS=yes" >> $config_host_mak
> fi
> diff --git a/net/net.c b/net/net.c
> index 0c30414..3dac29b 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -803,7 +803,7 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
> [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
> #endif
> [NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
> -#ifdef CONFIG_VHOST_NET
> +#ifdef CONFIG_VHOST_NET_USED
> [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
> #endif
> };
> @@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
> case NET_CLIENT_OPTIONS_KIND_BRIDGE:
> #endif
> case NET_CLIENT_OPTIONS_KIND_HUBPORT:
> -#ifdef CONFIG_VHOST_NET
> +#ifdef CONFIG_VHOST_NET_USED
> case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
> #endif
> break;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [snabb-devel] Re: [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED
2014-06-19 15:35 ` Michael S. Tsirkin
@ 2014-06-19 15:38 ` Nikolay Nikolaev
0 siblings, 0 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:38 UTC (permalink / raw)
To: snabb-devel@googlegroups.com
Cc: VirtualOpenSystems Technical Team, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]
On Thu, Jun 19, 2014 at 6:35 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Thu, Jun 19, 2014 at 06:07:15PM +0300, Nikolay Nikolaev wrote:
> > This will be used in net.c (for now) to enable vhos-user netdev backend.
> >
> > Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
>
> Did you test this with mingw?
>
No, I didn't manage to setup mingw under linux. But this "vhost_net" should
be enabled only for linux in configure. So if I understand it properly,
mingw should be safe.
regards,
Nikolay Nikolaev
>
> > ---
> > configure | 3 +++
> > net/net.c | 4 ++--
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 9f4ba45..fb3c856 100755
> > --- a/configure
> > +++ b/configure
> > @@ -4543,6 +4543,9 @@ fi
> > if test "$vhost_scsi" = "yes" ; then
> > echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
> > fi
> > +if test "$vhost_net" = "yes" ; then
> > + echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
> > +fi
> > if test "$blobs" = "yes" ; then
> > echo "INSTALL_BLOBS=yes" >> $config_host_mak
> > fi
> > diff --git a/net/net.c b/net/net.c
> > index 0c30414..3dac29b 100644
> > --- a/net/net.c
> > +++ b/net/net.c
> > @@ -803,7 +803,7 @@ static int (* const
> net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
> > [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
> > #endif
> > [NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
> > -#ifdef CONFIG_VHOST_NET
> > +#ifdef CONFIG_VHOST_NET_USED
> > [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
> > #endif
> > };
> > @@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int
> is_netdev, Error **errp)
> > case NET_CLIENT_OPTIONS_KIND_BRIDGE:
> > #endif
> > case NET_CLIENT_OPTIONS_KIND_HUBPORT:
> > -#ifdef CONFIG_VHOST_NET
> > +#ifdef CONFIG_VHOST_NET_USED
> > case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
> > #endif
> > break;
>
> --
> You received this message because you are subscribed to the Google Groups
> "Snabb Switch development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to snabb-devel+unsubscribe@googlegroups.com.
> To post to this group, send an email to snabb-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/snabb-devel.
>
[-- Attachment #2: Type: text/html, Size: 3709 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test
2014-06-19 15:09 ` [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test Nikolay Nikolaev
@ 2014-06-19 15:41 ` Michael S. Tsirkin
2014-06-19 17:18 ` Paolo Bonzini
0 siblings, 1 reply; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-06-19 15:41 UTC (permalink / raw)
To: Nikolay Nikolaev; +Cc: snabb-devel, qemu-devel, tech
On Thu, Jun 19, 2014 at 06:09:05PM +0300, Nikolay Nikolaev wrote:
> Also use qtest-obj-y to get the right library order.
>
> Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Seems to still break mingw build.
Please build-test it.
> ---
> tests/Makefile | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/Makefile b/tests/Makefile
> index 4caf7de..db4accf 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -156,7 +156,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-y += 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))
> @@ -323,11 +323,11 @@ 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
> +LIBS+= -lutil
>
> # QTest rules
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
` (5 preceding siblings ...)
2014-06-19 15:09 ` [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test Nikolay Nikolaev
@ 2014-06-19 15:48 ` Michael S. Tsirkin
2014-06-19 15:55 ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
6 siblings, 1 reply; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-06-19 15:48 UTC (permalink / raw)
To: Nikolay Nikolaev; +Cc: snabb-devel, qemu-devel, tech
On Thu, Jun 19, 2014 at 06:06:55PM +0300, Nikolay Nikolaev wrote:
> The following series enables vhost-user-test in make check.
>
> The first patch adds a new CONFIG_VHOST_NET_USED in configure
> to be used in net.c to enable vhost-user netdev backend.
>
> Fifth patch fixes an error when calling erro_setg in vhost_dev_init.
I squashed path 5 into mine, thanks a lot for the fix.
Patch 1-4 applied on the pci branch.
Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.
> ---
>
> Nikolay Nikolaev (6):
> configure: add new config define CONFIG_VHOST_NET_USED
> libqemustub: add more stubs for qemu-char
> qtest: fix qtest for vhost-user
> qtest: fix vhost-user-test unbalanced mutex locks
> vhost: fix migration_blocker initialization
> qtest: enable vhost-user-test
>
>
> configure | 3 +
> hw/virtio/vhost.c | 3 -
> net/net.c | 4 +
> stubs/Makefile.objs | 2 +
> stubs/chr-baum-init.c | 7 ++
> stubs/qemu-chr-open-spice.c | 12 ++++
> tests/Makefile | 6 +-
> tests/vhost-user-test.c | 128 ++++++++++++++++++++++++++++++++++++++-----
> 8 files changed, 143 insertions(+), 22 deletions(-)
> create mode 100644 stubs/chr-baum-init.c
> create mode 100644 stubs/qemu-chr-open-spice.c
>
> --
> Signature
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [snabb-devel] Re: [PATCH 0/6] vhost-user qtest fixes
2014-06-19 15:48 ` [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Michael S. Tsirkin
@ 2014-06-19 15:55 ` Nikolay Nikolaev
2014-06-19 16:20 ` Nikolay Nikolaev
0 siblings, 1 reply; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 15:55 UTC (permalink / raw)
To: snabb-devel@googlegroups.com
Cc: VirtualOpenSystems Technical Team, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]
On Thu, Jun 19, 2014 at 6:48 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Thu, Jun 19, 2014 at 06:06:55PM +0300, Nikolay Nikolaev wrote:
> > The following series enables vhost-user-test in make check.
> >
> > The first patch adds a new CONFIG_VHOST_NET_USED in configure
> > to be used in net.c to enable vhost-user netdev backend.
> >
> > Fifth patch fixes an error when calling erro_setg in vhost_dev_init.
>
> I squashed path 5 into mine, thanks a lot for the fix.
> Patch 1-4 applied on the pci branch.
> Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.
>
OK, thanks Michael!
I am still looking how to setup mingw. Any hints? Is compiling on windows
simpler?
regards,
Niklay Nikolaev
>
> > ---
> >
> > Nikolay Nikolaev (6):
> > configure: add new config define CONFIG_VHOST_NET_USED
> > libqemustub: add more stubs for qemu-char
> > qtest: fix qtest for vhost-user
> > qtest: fix vhost-user-test unbalanced mutex locks
> > vhost: fix migration_blocker initialization
> > qtest: enable vhost-user-test
> >
> >
> > configure | 3 +
> > hw/virtio/vhost.c | 3 -
> > net/net.c | 4 +
> > stubs/Makefile.objs | 2 +
> > stubs/chr-baum-init.c | 7 ++
> > stubs/qemu-chr-open-spice.c | 12 ++++
> > tests/Makefile | 6 +-
> > tests/vhost-user-test.c | 128
> ++++++++++++++++++++++++++++++++++++++-----
> > 8 files changed, 143 insertions(+), 22 deletions(-)
> > create mode 100644 stubs/chr-baum-init.c
> > create mode 100644 stubs/qemu-chr-open-spice.c
> >
> > --
> > Signature
>
> --
> You received this message because you are subscribed to the Google Groups
> "Snabb Switch development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to snabb-devel+unsubscribe@googlegroups.com.
> To post to this group, send an email to snabb-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/snabb-devel.
>
[-- Attachment #2: Type: text/html, Size: 3160 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char
2014-06-19 15:07 ` [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char Nikolay Nikolaev
@ 2014-06-19 16:06 ` Andrew Jones
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Jones @ 2014-06-19 16:06 UTC (permalink / raw)
To: Nikolay Nikolaev; +Cc: snabb-devel, qemu-devel, tech, mst
On Thu, Jun 19, 2014 at 06:07:40PM +0300, Nikolay Nikolaev wrote:
> Additional stubs:
> - chr_baum_init
> - qemu_chr_open_spice_vmc
> - qemu_chr_open_spice_port
>
> Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> ---
> stubs/Makefile.objs | 2 ++
> stubs/chr-baum-init.c | 7 +++++++
> stubs/qemu-chr-open-spice.c | 12 ++++++++++++
> 3 files changed, 21 insertions(+)
> create mode 100644 stubs/chr-baum-init.c
> create mode 100644 stubs/qemu-chr-open-spice.c
>
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 997d68d..2312076 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -1,5 +1,6 @@
> stub-obj-y += arch-query-cpu-def.o
> stub-obj-y += bdrv-commit-all.o
> +stub-obj-y += chr-baum-init.o
> stub-obj-y += chr-msmouse.o
> stub-obj-y += clock-warp.o
> stub-obj-y += cpu-get-clock.o
> @@ -24,6 +25,7 @@ stub-obj-y += mon-set-error.o
> stub-obj-y += monitor-init.o
> stub-obj-y += notify-event.o
> stub-obj-y += pci-drive-hot-add.o
> +stub-obj-y += qemu-chr-open-spice.o
> stub-obj-y += qtest.o
> stub-obj-y += reset.o
> stub-obj-y += runstate-check.o
> diff --git a/stubs/chr-baum-init.c b/stubs/chr-baum-init.c
> new file mode 100644
> index 0000000..f5cc6ce
> --- /dev/null
> +++ b/stubs/chr-baum-init.c
> @@ -0,0 +1,7 @@
> +#include "qemu-common.h"
> +#include "sysemu/char.h"
> +
> +CharDriverState *chr_baum_init(void)
> +{
> + return NULL;
> +}
> diff --git a/stubs/qemu-chr-open-spice.c b/stubs/qemu-chr-open-spice.c
> new file mode 100644
> index 0000000..40a29a9
> --- /dev/null
> +++ b/stubs/qemu-chr-open-spice.c
> @@ -0,0 +1,12 @@
> +#include "qemu-common.h"
> +#include "ui/qemu-spice.h"
> +
> +CharDriverState *qemu_chr_open_spice_vmc(const char *type)
> +{
> + return NULL;
> +}
> +
> +CharDriverState *qemu_chr_open_spice_port(const char *name)
> +{
> + return NULL;
> +}
>
>
The build breaks for '--disable-spice' configs now. You get
.../stubs/qemu-chr-open-spice.c:4:18:
error: no previous prototype for 'qemu_chr_open_spice_vmc'
[-Werror=missing-prototypes]
CharDriverState *qemu_chr_open_spice_vmc(const char *type)
^
.../stubs/qemu-chr-open-spice.c:9:18:
error: no previous prototype for 'qemu_chr_open_spice_port'
[-Werror=missing-prototypes]
CharDriverState *qemu_chr_open_spice_port(const char *name)
^
I believe you need something like the following instead
drew
#include "qemu-common.h"
#include "ui/qemu-spice.h"
#ifdef CONFIG_SPICE
CharDriverState *qemu_chr_open_spice_vmc(const char *type)
{
return NULL;
}
#if SPICE_SERVER_VERSION >= 0x000c02
CharDriverState *qemu_chr_open_spice_port(const char *name)
{
return NULL;
}
#endif
#endif
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [snabb-devel] Re: [PATCH 0/6] vhost-user qtest fixes
2014-06-19 15:55 ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
@ 2014-06-19 16:20 ` Nikolay Nikolaev
0 siblings, 0 replies; 15+ messages in thread
From: Nikolay Nikolaev @ 2014-06-19 16:20 UTC (permalink / raw)
To: snabb-devel@googlegroups.com
Cc: VirtualOpenSystems Technical Team, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]
On Thu, Jun 19, 2014 at 6:55 PM, Nikolay Nikolaev <
n.nikolaev@virtualopensystems.com> wrote:
>
>
>
> On Thu, Jun 19, 2014 at 6:48 PM, Michael S. Tsirkin <mst@redhat.com>
> wrote:
>
>> On Thu, Jun 19, 2014 at 06:06:55PM +0300, Nikolay Nikolaev wrote:
>> > The following series enables vhost-user-test in make check.
>> >
>> > The first patch adds a new CONFIG_VHOST_NET_USED in configure
>> > to be used in net.c to enable vhost-user netdev backend.
>> >
>> > Fifth patch fixes an error when calling erro_setg in vhost_dev_init.
>>
>> I squashed path 5 into mine, thanks a lot for the fix.
>> Patch 1-4 applied on the pci branch.
>> Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.
>>
>
> OK, thanks Michael!
> I am still looking how to setup mingw. Any hints? Is compiling on windows
> simpler?
>
> regards,
> Niklay Nikolaev
>
After removing the -lutil line it still breaks for my mingw:
../backends/hostmem.o: In function `host_memory_backend_memory_complete':
/home/nickolaev/workspace/qemu/backends/hostmem.c:342: undefined reference
to `os_mem_prealloc'
regards,
Nikolay Nikolaev
>
>
>>
>> > ---
>> >
>> > Nikolay Nikolaev (6):
>> > configure: add new config define CONFIG_VHOST_NET_USED
>> > libqemustub: add more stubs for qemu-char
>> > qtest: fix qtest for vhost-user
>> > qtest: fix vhost-user-test unbalanced mutex locks
>> > vhost: fix migration_blocker initialization
>> > qtest: enable vhost-user-test
>> >
>> >
>> > configure | 3 +
>> > hw/virtio/vhost.c | 3 -
>> > net/net.c | 4 +
>> > stubs/Makefile.objs | 2 +
>> > stubs/chr-baum-init.c | 7 ++
>> > stubs/qemu-chr-open-spice.c | 12 ++++
>> > tests/Makefile | 6 +-
>> > tests/vhost-user-test.c | 128
>> ++++++++++++++++++++++++++++++++++++++-----
>> > 8 files changed, 143 insertions(+), 22 deletions(-)
>> > create mode 100644 stubs/chr-baum-init.c
>> > create mode 100644 stubs/qemu-chr-open-spice.c
>> >
>> > --
>> > Signature
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Snabb Switch development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to snabb-devel+unsubscribe@googlegroups.com.
>> To post to this group, send an email to snabb-devel@googlegroups.com.
>> Visit this group at http://groups.google.com/group/snabb-devel.
>>
>
>
[-- Attachment #2: Type: text/html, Size: 4264 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test
2014-06-19 15:41 ` Michael S. Tsirkin
@ 2014-06-19 17:18 ` Paolo Bonzini
0 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2014-06-19 17:18 UTC (permalink / raw)
To: snabb-devel, Nikolay Nikolaev; +Cc: tech, qemu-devel
Il 19/06/2014 17:41, Michael S. Tsirkin ha scritto:
>> +check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
Just using check-qtest-i386-$(CONFIG_POSIX) will work. Windows doesn't
have Unix sockets.
Paolo
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-06-19 17:19 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19 15:06 [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED Nikolay Nikolaev
2014-06-19 15:35 ` Michael S. Tsirkin
2014-06-19 15:38 ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
2014-06-19 15:07 ` [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char Nikolay Nikolaev
2014-06-19 16:06 ` Andrew Jones
2014-06-19 15:07 ` [Qemu-devel] [PATCH 3/6] qtest: fix qtest for vhost-user Nikolay Nikolaev
2014-06-19 15:08 ` [Qemu-devel] [PATCH 4/6] qtest: fix vhost-user-test unbalanced mutex locks Nikolay Nikolaev
2014-06-19 15:08 ` [Qemu-devel] [PATCH 5/6] vhost: fix migration_blocker initialization Nikolay Nikolaev
2014-06-19 15:09 ` [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test Nikolay Nikolaev
2014-06-19 15:41 ` Michael S. Tsirkin
2014-06-19 17:18 ` Paolo Bonzini
2014-06-19 15:48 ` [Qemu-devel] [PATCH 0/6] vhost-user qtest fixes Michael S. Tsirkin
2014-06-19 15:55 ` [Qemu-devel] [snabb-devel] " Nikolay Nikolaev
2014-06-19 16:20 ` Nikolay Nikolaev
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).