Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-21 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Thu, Jan 17, 2013 at 12:40:29PM +1030, Rusty Russell wrote: >> I resist sprinkling __user everywhere because it's *not* always user >> addresses, and it's deeply misleading to anyone reading it. I'd rather >> have it in one place with a big comment. >> I can try

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-18 Thread Rusty Russell
Rusty Russell writes: > "Michael S. Tsirkin" writes: >> On Wed, Jan 16, 2013 at 01:43:32PM +1030, Rusty Russell wrote: >>> "Michael S. Tsirkin" writes: >>> >> +static int resize_iovec(struct vringh_iov *iov, gfp_t gfp) >>> >> +{ >>> >> +struct iovec *new; >>> >> +unsigned int new

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-17 Thread Michael S. Tsirkin
On Thu, Jan 17, 2013 at 12:40:29PM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > On Wed, Jan 16, 2013 at 01:43:32PM +1030, Rusty Russell wrote: > >> "Michael S. Tsirkin" writes: > >> >> +static int resize_iovec(struct vringh_iov *iov, gfp_t gfp) > >> >> +{ > >> >> + struct

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-16 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Wed, Jan 16, 2013 at 01:43:32PM +1030, Rusty Russell wrote: >> "Michael S. Tsirkin" writes: >> >> +static int resize_iovec(struct vringh_iov *iov, gfp_t gfp) >> >> +{ >> >> + struct iovec *new; >> >> + unsigned int new_num = iov->max * 2; >> > >> > We must limit

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-16 Thread Michael S. Tsirkin
On Wed, Jan 16, 2013 at 01:43:32PM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > >> +static int resize_iovec(struct vringh_iov *iov, gfp_t gfp) > >> +{ > >> + struct iovec *new; > >> + unsigned int new_num = iov->max * 2; > > > > We must limit this I think, this is coming > > from

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-15 Thread Rusty Russell
"Michael S. Tsirkin" writes: >> +static int resize_iovec(struct vringh_iov *iov, gfp_t gfp) >> +{ >> +struct iovec *new; >> +unsigned int new_num = iov->max * 2; > > We must limit this I think, this is coming > from userspace. How about UIO_MAXIOV? We limit it to the ring size already; UI

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-14 Thread Michael S. Tsirkin
On Fri, Jan 11, 2013 at 05:07:44PM +1030, Rusty Russell wrote: > Untested, but I wanted to post before the weekend. > > I think the implementation is a bit nicer, and though we have a callback > to get the guest-to-userspace offset, it might be faster since I think > most cases will re-use the sam

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-14 Thread Michael S. Tsirkin
On Sat, Jan 12, 2013 at 10:50:30AM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > On Fri, Jan 11, 2013 at 09:18:33AM +1030, Rusty Russell wrote: > >> "Michael S. Tsirkin" writes: > >> > On Thu, Jan 10, 2013 at 09:00:55PM +1030, Rusty Russell wrote: > >> >> Not sure why vhost/net d

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-11 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Fri, Jan 11, 2013 at 09:18:33AM +1030, Rusty Russell wrote: >> "Michael S. Tsirkin" writes: >> > On Thu, Jan 10, 2013 at 09:00:55PM +1030, Rusty Russell wrote: >> >> Not sure why vhost/net doesn't built a packet and feed it in >> >> netif_rx_ni(). This is what t

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-11 Thread Rusty Russell
Sjur Brændeland writes: > How do you see the in-kernel API for this? I would like to see > something similar to my previous patches, where we extend > the virtqueue API. E.g. something like this: > struct virtqueue *vring_new_virtqueueh(unsigned int index, > u

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-11 Thread Sjur Brændeland
On Fri, Jan 11, 2013 at 7:37 AM, Rusty Russell wrote: >virtio_host: host-side implementation of virtio rings (untested!) > >Getting use of virtio rings correct is tricky, and a recent patch saw >an implementation of in-kernel rings (as separate from userspace). How do you see the in-kernel API fo

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-11 Thread Sjur Brændeland
On Fri, Jan 11, 2013 at 12:35 AM, Rusty Russell wrote: > Hi Sjur! > > OK, the Internet was no help here, how do you pronounce Sjur? > I'm guessing "shoor" rhyming with tour until I know better. Thank you for asking! This is pretty close yes. I usually tell people to pronounce it like "sur

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Michael S. Tsirkin
On Fri, Jan 11, 2013 at 09:18:33AM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > > On Thu, Jan 10, 2013 at 09:00:55PM +1030, Rusty Russell wrote: > >> Not sure why vhost/net doesn't built a packet and feed it in > >> netif_rx_ni(). This is what tun seems to do, and with this code i

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Rusty Russell
Untested, but I wanted to post before the weekend. I think the implementation is a bit nicer, and though we have a callback to get the guest-to-userspace offset, it might be faster since I think most cases will re-use the same mapping. Feedback on API welcome! Rusty. virtio_host: host-side imple

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Rusty Russell
Sjur Brændeland writes: > Hi Rusty, > > On Thu, Jan 10, 2013 at 11:30 AM, Rusty Russell wrote: > ... >>I now have some lightly-tested code (via a userspace harness). > > Great - thank you for looking into this. I will start integrating this > with my patches > when you send out a proper patch. H

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Thu, Jan 10, 2013 at 09:00:55PM +1030, Rusty Russell wrote: >> Not sure why vhost/net doesn't built a packet and feed it in >> netif_rx_ni(). This is what tun seems to do, and with this code it >> should be fairly optimal. > > Because we want to use NAPI. Not qu

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Sjur Brændeland
Hi Rusty, On Thu, Jan 10, 2013 at 11:30 AM, Rusty Russell wrote: ... >I now have some lightly-tested code (via a userspace harness). Great - thank you for looking into this. I will start integrating this with my patches when you send out a proper patch. ... > diff --git a/drivers/virtio/Kconfig

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Michael S. Tsirkin
On Thu, Jan 10, 2013 at 09:00:55PM +1030, Rusty Russell wrote: > Not sure why vring/net doesn't built a packet and feed it in > netif_rx_ni(). This is what tun seems to do, and with this code it > should be fairly optimal. Because we want to use NAPI. -- MST

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-10 Thread Rusty Russell
Rusty Russell writes: > It basically involves moving much of vring.c into a virtio_host.c: the > parts which actually touch the ring. Then it provides accessors for > vring.c to use which are __user-safe (all casts are inside > virtio_host.c). > > I should have something to post by end of today,

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-08 Thread Rusty Russell
Sjur Brændeland writes: > On Fri, Dec 21, 2012 at 7:11 AM, Rusty Russell wrote: >> "Michael S. Tsirkin" writes: >> >>> On Wed, Dec 05, 2012 at 03:36:58PM +0100, Sjur Brændeland wrote: Feedback on this patch-set is appreciated, particularly on structure and code-reuse between vhost.c an

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2013-01-08 Thread Sjur Brændeland
On Fri, Dec 21, 2012 at 7:11 AM, Rusty Russell wrote: > "Michael S. Tsirkin" writes: > >> On Wed, Dec 05, 2012 at 03:36:58PM +0100, Sjur Brændeland wrote: >>> Feedback on this patch-set is appreciated, particularly on structure >>> and code-reuse between vhost.c and the host-side virtio-queue. >>

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2012-12-20 Thread Rusty Russell
"Michael S. Tsirkin" writes: > On Wed, Dec 05, 2012 at 03:36:58PM +0100, Sjur Brændeland wrote: >> Feedback on this patch-set is appreciated, particularly on structure >> and code-reuse between vhost.c and the host-side virtio-queue. >> I'd also like some suggestions on how to handle the build co

Re: [RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2012-12-06 Thread Michael S. Tsirkin
On Wed, Dec 05, 2012 at 03:36:58PM +0100, Sjur Brændeland wrote: > Feedback on this patch-set is appreciated, particularly on structure > and code-reuse between vhost.c and the host-side virtio-queue. > I'd also like some suggestions on how to handle the build configuration > better - currently the

[RFCv2 00/12] Introduce host-side virtio queue and CAIF Virtio.

2012-12-05 Thread Sjur Brændeland
From: Sjur Brændeland This patch-set introduces a host-side virtqueue implementation and the CAIF Virtio Link layer. See http://lwn.net/Articles/522296/ for background info on CAIF over Virtio. After feedback from Rusty, I have re-factored vhost.c and pulled out common functionality and data def