Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-20 Thread Rusty Russell
On Fri, 14 Aug 2009 12:23:46 am Arnd Bergmann wrote: On Thursday 13 August 2009, Michael S. Tsirkin wrote: The best way to do this IMO would be to add zero copy support to raw sockets, vhost will then get it basically for free. Yes, that would be nice. I wonder if that could lead to

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 07:59:47PM +0200, Arnd Bergmann wrote: The trick is to swap the virtqueues instead. virtio-net is actually mostly symmetric in just the same way that the physical wires on a twisted pair ethernet are symmetric (I like how that analogy fits). You need to really squint

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 02:27:31PM -0500, Anthony Liguori wrote: Arnd Bergmann wrote: As I pointed out earlier, most code in virtio net is asymmetrical: guest provides buffers, host consumes them. Possibly, one could use virtio rings in a symmetrical way, but support of existing guest virtio

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 02:22:38PM -0500, Anthony Liguori wrote: Michael S. Tsirkin wrote: We discussed this before, and I still think this could be directly derived from struct virtqueue, in the same way that vring_virtqueue is derived from struct virtqueue. I prefer keeping it

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Arnd Bergmann
On Wednesday 12 August 2009, Anthony Liguori wrote: At any rate, I'd like to see performance results before we consider trying to reuse virtio code. Yes, I agree. I'd also like to do more work on the macvlan extensions to see if it works out without involving a socket. Passing the socket into

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Arnd Bergmann
On Thursday 13 August 2009, Arnd Bergmann wrote: Unfortunately, this also implies that you could no longer simply use the packet socket interface as you do currently, as I realized only now. This obviously has a significant impact on your user space interface. Also, if we do the copy in the

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Arnd Bergmann
On Thursday 13 August 2009, Michael S. Tsirkin wrote: On Wed, Aug 12, 2009 at 07:59:47PM +0200, Arnd Bergmann wrote: The trick is to swap the virtqueues instead. virtio-net is actually mostly symmetric in just the same way that the physical wires on a twisted pair ethernet are symmetric (I

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Thu, Aug 13, 2009 at 03:38:43PM +0200, Arnd Bergmann wrote: On Thursday 13 August 2009, Michael S. Tsirkin wrote: On Wed, Aug 12, 2009 at 07:59:47PM +0200, Arnd Bergmann wrote: The trick is to swap the virtqueues instead. virtio-net is actually mostly symmetric in just the same way

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Thu, Aug 13, 2009 at 03:48:35PM +0200, Arnd Bergmann wrote: On Thursday 13 August 2009, Arnd Bergmann wrote: Unfortunately, this also implies that you could no longer simply use the packet socket interface as you do currently, as I realized only now. This obviously has a significant

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Arnd Bergmann
On Thursday 13 August 2009, Michael S. Tsirkin wrote: The best way to do this IMO would be to add zero copy support to raw sockets, vhost will then get it basically for free. Yes, that would be nice. I wonder if that could lead to security problems on TX though. I guess It will only bring

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Arnd Bergmann
On Thursday 13 August 2009, Michael S. Tsirkin wrote: Right now, the number of copy operations in your code is the same. You are doing the copy a little bit later in skb_copy_datagram_iovec(), which is indeed a very nice hack. Changing to a virtqueue based method would imply that the host

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Michael S. Tsirkin
On Thu, Aug 13, 2009 at 04:58:06PM +0200, Arnd Bergmann wrote: On Thursday 13 August 2009, Michael S. Tsirkin wrote: Right now, the number of copy operations in your code is the same. You are doing the copy a little bit later in skb_copy_datagram_iovec(), which is indeed a very nice

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-13 Thread Avi Kivity
On 08/13/2009 05:53 PM, Arnd Bergmann wrote: On Thursday 13 August 2009, Michael S. Tsirkin wrote: The best way to do this IMO would be to add zero copy support to raw sockets, vhost will then get it basically for free. Yes, that would be nice. I wonder if that could lead to

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Arnd Bergmann
On Monday 10 August 2009, Michael S. Tsirkin wrote: +struct workqueue_struct *vhost_workqueue; [nitpicking] This could be static. +/* The virtqueue structure describes a queue attached to a device. */ +struct vhost_virtqueue { + struct vhost_dev *dev; + + /* The actual ring of

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Ira W. Snyder
On Wed, Aug 12, 2009 at 07:03:22PM +0200, Arnd Bergmann wrote: On Monday 10 August 2009, Michael S. Tsirkin wrote: +struct workqueue_struct *vhost_workqueue; [nitpicking] This could be static. +/* The virtqueue structure describes a queue attached to a device. */ +struct

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 07:03:22PM +0200, Arnd Bergmann wrote: On Monday 10 August 2009, Michael S. Tsirkin wrote: +struct workqueue_struct *vhost_workqueue; [nitpicking] This could be static. Good catch. Thanks! +/* The virtqueue structure describes a queue attached to a device. */

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 10:19:22AM -0700, Ira W. Snyder wrote: On Wed, Aug 12, 2009 at 07:03:22PM +0200, Arnd Bergmann wrote: On Monday 10 August 2009, Michael S. Tsirkin wrote: +struct workqueue_struct *vhost_workqueue; [nitpicking] This could be static. +/* The virtqueue

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Ira W. Snyder
On Wed, Aug 12, 2009 at 08:31:04PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 12, 2009 at 10:19:22AM -0700, Ira W. Snyder wrote: [ snip out code ] We discussed this before, and I still think this could be directly derived from struct virtqueue, in the same way that vring_virtqueue

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Arnd Bergmann
On Wednesday 12 August 2009, Michael S. Tsirkin wrote: On Wed, Aug 12, 2009 at 07:03:22PM +0200, Arnd Bergmann wrote: We discussed this before, and I still think this could be directly derived from struct virtqueue, in the same way that vring_virtqueue is derived from struct virtqueue. I

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Anthony Liguori
Michael S. Tsirkin wrote: We discussed this before, and I still think this could be directly derived from struct virtqueue, in the same way that vring_virtqueue is derived from struct virtqueue. I prefer keeping it simple. Much of abstraction in virtio is due to the fact that it needs to

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Anthony Liguori
Arnd Bergmann wrote: As I pointed out earlier, most code in virtio net is asymmetrical: guest provides buffers, host consumes them. Possibly, one could use virtio rings in a symmetrical way, but support of existing guest virtio net means there's almost no shared code. The trick is to

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Paul E. McKenney
On Mon, Aug 10, 2009 at 09:53:40PM +0300, Michael S. Tsirkin wrote: What it is: vhost net is a character device that can be used to reduce the number of system calls involved in virtio networking. Existing virtio net code is used in the guest without modification. There's similarity with

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-12 Thread Michael S. Tsirkin
On Wed, Aug 12, 2009 at 10:48:21AM -0700, Ira W. Snyder wrote: On Wed, Aug 12, 2009 at 08:31:04PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 12, 2009 at 10:19:22AM -0700, Ira W. Snyder wrote: [ snip out code ] We discussed this before, and I still think this could be directly

[PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-10 Thread Michael S. Tsirkin
What it is: vhost net is a character device that can be used to reduce the number of system calls involved in virtio networking. Existing virtio net code is used in the guest without modification. There's similarity with vringfd, with some differences and reduced scope - uses eventfd for

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-10 Thread Arnd Bergmann
On Monday 10 August 2009, Michael S. Tsirkin wrote: What it is: vhost net is a character device that can be used to reduce the number of system calls involved in virtio networking. Existing virtio net code is used in the guest without modification. Very nice, I loved reading it. It's getting

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-10 Thread Michael S. Tsirkin
On Mon, Aug 10, 2009 at 09:51:18PM +0200, Arnd Bergmann wrote: On Monday 10 August 2009, Michael S. Tsirkin wrote: What it is: vhost net is a character device that can be used to reduce the number of system calls involved in virtio networking. Existing virtio net code is used in the guest

Re: [PATCH 2/2] vhost_net: a kernel-level virtio server

2009-08-10 Thread Arnd Bergmann
On Monday 10 August 2009 20:10:44 Michael S. Tsirkin wrote: On Mon, Aug 10, 2009 at 09:51:18PM +0200, Arnd Bergmann wrote: what is the difference between vhost_net_reset_owner(n) and vhost_net_set_socket(n, -1)? set socket to -1 will only stop the device. reset owner will let another