[dpdk-dev] [PATCH] vhost: enable live migration

2015-06-09 Thread Long, Thomas


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Thursday, June 4, 2015 2:00 PM
> To: Xie, Huawei
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] vhost: enable live migration

> 2015-06-01 04:47, Ouyang, Changchun:
> >  From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Huawei Xie
> > > When we migrate VM, without this feature, qemu will report error :
> > > "migrate: Migration disabled: vhost lacks VHOST_F_LOG_ALL feature".
> > 
> > Is this enough for vhost to support  migrate VM?
> > I remember Claire has another patch, possibly need refer to that patch.

> Indeed, there were some patches which do not build:
>   http://dpdk.org/ml/archives/dev/2014-August/005050.html
> And there was no answer.

The log name is incorrect in Claire's patch and "CONFIG" needs to replaced with 
"VHOST_CONFIG". It also only supported migration for vhost_cuse. Claire left 
the org around the same time and the patch was not picked up



> [...]
> > > + (1ULL << VHOST_F_LOG_ALL))

> Please check if this line is sufficient.

This should be sufficient to enable migration for vhost-user. 

The previous patch with the CONFIG log fix enables migration for vhost-cuse. 
The behavior of qemu with vhost_cuse when migrating is to turn on the migration 
flag before migration regardless of what the backend advertises as being 
supported and to disable it again once migration has been completed. This is 
why Claire's patch ignores the VHOST_F_LOG_ALL setting although I don't think 
this is the right way to implement this.  If the current patch is combined with 
the vhost_net_ioctl modifications of the original patch then it should enable 
migration for both vhost-cuse and vhost-user. 

> Thanks


[dpdk-dev] [PATCH 0/2] vhost: numa aware allocation of virtio_net device and vhost virt queue

2015-06-09 Thread Long, Thomas
Acked-by: Tommy Long 

-Original Message-
From: Xie, Huawei 
Sent: Friday, June 5, 2015 4:13 AM
To: dev at dpdk.org
Cc: Long, Thomas
Subject: [PATCH 0/2] vhost: numa aware allocation of virtio_net device and 
vhost virt queue

The virtio_net device and vhost virt queue should be allocated on the same numa 
node as vring descriptors.
When we firstly allocate the virtio_net device and vhost virt queue, we don't 
know the numa node of vring descriptors.
When we receive the VHOST_SET_VRING_ADDR message, we get the numa node of vring 
descriptors, so we will try to reallocate virtio_net and vhost virt queue to 
the same numa node.

Huawei Xie (2):
  use rte_malloc/free for virtio_net and virt_queue memory data allocation/free
  When we get the address of vring descriptor table, will try to reallocate 
virtio_net device and virtqueue to the same numa node.

 config/common_linuxapp|   1 +
 lib/librte_vhost/Makefile |   4 ++
 lib/librte_vhost/virtio-net.c | 112 ++
 mk/rte.app.mk |   3 ++
 4 files changed, 111 insertions(+), 9 deletions(-)

-- 
1.8.1.4



[dpdk-dev] [PATCH RFC 0/2] vhost: numa aware allocation of virtio_net device and vhost virt queue

2015-06-03 Thread Long, Thomas
Acked-by: Tommy Long 

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Huawei Xie
Sent: Thursday, May 28, 2015 3:04 AM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH RFC 0/2] vhost: numa aware allocation of virtio_net 
device and vhost virt queue

The virtio_net device and vhost virt queue should be allocated on the same numa 
node as vring descriptors.
When we firstly allocate the virtio_net device and vhost virt queue, we don't 
know the numa node of vring descriptors.
When we receive the VHOST_SET_VRING_ADDR message, we get the numa node of vring 
descriptors, so we will try to reallocate virtio_net and vhost virt queue to 
the same numa node.

Huawei Xie (2):
  use rte_malloc/free for virtio_net and virt_queue memory data allocation/free
  When we get the address of vring descriptor table, will try to reallocate 
virtio_net device and virtqueue to the same numa node.

 config/common_linuxapp|   1 +
 lib/librte_vhost/Makefile |   4 ++
 lib/librte_vhost/virtio-net.c | 112 ++
 mk/rte.app.mk |   3 ++
 4 files changed, 111 insertions(+), 9 deletions(-)

-- 
1.8.1.4



[dpdk-dev] [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message

2015-03-04 Thread Long, Thomas
Acked-by: Tommy Long  


-Original Message-
From: Xie, Huawei 
Sent: Tuesday, March 3, 2015 2:26 AM
To: dev at dpdk.org
Cc: haifeng.lin at huawei.com; mukawa at igel.co.jp; Long, Thomas; Xie, Huawei
Subject: [PATCH] lib/librte_vhost: remove vhost device from data plane when 
receive VHOST_SET_MEM_TABLE message

This patch fixes the segfault issue in the case vhost receives new 
VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which we uses as 
the stop message).

Signed-off-by: Huawei Xie 
---
 lib/librte_vhost/vhost_user/virtio-net-user.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c 
b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 97c5177..aa08706 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -109,6 +109,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct 
VhostUserMsg *pmsg)
if (dev == NULL)
return -1;

+   /* Remove from the data plane. */
+   if (dev->flags & VIRTIO_DEV_RUNNING)
+   notify_ops->destroy_device(dev);
+
if (dev->mem) {
free_mem_region(dev);
free(dev->mem);
-- 
1.8.1.4



[dpdk-dev] [PATCH v2] lib/librte_vhost: vhost library support to facilitate integration with vswitch.

2014-07-25 Thread Long, Thomas
Acked-by: Tommy Long 

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Huawei Xie
Sent: Friday, July 18, 2014 10:56 AM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH v2] lib/librte_vhost: vhost library support to 
facilitate integration with vswitch.

Signed-off-by: Huawei Xie 
---
 config/common_linuxapp   |7 +
 lib/Makefile |1 +
 lib/librte_vhost/Makefile|   48 ++
 lib/librte_vhost/eventfd_link/Makefile   |   39 +
 lib/librte_vhost/eventfd_link/eventfd_link.c |  205 ++
 lib/librte_vhost/eventfd_link/eventfd_link.h |   79 ++
 lib/librte_vhost/rte_virtio_net.h|  192 +
 lib/librte_vhost/vhost-net-cdev.c|  363 ++
 lib/librte_vhost/vhost-net-cdev.h|  112 +++
 lib/librte_vhost/vhost_rxtx.c|  292 
 lib/librte_vhost/virtio-net.c| 1002 ++
 11 files changed, 2340 insertions(+)
 create mode 100644 lib/librte_vhost/Makefile
 create mode 100644 lib/librte_vhost/eventfd_link/Makefile
 create mode 100644 lib/librte_vhost/eventfd_link/eventfd_link.c
 create mode 100644 lib/librte_vhost/eventfd_link/eventfd_link.h
 create mode 100644 lib/librte_vhost/rte_virtio_net.h
 create mode 100644 lib/librte_vhost/vhost-net-cdev.c
 create mode 100644 lib/librte_vhost/vhost-net-cdev.h
 create mode 100644 lib/librte_vhost/vhost_rxtx.c
 create mode 100644 lib/librte_vhost/virtio-net.c

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7bf5d80..5b58278 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -390,6 +390,13 @@ CONFIG_RTE_KNI_VHOST_DEBUG_RX=n
 CONFIG_RTE_KNI_VHOST_DEBUG_TX=n

 #
+# Compile vhost library
+# fuse, fuse-devel, kernel-modules-extra packages are needed
+#
+CONFIG_RTE_LIBRTE_VHOST=n
+CONFIG_RTE_LIBRTE_VHOST_DEBUG=n
+
+#
 #Compile Xen domain0 support
 #
 CONFIG_RTE_LIBRTE_XEN_DOM0=n
diff --git a/lib/Makefile b/lib/Makefile
index 10c5bb3..007c174 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -60,6 +60,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_METER) += librte_meter
 DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += librte_sched
 DIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += librte_kvargs
 DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
+DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
 DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
new file mode 100644
index 000..f79778b
--- /dev/null
+++ b/lib/librte_vhost/Makefile
@@ -0,0 +1,48 @@
+#   BSD LICENSE
+# 
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+# 
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+# 
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+# 
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_vhost.a
+
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64 -lfuse
+LDFLAGS += -lfuse
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := vhost-net-cdev.c virtio-net.c vhost_rxtx.c
+
+# install includes
+SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h
+
+# this lib needs eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal lib/librte_mbuf
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_vhost/eventfd_link/Makefile 
b/lib/librte_vhost/eventfd_link/Makefile
new file mode 100644
index 000..5f