Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Stefan Hajnoczi
On Fri, Apr 24, 2015 at 10:47 AM, Stefan Hajnoczi stefa...@gmail.com wrote: At this level it's compared to vhost-user, but it's not programmable in userspace! s/compared/comparable/ ___ Virtualization mailing list

Re: [PATCH v5 6/8] virtio: add explicit big-endian support to memory accessors

2015-04-24 Thread Greg Kurz
On Fri, 24 Apr 2015 09:04:21 +0200 Cornelia Huck cornelia.h...@de.ibm.com wrote: On Thu, 23 Apr 2015 21:27:19 +0200 Thomas Huth th...@redhat.com wrote: Thomas's e-mail did not make it to my mailbox... weird. :-\ On Thu, 23 Apr 2015 17:29:06 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote:

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Luke Gorrie
Hi Stefan, Great topic. I am also extremely interested in helping Virtio-net become the standard for the networking industry (the universe of DPDK, etc). On 22 April 2015 at 19:01, Stefan Hajnoczi stefa...@redhat.com wrote: [It may be necessary to remove virtio-...@lists.oasis-open.org from CC

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Stefan Hajnoczi
On Fri, Apr 24, 2015 at 9:12 AM, Luke Gorrie l...@snabb.co wrote: - How fast would the new design likely be? This proposal eliminates two things in the path: 1. Compared to vhost_net, it bypasses the host tun driver and network stack, replacing it with direct vhost_net - vhost_net data

Re: [PATCH v5 7/8] vhost: cross-endian support for legacy devices

2015-04-24 Thread Cornelia Huck
On Fri, 24 Apr 2015 10:06:19 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: On Fri, 24 Apr 2015 09:19:26 +0200 Cornelia Huck cornelia.h...@de.ibm.com wrote: On Thu, 23 Apr 2015 17:29:42 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: diff --git a/include/uapi/linux/vhost.h

Re: [PATCH v5 7/8] vhost: cross-endian support for legacy devices

2015-04-24 Thread Greg Kurz
On Fri, 24 Apr 2015 09:19:26 +0200 Cornelia Huck cornelia.h...@de.ibm.com wrote: On Thu, 23 Apr 2015 17:29:42 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: This patch brings cross-endian support to vhost when used to implement legacy virtio devices. Since it is a relatively rare

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Paolo Bonzini
On 24/04/2015 10:12, Luke Gorrie wrote: I think this approach could be fruitful in bringing virtio-net to VM-to-VM networking use cases. Unless virtio-net is extended for this use case, I'm afraid DPDK and OpenDataPlane communities might steer clear of VIRTIO.

[PATCH v6 6/8] virtio: add explicit big-endian support to memory accessors

2015-04-24 Thread Greg Kurz
The current memory accessors logic is: - little endian if little_endian - native endian (i.e. no byteswap) if !little_endian If we want to fully support cross-endian vhost, we also need to be able to convert to big endian. Instead of changing the little_endian argument to some 3-value enum, this

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Luke Gorrie
On 24 April 2015 at 11:47, Stefan Hajnoczi stefa...@gmail.com wrote: Incidentally, we also did a pile of work last year on zero-copy NIC-VM transfers and discovered a lot of interesting problems and edge cases where Virtio-net spec and/or drivers are hard to match up with common NICs.

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Stefan Hajnoczi
On Fri, Apr 24, 2015 at 1:17 PM, Luke Gorrie l...@snabb.co wrote: On 24 April 2015 at 11:47, Stefan Hajnoczi stefa...@gmail.com wrote: My concern is the overhead of the vhost_net component copying descriptors between NICs. I see. So you would not have to reserve CPU resources for vswitches.

Re: [PATCH v6 0/8] vhost: support for cross endian guests

2015-04-24 Thread Michael S. Tsirkin
On Fri, Apr 24, 2015 at 02:24:15PM +0200, Greg Kurz wrote: Only cosmetic and documentation changes since v5. --- Looks sane to me. I plan to review and apply next week. Greg Kurz (8): virtio: introduce virtio_is_little_endian() helper tun: add tun_is_little_endian() helper

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Stefan Hajnoczi
On Fri, Apr 24, 2015 at 2:10 PM, Luke Gorrie l...@snabb.co wrote: On 24 April 2015 at 14:17, Luke Gorrie l...@snabb.co wrote: For what it is worth, I think Erm, sorry about ranting with my pre-existing ideas without having examined the proposed specification in detail. My experience with

[PATCH v6 0/8] vhost: support for cross endian guests

2015-04-24 Thread Greg Kurz
Only cosmetic and documentation changes since v5. --- Greg Kurz (8): virtio: introduce virtio_is_little_endian() helper tun: add tun_is_little_endian() helper macvtap: introduce macvtap_is_little_endian() helper vringh: introduce vringh_is_little_endian() helper

Re: [virtio-dev] Zerocopy VM-to-VM networking using virtio-net

2015-04-24 Thread Luke Gorrie
On 24 April 2015 at 14:17, Luke Gorrie l...@snabb.co wrote: For what it is worth, I think Erm, sorry about ranting with my pre-existing ideas without having examined the proposed specification in detail. I have a long backlog of things that I have been meaning to discuss with the Virtio-net

[PATCH v6 5/8] vhost: introduce vhost_is_little_endian() helper

2015-04-24 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/vhost/vhost.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8c1c792..6a49960 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h

[PATCH v6 4/8] vringh: introduce vringh_is_little_endian() helper

2015-04-24 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/vringh.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/vringh.h b/include/linux/vringh.h index a3fa537..3ed62ef 100644 --- a/include/linux/vringh.h +++

[PATCH v6 2/8] tun: add tun_is_little_endian() helper

2015-04-24 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/net/tun.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 857dca4..3c3d6c0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -206,14 +206,19 @@ struct

[PATCH v6 1/8] virtio: introduce virtio_is_little_endian() helper

2015-04-24 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/virtio_config.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index ca3ed78..bd1a582 100644 ---

[PATCH v6 3/8] macvtap: introduce macvtap_is_little_endian() helper

2015-04-24 Thread Greg Kurz
Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/net/macvtap.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 27ecc5c..a2f2958 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -49,14

[PATCH v6 8/8] macvtap/tun: cross-endian support for little-endian hosts

2015-04-24 Thread Greg Kurz
The VNET_LE flag was introduced to fix accesses to virtio 1.0 headers that are always little-endian. It can also be used to handle the special case of a legacy little-endian device implemented by a big-endian host. Let's add a flag and ioctls for big-endian devices as well. If both flags are set,

Re: [PATCH v5 1/8] virtio: introduce virtio_is_little_endian() helper

2015-04-24 Thread Thomas Huth
Am Thu, 23 Apr 2015 17:26:20 +0200 schrieb Greg Kurz gk...@linux.vnet.ibm.com: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/virtio_config.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/virtio_config.h

Re: [PATCH v5 4/8] vringh: introduce vringh_is_little_endian() helper

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:26:52 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/vringh.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/vringh.h b/include/linux/vringh.h

Re: [PATCH v5 5/8] vhost: introduce vhost_is_little_endian() helper

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:27:05 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/vhost/vhost.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h

Re: [PATCH v5 6/8] virtio: add explicit big-endian support to memory accessors

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:29:06 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: The current memory accessors logic is: - little endian if little_endian - native endian (i.e. no byteswap) if !little_endian If we want to fully support cross-endian vhost, we also need to be able to convert to

Re: [PATCH v5 1/8] virtio: introduce virtio_is_little_endian() helper

2015-04-24 Thread Thomas Huth
Am Thu, 23 Apr 2015 19:22:15 +0200 schrieb Thomas Huth th...@redhat.com: Am Thu, 23 Apr 2015 17:26:20 +0200 schrieb Greg Kurz gk...@linux.vnet.ibm.com: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/virtio_config.h | 17 +++-- 1 file changed, 11

Re: [PATCH v5 1/8] virtio: introduce virtio_is_little_endian() helper

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:26:20 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- include/linux/virtio_config.h | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/virtio_config.h

Re: [PATCH v5 2/8] tun: add tun_is_little_endian() helper

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:26:30 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/net/tun.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 857dca4..3c3d6c0

Re: [PATCH v5 3/8] macvtap: introduce macvtap_is_little_endian() helper

2015-04-24 Thread Thomas Huth
On Thu, 23 Apr 2015 17:26:41 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: Signed-off-by: Greg Kurz gk...@linux.vnet.ibm.com --- drivers/net/macvtap.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index

[PATCH v16 01/14] qspinlock: A simple generic 4-byte queue spinlock

2015-04-24 Thread Waiman Long
This patch introduces a new generic queue spinlock implementation that can serve as an alternative to the default ticket spinlock. Compared with the ticket spinlock, this queue spinlock should be almost as fair as the ticket spinlock. It has about the same speed in single-thread and it can be much

[PATCH v16 00/14] qspinlock: a 4-byte queue spinlock with PV support

2015-04-24 Thread Waiman Long
v15-v16: - Remove the lfsr patch and use linear probing as lfsr is not really necessary in most cases. - Move the paravirt PV_CALLEE_SAVE_REGS_THUNK code to an asm header. - Add a patch to collect PV qspinlock statistics which also supersedes the PV lock hash debug patch. - Add PV

[PATCH v16 04/14] qspinlock: Extract out code snippets for the next patch

2015-04-24 Thread Waiman Long
This is a preparatory patch that extracts out the following 2 code snippets to prepare for the next performance optimization patch. 1) the logic for the exchange of new and previous tail code words into a new xchg_tail() function. 2) the logic for clearing the pending bit and setting the

[PATCH v16 06/14] qspinlock: Use a simple write to grab the lock

2015-04-24 Thread Waiman Long
Currently, atomic_cmpxchg() is used to get the lock. However, this is not really necessary if there is more than one task in the queue and the queue head don't need to reset the tail code. For that case, a simple write to set the lock bit is enough as the queue head will be the only one eligible

[PATCH v16 02/14] qspinlock, x86: Enable x86-64 to use queue spinlock

2015-04-24 Thread Waiman Long
This patch makes the necessary changes at the x86 architecture specific layer to enable the use of queue spinlock for x86-64. As x86-32 machines are typically not multi-socket. The benefit of queue spinlock may not be apparent. So queue spinlock is not enabled. Currently, there is some

[PATCH v16 03/14] qspinlock: Add pending bit

2015-04-24 Thread Waiman Long
From: Peter Zijlstra (Intel) pet...@infradead.org Because the qspinlock needs to touch a second cacheline (the per-cpu mcs_nodes[]); add a pending bit and allow a single in-word spinner before we punt to the second cacheline. It is possible so observe the pending bit without the locked bit when

[PATCH v16 14/14] pvqspinlock: Collect slowpath lock statistics

2015-04-24 Thread Waiman Long
This patch enables the accumulation of PV qspinlock statistics when either one of the following three sets of CONFIG parameters are enabled: 1) CONFIG_LOCK_STAT CONFIG_DEBUG_FS 2) CONFIG_KVM_DEBUG_FS 3) CONFIG_XEN_DEBUG_FS The accumulated lock statistics will be reported in debugfs under the

[PATCH v16 12/14] pvqspinlock: Only kick CPU at unlock time

2015-04-24 Thread Waiman Long
Before this patch, a CPU may have been kicked twice before getting the lock - one before it becomes queue head and once before it gets the lock. All these CPU kicking and halting (VMEXIT) can be expensive and slow down system performance, especially in an overcommitted guest. This patch adds a

[PATCH v16 13/14] pvqspinlock: Improve slowpath performance by avoiding cmpxchg

2015-04-24 Thread Waiman Long
In the pv_scan_next() function, the slow cmpxchg atomic operation is performed even if the other CPU is not even close to being halted. This extra cmpxchg can harm slowpath performance. This patch introduces the new mayhalt flag to indicate if the other spinning CPU is close to being halted or

CfP Virtualization in High-Performance Cloud Computing Workshop (VHPC '15)

2015-04-24 Thread VHPC 15
= CALL FOR PAPERS 10th Workshop on Virtualization in High-Performance Cloud Computing (VHPC '15) held in conjunction with Euro-Par 2015, August 24-28, Vienna, Austria (Springer LNCS)

[PATCH v16 05/14] qspinlock: Optimize for smaller NR_CPUS

2015-04-24 Thread Waiman Long
From: Peter Zijlstra (Intel) pet...@infradead.org When we allow for a max NR_CPUS 2^14 we can optimize the pending wait-acquire and the xchg_tail() operations. By growing the pending bit to a byte, we reduce the tail to 16bit. This means we can use xchg16 for the tail part and do away with all

[PATCH v16 10/14] pvqspinlock, x86: Enable PV qspinlock for KVM

2015-04-24 Thread Waiman Long
This patch adds the necessary KVM specific code to allow KVM to support the CPU halting and kicking operations needed by the queue spinlock PV code. Signed-off-by: Waiman Long waiman.l...@hp.com --- arch/x86/kernel/kvm.c | 43 +++ kernel/Kconfig.locks |

[PATCH v16 07/14] qspinlock: Revert to test-and-set on hypervisors

2015-04-24 Thread Waiman Long
From: Peter Zijlstra (Intel) pet...@infradead.org When we detect a hypervisor (!paravirt, see qspinlock paravirt support patches), revert to a simple test-and-set lock to avoid the horrors of queue preemption. Signed-off-by: Peter Zijlstra (Intel) pet...@infradead.org Signed-off-by: Waiman Long

[PATCH v16 09/14] pvqspinlock, x86: Implement the paravirt qspinlock call patching

2015-04-24 Thread Waiman Long
From: Peter Zijlstra (Intel) pet...@infradead.org We use the regular paravirt call patching to switch between: native_queue_spin_lock_slowpath() __pv_queue_spin_lock_slowpath() native_queue_spin_unlock()__pv_queue_spin_unlock() We use a callee saved call for the unlock

[PATCH v16 08/14] pvqspinlock: Implement simple paravirt support for the qspinlock

2015-04-24 Thread Waiman Long
Provide a separate (second) version of the spin_lock_slowpath for paravirt along with a special unlock path. The second slowpath is generated by adding a few pv hooks to the normal slowpath, but where those will compile away for the native case, they expand into special wait/wake code for the pv

[PATCH v16 11/14] pvqspinlock, x86: Enable PV qspinlock for Xen

2015-04-24 Thread Waiman Long
From: David Vrabel david.vra...@citrix.com This patch adds the necessary Xen specific code to allow Xen to support the CPU halting and kicking operations needed by the queue spinlock PV code. Signed-off-by: David Vrabel david.vra...@citrix.com Signed-off-by: Waiman Long waiman.l...@hp.com ---

Re: [PATCH v5 6/8] virtio: add explicit big-endian support to memory accessors

2015-04-24 Thread Cornelia Huck
On Thu, 23 Apr 2015 21:27:19 +0200 Thomas Huth th...@redhat.com wrote: On Thu, 23 Apr 2015 17:29:06 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: The current memory accessors logic is: - little endian if little_endian - native endian (i.e. no byteswap) if !little_endian If we

Re: [PATCH v5 7/8] vhost: cross-endian support for legacy devices

2015-04-24 Thread Cornelia Huck
On Thu, 23 Apr 2015 17:29:42 +0200 Greg Kurz gk...@linux.vnet.ibm.com wrote: This patch brings cross-endian support to vhost when used to implement legacy virtio devices. Since it is a relatively rare situation, the feature availability is controlled by a kernel config option (not set by